feat: add taro student learning flow

This commit is contained in:
Codex
2026-06-29 12:04:59 +08:00
parent c090008f52
commit b79c4259c0
28 changed files with 1567 additions and 12 deletions

View File

@@ -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>