Showing
3 changed files
with
22 additions
and
8 deletions
| @@ -2,15 +2,17 @@ import { | @@ -2,15 +2,17 @@ import { | ||
| 2 | getTabbarHeight | 2 | getTabbarHeight |
| 3 | } from '@/plugins/utils'; | 3 | } from '@/plugins/utils'; |
| 4 | let baseUrl = ""; | 4 | let baseUrl = ""; |
| 5 | +let baseDrawioUrl = "" | ||
| 5 | if (process.env.NODE_ENV === 'development') { | 6 | if (process.env.NODE_ENV === 'development') { |
| 6 | // 开发环境 | 7 | // 开发环境 |
| 7 | // baseUrl = 'http://192.168.10.115:8080/api' | 8 | // baseUrl = 'http://192.168.10.115:8080/api' |
| 8 | baseUrl = 'https://dev.thingskit.com/api' | 9 | baseUrl = 'https://dev.thingskit.com/api' |
| 9 | - | 10 | + baseDrawioUrl = 'https://dev.thingskit.com/thingskit-drawio' |
| 10 | } else if (process.env.NODE_ENV === 'production') { | 11 | } else if (process.env.NODE_ENV === 'production') { |
| 11 | // 生产环境 | 12 | // 生产环境 |
| 12 | // baseUrl = 'http://47.99.141.212:8080/api' | 13 | // baseUrl = 'http://47.99.141.212:8080/api' |
| 13 | baseUrl = 'https://dev.thingskit.com/api' | 14 | baseUrl = 'https://dev.thingskit.com/api' |
| 15 | + baseDrawioUrl = 'https://dev.thingskit.com/thingskit-drawio' | ||
| 14 | } | 16 | } |
| 15 | 17 | ||
| 16 | let systemInfo = { | 18 | let systemInfo = { |
| @@ -41,6 +43,7 @@ console.log(systemInfo, 'systemInfo') | @@ -41,6 +43,7 @@ console.log(systemInfo, 'systemInfo') | ||
| 41 | const courtConfig = { | 43 | const courtConfig = { |
| 42 | publicAppId: '', //公众号appId | 44 | publicAppId: '', //公众号appId |
| 43 | baseUrl: baseUrl, //域名 | 45 | baseUrl: baseUrl, //域名 |
| 46 | + baseDrawioUrl: baseDrawioUrl, | ||
| 44 | systemInfo: systemInfo, //系统信息 | 47 | systemInfo: systemInfo, //系统信息 |
| 45 | mapData: { | 48 | mapData: { |
| 46 | key: '', //地图key | 49 | key: '', //地图key |
| @@ -14,7 +14,10 @@ uni.$u.http.setConfig((config) => { | @@ -14,7 +14,10 @@ uni.$u.http.setConfig((config) => { | ||
| 14 | window.sessionStorage.getItem("userInfo").isToken; | 14 | window.sessionStorage.getItem("userInfo").isToken; |
| 15 | // #endif | 15 | // #endif |
| 16 | /* config 为默认全局配置*/ | 16 | /* config 为默认全局配置*/ |
| 17 | - config.baseURL = base.baseUrl; /* 根域名 */ | 17 | + // const getConfiguration = uni.getStorageSync('getConfiguration').isConfiguration |
| 18 | + // console.log('getConfiguration', getConfiguration); | ||
| 19 | + // config.baseURL = getConfiguration == true ? base.baseDrawioUrl : base.baseUrl /* 根域名 */ | ||
| 20 | + config.baseURL = base.baseUrl /* 根域名 */ | ||
| 18 | config.header = { | 21 | config.header = { |
| 19 | "Content-Type": "application/json", | 22 | "Content-Type": "application/json", |
| 20 | 'X-Authorization': "Bearer " + token, | 23 | 'X-Authorization': "Bearer " + token, |
| @@ -39,17 +42,23 @@ uni.$u.http.interceptors.request.use( | @@ -39,17 +42,23 @@ uni.$u.http.interceptors.request.use( | ||
| 39 | // 初始化请求拦截器时,会执行此方法,此时data为undefined,赋予默认{} | 42 | // 初始化请求拦截器时,会执行此方法,此时data为undefined,赋予默认{} |
| 40 | config.data = config.data || {}; | 43 | config.data = config.data || {}; |
| 41 | // 根据custom参数中配置的是否需要token,添加对应的请求头 | 44 | // 根据custom参数中配置的是否需要token,添加对应的请求头 |
| 45 | + const getConfiguration = uni.getStorageSync('getConfiguration').isConfiguration | ||
| 42 | if (config?.custom?.auth) { | 46 | if (config?.custom?.auth) { |
| 43 | config.header['X-Authorization'] = | 47 | config.header['X-Authorization'] = |
| 44 | "Bearer " + store.state.userInfo.isToken || | 48 | "Bearer " + store.state.userInfo.isToken || |
| 45 | uni.getStorageSync("userInfo").isToken || | 49 | uni.getStorageSync("userInfo").isToken || |
| 46 | undefined; | 50 | undefined; |
| 51 | + config.baseURL = getConfiguration == true ? base.baseDrawioUrl : base.baseUrl | ||
| 47 | } | 52 | } |
| 48 | if (config?.custom?.load) { | 53 | if (config?.custom?.load) { |
| 49 | //打开加载动画 | 54 | //打开加载动画 |
| 50 | store.commit("setLoadingShow", true); | 55 | store.commit("setLoadingShow", true); |
| 51 | } | 56 | } |
| 52 | - | 57 | + if (getConfiguration) { |
| 58 | + uni.setStorageSync('config', config) | ||
| 59 | + } else { | ||
| 60 | + uni.removeStorageSync('config') | ||
| 61 | + } | ||
| 53 | return config; | 62 | return config; |
| 54 | }, | 63 | }, |
| 55 | (config) => { | 64 | (config) => { |
| @@ -121,6 +121,10 @@ export default { | @@ -121,6 +121,10 @@ export default { | ||
| 121 | // 隐藏原生的tabbar | 121 | // 隐藏原生的tabbar |
| 122 | uni.hideTabBar(); | 122 | uni.hideTabBar(); |
| 123 | this.getDeviceTotalData(); | 123 | this.getDeviceTotalData(); |
| 124 | + uni.setStorageSync('getConfiguration', { | ||
| 125 | + isConfiguration: false | ||
| 126 | + }); | ||
| 127 | + uni.removeStorageSync('getConfiguration'); | ||
| 124 | }, | 128 | }, |
| 125 | methods: { | 129 | methods: { |
| 126 | ...mapActions(['updateBadgeTotal']), | 130 | ...mapActions(['updateBadgeTotal']), |
| @@ -145,13 +149,11 @@ export default { | @@ -145,13 +149,11 @@ export default { | ||
| 145 | uni.navigateTo({ | 149 | uni.navigateTo({ |
| 146 | url: 'camera/camera' | 150 | url: 'camera/camera' |
| 147 | }); | 151 | }); |
| 148 | - // this.showToastWip() | ||
| 149 | }, | 152 | }, |
| 150 | openOrgStatus() { | 153 | openOrgStatus() { |
| 151 | - // uni.navigateTo({ | ||
| 152 | - // url: 'configuration/configuration' | ||
| 153 | - // }); | ||
| 154 | - this.showToastWip(); | 154 | + uni.navigateTo({ |
| 155 | + url: 'configuration/configuration' | ||
| 156 | + }); | ||
| 155 | }, | 157 | }, |
| 156 | //告警状态查询 | 158 | //告警状态查询 |
| 157 | navigatorAlarmStatus(e) { | 159 | navigatorAlarmStatus(e) { |