增加退出登录
This commit is contained in:
parent
2fcd9ceda3
commit
e04c62df44
|
@ -236,5 +236,16 @@ export default {
|
|||
return reject(response.msg);
|
||||
}).catch(e => { });
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 注销登录
|
||||
*/
|
||||
logout() {
|
||||
prototype.$storage.set('user_access_token', null);
|
||||
prototype.$storage.set('userinfo', null);
|
||||
$store.commit('user/token', "");
|
||||
prototype.$utils.toast('注销成功').then(() => {
|
||||
prototype.$utils.toPage('/pages/index/index', {}, 'switch');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
</view>
|
||||
</view>
|
||||
<view class="common-save-form-btn">
|
||||
<view class="btn">退出账户</view>
|
||||
<view class="btn" @click="logout">退出账户</view>
|
||||
</view>
|
||||
</view>
|
||||
</app-layout>
|
||||
|
@ -59,6 +59,9 @@ export default {
|
|||
toPage(url) {
|
||||
this.$utils.toPage(url);
|
||||
},
|
||||
logout() {
|
||||
this.$models.user.logout();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -16,7 +16,7 @@ export default {
|
|||
},
|
||||
getters: {
|
||||
isLogin(state) {
|
||||
return state.token.length > 0;
|
||||
return state.token && state.token.length > 0;
|
||||
},
|
||||
},
|
||||
mutations: {
|
||||
|
|
Loading…
Reference in New Issue