对接退出登录接口,调整登录逻辑
This commit is contained in:
parent
7a80f80220
commit
3ecb5d6466
@ -54,11 +54,6 @@ export default {
|
||||
},
|
||||
data(){
|
||||
return{
|
||||
// #ifdef MP
|
||||
// 微信小程序自定义导航栏参数
|
||||
StatusBar: this.StatusBar || 0,
|
||||
CustomBarHeight: this.Custom.height+(this.Custom.top-this.StatusBar)*2 || 0,
|
||||
// #endif
|
||||
currentLoginType: 0,//当前登录方式-1飞行员、0用户
|
||||
logo: '/static/logo.png',// logo图标
|
||||
loading: true,// 加载
|
||||
@ -147,7 +142,7 @@ export default {
|
||||
// that.$u.vuex('vuex_token', 'fbc545a91cc94fe89296828a25a7e08e@9085553879028596738');
|
||||
await that.$u.vuex('user_message', JSON.stringify(res.user.user));
|
||||
if(that.nextUrl===''){
|
||||
uni.navigateBack({complete() {
|
||||
uni.redirectTo({url: '/aircraft/server/index/index',complete() {
|
||||
setTimeout(()=>{
|
||||
uni.showToast({icon: 'none', title: '登录成功!'});
|
||||
},600)
|
||||
@ -164,7 +159,7 @@ export default {
|
||||
}
|
||||
}
|
||||
}catch(e){
|
||||
that.$refs.uToast.show({type: 'error',title: "处理失败!"});
|
||||
this.$refs.uToast.show({type: 'error',title: "处理失败!"});
|
||||
}finally{
|
||||
this.dotLoading = false;
|
||||
}
|
||||
|
@ -81,10 +81,28 @@ export default {
|
||||
}
|
||||
},
|
||||
loginout(){
|
||||
let that = this;
|
||||
uni.showModal({
|
||||
title: '退出登录',
|
||||
content: '是否确认退出登录?',
|
||||
confirmColor: '#f7c04d'
|
||||
confirmColor: '#f7c04d',
|
||||
success: async(res) => {
|
||||
if (res.confirm) {
|
||||
await that.$api.logout();
|
||||
that.$u.vuex('vuex_token', '');
|
||||
that.$u.vuex('user_message', {});
|
||||
uni.reLaunch({
|
||||
url: '/aircraft/server/my/child_pages/login',
|
||||
complete() {
|
||||
setTimeout(()=>{
|
||||
uni.showToast({
|
||||
icon: 'none',title: '退出登录成功!'
|
||||
})
|
||||
},300);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ const install = (Vue, vm) => {
|
||||
// 用户管理
|
||||
vm.$api.aLogin = async (params = {}) => await vm.$u.post('/auth/login/a', params);// 飞行员端登录
|
||||
vm.$api.bLogin = async (params = {}) => await vm.$u.post('/auth/login/b', params);// 用户端登录
|
||||
vm.$api.logOut = async () => await vm.$u.get('/auth/logout');// 用户登出
|
||||
vm.$api.logout = async () => await vm.$u.delete('/auth/logout');// 用户登出
|
||||
|
||||
// 轮播图管理
|
||||
vm.$api.allBanners = async () => await vm.$u.get('/cpBanner/all');// 获取全部轮播图
|
||||
|
@ -33,7 +33,7 @@ const install = (Vue, vm) => {
|
||||
// uni.showToast({'title':'请先登录', 'icon':'none'});
|
||||
// return false;
|
||||
// }
|
||||
|
||||
console.log('config,',config);
|
||||
config.header.Authorization = vm.$store.state.vuex_token;
|
||||
// if (config.method == 'POST') {
|
||||
// config.data['__token__'] = vm.vuex__token__;
|
||||
@ -47,6 +47,7 @@ const install = (Vue, vm) => {
|
||||
// vm.$u.vuex('vuex__token__', res.header.__token__);
|
||||
// }
|
||||
let result = res.data;
|
||||
console.log(res);
|
||||
switch (result.code) {
|
||||
case 1:
|
||||
case 0:
|
||||
|
Loading…
Reference in New Issue
Block a user