diff --git a/src/renderer/src/hooks/useGetSubject.js b/src/renderer/src/hooks/useGetSubject.js index f7882a2..2b61a08 100644 --- a/src/renderer/src/hooks/useGetSubject.js +++ b/src/renderer/src/hooks/useGetSubject.js @@ -55,7 +55,7 @@ export const useGetSubject = async () =>{ treeData = getTreeData(subjectList[0].id) // 设置一个默认的curNode let curNode - if(treeData[0].children){ + if(treeData[0].children && treeData[0].children.length){ curNode = treeData[0].children[0] } else{ diff --git a/src/renderer/src/layout/components/Header.vue b/src/renderer/src/layout/components/Header.vue index 31d79ea..0b7b6f5 100644 --- a/src/renderer/src/layout/components/Header.vue +++ b/src/renderer/src/layout/components/Header.vue @@ -38,7 +38,7 @@ {{ userStore.user.nickName }}
- +
{{ userStore.user.edusubject }} @@ -178,9 +178,10 @@ const changeSubject = async (command) =>{ curBook: null, curNode: null, defaultExpandedKeys: [], + subjectTree: [] } sessionStore.set( 'subject', sessionSubject) - const { userId, userName, phonenumber, plainpwd } = userStore.user + const { userId, userName, plainpwd } = userStore.user const data = { userId, userName, @@ -188,7 +189,7 @@ const changeSubject = async (command) =>{ edusubject: command.edusubject } await updateUserInfo(data) - await userStore.login({username: phonenumber ? phonenumber : userName, password: plainpwd}) + await userStore.login({username: userName, password: plainpwd}) await userStore.getInfo() router.go() } diff --git a/src/renderer/src/views/profile/userInfo.vue b/src/renderer/src/views/profile/userInfo.vue index 708da12..2d9d1a2 100644 --- a/src/renderer/src/views/profile/userInfo.vue +++ b/src/renderer/src/views/profile/userInfo.vue @@ -47,6 +47,7 @@ import { listEvaluation } from '@/api/subject/index' import useUserStore from '@/store/modules/user' import {ElMessage} from 'element-plus' import { clearBookInfo } from '@/utils/ruoyi' +import { sessionStore } from '@/utils/store' const props = defineProps({ user: { @@ -148,7 +149,14 @@ function submit() { userStore.login({username:props.user.userName,password:props.user.plainpwd}).then(() => { userStore.getInfo().then(res => { if(res.code === 200){ - clearBookInfo() + let sessionSubject = { + bookList: null, + curBook: null, + curNode: null, + defaultExpandedKeys: [], + subjectTree: [] + } + sessionStore.set( 'subject', sessionSubject) ElMessage.success('修改成功') }else{ ElMessage.error(response.msg)