forked from wangziqi/gongxue-base
feat: add taro student learning flow
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import Taro from '@tarojs/taro';
|
||||
import { Button, Text, View } from '@tarojs/components';
|
||||
import { getTenantContext } from '@/services/api';
|
||||
import { loadStudentDashboard, type DashboardSnapshot } from '@/services/catalog';
|
||||
@@ -17,6 +18,14 @@ export default function StudentHomePage() {
|
||||
|
||||
const entryNames = useMemo(() => (snapshot?.entries || []).slice(0, 6), [snapshot]);
|
||||
const brandName = tenant?.branding.brandName || tenant?.branding.shortName || '工学题库';
|
||||
const quickActions = [
|
||||
{ name: '刷题', path: '/pages/student/catalog/index', meta: '顺序 / 随机 / 模考' },
|
||||
{ name: '背单词', path: '/pages/student/vocabulary/index', meta: '复习计划' },
|
||||
{ name: '知识手册', path: '/pages/student/handbook/index', meta: '章节阅读' },
|
||||
{ name: '分数线', path: '/pages/student/scoreline/index', meta: '院校趋势' },
|
||||
{ name: '资料', path: '/pages/student/assets/index', meta: 'PDF 预览' },
|
||||
{ name: '个人中心', path: '/pages/student/profile/index', meta: '会员 / 订单' },
|
||||
];
|
||||
|
||||
return (
|
||||
<View className='student-page'>
|
||||
@@ -25,26 +34,38 @@ export default function StudentHomePage() {
|
||||
<Text className='brand'>{brandName}</Text>
|
||||
<Text className='subline'>{userName ? `${userName},继续学习` : '题库、手册、资料和会员统一入口'}</Text>
|
||||
</View>
|
||||
<Button className='ghost-button'>会员</Button>
|
||||
<Button className='ghost-button' onClick={() => Taro.navigateTo({ url: '/pages/student/profile/index' })}>我的</Button>
|
||||
</View>
|
||||
|
||||
<View className='hero-band'>
|
||||
<Text className='hero-title'>今日学习</Text>
|
||||
<Text className='hero-copy'>后端已接入多租户题库、练习快照、错题、收藏、单词和知识手册接口。</Text>
|
||||
<Text className='hero-copy'>题库、背单词、知识手册、分数线、资料和会员都已接入新 SaaS 后端。</Text>
|
||||
</View>
|
||||
|
||||
<View className='section'>
|
||||
<Text className='section-title'>学习入口</Text>
|
||||
<View className='entry-grid'>
|
||||
{entryNames.length ? entryNames.map(item => (
|
||||
<View className='entry-tile' key={item.id}>
|
||||
<View className='entry-tile' key={item.id} onClick={() => Taro.navigateTo({ url: `/pages/student/catalog/index?entryId=${item.id}` })}>
|
||||
<Text className='entry-name'>{item.name}</Text>
|
||||
<Text className='entry-type'>{item.entryType || 'content'}</Text>
|
||||
</View>
|
||||
)) : ['刷题', '背单词', '知识手册', '分数线', '资料下载', '会员中心'].map(name => (
|
||||
<View className='entry-tile' key={name}>
|
||||
<Text className='entry-name'>{name}</Text>
|
||||
<Text className='entry-type'>待联调</Text>
|
||||
)) : quickActions.map(item => (
|
||||
<View className='entry-tile' key={item.name} onClick={() => Taro.navigateTo({ url: item.path })}>
|
||||
<Text className='entry-name'>{item.name}</Text>
|
||||
<Text className='entry-type'>{item.meta}</Text>
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
</View>
|
||||
|
||||
<View className='section'>
|
||||
<Text className='section-title'>功能导航</Text>
|
||||
<View className='entry-grid'>
|
||||
{quickActions.map(item => (
|
||||
<View className='entry-tile compact' key={item.path} onClick={() => Taro.navigateTo({ url: item.path })}>
|
||||
<Text className='entry-name'>{item.name}</Text>
|
||||
<Text className='entry-type'>{item.meta}</Text>
|
||||
</View>
|
||||
))}
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user