对接退出登录接口,调整登录逻辑

This commit is contained in:
Double-_-Z 2025-07-23 23:37:19 +08:00
parent 7a80f80220
commit 3ecb5d6466
4 changed files with 24 additions and 10 deletions

View File

@ -54,11 +54,6 @@ export default {
}, },
data(){ data(){
return{ return{
// #ifdef MP
//
StatusBar: this.StatusBar || 0,
CustomBarHeight: this.Custom.height+(this.Custom.top-this.StatusBar)*2 || 0,
// #endif
currentLoginType: 0,//-10 currentLoginType: 0,//-10
logo: '/static/logo.png',// logo logo: '/static/logo.png',// logo
loading: true,// loading: true,//
@ -147,7 +142,7 @@ export default {
// that.$u.vuex('vuex_token', 'fbc545a91cc94fe89296828a25a7e08e@9085553879028596738'); // that.$u.vuex('vuex_token', 'fbc545a91cc94fe89296828a25a7e08e@9085553879028596738');
await that.$u.vuex('user_message', JSON.stringify(res.user.user)); await that.$u.vuex('user_message', JSON.stringify(res.user.user));
if(that.nextUrl===''){ if(that.nextUrl===''){
uni.navigateBack({complete() { uni.redirectTo({url: '/aircraft/server/index/index',complete() {
setTimeout(()=>{ setTimeout(()=>{
uni.showToast({icon: 'none', title: '登录成功!'}); uni.showToast({icon: 'none', title: '登录成功!'});
},600) },600)
@ -164,7 +159,7 @@ export default {
} }
} }
}catch(e){ }catch(e){
that.$refs.uToast.show({type: 'error',title: "处理失败!"}); this.$refs.uToast.show({type: 'error',title: "处理失败!"});
}finally{ }finally{
this.dotLoading = false; this.dotLoading = false;
} }

View File

@ -81,10 +81,28 @@ export default {
} }
}, },
loginout(){ loginout(){
let that = this;
uni.showModal({ uni.showModal({
title: '退出登录', title: '退出登录',
content: '是否确认退出登录?', 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);
}
})
}
}
}) })
} }
} }

View File

@ -5,7 +5,7 @@ const install = (Vue, vm) => {
// 用户管理 // 用户管理
vm.$api.aLogin = async (params = {}) => await vm.$u.post('/auth/login/a', params);// 飞行员端登录 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.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');// 获取全部轮播图 vm.$api.allBanners = async () => await vm.$u.get('/cpBanner/all');// 获取全部轮播图

View File

@ -33,7 +33,7 @@ const install = (Vue, vm) => {
// uni.showToast({'title':'请先登录', 'icon':'none'}); // uni.showToast({'title':'请先登录', 'icon':'none'});
// return false; // return false;
// } // }
console.log('config,',config);
config.header.Authorization = vm.$store.state.vuex_token; config.header.Authorization = vm.$store.state.vuex_token;
// if (config.method == 'POST') { // if (config.method == 'POST') {
// config.data['__token__'] = vm.vuex__token__; // config.data['__token__'] = vm.vuex__token__;
@ -47,6 +47,7 @@ const install = (Vue, vm) => {
// vm.$u.vuex('vuex__token__', res.header.__token__); // vm.$u.vuex('vuex__token__', res.header.__token__);
// } // }
let result = res.data; let result = res.data;
console.log(res);
switch (result.code) { switch (result.code) {
case 1: case 1:
case 0: case 0: