请求优化

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,112 +1,112 @@
{
"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": [
"portrait-primary",
"portrait-secondary",
"landscape-primary",
"landscape-secondary"
],
"splashscreen": {
"alwaysShowBeforeRender": true,
"waiting": true,
"autoclose": true,
"delay": 0
},
/* */
"modules": {
"Geolocation": {},
"Maps": {},
"LivePusher": {},
"VideoPlayer": {},
"Barcode": {},
"Camera": {},
"UniMP": {
"description": "uni小程序"
}
},
/* */
"distribute": {
/* android */
"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\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
],
"minSdkVersion": 21
},
/* ios */
"ios": {
"dSYMs": false
},
/* SDK */
"sdkConfigs": {
"ad": {},
"geolocation": {
"amap": {
"name": "amap_18982406440DFVLElaO",
"__platform__": ["android"],
"appkey_ios": "4e6789b864fe1a2d76b98e38158f20f2",
"appkey_android": "a230d943475443eb29fc3871fbef8605"
},
"system": {
"__platform__": ["ios", "android"]
}
},
"maps": {
"amap": {
"name": "4e6789b864fe1a2d76b98e38158f20f2",
"appkey_ios": "a230d943475443eb29fc3871fbef8605",
"appkey_android": "a230d943475443eb29fc3871fbef8605"
}
}
}
}
},
/* */
"quickapp": {},
/* */
"mp-weixin": {
"appid": "",
"setting": {
"urlCheck": false
},
"usingComponents": true
},
"mp-alipay": {
"usingComponents": true
},
"mp-baidu": {
"usingComponents": true
},
"mp-toutiao": {
"usingComponents": true
},
"uniStatistics": {
"enable": false
},
"vueVersion": "3"
"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" : [
"portrait-primary",
"portrait-secondary",
"landscape-primary",
"landscape-secondary"
],
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
"autoclose" : true,
"delay" : 0
},
/* */
"modules" : {
"Geolocation" : {},
"Maps" : {},
"LivePusher" : {},
"VideoPlayer" : {},
"Barcode" : {},
"Camera" : {},
"UniMP" : {
"description" : "uni小程序"
}
},
/* */
"distribute" : {
/* android */
"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\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
],
"minSdkVersion" : 21
},
/* ios */
"ios" : {
"dSYMs" : false
},
/* SDK */
"sdkConfigs" : {
"ad" : {},
"geolocation" : {
"amap" : {
"name" : "amap_18982406440DFVLElaO",
"__platform__" : [ "android" ],
"appkey_ios" : "4e6789b864fe1a2d76b98e38158f20f2",
"appkey_android" : "a230d943475443eb29fc3871fbef8605"
},
"system" : {
"__platform__" : [ "ios", "android" ]
}
},
"maps" : {
"amap" : {
"name" : "4e6789b864fe1a2d76b98e38158f20f2",
"appkey_ios" : "a230d943475443eb29fc3871fbef8605",
"appkey_android" : "a230d943475443eb29fc3871fbef8605"
}
}
}
}
},
/* */
"quickapp" : {},
/* */
"mp-weixin" : {
"appid" : "",
"setting" : {
"urlCheck" : false
},
"usingComponents" : true
},
"mp-alipay" : {
"usingComponents" : true
},
"mp-baidu" : {
"usingComponents" : true
},
"mp-toutiao" : {
"usingComponents" : true
},
"uniStatistics" : {
"enable" : false
},
"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();
// }
uni.showToast({
title: res.data.msg,
icon: 'none',
})
if (res.data.msg == "登录超时,请重新登录") {
// store.commit('LOGOUT');
uni.showToast({
title: res.data.msg ,
icon: 'none',
})
uni.reLaunch({
url:'/pages/Login/login'
})
}
} else if (res.data.code == 0) {
if (res.data.msg != '用户信息不存在') {
uni.showToast({