首页、学情、任务绑定接口

This commit is contained in:
hexi
2026-11-06 16:43:41 +08:00
parent af73453035
commit 4a19192d73
16 changed files with 965 additions and 236 deletions
+11 -3
View File
@@ -62,7 +62,7 @@
<script setup lang="ts">
import MainTabBar from '../../components/main-tab-bar.uvue'
import { apiGetBoundStudents, type BoundStudentSummary } from '../../api/student'
import { applyBoundStudent, homeStudentProfile, saveSelectedStudent } from '../../store/home'
import { homeStudentProfile, selectedStudentChangeVersion, switchBoundStudent } from '../../store/home'
import type { UserInfo } from '../../api/auth'
import { clearUserInfo } from '../../store/user'
@@ -72,9 +72,17 @@
const selectedStudentId = ref(homeStudentProfile.value?.id ?? '')
const isLoading = ref(true)
const listFailed = ref(false)
const observedStudentVersion = ref(selectedStudentChangeVersion.value)
onLoad(() => { loadStudents() })
onShow(() => {
if (observedStudentVersion.value !== selectedStudentChangeVersion.value) {
observedStudentVersion.value = selectedStudentChangeVersion.value
selectedStudentId.value = homeStudentProfile.value?.id ?? selectedStudentId.value
}
})
async function loadStudents() {
isLoading.value = true
listFailed.value = false
@@ -92,8 +100,8 @@
selectedStudentId.value = studentId
const student = students.value.find((item) => item.id === studentId)
if (student) {
saveSelectedStudent(student)
applyBoundStudent(student)
switchBoundStudent(student)
observedStudentVersion.value = selectedStudentChangeVersion.value
}
}