flx:提交配置

This commit is contained in:
X_Rian 2024-11-12 15:37:42 +08:00
parent 356f9539af
commit f681506cea

View File

@ -8,8 +8,8 @@
// export const BASE_URL = "http://jxj.zhgdyun.com:61212" // 洁远程 // export const BASE_URL = "http://jxj.zhgdyun.com:61212" // 洁远程
// export const BASE_URL = "http://182.90.224.237:35557" // export const BASE_URL = "http://182.90.224.237:35557"
// export const BASE_URL = "http://192.168.34.155:19111" // export const BASE_URL = "http://192.168.34.155:19111"
export const BASE_URL = "http://192.168.34.221:9111" // export const BASE_URL = "http://192.168.34.221:9111"
// axios.defaults.baseURL ='http://192.168.34.221:9111/' //郭圣雄本地 // axios.defaults.baseURL ='http://192.168.34.221:9111/' //郭圣雄本地
//export const BASE_URL = "http://192.168.8.100:10000" //export const BASE_URL = "http://192.168.8.100:10000"
//export const BASE_URL = "http://106.13.16.28:10000" //export const BASE_URL = "http://106.13.16.28:10000"
@ -18,6 +18,8 @@ export const BASE_URL = "http://192.168.34.221:9111"
// export const BASE_URL = "http://42.180.188.17:9809" // 鞍钢正式环境 // export const BASE_URL = "http://42.180.188.17:9809" // 鞍钢正式环境
// export const BASE_URL = "http://42.180.188.17:19098" // 鞍钢线上测试环境 // export const BASE_URL = "http://42.180.188.17:19098" // 鞍钢线上测试环境
// export const BASE_URL = "http://jxj.zhgdyun.com:18004" // 包头线上地址 // export const BASE_URL = "http://jxj.zhgdyun.com:18004" // 包头线上地址
export const BASE_URL = "http://121.37.106.37:19999" // 新能源智慧基建管理平台线上地址
//是否已显示未登录弹窗 //是否已显示未登录弹窗
let showNoLoginTip = false let showNoLoginTip = false
@ -26,69 +28,69 @@ let showNoLoginTip = false
* @param {Object} config uni request的配置 * @param {Object} config uni request的配置
*/ */
export function request(config = {}, sl = true) { export function request(config = {}, sl = true) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (sl) { if (sl) {
uni.showLoading({ uni.showLoading({
title: '加载中...' title: '加载中...'
}) })
} }
uni.request({ uni.request({
url: BASE_URL + (config.url.startsWith("/") ? config.url : ("/" + config.url)), url: BASE_URL + (config.url.startsWith("/") ? config.url : ("/" + config.url)),
method: (config.method || 'GET').toLocaleUpperCase(), method: (config.method || 'GET').toLocaleUpperCase(),
timeout: config.timeout || 20000, timeout: config.timeout || 20000,
withCredentials: true, withCredentials: true,
header: { header: {
//大家在这里传自定义的token这里默认wflow的 //大家在这里传自定义的token这里默认wflow的
Authorization: "Bearer " + uni.getStorageSync('wflow-token'), Authorization: "Bearer " + uni.getStorageSync('wflow-token'),
TenantId: JSON.parse(uni.getStorageSync("loginUser")).sn, TenantId: JSON.parse(uni.getStorageSync("loginUser")).sn,
...config.header, ...config.header,
}, },
dataType: 'json', dataType: 'json',
data: config.data, data: config.data,
success: (res) => { success: (res) => {
if (res.statusCode === 200) { if (res.statusCode === 200) {
showNoLoginTip = false showNoLoginTip = false
resolve(res) resolve(res)
} else if (res.statusCode === 401) { } else if (res.statusCode === 401) {
if (!showNoLoginTip) { if (!showNoLoginTip) {
showNoLoginTip = true showNoLoginTip = true
// uni.showModal({ // uni.showModal({
// title: '提示', // title: '提示',
// content: '登录已失效,是否重新跳转到登录', // content: '登录已失效,是否重新跳转到登录',
// success: function(res) { // success: function(res) {
// showNoLoginTip = false // showNoLoginTip = false
// uni.removeStorageSync('loginUser') // uni.removeStorageSync('loginUser')
// if (res.confirm) { // if (res.confirm) {
// uni.navigateTo({ url: '/pages/login/login' }) // uni.navigateTo({ url: '/pages/login/login' })
// } // }
// } // }
// }); // });
} }
} else if (res.statusCode === 500) { } else if (res.statusCode === 500) {
console.log(res) console.log(res)
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: '系统异常:' + res.data title: '系统异常:' + res.data
}) })
} else { } else {
showNoLoginTip = false showNoLoginTip = false
reject({ reject({
statusCode: res.statusCode, statusCode: res.statusCode,
msg: res.data msg: res.data
}) })
} }
}, },
fail: (err) => { fail: (err) => {
console.log(err) console.log(err)
uni.showToast({ uni.showToast({
title: '网络异常,请检查网络', title: '网络异常,请检查网络',
duration: 2000, duration: 2000,
icon: 'none' icon: 'none'
}) })
}, },
complete: () => uni.hideLoading() complete: () => uni.hideLoading()
}) })
}) })
} }
export default request export default request