Merge branch 'main' into zouyf_dev

This commit is contained in:
“zouyf” 2024-09-26 16:25:28 +08:00
commit c3bd7b31ee
3 changed files with 14 additions and 5 deletions

View File

@ -55,7 +55,7 @@ export const useGetSubject = async () =>{
treeData = getTreeData(subjectList[0].id) treeData = getTreeData(subjectList[0].id)
// 设置一个默认的curNode // 设置一个默认的curNode
let curNode let curNode
if(treeData[0].children){ if(treeData[0].children && treeData[0].children.length){
curNode = treeData[0].children[0] curNode = treeData[0].children[0]
} }
else{ else{

View File

@ -38,7 +38,7 @@
<span class="user-name">{{ userStore.user.nickName }}</span> <span class="user-name">{{ userStore.user.nickName }}</span>
<div class="flex"> <div class="flex">
<el-dropdown @command="changeSubject"> <el-dropdown @command="changeSubject" max-height="500">
<div class="user-subject">{{ userStore.user.edusubject }} <div class="user-subject">{{ userStore.user.edusubject }}
<el-icon class="el-icon--right"><arrow-down /> <el-icon class="el-icon--right"><arrow-down />
</el-icon> </el-icon>
@ -178,9 +178,10 @@ const changeSubject = async (command) =>{
curBook: null, curBook: null,
curNode: null, curNode: null,
defaultExpandedKeys: [], defaultExpandedKeys: [],
subjectTree: []
} }
sessionStore.set( 'subject', sessionSubject) sessionStore.set( 'subject', sessionSubject)
const { userId, userName, phonenumber, plainpwd } = userStore.user const { userId, userName, plainpwd } = userStore.user
const data = { const data = {
userId, userId,
userName, userName,
@ -188,7 +189,7 @@ const changeSubject = async (command) =>{
edusubject: command.edusubject edusubject: command.edusubject
} }
await updateUserInfo(data) await updateUserInfo(data)
await userStore.login({username: phonenumber ? phonenumber : userName, password: plainpwd}) await userStore.login({username: userName, password: plainpwd})
await userStore.getInfo() await userStore.getInfo()
router.go() router.go()
} }

View File

@ -47,6 +47,7 @@ import { listEvaluation } from '@/api/subject/index'
import useUserStore from '@/store/modules/user' import useUserStore from '@/store/modules/user'
import {ElMessage} from 'element-plus' import {ElMessage} from 'element-plus'
import { clearBookInfo } from '@/utils/ruoyi' import { clearBookInfo } from '@/utils/ruoyi'
import { sessionStore } from '@/utils/store'
const props = defineProps({ const props = defineProps({
user: { user: {
@ -148,7 +149,14 @@ function submit() {
userStore.login({username:props.user.userName,password:props.user.plainpwd}).then(() => { userStore.login({username:props.user.userName,password:props.user.plainpwd}).then(() => {
userStore.getInfo().then(res => { userStore.getInfo().then(res => {
if(res.code === 200){ if(res.code === 200){
clearBookInfo() let sessionSubject = {
bookList: null,
curBook: null,
curNode: null,
defaultExpandedKeys: [],
subjectTree: []
}
sessionStore.set( 'subject', sessionSubject)
ElMessage.success('修改成功') ElMessage.success('修改成功')
}else{ }else{
ElMessage.error(response.msg) ElMessage.error(response.msg)