请求优化

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

View File

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

View File

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