fix: 首页教师相关
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
0bd3e761ca
commit
fb6a63d7a5
|
|
@ -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(() => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue