Commit 5728b3e088196342c1d5d9e87f58feb4ec8613b7

Authored by sqy
2 parents ec6dd08e ee95abc1

Merge branch 'main' into sqy_dev

@@ -10,26 +10,29 @@ VITE_DROP_CONSOLE = true @@ -10,26 +10,29 @@ VITE_DROP_CONSOLE = true
10 # Whether to enable gzip or brotli compression 10 # Whether to enable gzip or brotli compression
11 # Optional: gzip | brotli | none 11 # Optional: gzip | brotli | none
12 # If you need multiple forms, you can use `,` to separate 12 # If you need multiple forms, you can use `,` to separate
13 -VITE_BUILD_COMPRESS = 'none' 13 +VITE_BUILD_COMPRESS = 'gzip'
14 14
15 # Whether to delete origin files when using compress, default false 15 # Whether to delete origin files when using compress, default false
16 VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false 16 VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE = false
17 17
18 # Basic interface address SPA 18 # Basic interface address SPA
19 -VITE_GLOB_API_URL=/api 19 +VITE_GLOB_API_URL=http://101.133.234.90:8080/api
20 20
21 # File upload address, optional 21 # File upload address, optional
22 # It can be forwarded by nginx or write the actual address directly 22 # It can be forwarded by nginx or write the actual address directly
23 -VITE_GLOB_UPLOAD_URL=/upload 23 +VITE_GLOB_UPLOAD_URL=http://101.133.234.90:3300/upload
24 24
25 # Interface prefix 25 # Interface prefix
26 -VITE_GLOB_API_URL_PREFIX=/v1 26 +VITE_GLOB_API_URL_PREFIX=/yt
27 27
28 # Whether to enable image compression 28 # Whether to enable image compression
29 -VITE_USE_IMAGEMIN= true 29 +VITE_USE_IMAGEMIN= false
30 30
31 # use pwa 31 # use pwa
32 VITE_USE_PWA = false 32 VITE_USE_PWA = false
33 33
34 # Is it compatible with older browsers 34 # Is it compatible with older browsers
35 -VITE_LEGACY = false 35 +VITE_LEGACY = true
  36 +
  37 +# 实时数据的ws地址
  38 +VITE_WEB_SOCKET = ws://101.133.234.90:8080/api/ws/plugins/telemetry?token=
@@ -10,58 +10,17 @@ import { useGlobSetting } from '/@/hooks/setting'; @@ -10,58 +10,17 @@ import { useGlobSetting } from '/@/hooks/setting';
10 import { useMessage } from '/@/hooks/web/useMessage'; 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, getAuthCache } from '/@/utils/auth'; 13 +import { getJwtToken } from '/@/utils/auth';
14 import { setObjToUrlParams, deepMerge } from '/@/utils'; 14 import { setObjToUrlParams, deepMerge } from '/@/utils';
15 import { useErrorLogStoreWithOut } from '/@/store/modules/errorLog'; 15 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(); 21 const globSetting = useGlobSetting();
56 const urlPrefix = globSetting.urlPrefix; 22 const urlPrefix = globSetting.urlPrefix;
57 const { createMessage, createErrorModal } = useMessage(); 23 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();  
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 }