zouyf_dev #274

Merged
zouyf merged 2 commits from zouyf_dev into main 2024-09-26 16:26:08 +08:00
3 changed files with 14 additions and 5 deletions
Showing only changes of commit c3bd7b31ee - Show all commits

View File

@ -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{

View File

@ -38,7 +38,7 @@
<span class="user-name">{{ userStore.user.nickName }}</span>
<div class="flex">
<el-dropdown @command="changeSubject">
<el-dropdown @command="changeSubject" max-height="500">
<div class="user-subject">{{ userStore.user.edusubject }}
<el-icon class="el-icon--right"><arrow-down />
</el-icon>
@ -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()
}

View File

@ -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)