修复安卓显示和成长积分接口

This commit is contained in:
tanxin
2026-11-10 15:32:09 +08:00
parent ed134f0e99
commit ef53fc7c40
4 changed files with 54 additions and 269 deletions
+14 -6
View File
@@ -7,8 +7,8 @@
<script setup lang="ts">
import UniIcons from '../../uni_modules/uni-icons-x/components/uni-icons/uni-icons.uvue'
import { apiGetStudentGrowth, apiGetStudentHomeProfile, apiGetStudentPointRecords, type StudentGrowth } from '../../api/student'
import { homeStudentProfile, selectedStudentChangeVersion, setHomeStudentProfile } from '../../store/home'
import { apiGetBoundStudents, apiGetStudentGrowth, apiGetStudentPointRecords, type StudentGrowth } from '../../api/student'
import { applyBoundStudent, getSavedSelectedStudent, homeStudentProfile, saveSelectedStudent, selectedStudentChangeVersion } from '../../store/home'
const growth = ref<StudentGrowth>({ studentId: '', studentName: '', studentGrade: '', studentClass: '', pointsBalance: 0, level: 0, rank: 0, streakDays: 0, totalPoints: 0, records: [] })
const isLoading = ref(true)
@@ -33,10 +33,18 @@
isLoading.value = true
let studentId = homeStudentProfile.value?.id ?? ''
if (!studentId) {
const profileRes = await apiGetStudentHomeProfile(undefined, false)
if (profileRes && profileRes.data) {
setHomeStudentProfile(profileRes.data)
studentId = profileRes.data.id
const savedStudent = getSavedSelectedStudent()
if (savedStudent) {
applyBoundStudent(savedStudent)
studentId = savedStudent.id
} else {
const res = await apiGetBoundStudents()
const firstStudent = res?.data?.students[0]
if (firstStudent) {
saveSelectedStudent(firstStudent)
applyBoundStudent(firstStudent)
studentId = firstStudent.id
}
}
}
if (studentId) {