fix: 一点修复
continuous-integration/drone/push Build is passing Details

This commit is contained in:
张哲铜 2025-11-20 23:24:05 +08:00
parent 2ed92d3f7a
commit 785696659a
13 changed files with 133 additions and 128 deletions

View File

@ -3,69 +3,69 @@
* API模块
*/
// 公用接口
export { default as publicApi } from './公用接口';
export { default as answerSheetScanRecordApi } from './client/answerSheetScanRecord'
// 系统管理相关
export { default as menuApi } from './菜单管理';
export { default as systemUserApi } from './系统用户';
export { default as systemRoleApi } from './系统角色';
// 学校管理相关
export { default as schoolApi } from './学校管理';
export { default as studentApi } from './学生管理';
export { default as teacherApi } from './教师管理';
export { default as subjectApi } from './科目管理';
// 考试管理相关
export { default as examApi } from './考试管理';
export { default as examStudentApi } from './考试学生管理';
export { default as examManagerApi } from './考试管理员';
export { default as examVirtualTeacherApi } from './考试虚拟阅卷老师管理';
export { default as examReportConfigApi } from './考试报告发布设置管理';
export { default as examSubjectAnswerSheetTemplateApi } from './考试科目答题卡模板';
export { default as examSubjectAnswerSheetTemplateQuestionApi } from './考试科目答题卡模板题目';
export { default as examSubjectAnswerSheetQuestionApi } from './考试科目扫描答题卡题目';
export { default as examMarkingSettingsApi } from './阅卷设置管理';
export { default as examStatisticsApi } from './考试统计';
export { default as examMarkingProgressApi } from './阅卷进度';
export { default as examMarkingQualityApi } from './阅卷质量';
export { default as examSubjectManagementApi } from './考试科目管理';
export { default as examProblemSheetApi } from './问题卷';
export { default as examScanApi } from './扫描答题卡';
export { default as examScanV2Api } from './扫描答题卡V2';
export { default as examAnalysisSettingApi } from './成绩分析设置';
// 数据字典相关
export { default as dictTypeApi } from './数据字典类型';
export { default as dictItemApi } from './数据字典项';
// 答题卡管理相关
export { default as answerSheetApi } from './答题卡管理';
// 基础服务相关
export { default as fileApi } from './文件管理';
export { default as fileUploadApi } from './文件上传';
export { default as authApi } from './认证';
export { default as schedulerApi } from './定时任务';
export { default as queueApi } from './消息队列';
export { default as queryApi } from './查询筛选';
// 阅卷相关
export { default as examMarkingTaskApi } from './阅卷任务';
// 统分发布相关
export { default as scorePublishApi } from './统分发布';
export * from './client/data-contracts'
// 扫描相关
export { default as scannerApi } from './client/scanner'
export { default as scannerClientApi } from './client/scannerClient'
export { default as templateClientApi } from './client/template'
// 导出所有数据类型
export * from './data-contracts';
export * from './client/data-contracts';
export * from './data-contracts'
// 公用接口
export { default as publicApi } from './公用接口'
// 学校管理相关
export { default as schoolApi } from './学校管理'
export { default as studentApi } from './学生管理'
export { default as schedulerApi } from './定时任务'
export { default as examAnalysisSettingApi } from './成绩分析设置'
export { default as examScanApi } from './扫描答题卡'
export { default as examScanV2Api } from './扫描答题卡V2'
export { default as teacherApi } from './教师管理'
// 数据字典相关
export { default as dictTypeApi } from './数据字典类型'
export { default as dictItemApi } from './数据字典项'
export { default as fileUploadApi } from './文件上传'
// 基础服务相关
export { default as fileApi } from './文件管理'
export { default as queryApi } from './查询筛选'
export { default as queueApi } from './消息队列'
export { default as subjectApi } from './科目管理'
// 答题卡管理相关
export { default as answerSheetApi } from './答题卡管理'
export { default as systemUserApi } from './系统用户'
export { default as systemRoleApi } from './系统角色'
// 统分发布相关
export { default as scorePublishApi } from './统分发布'
// 教师相关
export { default as teacherScoreAnalysisApi } from './老师成绩分析';
export { default as teacherScoreAnalysisApi } from './老师成绩分析'
export { default as examStudentApi } from './考试学生管理'
// 扫描相关
export { default as scannerApi } from './client/scanner';
export { default as scannerClientApi } from './client/scannerClient';
export { default as answerSheetScanRecordApi } from './client/answerSheetScanRecord';
export { default as templateClientApi } from './client/template';
export { default as examReportConfigApi } from './考试报告发布设置管理'
export { default as examSubjectAnswerSheetQuestionApi } from './考试科目扫描答题卡题目'
export { default as examSubjectAnswerSheetTemplateApi } from './考试科目答题卡模板'
export { default as examSubjectAnswerSheetTemplateQuestionApi } from './考试科目答题卡模板题目'
export { default as examSubjectManagementApi } from './考试科目管理'
// 考试管理相关
export { default as examApi } from './考试管理'
export { default as examManagerApi } from './考试管理员'
export { default as examStatisticsApi } from './考试统计'
export { default as examVirtualTeacherApi } from './考试虚拟阅卷老师管理'
// 系统管理相关
export { default as menuApi } from './菜单管理'
export { default as authApi } from './认证'
export { default as examProblemSheetApi } from './问题卷'
// 阅卷相关
export { default as examMarkingTaskApi } from './阅卷任务'
export { default as examMarkingSettingsApi } from './阅卷设置管理'
export { default as examMarkingQualityApi } from './阅卷质量'
export { default as examMarkingProgressApi } from './阅卷进度'

