物流环境配置

This commit is contained in:
嗜血龙帅 2023-09-07 23:24:42 +08:00
parent 3ac290329c
commit bfb3c5fd22
2 changed files with 20 additions and 11 deletions

View File

@ -1,15 +1,20 @@
let httpApiThree; let httpApiThree;
let httpApi; let httpApi;
let httpApiTwo;
// 正式使用的域名 // 正式使用的域名
httpApi = 'https://ceshi-worker-task.lihaink.cn' //测试 // httpApi = 'https://ceshi-worker-task.lihaink.cn' //测试
// httpApi = 'https://preview-worker-task.lihaink.cn' //预上线 // httpApi = 'https://preview-worker-task.lihaink.cn' //预上线
// httpApi = 'https://worker-task.lihaink.cn' //正式 httpApi = 'https://worker-task.lihaink.cn' //正式
// 物流
httpApiTwo = 'https://logistics.lihaink.cn' //正式环境
// httpApiTwo = 'https://ceshi-logistics.lihaink.cn' //测试环境
httpApiThree = 'https://ceshi-worker-task.lihaink.cn' //测试 // httpApiThree = 'https://ceshi-worker-task.lihaink.cn' //测试
// httpApiThree = 'https://preview-worker-task.lihaink.cn' //预上线 // httpApiThree = 'https://preview-worker-task.lihaink.cn' //预上线
// httpApiThree = 'https://worker-task.lihaink.cn' //正式 httpApiThree = 'https://worker-task.lihaink.cn' //正式
// #ifdef H5 // #ifdef H5
// httpApiThree = 'baseUrlTest' //生产 // httpApiThree = 'baseUrlTest' //生产
// #endif // #endif
@ -33,6 +38,7 @@ module.exports = {
// 请求域名 格式: https://您的域名 // 请求域名 格式: https://您的域名
HTTP_REQUEST_URL: httpApi, HTTP_REQUEST_URL: httpApi,
HTTP_REQUEST_URL_THREE: httpApiThree, HTTP_REQUEST_URL_THREE: httpApiThree,
HTTP_REQUEST_URL_TWO: httpApiTwo,
// #ifdef H5 // #ifdef H5
//H5接口是浏览器地址 //H5接口是浏览器地址

View File

@ -1,5 +1,5 @@
import { import {
HTTP_REQUEST_URL_THREE, HTTP_REQUEST_URL_TWO,
HEADER, HEADER,
TOKENNAME, TOKENNAME,
} from '@/config/app'; } from '@/config/app';
@ -21,8 +21,7 @@ function baseRequestTwo(url, method, data, {
noAuth = false, noAuth = false,
noVerify = false noVerify = false
}) { }) {
// let Url = "https://logistics.lihaink.cn", //正式环境 let Url = HTTP_REQUEST_URL_TWO,
let Url = "https://ceshi-logistics.lihaink.cn", //测试环境
header = HEADER; header = HEADER;
if (!noAuth) { if (!noAuth) {
// 已经未登录了,禁止请求 // 已经未登录了,禁止请求
@ -41,6 +40,7 @@ function baseRequestTwo(url, method, data, {
// if (store.state.app.token) header[TOKENNAME] = 'Bearer ' + store.state.app.token; // if (store.state.app.token) header[TOKENNAME] = 'Bearer ' + store.state.app.token;
if (store.state.app.token) header[TOKENNAME] = store.state.app.token; if (store.state.app.token) header[TOKENNAME] = store.state.app.token;
// header[TOKENNAME] = 'Bearer sdjflidshjgfkbdasgjmasbgvhauuiavhkesvndkaesbvkjsdbv'; // header[TOKENNAME] = 'Bearer sdjflidshjgfkbdasgjmasbgvhauuiavhkesvndkaesbvkjsdbv';
return new Promise((reslove, reject) => { return new Promise((reslove, reject) => {
// uni.showLoading({ // uni.showLoading({
@ -52,6 +52,7 @@ function baseRequestTwo(url, method, data, {
method: method || 'GET', method: method || 'GET',
header: { header: {
...header ...header
}, },
data: method != 'GET' ? data || {} : {}, data: method != 'GET' ? data || {} : {},
params: method == 'GET' ? data : {}, params: method == 'GET' ? data : {},
@ -66,10 +67,12 @@ function baseRequestTwo(url, method, data, {
reject(res.data); reject(res.data);
} else if (res.data.code == 0) { } else if (res.data.code == 0) {
// uni.hideLoading(); // uni.hideLoading();
uni.showToast({ if (res.data.show != 1 && res.data.msg != '无登录信息') {
title: res.data.msg || '请检查网络', uni.showToast({
icon: 'none' title: res.data.msg || '请检查网络',
}) icon: 'none',
})
}
reject(res.data); reject(res.data);
} else if (res.data.code == 1) { } else if (res.data.code == 1) {
store.commit("SET_REQUEST"); store.commit("SET_REQUEST");