api配置

This commit is contained in:
jia 2023-09-25 15:18:00 +08:00
parent 37aae470df
commit 282c77ee6b
2 changed files with 10 additions and 8 deletions

View File

@ -17,20 +17,19 @@ switch (env) {
httpApi = 'https://shop.lihaink.cn' // 生产
httpApiTwo = 'https://nk.lihaink.cn'
httpApiThree = 'http://ceshi-oa.lihaink.cn'
httpApiFour= 'https://worker-task.lihaink.cn'
httpApiFour = 'https://worker-task.lihaink.cn'
break;
case 'prew':
httpApi = 'https://test.shop.lihaink.cn' //预发布环境
httpApiTwo = "https://nk.lihaink.cn"
httpApiThree = 'http://ceshi-oa.lihaink.cn'
httpApiFour= 'https://preview-worker-task.lihaink.cn'
httpApiFour = 'https://preview-worker-task.lihaink.cn'
break;
default:
httpApi = "https://crmeb-test.shop.lihaink.cn" // 测试
httpApiTwo = "https://nk.lihaink.cn"
httpApiThree = 'http://ceshi-oa.lihaink.cn'
httpApiFour= 'https://ceshi-worker-task.lihaink.cn'
httpApiFour = 'https://ceshi-worker-task.lihaink.cn'
}
@ -80,9 +79,10 @@ module.exports = {
HTTP_REQUEST_URL_FOUR: httpApiFour,
VUE_APP_WS_URL: `${wsApi}?type=user`,
// #endif
// #ifdef H5
//H5接口是浏览器地址
HTTP_REQUEST_URL_FOUR: httpApiFour|| window.location.protocol + "//" + window.location.host,
HTTP_REQUEST_URL: httpApi || window.location.protocol + "//" + window.location.host,
HTTP_REQUEST_URL_TWO: httpApiTwo || window.location.protocol + "//" + window.location.host,
// 聊天长连接地址

View File

@ -8,6 +8,7 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import {
HTTP_REQUEST_URL,
HTTP_REQUEST_URL_FOUR,
HEADER,
TOKENNAME
@ -18,6 +19,7 @@ import {
import store from '../store';
console.log(HTTP_REQUEST_URL_FOUR)
/**
* 发送请求
@ -26,6 +28,7 @@ function baseRequest(url, method, data, {
noAuth = false,
noVerify = false
}) {
let Url = HTTP_REQUEST_URL_FOUR,
header = HEADER;
@ -37,13 +40,13 @@ function baseRequest(url, method, data, {
uni.request({
url: Url + '/api/' + url,
method: method || 'GET',
header: header,
// header: header,
data: data || {},
success: (res) => {
// #ifdef APP-PLUS
// console.log('app', Url + '/api/' + url, res.data);
// #endif
console.log(res.data.code)
if (noVerify)
reslove(res.data, res);
else if (res.data.status == 200)
@ -57,7 +60,6 @@ function baseRequest(url, method, data, {
})
reject(res.data);
} else if (res.statusCode==200) {
reslove(res.data,res.data);
} else
reject(res.data.message || '系统错误');