forked from wangziqi/gongxue-base
feat: use preset avatars and disable leaderboard by default
This commit is contained in:
@@ -4,11 +4,9 @@ import { Button, Input, Text, View } from '@tarojs/components';
|
||||
import { logout } from '@/services/auth';
|
||||
import { checkActivationCode, loadEntitlements, loadOrders, loadSvipPlans, redeemActivationCode, type OrderItem, type SvipPlan } from '@/services/commerce';
|
||||
import {
|
||||
loadLeaderboard,
|
||||
loadLearningStats,
|
||||
loadLearningTrend,
|
||||
loadPracticeHistory,
|
||||
type LeaderboardItem,
|
||||
type LearningStats,
|
||||
type LearningTrendItem,
|
||||
type PracticeHistoryItem,
|
||||
@@ -144,8 +142,6 @@ export default function StudentProfilePage() {
|
||||
const [orders, setOrders] = useState<OrderItem[]>([]);
|
||||
const [badges, setBadges] = useState<Record<string, unknown>[]>([]);
|
||||
const [countdowns, setCountdowns] = useState<Record<string, unknown>[]>([]);
|
||||
const [leaderboard, setLeaderboard] = useState<LeaderboardItem[]>([]);
|
||||
const [currentRank, setCurrentRank] = useState<LeaderboardItem | null>(null);
|
||||
const [learningStats, setLearningStats] = useState<LearningStats | null>(null);
|
||||
const [learningTrend, setLearningTrend] = useState<LearningTrendItem[]>([]);
|
||||
const [practiceHistory, setPracticeHistory] = useState<PracticeHistoryItem[]>([]);
|
||||
@@ -168,7 +164,6 @@ export default function StudentProfilePage() {
|
||||
loadOrders().catch(() => ({ items: [] })),
|
||||
loadBadges().catch(() => ({ items: [] })),
|
||||
loadExamCountdowns().catch(() => ({ items: [] })),
|
||||
loadLeaderboard('questions').catch(() => ({ items: [], currentUser: null })),
|
||||
loadLearningStats(30).catch(() => ({ item: undefined })),
|
||||
loadLearningTrend(14).catch(() => ({ items: [] })),
|
||||
loadPracticeHistory({ limit: 6 }).catch(() => ({ items: [] })),
|
||||
@@ -183,7 +178,6 @@ export default function StudentProfilePage() {
|
||||
orderPayload,
|
||||
badgePayload,
|
||||
countdownPayload,
|
||||
leaderboardPayload,
|
||||
statsPayload,
|
||||
trendPayload,
|
||||
historyPayload,
|
||||
@@ -197,8 +191,6 @@ export default function StudentProfilePage() {
|
||||
setOrders(orderPayload.items || []);
|
||||
setBadges(badgePayload.items || []);
|
||||
setCountdowns(countdownPayload.items || []);
|
||||
setLeaderboard(leaderboardPayload.items || []);
|
||||
setCurrentRank(leaderboardPayload.currentUser || null);
|
||||
setLearningStats(statsPayload.item || null);
|
||||
setLearningTrend(trendPayload.items || []);
|
||||
setPracticeHistory(historyPayload.items || []);
|
||||
@@ -621,7 +613,7 @@ export default function StudentProfilePage() {
|
||||
</View>
|
||||
<View className='grid-two'>
|
||||
<View className='metric'><Text className='metric-value'>{String(badges.length)}</Text><Text className='metric-label'>勋章</Text></View>
|
||||
<View className='metric'><Text className='metric-value'>{currentRank ? `第${String(currentRank.rank)}` : String(leaderboard.length)}</Text><Text className='metric-label'>{currentRank ? `7 日答题榜 · ${String(currentRank.value)} 题` : '排行榜样本'}</Text></View>
|
||||
<View className='metric'><Text className='metric-value'>{String(wrongBook?.unresolvedWrong ?? 0)}</Text><Text className='metric-label'>待解决错题</Text></View>
|
||||
<View className='metric'><Text className='metric-value'>{String(favoriteStats?.favoriteQuestions ?? 0)}</Text><Text className='metric-label'>收藏题目</Text></View>
|
||||
<View className='metric'><Text className='metric-value'>{percent(reportStats?.avgAccuracy)}</Text><Text className='metric-label'>报告平均正确率</Text></View>
|
||||
</View>
|
||||
|
||||
@@ -4,6 +4,11 @@ export interface StudentProfile {
|
||||
userId?: string;
|
||||
name?: string | null;
|
||||
phone?: string | null;
|
||||
avatarPreset?: 'male' | 'female';
|
||||
avatar?: {
|
||||
preset?: 'male' | 'female';
|
||||
displayUrl?: string | null;
|
||||
};
|
||||
score?: number;
|
||||
target?: {
|
||||
regionId?: string | null;
|
||||
@@ -89,7 +94,7 @@ export async function loadProfile() {
|
||||
|
||||
export async function updateProfile(input: {
|
||||
name?: string;
|
||||
avatarUrl?: string;
|
||||
avatarPreset?: 'male' | 'female';
|
||||
regionId?: string;
|
||||
selectedSchoolId?: string;
|
||||
selectedMajorId?: string;
|
||||
|
||||
Reference in New Issue
Block a user