请求优化

This commit is contained in:
jia 2023-12-07 09:34:55 +08:00
parent 6a63cdf094
commit 45547b52b7
3 changed files with 128 additions and 120 deletions

View File

@ -1,44 +1,44 @@
{
"name": "种植溯源",
"appid": "__UNI__D087881",
"description": "",
"versionName": "1.0.1",
"versionCode": "100",
"transformPx": false,
"name" : "种植溯源",
"appid" : "__UNI__D087881",
"description" : "",
"versionName" : "1.0.1",
"versionCode" : "100",
"transformPx" : false,
/* 5+App */
"app-plus": {
"usingComponents": true,
"nvueStyleCompiler": "uni-app",
"compilerVersion": 3,
"screenOrientation": [
"app-plus" : {
"usingComponents" : true,
"nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3,
"screenOrientation" : [
"portrait-primary",
"portrait-secondary",
"landscape-primary",
"landscape-secondary"
],
"splashscreen": {
"alwaysShowBeforeRender": true,
"waiting": true,
"autoclose": true,
"delay": 0
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
"autoclose" : true,
"delay" : 0
},
/* */
"modules": {
"Geolocation": {},
"Maps": {},
"LivePusher": {},
"VideoPlayer": {},
"Barcode": {},
"Camera": {},
"UniMP": {
"description": "uni小程序"
"modules" : {
"Geolocation" : {},
"Maps" : {},
"LivePusher" : {},
"VideoPlayer" : {},
"Barcode" : {},
"Camera" : {},
"UniMP" : {
"description" : "uni小程序"
}
},
/* */
"distribute": {
"distribute" : {
/* android */
"android": {
"permissions": [
"android" : {
"permissions" : [
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
@ -56,57 +56,57 @@
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
],
"minSdkVersion": 21
"minSdkVersion" : 21
},
/* ios */
"ios": {
"dSYMs": false
"ios" : {
"dSYMs" : false
},
/* SDK */
"sdkConfigs": {
"ad": {},
"geolocation": {
"amap": {
"name": "amap_18982406440DFVLElaO",
"__platform__": ["android"],
"appkey_ios": "4e6789b864fe1a2d76b98e38158f20f2",
"appkey_android": "a230d943475443eb29fc3871fbef8605"
"sdkConfigs" : {
"ad" : {},
"geolocation" : {
"amap" : {
"name" : "amap_18982406440DFVLElaO",
"__platform__" : [ "android" ],
"appkey_ios" : "4e6789b864fe1a2d76b98e38158f20f2",
"appkey_android" : "a230d943475443eb29fc3871fbef8605"
},
"system": {
"__platform__": ["ios", "android"]
"system" : {
"__platform__" : [ "ios", "android" ]
}
},
"maps": {
"amap": {
"name": "4e6789b864fe1a2d76b98e38158f20f2",
"appkey_ios": "a230d943475443eb29fc3871fbef8605",
"appkey_android": "a230d943475443eb29fc3871fbef8605"
"maps" : {
"amap" : {
"name" : "4e6789b864fe1a2d76b98e38158f20f2",
"appkey_ios" : "a230d943475443eb29fc3871fbef8605",
"appkey_android" : "a230d943475443eb29fc3871fbef8605"
}
}
}
}
},
/* */
"quickapp": {},
"quickapp" : {},
/* */
"mp-weixin": {
"appid": "",
"setting": {
"urlCheck": false
"mp-weixin" : {
"appid" : "",
"setting" : {
"urlCheck" : false
},
"usingComponents": true
"usingComponents" : true
},
"mp-alipay": {
"usingComponents": true
"mp-alipay" : {
"usingComponents" : true
},
"mp-baidu": {
"usingComponents": true
"mp-baidu" : {
"usingComponents" : true
},
"mp-toutiao": {
"usingComponents": true
"mp-toutiao" : {
"usingComponents" : true
},
"uniStatistics": {
"enable": false
"uniStatistics" : {
"enable" : false
},
"vueVersion": "3"
"vueVersion" : "3"
}

View File

@ -17,6 +17,7 @@ function baseRequest(url, method, data, {
header = config.HEADER;
if (store.state.userInfo) {
header.TOKEN = store.state.userInfo.token
}
return new Promise((reslove, reject) => {
@ -43,9 +44,13 @@ function baseRequest(url, method, data, {
reslove(res.data);
else if (res.data.code == -1) {
if (onReLogin) {
if (res.data.msg == "登录超时,请重新登录") {
// store.commit('LOGOUT');
uni.reLaunch({
url:'/pages/Login/login'
})
}
} else if (res.data.code == 0) {
if (res.data.msg != '用户信息不存在') {

View File

@ -37,15 +37,18 @@ function baseRequest(url, method, data, {
if (noVerify)
reslove(res.data);
else if (res.data.code == -1) {
// if (onReLogin) {
// // store.commit('LOGOUT');
// return reject();
// }
if (res.data.msg == "登录超时,请重新登录") {
// store.commit('LOGOUT');
uni.showToast({
title: res.data.msg,
title: res.data.msg ,
icon: 'none',
})
uni.reLaunch({
url:'/pages/Login/login'
})
}
} else if (res.data.code == 0) {
if (res.data.msg != '用户信息不存在') {
uni.showToast({