|
@@ -145,18 +145,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 =
|
|
|
|
+ states.userType === 'TEACHER'
|
|
|
|
+ ? '/api-website/teacher/queryUserInfo'
|
|
|
|
+ : '/api-website/student/queryUserInfo'
|
|
|
|
+ const { data } = await request.get(url)
|
|
|
|
+
|
|
|
|
+ if (data.userType.indexOf(userType) != -1) {
|
|
|
|
+ setAuth(
|
|
|
|
+ JSON.stringify({
|
|
|
|
+ token,
|
|
|
|
+ loginUserType: userType
|
|
|
|
+ })
|
|
|
|
+ )
|
|
|
|
+ router.push({ path: '/' })
|
|
|
|
+ // router.push({ path: nowPath, query: { ...route.query } })
|
|
|
|
+ setTimeout(() => {
|
|
|
|
+ window.location.reload()
|
|
|
|
+ }, 500)
|
|
|
|
+ } else {
|
|
|
|
+ // 账号已锁定
|
|
|
|
+ }
|
|
|
|
+ } catch {
|
|
|
|
+ // state.user.status = 'init'
|
|
|
|
+ }
|
|
})
|
|
})
|
|
}
|
|
}
|
|
const logout = async () => {
|
|
const logout = async () => {
|