调节系统开发

This commit is contained in:
gyj
2024-01-10 18:09:46 +08:00
parent fec7d4626c
commit 70e12e5618
6 changed files with 37 additions and 17 deletions
+8 -5
View File
@@ -5,9 +5,11 @@ import errorCode from '@/utils/errorCode'
import { toast, showConfirm, tansParams } from '@/utils/common'
let timeout = 10000
const baseUrl = config.baseUrl
const request = config => {
const baseUrlZC = config.baseUrlZC
const baseUrlTJ = config.baseUrlTJ
const request = config => {
const sysType = uni.getStorageSync('sysType')
// 是否需要设置 token
const isToken = (config.headers || {}).isToken === false
config.header = config.header || {}
@@ -20,11 +22,12 @@ const request = config => {
url = url.slice(0, -1)
config.url = url
}
return new Promise((resolve, reject) => {
return new Promise((resolve, reject) => {
const reqURL = sysType == 1 ? baseUrlZC : baseUrlTJ
uni.request({
method: config.method || 'get',
timeout: config.timeout || timeout,
url: config.baseUrl || baseUrl + config.url,
url: config.baseUrl || reqURL + config.url,
data: config.data,
header: config.header,
dataType: 'json'