Commit adc5ada63a4aa4ed1068b1052305dfb1a1fe3c41
Merge branch 'ft-dev' into 'main'
fix:修改生产环境端口问题和移除utils/http/axios无效代码 See merge request huang/yun-teng-iot-front!75
Showing
2 changed files
with
19 additions
and
96 deletions
1 | # Whether to open mock | 1 | # Whether to open mock |
2 | -VITE_USE_MOCK = false | 2 | +# VITE_USE_MOCK = true |
3 | 3 | ||
4 | # public path | 4 | # public path |
5 | VITE_PUBLIC_PATH = / | 5 | VITE_PUBLIC_PATH = / |
6 | 6 | ||
7 | -# Delete console | ||
8 | -VITE_DROP_CONSOLE = true | 7 | +# Cross-domain proxy, you can configure multiple |
8 | +# Please note that no line breaks | ||
9 | + | ||
10 | +# 本地 | ||
11 | +# VITE_PROXY = [["/api","http://192.168.10.123:8080/api"],["/upload","http://192.168.10.124:3300/upload"]] | ||
9 | 12 | ||
10 | -# Whether to enable gzip or brotli compression | ||
11 | -# Optional: gzip | brotli | none | ||
12 | -# If you need multiple forms, you can use `,` to separate | ||
13 | -VITE_BUILD_COMPRESS = 'none' | 13 | +# 线上 |
14 | +VITE_PROXY = [["/api","http://101.133.234.90:8080/api"],["/upload","http://192.168.10.116:3300/upload"]] | ||
14 | 15 | ||
15 | -# Whether to delete origin files when using compress, default false | ||
16 | -VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false | 16 | +# 实时数据的ws地址 |
17 | +VITE_WEB_SOCKET = ws://101.133.234.90:8080/api/ws/plugins/telemetry?token= | ||
18 | + | ||
19 | +# Delete console | ||
20 | +VITE_DROP_CONSOLE = true | ||
17 | 21 | ||
18 | # Basic interface address SPA | 22 | # Basic interface address SPA |
19 | VITE_GLOB_API_URL=/api | 23 | VITE_GLOB_API_URL=/api |
20 | 24 | ||
21 | # File upload address, optional | 25 | # File upload address, optional |
22 | -# It can be forwarded by nginx or write the actual address directly | ||
23 | VITE_GLOB_UPLOAD_URL=/upload | 26 | VITE_GLOB_UPLOAD_URL=/upload |
24 | 27 | ||
25 | # Interface prefix | 28 | # Interface prefix |
26 | -VITE_GLOB_API_URL_PREFIX=/v1 | ||
27 | - | ||
28 | -# Whether to enable image compression | ||
29 | -VITE_USE_IMAGEMIN= true | ||
30 | - | ||
31 | -# use pwa | ||
32 | -VITE_USE_PWA = false | ||
33 | - | ||
34 | -# Is it compatible with older browsers | ||
35 | -VITE_LEGACY = false | 29 | +VITE_GLOB_API_URL_PREFIX=/yt |
@@ -6,8 +6,8 @@ import type { RequestOptions, Result } from '/#/axios'; | @@ -6,8 +6,8 @@ import type { RequestOptions, Result } from '/#/axios'; | ||
6 | import type { AxiosTransform, CreateAxiosOptions } from './axiosTransform'; | 6 | import type { AxiosTransform, CreateAxiosOptions } from './axiosTransform'; |
7 | import { VAxios } from './Axios'; | 7 | import { VAxios } from './Axios'; |
8 | import { checkStatus } from './checkStatus'; | 8 | import { checkStatus } from './checkStatus'; |
9 | -// import { useGlobSetting } from '/@/hooks/setting'; | ||
10 | -// import { useMessage } from '/@/hooks/web/useMessage'; | 9 | +import { useGlobSetting } from '/@/hooks/setting'; |
10 | +import { useMessage } from '/@/hooks/web/useMessage'; | ||
11 | import { RequestEnum, ContentTypeEnum } from '/@/enums/httpEnum'; | 11 | import { RequestEnum, ContentTypeEnum } from '/@/enums/httpEnum'; |
12 | import { isString } from '/@/utils/is'; | 12 | import { isString } from '/@/utils/is'; |
13 | import { getJwtToken } from '/@/utils/auth'; | 13 | import { getJwtToken } from '/@/utils/auth'; |
@@ -16,52 +16,11 @@ import { useErrorLogStoreWithOut } from '/@/store/modules/errorLog'; | @@ -16,52 +16,11 @@ import { useErrorLogStoreWithOut } from '/@/store/modules/errorLog'; | ||
16 | import { useI18n } from '/@/hooks/web/useI18n'; | 16 | import { useI18n } from '/@/hooks/web/useI18n'; |
17 | import { joinTimestamp, formatRequestDate } from './helper'; | 17 | import { joinTimestamp, formatRequestDate } from './helper'; |
18 | import { PageEnum } from '/@/enums/pageEnum'; | 18 | import { PageEnum } from '/@/enums/pageEnum'; |
19 | -// import { REFRESH_TOKEN_KEY } from '/@/enums/cacheEnum'; | ||
20 | import { router } from '/@/router'; | 19 | import { router } from '/@/router'; |
21 | 20 | ||
22 | -// import { useUserStore } from '/@/store/modules/user'; | ||
23 | -// const userStore = useUserStore(); | ||
24 | -// console.log(userStore.userInfo); | ||
25 | - | ||
26 | -// YUNTENG IOT__DEVELOPMENT__2.7.1__COMMON__LOCAL__KEY__ | ||
27 | - | ||
28 | -// function timestampToTime(timestamp) { | ||
29 | -// const date = new Date(timestamp); //时间戳为10位需*1000,时间戳为13位的话不需乘1000 | ||
30 | -// const Y = date.getFullYear() + '-'; | ||
31 | -// const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'; | ||
32 | -// const D = date.getDate() + ' '; | ||
33 | -// const h = date.getHours() + ':'; | ||
34 | -// const m = date.getMinutes() + ':'; | ||
35 | -// const s = date.getSeconds(); | ||
36 | -// return Y + M + D + h + m + s; | ||
37 | -// } | ||
38 | - | ||
39 | -// function convertToDate() { | ||
40 | -// const date = new Date(); | ||
41 | -// const y = date.getFullYear(); | ||
42 | -// let m = date.getMonth() + 1; | ||
43 | -// let d = date.getDate(); | ||
44 | -// let h = date.getHours(); | ||
45 | -// let min = date.getMinutes(); | ||
46 | -// let s = date.getSeconds(); | ||
47 | -// m = m < 10 ? '0' + m : m; //月小于10,加0 | ||
48 | -// d = d < 10 ? '0' + d : d; //day小于10,加0 | ||
49 | -// h = h < 10 ? '0' + h : h; | ||
50 | -// min = min < 10 ? '0' + min : min; | ||
51 | -// s = s < 10 ? '0' + s : s; | ||
52 | -// return y + '-' + m + '-' + d + ' ' + h + ':' + min + ':' + s; | ||
53 | -// } | ||
54 | - | ||
55 | -// const globSetting = useGlobSetting(); | ||
56 | -// const urlPrefix = globSetting.urlPrefix; | ||
57 | -// const { createMessage, createErrorModal } = useMessage(); | ||
58 | -// const getJwtTokenInfo = getAuthCache(REFRESH_TOKEN_KEY); | ||
59 | -// const getExiper = window.localStorage.getItem( | ||
60 | -// 'UNDEFINED__DEVELOPMENT__2.7.1__COMMON__LOCAL__KEY__' | ||
61 | -// ); | ||
62 | -// const getExiperValue = JSON.parse(getExiper); | ||
63 | -// const expireTime = timestampToTime(getExiperValue.expire); | ||
64 | -// const nowTime = convertToDate(); | 21 | +const globSetting = useGlobSetting(); |
22 | +const urlPrefix = globSetting.urlPrefix; | ||
23 | +const { createMessage, createErrorModal } = useMessage(); | ||
65 | 24 | ||
66 | /** | 25 | /** |
67 | * @description: 数据处理,方便区分多种处理方式 | 26 | * @description: 数据处理,方便区分多种处理方式 |
@@ -166,40 +125,10 @@ const transform: AxiosTransform = { | @@ -166,40 +125,10 @@ const transform: AxiosTransform = { | ||
166 | try { | 125 | try { |
167 | console.log(response.data); | 126 | console.log(response.data); |
168 | if (response.data.status == '401' || response.data.message == '"Authentication failed"') { | 127 | if (response.data.status == '401' || response.data.message == '"Authentication failed"') { |
169 | - // window.localStorage.removeItem('UNDEFINED__DEVELOPMENT__2.7.1__COMMON__LOCAL__KEY__'); | ||
170 | - // window.localStorage.removeItem('UNDEFINED__DEVELOPMENT__2.7.1__LOCALE__'); | ||
171 | window.localStorage.clear(); | 128 | window.localStorage.clear(); |
172 | window.sessionStorage.clear(); | 129 | window.sessionStorage.clear(); |
173 | router.push(PageEnum.BASE_HOME); | 130 | router.push(PageEnum.BASE_HOME); |
174 | - // doRefresh(); | ||
175 | - | ||
176 | - // console.log(router); | ||
177 | - // router.push('/other'); | ||
178 | - // if (expireTime < nowTime) { | ||
179 | - // // console.log('过期'); | ||
180 | - // createMessage.error('token已经过期,请退回登录'); | ||
181 | - // } else { | ||
182 | - // // console.log('未过期'); | ||
183 | - // } | ||
184 | - // router.push(PageEnum.BASE_LOGIN); | ||
185 | - // if (getJwtTokenInfo) { | ||
186 | - // if (PageEnum.BASE_LOGIN) { | ||
187 | - // router.push(PageEnum.BASE_LOGIN); | ||
188 | - // } | ||
189 | - // } | ||
190 | - // router.beforeEach((to, from, next) => { | ||
191 | - // console.log(to); | ||
192 | - // if (getJwtTokenInfo) { | ||
193 | - // if (to.path !== '/login') { | ||
194 | - // // doRefresh(); | ||
195 | - // next({ path: '/adass' }); | ||
196 | - // } | ||
197 | - // } | ||
198 | - // }); | ||
199 | - } else { | ||
200 | - // doRefresh(); | ||
201 | } | 131 | } |
202 | - | ||
203 | if (code === 'ECONNABORTED' && message.indexOf('timeout') !== -1) { | 132 | if (code === 'ECONNABORTED' && message.indexOf('timeout') !== -1) { |
204 | errMessage = t('sys.api.apiTimeoutMessage'); | 133 | errMessage = t('sys.api.apiTimeoutMessage'); |
205 | } | 134 | } |