更新请求,去除中间代理,直接请求后台接口

This commit is contained in:
YeMingfei666 2024-09-10 15:27:37 +08:00
parent 8befd0605a
commit 7d57094bcd
1 changed files with 4 additions and 10 deletions

View File

@ -15,13 +15,7 @@ import {
} from '@/commons/utils/encryptUtil.js' } from '@/commons/utils/encryptUtil.js'
import infoBox from "@/commons/utils/infoBox.js" import infoBox from "@/commons/utils/infoBox.js"
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
let baseUrl = 'http://101.37.12.135:8080' let baseUrl = 'https://admintestpapi.sxczgkj.cn'
// #ifdef H5
baseUrl = '/server3/ysk'
// #endif
// #ifndef H5
baseUrl = 'http://101.37.12.135:8080/ysk'
// #endif
// 多少 ms 以内, 不提示loading // 多少 ms 以内, 不提示loading
const loadingShowTime = 200 const loadingShowTime = 200
@ -114,13 +108,13 @@ function commonsProcess(showLoading, httpReqCallback) {
return Promise.resolve(bodyData) return Promise.resolve(bodyData)
}).catch(res => { }).catch(res => {
if(res.code==401){ if(res.status==401){
storageManage.token(null, true) storageManage.token(null, true)
infoBox.showErrorToast('请登录').then(() => { infoBox.showErrorToast('请登录').then(() => {
go.to("PAGES_LOGIN", {}, go.GO_TYPE_RELAUNCH) go.to("PAGES_LOGIN", {}, go.GO_TYPE_RELAUNCH)
}) })
} }
if(res.code==500){ if(res.status==500){
storageManage.token(null, true) storageManage.token(null, true)
infoBox.showErrorToast('请登录').then(() => { infoBox.showErrorToast('请登录').then(() => {
go.to("PAGES_LOGIN", {}, go.GO_TYPE_RELAUNCH) go.to("PAGES_LOGIN", {}, go.GO_TYPE_RELAUNCH)
@ -149,7 +143,7 @@ function commonsProcess(showLoading, httpReqCallback) {
function req(uri, data, method = "GET", showLoading = true, extParams = {}) { function req(uri, data, method = "GET", showLoading = true, extParams = {}) {
let headerObject = {} let headerObject = {}
// headerObject[appConfig.tokenKey] = storageManage.token() // headerObject[appConfig.tokenKey] = storageManage.token()
headerObject["satoken"] = storageManage.token() headerObject["authorization"] = storageManage.token()
headerObject["content-type"] = 'application/json' headerObject["content-type"] = 'application/json'
return commonsProcess(showLoading, () => { return commonsProcess(showLoading, () => {