View File

@ -40,7 +40,7 @@ watch(
(options) => {
if (options.length > 0 && !compareClassId.value) {
//
const otherClasses = options.filter(item => item.value !== homeStore.selectedClassId)
const otherClasses = options.filter(item => item.value !== homeStore.selectedClassKey)
if (otherClasses.length > 0) {
compareClassId.value = otherClasses[0].value
}
@ -71,7 +71,7 @@ const {
queryKey: [
'class-trend',
useUserId(),
homeStore.selectedClassId,
homeStore.selectedClassKey,
homeStore.selectedGradeKey,
compareClassId,
props.selectedSubjectId,
@ -80,7 +80,7 @@ const {
queryFn: async () => {
const response = await teacherAnalysisTrendUsingPost({
body: {
class_key: homeStore.selectedClassId,
class_key: homeStore.selectedClassKey,
grade_key: homeStore.selectedGradeKey,
class_key_compare: compareClassId.value!,
subject_id: props.selectedSubjectId || 0,
@ -91,7 +91,7 @@ const {
return response || { trend_list: [] }
},
enabled: computed(() =>
!!homeStore.selectedClassId
!!homeStore.selectedClassKey
&& !!homeStore.selectedGradeKey
&& !!compareClassId.value,
),

View File

@ -42,7 +42,7 @@ async function queryExamQuestionList(pageNo: number, pageSize: number) {
const result = await teacherAnalysisQuestionStatUsingPost({
body: {
grade_key: homeStore.selectedGradeKey || 0,
class_key: homeStore.selectedClassId || 0,
class_key: homeStore.selectedClassKey || 0,
subject_id: selectedSubjectId.value,
page: pageNo,
page_size: pageSize,
@ -61,7 +61,7 @@ const chartRef = ref<InstanceType<typeof AverageScoreChart>>()
//
const classOptions = computed(() =>
homeStore.classOptions
.filter(cls => cls.value !== homeStore.selectedClassId)
.filter(cls => cls.value !== homeStore.selectedClassKey)
.map(cls => ({
label: cls.label,
value: cls.value,

View File

@ -40,7 +40,7 @@ const {
useUserId(),
selectedExamId,
homeStore.selectedGradeKey,
homeStore.selectedClassId,
homeStore.selectedClassKey,
homeStore.selectedSubjectId,
],
queryFn: async () => {
@ -48,7 +48,7 @@ const {
body: {
exam_id: selectedExamId.value!,
grade_key: homeStore.selectedGradeKey!,
class_key: homeStore.selectedClassId!,
class_key: homeStore.selectedClassKey!,
subject_id: homeStore.selectedSubjectId!,
},
})
@ -57,7 +57,7 @@ const {
enabled: computed(() =>
!!selectedExamId.value
&& !!homeStore.selectedGradeKey
&& !!homeStore.selectedClassId
&& !!homeStore.selectedClassKey
&& !!homeStore.selectedSubjectId,
),
staleTime: 30000,
@ -94,7 +94,7 @@ async function viewDetail(item: API.QuestionStatInfo) {
body: {
exam_id: selectedExamId.value!,
grade_key: homeStore.selectedGradeKey!,
class_key: homeStore.selectedClassId!,
class_key: homeStore.selectedClassKey!,
subject_id: homeStore.selectedSubjectId!,
},
})
@ -124,7 +124,7 @@ async function viewDetail(item: API.QuestionStatInfo) {
// -
function handleViewStudentList(question: API.QuestionStatInfo) {
uni.navigateTo({
url: `/pages/class-analysis/question-score-detail?exam_id=${selectedExamId.value}&grade_key=${homeStore.selectedGradeKey}&class_key=${homeStore.selectedClassId}&subject_id=${homeStore.selectedSubjectId}&question_id=${question.question_id}`,
url: `/pages/class-analysis/question-score-detail?exam_id=${selectedExamId.value}&grade_key=${homeStore.selectedGradeKey}&class_key=${homeStore.selectedClassKey}&subject_id=${homeStore.selectedSubjectId}&question_id=${question.question_id}`,
})
}

View File

@ -81,17 +81,17 @@ const tempSettings = ref({
// store
const schoolName = computed(() => {
const userInfo = userStore.getUserInfo
const userInfo = userStore.info
return userInfo.schools?.[0]?.name || '学校'
})
const teacherName = computed(() => {
const userInfo = userStore.getUserInfo
const userInfo = userStore.info
return userInfo.nickname || '教师'
})
const teacherSubject = computed(() => {
const userInfo = userStore.getUserInfo
const userInfo = userStore.info
//
const roleName = userInfo.roles?.[0]?.name
if (roleName) {
@ -104,10 +104,10 @@ const teacherSubject = computed(() => {
//
const selectedClassName = computed(() => {
if (!homeStore.selectedClassId) {
if (homeStore.selectedClassId === null) {
return '请选择班级'
}
const selectedClass = homeStore.classOptions.find(item => item.value === homeStore.selectedClassId && item.gradeKey === homeStore.selectedGradeKey)
const selectedClass = homeStore.classOptions.find(item => item.value === homeStore.selectedClassId)
return selectedClass?.label || '请选择班级'
})
@ -145,7 +145,7 @@ const menuItems = [
//
async function fetchExamStats() {
if (!homeStore.selectedClassId || !homeStore.selectedExamId) {
if (!homeStore.selectedClassKey || !homeStore.selectedExamId) {
return
}
@ -153,9 +153,9 @@ async function fetchExamStats() {
loading.value = true
const response = await teacherAnalysisRecentExamStatsUsingPost({
body: {
class_key: homeStore.selectedClassId,
class_key: homeStore.selectedClassKey,
exam_id: homeStore.selectedExamId,
grade_key: homeStore.selectedClassId, // 使class_keygrade_key
grade_key: homeStore.selectedClassKey, // 使class_keygrade_key
excellent_scoring_rate: scoreSettings.value.excellent_scoring_rate,
good_scoring_rate: scoreSettings.value.good_scoring_rate,
pass_scoring_rate: scoreSettings.value.pass_scoring_rate,
@ -256,7 +256,7 @@ function handleClassChange() {
}
//
watch(() => homeStore.selectedClassId, () => {
watch(() => homeStore.selectedClassKey, () => {
//
fetchExamStats()
//
@ -329,7 +329,7 @@ function handleViewDetail() {
//
function handleExamReview() {
if (!homeStore.selectedClassId || !homeStore.selectedExamId) {
if (!homeStore.selectedClassKey || !homeStore.selectedExamId) {
uni.showToast({
title: '请先选择班级和考试',
icon: 'none',
@ -339,7 +339,7 @@ function handleExamReview() {
// TODO:
uni.navigateTo({
url: `/pages-sub/exam-review/index?classId=${homeStore.selectedClassId}&examId=${homeStore.selectedExamId}&subjectId=${homeStore.selectedExamSubjectId || ''}`,
url: `/pages-sub/exam-review/index?classId=${homeStore.selectedClassKey}&examId=${homeStore.selectedExamId}&subjectId=${homeStore.selectedExamSubjectId || ''}`,
})
}
@ -634,12 +634,12 @@ onMounted(async () => {
v-for="classItem in homeStore.classOptions"
:key="classItem.value"
class="flex items-center justify-between rounded-xl p-4 transition-colors"
:class="homeStore.selectedClassId === classItem.value && homeStore.selectedGradeKey === classItem.gradeKey ? 'bg-blue-50 border border-blue-100' : 'bg-slate-50'"
@tap="homeStore.selectedClassId = classItem.value; homeStore.selectedGradeKey = classItem.gradeKey; showClassPicker = false"
:class="homeStore.selectedClassId === classItem.value ? 'bg-blue-50 border border-blue-100' : 'bg-slate-50'"
@tap="homeStore.selectedClassId = classItem.value;showClassPicker = false"
>
<text class="text-base" :class="homeStore.selectedClassId === classItem.value && homeStore.selectedGradeKey === classItem.gradeKey ? 'text-blue-600 font-bold' : 'text-slate-700'">{{ classItem.label }}</text>
<text class="text-base" :class="homeStore.selectedClassId === classItem.value ? 'text-blue-600 font-bold' : 'text-slate-700'">{{ classItem.label }}</text>
<view
v-if="homeStore.selectedClassId === classItem.value && homeStore.selectedGradeKey === classItem.gradeKey"
v-if="homeStore.selectedClassId === classItem.value"
class="i-mingcute:check-circle-fill text-xl text-blue-500"
/>
</view>

View File

@ -26,14 +26,8 @@ const pagingRef = ref<ZPagingRef>()
//
const scoreList = ref<ScoreSheetInfo[]>([])
//
const classOptions = computed(() => homeStore.classOptions)
//
const subjectOptions = computed(() => homeStore.subjectOptions)
// ID
const selectedClassId = ref<number | null>(homeStore.selectedClassId)
const selectedClassId = ref<number | null>(homeStore.selectedClassKey)
//
function goBack() {
@ -50,7 +44,7 @@ function handleClassChange(event: { value: string | number, selectedItem: Record
//
async function queryScoreList(pageNo: number, pageSize: number) {
if (!homeStore.selectedClassId || !homeStore.selectedExamId || !homeStore.selectedGradeKey) {
if (!homeStore.selectedClassKey || !homeStore.selectedExamId || !homeStore.selectedGradeKey) {
pagingRef.value?.complete([])
return
}
@ -58,7 +52,7 @@ async function queryScoreList(pageNo: number, pageSize: number) {
try {
const response = await teacherAnalysisScoreSheetUsingPost({
body: {
class_key: homeStore.selectedClassId,
class_key: homeStore.selectedClassKey,
exam_id: homeStore.selectedExamId,
grade_key: homeStore.selectedGradeKey,
page: pageNo,
@ -123,7 +117,7 @@ function viewSubjectAnswerSheet(student: ScoreSheetInfo, subjectId: number) {
<wd-drop-menu>
<wd-drop-menu-item
v-model="selectedClassId"
:options="classOptions"
:options="homeStore.classOptions"
@change="handleClassChange"
/>
</wd-drop-menu>
@ -167,7 +161,7 @@ function viewSubjectAnswerSheet(student: ScoreSheetInfo, subjectId: number) {
<!-- 动态生成科目列 -->
<wd-table-col
v-for="subject in subjectOptions"
v-for="subject in homeStore.subjectOptions"
:key="subject.value"
:prop="`subject_${subject.value}`"
:label="subject.label"

View File

@ -97,7 +97,7 @@ const activeTab = computed({
})
const isQueryEnabled = computed(() =>
!!homeStore.selectedClassId && !!homeStore.selectedExamId && !!homeStore.selectedGradeKey,
!!homeStore.selectedClassKey && !!homeStore.selectedExamId && !!homeStore.selectedGradeKey,
)
// --- API Hooks () ---
@ -106,7 +106,7 @@ const { data: statsData } = useQuery({
queryKey: [
'overview-stats',
useUserId(),
homeStore.selectedClassId,
homeStore.selectedClassKey,
homeStore.selectedExamId,
homeStore.selectedGradeKey,
selectedSubjectId,
@ -118,7 +118,7 @@ const { data: statsData } = useQuery({
queryFn: async () => {
return await teacherAnalysisRecentExamStatsUsingPost({
body: {
class_key: homeStore.selectedClassId,
class_key: homeStore.selectedClassKey,
exam_id: homeStore.selectedExamId,
grade_key: homeStore.selectedGradeKey,
subject_id: selectedSubjectId.value || undefined,
@ -140,7 +140,7 @@ const { data: comparisonData } = useQuery({
'comparison-data',
useUserId(),
comparisonMode,
homeStore.selectedClassId,
homeStore.selectedClassKey,
homeStore.selectedExamId,
homeStore.selectedGradeKey,
selectedSubjectId.value,
@ -150,7 +150,7 @@ const { data: comparisonData } = useQuery({
return (await teacherAnalysisClassExamComparisonHorizontalUsingPost({
body: {
exam_id: homeStore.selectedExamId,
class_key: homeStore.selectedClassId,
class_key: homeStore.selectedClassKey,
grade_key: homeStore.selectedGradeKey,
subject_id: selectedSubjectId.value || undefined,
},
@ -159,14 +159,14 @@ const { data: comparisonData } = useQuery({
else {
return (await teacherAnalysisClassExamComparisonUsingPost({
body: {
class_key: homeStore.selectedClassId,
class_key: homeStore.selectedClassKey,
grade_key: homeStore.selectedGradeKey,
subject_id: selectedSubjectId.value || undefined,
},
})).exam_list as ExamComparisonItem[] || []
}
},
enabled: computed(() => !!homeStore.selectedClassId && !!homeStore.selectedGradeKey),
enabled: computed(() => !!homeStore.selectedClassKey && !!homeStore.selectedGradeKey),
staleTime: 30000,
})
@ -175,7 +175,7 @@ const { data: rankStatsData } = useQuery({
'rank-statistics',
useUserId(),
selectedClassIds,
homeStore.selectedClassId,
homeStore.selectedClassKey,
homeStore.selectedExamId,
selectedSubjectId,
scoreSettings.value.rank_top_1,
@ -185,7 +185,7 @@ const { data: rankStatsData } = useQuery({
queryFn: async () => {
const classIds = selectedClassIds.value.length > 0
? selectedClassIds.value
: (homeStore.selectedClassId ? [homeStore.selectedClassId.toString()] : [])
: (homeStore.selectedClassKey ? [homeStore.selectedClassKey.toString()] : [])
if (classIds.length === 0) {
return []
@ -213,14 +213,14 @@ const { data: rankStatsData } = useQuery({
// --- Methods ---
async function fetchKeyStudentsPaging(pageNo: number, pageSize: number) {
if (!homeStore.selectedClassId || !homeStore.selectedExamId || !homeStore.selectedGradeKey) {
if (!homeStore.selectedClassKey || !homeStore.selectedExamId || !homeStore.selectedGradeKey) {
keyStudentsPaging.value?.complete(false)
return
}
try {
const response = await teacherAnalysisKeyStudentUsingPost({
body: {
class_key: homeStore.selectedClassId,
class_key: homeStore.selectedClassKey,
exam_id: homeStore.selectedExamId,
grade_key: homeStore.selectedGradeKey,
subject_id: selectedSubjectId.value || undefined,
@ -271,7 +271,7 @@ function toggleComparisonMode(mode: 'horizontal' | 'vertical') {
}
function handleViewScoreList() {
if (!homeStore.selectedClassId || !homeStore.selectedExamId) {
if (!homeStore.selectedClassKey || !homeStore.selectedExamId) {
uni.showToast({ title: '请先选择班级和考试', icon: 'none' })
return
}

View File

@ -32,7 +32,7 @@ safeAreaInsets = systemInfo.safeAreaInsets
// #endif
//
const userInfo = computed(() => userStore.getUserInfo)
const userInfo = computed(() => userStore.info)
//
const menuItems = [

View File

@ -17,7 +17,7 @@ const selectedSubjectId = ref(0)
const { data: reportData, isLoading } = useQuery({
queryKey: computed(() => [
'personal-report',
homeStore.selectedClassId,
homeStore.selectedClassKey,
homeStore.selectedGradeKey,
homeStore.selectedExamId,
studentNumber.value,
@ -26,7 +26,7 @@ const { data: reportData, isLoading } = useQuery({
queryFn: async () => {
const response = await teacherAnalysisPersonalReportUsingPost({
body: {
class_key: homeStore.selectedClassId,
class_key: homeStore.selectedClassKey,
grade_key: homeStore.selectedGradeKey,
exam_id: homeStore.selectedExamId,
student_number: studentNumber.value,
@ -36,7 +36,7 @@ const { data: reportData, isLoading } = useQuery({
return response
},
enabled: computed(() =>
!!homeStore.selectedClassId
!!homeStore.selectedClassKey
&& !!homeStore.selectedGradeKey
&& !!homeStore.selectedExamId
&& !!studentNumber.value,

View File

@ -13,7 +13,7 @@ const searchQuery = ref('')
// 2. Query ()
const canLoadStudents = computed(() => {
return homeStore.selectedClassId && homeStore.selectedExamId && homeStore.selectedExamSubjectId
return homeStore.selectedClassKey && homeStore.selectedExamId && homeStore.selectedExamSubjectId
})
const {
@ -24,7 +24,7 @@ const {
} = useQuery({
queryKey: computed(() => [
'students',
homeStore.selectedClassId,
homeStore.selectedClassKey,
homeStore.selectedExamId,
homeStore.selectedExamSubjectId,
homeStore.selectedGradeKey,
@ -33,7 +33,7 @@ const {
queryFn: async () => {
const response = await teacherAnalysisStudentListUsingPost({
body: {
class_id: homeStore.selectedClassId!,
class_id: homeStore.selectedClassKey!,
exam_subject_id: homeStore.selectedExamSubjectId!,
grade_id: homeStore.selectedGradeKey!,
keyword: searchQuery.value || undefined,
@ -81,7 +81,7 @@ async function handleDownload() {
uni.showLoading({ title: '准备中' })
const response = await teacherAnalysisExportStudentListUsingPost({
body: {
class_id: homeStore.selectedClassId!,
class_id: homeStore.selectedClassKey!,
exam_subject_id: homeStore.selectedExamSubjectId!,
grade_id: homeStore.selectedGradeKey!,
},

View File

@ -630,10 +630,6 @@ export type ExamMarkingTaskResponse = {
exam_name?: string;
/** 考试类型 */
exam_type?: string;
/** 年级 */
grade?: string;
/** 是否已统分 */
is_scored?: boolean;
/** 科目列表 */
subjects?: SubjectInfo[];
};

View File

@ -10,6 +10,7 @@ export interface SelectOption {
value: number
examSubjectId?: number
subjectId?: number
classKey?: number
gradeKey?: number
}
@ -36,7 +37,6 @@ export const useHomeStore = defineStore(
const selectedExamId = useUserStorage<number>('home_selectedExamId', 0)
const selectedSubjectId = useUserStorage<number>('home_selectedSubjectId', 0)
const selectedExamSubjectId = useUserStorage<number>('home_selectedExamSubjectId', 0)
const selectedGradeKey = useUserStorage<number>('home_selectedGradeKey', 0)
// 计算属性:考试选项
const examOptions = computed((): SelectOption[] => {
@ -48,13 +48,22 @@ export const useHomeStore = defineStore(
// 计算属性:班级选项
const classOptions = computed((): SelectOption[] => {
return classList.value.map(item => ({
return classList.value.map((item, index) => ({
label: item.label,
value: item.value,
value: index,
classKey: item.value,
gradeKey: item.gradeKey,
}))
})
const selectedClassKey = computed(() => {
return classOptions.value.find(item => item.value === selectedClassId.value)?.classKey || 0
})
const selectedGradeKey = computed(() => {
return classOptions.value.find(item => item.value === selectedClassId.value)?.gradeKey || 0
})
// 计算属性:根据选中考试获取科目选项
const subjectOptions = computed((): SelectOption[] => {
if (!selectedExamId.value) {
@ -193,6 +202,7 @@ export const useHomeStore = defineStore(
selectedExamId,
selectedSubjectId,
selectedExamSubjectId,
selectedClassKey,
selectedGradeKey,
// 方法

View File

@ -1,6 +1,8 @@
import type { ModelSysUser, ModelTeacherListResponse, ModelUserProfileResponse } from '@/api'
import type { LoginRequest, SysUser } from '@/service/types'
import { defineStore } from 'pinia'
import { computed, ref } from 'vue'
import { authApi } from '@/api'
import {
authCodeLoginUsingPost,
authLoginUsingPost,
@ -19,7 +21,9 @@ export const useUserStore = defineStore(
// 登录状态
const isLogin = ref(false)
// 用户信息
const info = ref<Partial<SysUser>>({})
const info = ref<Partial<ModelSysUser>>({})
// 教师信息
const teacherInfo = ref<Partial<ModelTeacherListResponse>>({})
// 访问令牌
const accessToken = ref('')
// 刷新令牌
@ -39,8 +43,9 @@ export const useUserStore = defineStore(
*
* @param newInfo
*/
const setUserInfo = (newInfo: SysUser) => {
info.value = newInfo
const setUserInfo = (newInfo: ModelUserProfileResponse) => {
info.value = newInfo.sys_user
teacherInfo.value = newInfo.teacher
}
/**
@ -101,7 +106,7 @@ export const useUserStore = defineStore(
*/
const fetchUserProfile = async () => {
try {
const userData = await authProfileUsingGet({})
const userData = await authApi.profileList()
if (userData) {
setUserInfo(userData)
return userData