|
@@ -11,7 +11,8 @@ import {
|
|
ElDropdown,
|
|
ElDropdown,
|
|
ElDropdownItem,
|
|
ElDropdownItem,
|
|
ElDropdownMenu,
|
|
ElDropdownMenu,
|
|
- ElMessageBox
|
|
|
|
|
|
+ ElMessageBox,
|
|
|
|
+ ElMessage
|
|
} from 'element-plus'
|
|
} from 'element-plus'
|
|
import classes from './index.module.less'
|
|
import classes from './index.module.less'
|
|
import teacherHeader from '@/common/images/icon_teacher.png'
|
|
import teacherHeader from '@/common/images/icon_teacher.png'
|
|
@@ -145,18 +146,32 @@ export default defineComponent({
|
|
}
|
|
}
|
|
ElMessageBox.confirm(`是否确定切换到${str}?`, '提示', {
|
|
ElMessageBox.confirm(`是否确定切换到${str}?`, '提示', {
|
|
type: 'warning'
|
|
type: 'warning'
|
|
- }).then(() => {
|
|
|
|
- setAuth(
|
|
|
|
- JSON.stringify({
|
|
|
|
- token,
|
|
|
|
- loginUserType: userType
|
|
|
|
- })
|
|
|
|
- )
|
|
|
|
- router.push({ path: '/' })
|
|
|
|
- // router.push({ path: nowPath, query: { ...route.query } })
|
|
|
|
- setTimeout(() => {
|
|
|
|
- window.location.reload()
|
|
|
|
- }, 500)
|
|
|
|
|
|
+ }).then(async () => {
|
|
|
|
+ try {
|
|
|
|
+ const url =
|
|
|
|
+ userType === 'TEACHER'
|
|
|
|
+ ? '/api-website/teacher/queryUserInfo'
|
|
|
|
+ : '/api-website/student/queryUserInfo'
|
|
|
|
+ const { data } = await request.get(url)
|
|
|
|
+ console.log(data, userType)
|
|
|
|
+
|
|
|
|
+ if (data.lockFlag) {
|
|
|
|
+ // 账号已锁定
|
|
|
|
+ ElMessage.error(`无法切换,${str}账号异常`)
|
|
|
|
+ } else {
|
|
|
|
+ setAuth(
|
|
|
|
+ JSON.stringify({
|
|
|
|
+ token,
|
|
|
|
+ loginUserType: userType
|
|
|
|
+ })
|
|
|
|
+ )
|
|
|
|
+ router.push({ path: '/' }).then(() => {
|
|
|
|
+ window.location.reload()
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ } catch {
|
|
|
|
+ // state.user.status = 'init'
|
|
|
|
+ }
|
|
})
|
|
})
|
|
}
|
|
}
|
|
const logout = async () => {
|
|
const logout = async () => {
|