Commit 747d728a34f813a5916f6551eaab7f8d450288e7
Merge branch 'ft-dev' into 'main'
fix:解决expire,为undefined问题 See merge request huang/yun-teng-iot-front!74
Showing
1 changed file
with
39 additions
and
39 deletions
| ... | ... | @@ -6,17 +6,17 @@ import type { RequestOptions, Result } from '/#/axios'; |
| 6 | 6 | import type { AxiosTransform, CreateAxiosOptions } from './axiosTransform'; |
| 7 | 7 | import { VAxios } from './Axios'; |
| 8 | 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 | 11 | import { RequestEnum, ContentTypeEnum } from '/@/enums/httpEnum'; |
| 12 | 12 | import { isString } from '/@/utils/is'; |
| 13 | -import { getJwtToken, getAuthCache } from '/@/utils/auth'; | |
| 13 | +import { getJwtToken } from '/@/utils/auth'; | |
| 14 | 14 | import { setObjToUrlParams, deepMerge } from '/@/utils'; |
| 15 | 15 | import { useErrorLogStoreWithOut } from '/@/store/modules/errorLog'; |
| 16 | 16 | import { useI18n } from '/@/hooks/web/useI18n'; |
| 17 | 17 | import { joinTimestamp, formatRequestDate } from './helper'; |
| 18 | 18 | import { PageEnum } from '/@/enums/pageEnum'; |
| 19 | -import { REFRESH_TOKEN_KEY } from '/@/enums/cacheEnum'; | |
| 19 | +// import { REFRESH_TOKEN_KEY } from '/@/enums/cacheEnum'; | |
| 20 | 20 | import { router } from '/@/router'; |
| 21 | 21 | |
| 22 | 22 | // import { useUserStore } from '/@/store/modules/user'; |
| ... | ... | @@ -25,43 +25,43 @@ import { router } from '/@/router'; |
| 25 | 25 | |
| 26 | 26 | // YUNTENG IOT__DEVELOPMENT__2.7.1__COMMON__LOCAL__KEY__ |
| 27 | 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 | -} | |
| 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 | 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 | -} | |
| 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 | 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(); | |
| 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(); | |
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | 67 | * @description: 数据处理,方便区分多种处理方式 | ... | ... |