Commit 84486278 by caoyanzhi

fix: 修复账号切换后无提示的bug

parent b7c5e4ec
......@@ -9,7 +9,9 @@ import request from './service/request.js';
export default {
name: 'App',
data () {
return {};
return {
userId: '',
};
},
created () {
this.getUserId();
......@@ -20,8 +22,7 @@ export default {
getUserId () {
request.get('/api-auth/get-login-user-info').then(res => {
if (res.data.errorCode === 0) {
const useId = res.data.result.userId;
localStorage.setItem('useId', useId);
this.useId = res.data.result.userId;
} else {
this.$message.error(res.data.message);
}
......@@ -34,8 +35,8 @@ export default {
request.get('/api-auth/get-login-user-info').then(res => {
if (res.data.errorCode === 0) {
const useId = res.data.result && res.data.result.userId;
if (localStorage.getItem('useId') !== useId) {
localStorage.setItem('useId', useId);
if (this.userId !== useId) {
this.userId = useId;
// 串号
this.$confirm('当前登录账号已经发生变化,如果您在其他页面已经登录另一个账号,请重新登录!', '登录账号变更提示', {
confirmButtonText: '重新登录',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment