| | |
| | | import { |
| | | globalApi |
| | | } from '@/api/globalApi.js'; |
| | | import { |
| | | apiLoginPassword |
| | | } from './publicInterface'; |
| | | |
| | | // 成功 |
| | | const responseOK = (response) => { |
| | | const { |
| | | data |
| | | } = response; |
| | | test(data); |
| | | return data; |
| | | } |
| | | const test = (obj) => { |
| | | if (obj instanceof Array) { |
| | | obj.forEach(e => { |
| | | test(e); |
| | | }) |
| | | } else if (obj instanceof Object) { |
| | | for (let key in obj) { |
| | | if (obj[key] == null) { |
| | | obj[key] = ""; |
| | | } else { |
| | | if (obj[key] instanceof Array || obj[key] instanceof Object) { |
| | | test(obj[key]) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | // 响应失败的依赖性 |
| | |
| | | 500: responseError |
| | | } |
| | | |
| | | // const BaseUrl = "http://192.168.0.120:9997" |
| | | // const webSocketUrl = "ws://192.168.0.120:9997/wrzs/ws/info" |
| | | const BaseUrl = "http://192.168.31.14:9997" |
| | | const webSocketUrl = "ws://192.168.31.14:9997/wrzs/ws/info" |
| | | |
| | | // const BaseUrl = "http://192.168.3.119:9997"; |
| | | // const BaseUrl = "http://192.168.0.144:9997"; |
| | | const BaseUrl = "http://hesuancj.cn:9997"; |
| | | // 线上 |
| | | // const BaseUrl = "https://hesuancj.cn:9095"; |
| | | // const BaseUrl = "http://localhost:9997"; |
| | | // const webSocketUrl = "ws://localhost:9997/wrzs/ws/info" |
| | | export const onlineurl = "https://mx.jzeg.cn:9096"; |
| | | // const BaseUrl = "http://192.168.0.100:9997"; |
| | | // const webSocketUrl = "ws://192.168.0.100:9997/wrzs/ws/info" |
| | | |
| | | // const webSocketUrl = "ws://hesuancj.cn:9095/wrzs/ws/info" |
| | | const webSocketUrl = "ws://hesuancj.cn:9997/wrzs/ws/info" |
| | | // const BaseUrl = "http://192.168.0.108:9997"; |
| | | // const webSocketUrl = "ws://192.168.0.108:9997/wrzs/ws/info" |
| | | // 线上生产 |
| | | // const BaseUrl = "https://mx.jzeg.cn:9096"; |
| | | // const webSocketUrl = "wss://mx.jzeg.cn:9096/wrzs/ws/info" |
| | | |
| | | |
| | | // 请求拦截 |
| | | const fetch = (url, opt) => { |
| | | // 查找对应地址 |
| | |
| | | return new Promise((resolve, reject) => { |
| | | |
| | | let options = {} |
| | | if (opt.data) { |
| | | Object.keys(opt.data).map(key => { |
| | | if (opt.data[key] == '' || opt.data[key] == "") { |
| | | opt.data[key] = null; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | Object.keys(opt).map(key => { |
| | | if (key !== "params") { |
| | | |
| | | return options[key] = opt[key] |
| | | } |
| | | }) |
| | |
| | | fetch, |
| | | BaseUrl, |
| | | webSocketUrl |
| | | } |
| | | } |