feat: 新增需求
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
/* process.env.NODE_ENV设置生产环境模式 */
|
||||
// #ifndef MP
|
||||
const baseURL = process.env.NODE_ENV === "production" ? "https://app.java.jnpfsoft.com" : "http://localhost:30000"
|
||||
const baseURL = process.env.NODE_ENV === "production" ? "https://app.java.jnpfsoft.com" : "http://10.28.117.48:48080"
|
||||
const webSocketUrl = process.env.NODE_ENV === "production" ? "wss://app.java.jnpfsoft.com/websocket" :
|
||||
"ws://localhost:30000/api/message/websocket"
|
||||
const report = process.env.NODE_ENV === 'production' ? 'https://java.jnpfsoft.com/Report' : 'http://localhost:8200'
|
||||
const pcURL = process.env.NODE_ENV === 'production' ? 'https://java.jnpfsoft.com' : 'http://localhost:3000'
|
||||
"ws://10.28.117.183:30000/api/message/websocket"
|
||||
const report = process.env.NODE_ENV === 'production' ? 'https://java.jnpfsoft.com/Report' : 'http://10.28.117.183:8200'
|
||||
const pcURL = process.env.NODE_ENV === 'production' ? 'https://java.jnpfsoft.com' : 'http://10.28.117.183:3000'
|
||||
// #endif
|
||||
|
||||
// #ifdef MP
|
||||
const baseURL = "http://localhost:30000"
|
||||
const webSocketUrl = "ws://localhost:30000/api/message/websocket"
|
||||
const report = 'http://localhost:8200'
|
||||
const pcURL = 'http://localhost:3000'
|
||||
const baseURL = "http://10.28.117.48:30000"
|
||||
const webSocketUrl = "ws://10.28.117.183:30000/api/message/websocket"
|
||||
const report = 'http://10.28.117.183:8200'
|
||||
const pcURL = 'http://10.28.117.183:3000'
|
||||
// #endif
|
||||
|
||||
const define = {
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
const {
|
||||
getBackLocale
|
||||
} = useLocale();
|
||||
const host = define.baseURL
|
||||
let host = define.baseURL
|
||||
const defaultOpt = {
|
||||
load: true
|
||||
}
|
||||
@@ -28,19 +28,30 @@ const defaultOpt = {
|
||||
function request(config) {
|
||||
config.options = Object.assign(defaultOpt, config.options)
|
||||
const token = uni.getStorageSync('token') || ''
|
||||
const tenantId = uni.getStorageSync('tenantId') || ''
|
||||
const systemCode = uni.getStorageSync('systemCode') || ''
|
||||
const locale = getBackLocale()
|
||||
let header = {
|
||||
"accept" : 'application/json, text/plain, */*',
|
||||
"App-Code": systemCode,
|
||||
"Content-Type": "application/json;charset=UTF-8",
|
||||
"Jnpf-Origin": "app",
|
||||
"Vue-Version": "3",
|
||||
"Accept-Language": locale,
|
||||
"tenant-id": tenantId,
|
||||
...config.header
|
||||
}
|
||||
header['App-Code'] = encodeURIComponent(header['App-Code'])
|
||||
if (token) header['Authorization'] = token
|
||||
// 测试 todo
|
||||
console.log(config.url,config.url.includes('admin-api'),'config.url.includes---')
|
||||
if(config.url.includes('admin-api')){
|
||||
host = 'http://10.28.117.48:48080'
|
||||
}else {
|
||||
host = define.baseURL
|
||||
}
|
||||
let url = config.url.indexOf('http') > -1 ? config.url : host + config.url
|
||||
|
||||
|
||||
if (config.options.load) {
|
||||
uni.showLoading({
|
||||
@@ -57,7 +68,7 @@ function request(config) {
|
||||
timeout: define.timeout,
|
||||
success: res => {
|
||||
if (res.statusCode === 200) {
|
||||
if (res.data.code == 200) {
|
||||
if (res.data.code == 200 || res.data.code == 0) {
|
||||
resolve(res.data)
|
||||
} else {
|
||||
ajaxError(res.data)
|
||||
@@ -88,7 +99,7 @@ function ajaxError(data) {
|
||||
title: data.msg || '请求出错,请重试',
|
||||
icon: 'none',
|
||||
complete() {
|
||||
if (data.code === 600 || data.code === 601 || data.code === 602) {
|
||||
if (data.code === 600 || data.code === 601 || data.code === 602 || data.code === 401) {
|
||||
setTimeout(() => {
|
||||
uni.removeStorageSync('token')
|
||||
uni.removeStorageSync('cid')
|
||||
|
||||
@@ -131,7 +131,7 @@ export const useDefineSetting = () => {
|
||||
b = Math.floor(a * parseInt(values[2]) + (1 - a) * 255);
|
||||
return '#' + ('0' + r.toString(16)).slice(-2) + ('0' + g.toString(16)).slice(-2) + ('0' + b.toString(16)).slice(-2);
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
flowStatusList,
|
||||
flowUrgentList,
|
||||
|
||||
Reference in New Issue
Block a user