fix: 首页教师相关
continuous-integration/drone/push Build is passing Details

This commit is contained in:
张哲铜 2025-09-24 00:27:18 +08:00
parent 0bd3e761ca
commit fb6a63d7a5
1 changed files with 24 additions and 4 deletions

View File

@ -14,6 +14,7 @@
import { computed, onMounted, ref } from 'vue' import { computed, onMounted, ref } from 'vue'
import { teacherAnalysisRecentExamStatsUsingPost } from '@/service/laoshichengjifenxi' import { teacherAnalysisRecentExamStatsUsingPost } from '@/service/laoshichengjifenxi'
import { useHomeStore } from '@/store/home' import { useHomeStore } from '@/store/home'
import { useUserStore } from '@/store/user'
defineOptions({ defineOptions({
name: 'Home', name: 'Home',
@ -44,6 +45,7 @@ safeAreaInsets = systemInfo.safeAreaInsets
// 使store // 使store
const homeStore = useHomeStore() const homeStore = useHomeStore()
const userStore = useUserStore()
// 线 // 线
const scoreSettings = ref({ const scoreSettings = ref({
@ -78,10 +80,28 @@ const tempSettings = ref({
top_n: scoreSettings.value.top_n, top_n: scoreSettings.value.top_n,
}) })
// TODO: store // store
const schoolName = ref('华师一附中') const schoolName = computed(() => {
const teacherName = ref('张信哲') const userInfo = userStore.getUserInfo
const teacherSubject = ref('语文') return userInfo.schools?.[0]?.name || '学校'
})
const teacherName = computed(() => {
const userInfo = userStore.getUserInfo
return userInfo.nickname || '教师'
})
const teacherSubject = computed(() => {
const userInfo = userStore.getUserInfo
//
const roleName = userInfo.roles?.[0]?.name
if (roleName) {
// """"
const subjectMatch = roleName.match(/^(.+?)教师$/)
return subjectMatch ? subjectMatch[1] : '学科'
}
return '学科'
})
// //
const selectedClassName = computed(() => { const selectedClassName = computed(() => {