From 18b8d60f6b7df2ad2ac75881668fc0891457f373 Mon Sep 17 00:00:00 2001 From: EarlySummer <785383749@qq.com> Date: Mon, 4 Nov 2024 16:29:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=B1=BB=E5=9E=8B=E5=8C=B9?= =?UTF-8?q?=E9=85=8D=E5=AF=BC=E8=87=B4=E7=9A=84run=20build=E7=9A=84?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- src/api/axios.ts | 43 ++++++------ .../Pages/ChartItemSetting/StylesSetting.vue | 2 +- .../Charts/Lines/LineGradientSingle/index.vue | 69 ++++++++++--------- .../Decorates/Mores/FlipperNumber/index.vue | 57 +++++++-------- .../Informations/Texts/TextCard/index.vue | 2 +- src/router/index.ts | 1 - .../modules/chartEditStore/chartEditStore.ts | 2 +- src/utils/utils.ts | 30 ++++---- src/views/edit/index.vue | 23 +++---- 10 files changed, 119 insertions(+), 112 deletions(-) diff --git a/package.json b/package.json index ecf03dd2..e8b8d1f0 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "@visactor/vchart": "^1.12.3", "@visactor/vchart-theme": "^1.12.1", "animate.css": "^4.1.1", - "axios": "^1.4.0", + "axios": "^1.6.8", "cesium": "1.99", "color": "^4.2.3", "crypto-js": "^4.1.1", diff --git a/src/api/axios.ts b/src/api/axios.ts index 7e74ac1a..e353d032 100644 --- a/src/api/axios.ts +++ b/src/api/axios.ts @@ -1,9 +1,9 @@ -import axios, { AxiosResponse, AxiosRequestConfig, Axios } from 'axios' +import axios, { AxiosResponse, AxiosRequestConfig, Axios,AxiosRequestHeaders,InternalAxiosRequestConfig } from 'axios' import { ResultEnum, ModuleTypeEnum } from "@/enums/httpEnum" import {PageEnum, ErrorPageNameMap, PreviewEnum} from "@/enums/pageEnum" import { StorageEnum } from '@/enums/storageEnum' import { axiosPre } from '@/settings/httpSetting' -import { SystemStoreEnum, SystemStoreUserInfoEnum } from '@/store/modules/systemStore/systemStore.d' +import { SystemStoreEnum, SystemStoreUserInfoEnum,UserInfoType } from '@/store/modules/systemStore/systemStore.d' import { redirectErrorPage, getLocalStorage, @@ -28,7 +28,9 @@ let base_url=`${import.meta.env.PROD ? import.meta.env.VITE_PRO_PATH : ''}${axio const dialog = useDialog() -export interface MyResponseType { + + +export interface MyResponseType extends AxiosResponse{ code: ResultEnum data: T message: string @@ -44,17 +46,14 @@ const axiosInstance = axios.create({ }) as unknown as MyRequestInstance axiosInstance.interceptors.request.use( - (config: AxiosRequestConfig) => { + (config:InternalAxiosRequestConfig) => { // 获取 tenantId const info = getLocalStorage(StorageEnum.GO_SYSTEM_STORE) // console.log(window.location) const tenantId = info ? info[SystemStoreEnum.TENANT_INFO]['tenantId'] : undefined - if (tenantId) { - config.headers = { - ...config.headers, - 'tenant-id': tenantId - } - } + + if (tenantId) (config as Recordable).headers['tenant-id'] = tenantId + // 白名单校验 if (includes(fetchAllowList, config.url)) return config @@ -64,11 +63,13 @@ axiosInstance.interceptors.request.use( routerTurnByName(PageEnum.BASE_LOGIN_NAME) return config } - const userInfo = info[SystemStoreEnum.USER_INFO] - config.headers = { - ...config.headers, - [userInfo[SystemStoreUserInfoEnum.TOKEN_NAME] || 'token']: 'Bearer ' + userInfo[SystemStoreUserInfoEnum.USER_TOKEN] || '' - } + const userInfo:UserInfoType = info[SystemStoreEnum.USER_INFO] as UserInfoType + + (config as Recordable).headers.Authorization = 'Bearer ' + userInfo[SystemStoreUserInfoEnum.USER_TOKEN] || '' + // config.headers = { + // ...config.headers, + // [userInfo[SystemStoreUserInfoEnum.TOKEN_NAME] || 'token']: 'Bearer ' + userInfo[SystemStoreUserInfoEnum.USER_TOKEN] || '' + // } return config }, (err: AxiosRequestConfig) => { @@ -123,12 +124,12 @@ axiosInstance.interceptors.response.use( }) //修改当前访问令牌 // config.headers!.Authorization = 'Bearer ' + (await refreshTokenRes).data.data.accessToken - const userInfo = info[SystemStoreEnum.USER_INFO] - config.headers = { - ...config.headers, - [userInfo[SystemStoreUserInfoEnum.TOKEN_NAME] || 'token']: 'Bearer ' + userInfo[SystemStoreUserInfoEnum.USER_TOKEN] || '' - } - + const userInfo:UserInfoType = info[SystemStoreEnum.USER_INFO] as UserInfoType + // config.headers = { + // ...config.headers, + // [userInfo[SystemStoreUserInfoEnum.TOKEN_NAME] || 'token']: 'Bearer ' + userInfo[SystemStoreUserInfoEnum.USER_TOKEN] || '' + // } + (config as Recordable).headers.Authorization = 'Bearer ' + userInfo[SystemStoreUserInfoEnum.USER_TOKEN] || '' requestList.forEach((cb: any) => { cb() }) diff --git a/src/components/Pages/ChartItemSetting/StylesSetting.vue b/src/components/Pages/ChartItemSetting/StylesSetting.vue index efb1d653..a226847c 100644 --- a/src/components/Pages/ChartItemSetting/StylesSetting.vue +++ b/src/components/Pages/ChartItemSetting/StylesSetting.vue @@ -182,7 +182,7 @@ const props = defineProps({ default: false }, chartStyles: { - type: Object as PropType, 'animations'>>, + type: Object as PropType, 'animations' | 'animationsOpen' | 'animationsCirculate' | 'animationsCurve' | 'animationsDirection' | 'circulatePlayTime' | 'circulateDelayTime'>>, required: true } }) diff --git a/src/packages/components/Charts/Lines/LineGradientSingle/index.vue b/src/packages/components/Charts/Lines/LineGradientSingle/index.vue index 5f9f2d6c..e638ab8d 100644 --- a/src/packages/components/Charts/Lines/LineGradientSingle/index.vue +++ b/src/packages/components/Charts/Lines/LineGradientSingle/index.vue @@ -6,6 +6,7 @@ diff --git a/src/packages/components/Decorates/Mores/FlipperNumber/index.vue b/src/packages/components/Decorates/Mores/FlipperNumber/index.vue index e5369bbe..9d9f3c8c 100644 --- a/src/packages/components/Decorates/Mores/FlipperNumber/index.vue +++ b/src/packages/components/Decorates/Mores/FlipperNumber/index.vue @@ -1,18 +1,18 @@ @@ -43,34 +43,35 @@ const { flipperRadius, flipperGap, flipperType, - flipperSpeed + flipperSpeed, + flipperBorderWidth } = toRefs(props.chartConfig.option as OptionType) const flipperData = ref([]) const getFlipperData = (val: string | number) => { return val - .toString() - .padStart(flipperLength.value, '0') // 左侧填充|右对齐 - .split('') // 转数组 - .slice(flipperLength.value * -1) // 从后面取指定长度 + .toString() + .padStart(flipperLength.value, '0') // 左侧填充|右对齐 + .split('') // 转数组 + .slice(flipperLength.value * -1) // 从后面取指定长度 } const updateDatasetHandler = (newVal: string | number) => { flipperData.value = getFlipperData(newVal) } watch( - () => props.chartConfig.option, - newVal => { - try { - updateDatasetHandler((newVal as OptionType).dataset) - } catch (error) { - console.log(error) + () => props.chartConfig.option, + newVal => { + try { + updateDatasetHandler((newVal as any as OptionType).dataset) + } catch (error) { + console.log(error) + } + }, + { + immediate: true, + deep: true } - }, - { - immediate: true, - deep: true - } ) useChartDataFetch(props.chartConfig, useChartEditStore, (newVal: string | number) => { diff --git a/src/packages/components/Informations/Texts/TextCard/index.vue b/src/packages/components/Informations/Texts/TextCard/index.vue index bd02533f..81eed183 100644 --- a/src/packages/components/Informations/Texts/TextCard/index.vue +++ b/src/packages/components/Informations/Texts/TextCard/index.vue @@ -51,7 +51,7 @@