@@ -21,6 +21,7 @@
|
||||
import app_upgrade from '@/uni_modules/app-upgrade/js_sdk/index.js'
|
||||
import util from '@/common/util.js';
|
||||
import config from '../../../common/config';
|
||||
import { clearUserSession } from '@/common/userSession.js';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@@ -84,27 +85,17 @@ export default {
|
||||
// #endif
|
||||
},
|
||||
logout() {
|
||||
this.$u.api.pdaLogout().then(res => {
|
||||
console.log('res',res)
|
||||
if (res.code != 0) {
|
||||
// this.$u.toast('退出登录失败');
|
||||
uni.reLaunch({
|
||||
url: '/pages/sys/login/index'
|
||||
});
|
||||
return
|
||||
}
|
||||
// 清除token和用户信息
|
||||
uni.removeStorageSync('token');
|
||||
this.$store.dispatch('updateUserInfo', null);
|
||||
const goLogin = () => {
|
||||
clearUserSession();
|
||||
uni.reLaunch({
|
||||
url: '/pages/sys/login/index'
|
||||
});
|
||||
};
|
||||
this.$u.api.pdaLogout().then(() => {
|
||||
goLogin();
|
||||
}).catch(error => {
|
||||
console.log('error',error)
|
||||
// 即使退出登录失败,也要清除本地token和用户信息
|
||||
uni.removeStorageSync('token');
|
||||
this.$store.dispatch('updateUserInfo', null);
|
||||
// this.$u.toast('退出登录失败');
|
||||
goLogin();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user