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