增加退出登录
This commit is contained in:
parent
2fcd9ceda3
commit
e04c62df44
|
@ -236,5 +236,16 @@ export default {
|
||||||
return reject(response.msg);
|
return reject(response.msg);
|
||||||
}).catch(e => { });
|
}).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>
|
</view>
|
||||||
<view class="common-save-form-btn">
|
<view class="common-save-form-btn">
|
||||||
<view class="btn">退出账户</view>
|
<view class="btn" @click="logout">退出账户</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</app-layout>
|
</app-layout>
|
||||||
|
@ -59,6 +59,9 @@ export default {
|
||||||
toPage(url) {
|
toPage(url) {
|
||||||
this.$utils.toPage(url);
|
this.$utils.toPage(url);
|
||||||
},
|
},
|
||||||
|
logout() {
|
||||||
|
this.$models.user.logout();
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -16,7 +16,7 @@ export default {
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
isLogin(state) {
|
isLogin(state) {
|
||||||
return state.token.length > 0;
|
return state.token && state.token.length > 0;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mutations: {
|
mutations: {
|
||||||
|
|
Loading…
Reference in New Issue