api配置
This commit is contained in:
parent
37aae470df
commit
282c77ee6b
@ -17,20 +17,19 @@ switch (env) {
|
|||||||
httpApi = 'https://shop.lihaink.cn' // 生产
|
httpApi = 'https://shop.lihaink.cn' // 生产
|
||||||
httpApiTwo = 'https://nk.lihaink.cn'
|
httpApiTwo = 'https://nk.lihaink.cn'
|
||||||
httpApiThree = 'http://ceshi-oa.lihaink.cn'
|
httpApiThree = 'http://ceshi-oa.lihaink.cn'
|
||||||
|
httpApiFour = 'https://worker-task.lihaink.cn'
|
||||||
httpApiFour= 'https://worker-task.lihaink.cn'
|
|
||||||
break;
|
break;
|
||||||
case 'prew':
|
case 'prew':
|
||||||
httpApi = 'https://test.shop.lihaink.cn' //预发布环境
|
httpApi = 'https://test.shop.lihaink.cn' //预发布环境
|
||||||
httpApiTwo = "https://nk.lihaink.cn"
|
httpApiTwo = "https://nk.lihaink.cn"
|
||||||
httpApiThree = 'http://ceshi-oa.lihaink.cn'
|
httpApiThree = 'http://ceshi-oa.lihaink.cn'
|
||||||
httpApiFour= 'https://preview-worker-task.lihaink.cn'
|
httpApiFour = 'https://preview-worker-task.lihaink.cn'
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
httpApi = "https://crmeb-test.shop.lihaink.cn" // 测试
|
httpApi = "https://crmeb-test.shop.lihaink.cn" // 测试
|
||||||
httpApiTwo = "https://nk.lihaink.cn"
|
httpApiTwo = "https://nk.lihaink.cn"
|
||||||
httpApiThree = 'http://ceshi-oa.lihaink.cn'
|
httpApiThree = 'http://ceshi-oa.lihaink.cn'
|
||||||
httpApiFour= 'https://ceshi-worker-task.lihaink.cn'
|
httpApiFour = 'https://ceshi-worker-task.lihaink.cn'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -83,6 +82,7 @@ module.exports = {
|
|||||||
|
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
//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: httpApi || window.location.protocol + "//" + window.location.host,
|
||||||
HTTP_REQUEST_URL_TWO: httpApiTwo || window.location.protocol + "//" + window.location.host,
|
HTTP_REQUEST_URL_TWO: httpApiTwo || window.location.protocol + "//" + window.location.host,
|
||||||
// 聊天长连接地址
|
// 聊天长连接地址
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
// | Author: CRMEB Team <admin@crmeb.com>
|
// | Author: CRMEB Team <admin@crmeb.com>
|
||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
import {
|
import {
|
||||||
|
HTTP_REQUEST_URL,
|
||||||
HTTP_REQUEST_URL_FOUR,
|
HTTP_REQUEST_URL_FOUR,
|
||||||
HEADER,
|
HEADER,
|
||||||
TOKENNAME
|
TOKENNAME
|
||||||
@ -18,6 +19,7 @@ import {
|
|||||||
import store from '../store';
|
import store from '../store';
|
||||||
|
|
||||||
|
|
||||||
|
console.log(HTTP_REQUEST_URL_FOUR)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送请求
|
* 发送请求
|
||||||
@ -26,6 +28,7 @@ function baseRequest(url, method, data, {
|
|||||||
noAuth = false,
|
noAuth = false,
|
||||||
noVerify = false
|
noVerify = false
|
||||||
}) {
|
}) {
|
||||||
|
|
||||||
let Url = HTTP_REQUEST_URL_FOUR,
|
let Url = HTTP_REQUEST_URL_FOUR,
|
||||||
header = HEADER;
|
header = HEADER;
|
||||||
|
|
||||||
@ -37,13 +40,13 @@ function baseRequest(url, method, data, {
|
|||||||
uni.request({
|
uni.request({
|
||||||
url: Url + '/api/' + url,
|
url: Url + '/api/' + url,
|
||||||
method: method || 'GET',
|
method: method || 'GET',
|
||||||
header: header,
|
// header: header,
|
||||||
data: data || {},
|
data: data || {},
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
// console.log('app', Url + '/api/' + url, res.data);
|
// console.log('app', Url + '/api/' + url, res.data);
|
||||||
// #endif
|
// #endif
|
||||||
|
console.log(res.data.code)
|
||||||
if (noVerify)
|
if (noVerify)
|
||||||
reslove(res.data, res);
|
reslove(res.data, res);
|
||||||
else if (res.data.status == 200)
|
else if (res.data.status == 200)
|
||||||
@ -57,7 +60,6 @@ function baseRequest(url, method, data, {
|
|||||||
})
|
})
|
||||||
reject(res.data);
|
reject(res.data);
|
||||||
} else if (res.statusCode==200) {
|
} else if (res.statusCode==200) {
|
||||||
|
|
||||||
reslove(res.data,res.data);
|
reslove(res.data,res.data);
|
||||||
} else
|
} else
|
||||||
reject(res.data.message || '系统错误');
|
reject(res.data.message || '系统错误');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user