diff --git a/proxyConfig.ts b/proxyConfig.ts new file mode 100644 index 00000000..31a0e6df --- /dev/null +++ b/proxyConfig.ts @@ -0,0 +1,52 @@ +import { loadEnv } from 'vite' +// 这里是开发环境的代理配置 +const devProxy = (mode:any) => { + return { + // 开发 + '/dcim': { + // @ts-ignore + target: loadEnv(mode, process.cwd()).VITE_DEV_PATH, + changeOrigin: true, + ws: true, + secure: true, + }, + // 开发首页缩略图 + '/data/file': { + // @ts-ignore + target: loadEnv(mode, process.cwd()).VITE_DEV_PATH, + changeOrigin: true, + ws: true, + secure: true, + }, + // 开发 图片 + '/svgConfig/customLargeScreen': { + // @ts-ignore + target: loadEnv(mode, process.cwd()).VITE_DEV_PATH, + changeOrigin: true, + // rewrite: (path) => path.replace(new RegExp(`^/svgConfig/customLargeScreen`), ''), + ws: true, + secure: true, + }, + }; +} + +// 这里是生产环境的代理配置 +const prodProxy = (mode:any) => { + return { + // 生产list页缩略图 开发时注释掉 + '/svgConfig/customLargeScreen/data/file': { + // @ts-ignore + target: loadEnv(mode, process.cwd()).VITE_DEV_PATH, + changeOrigin: true, + rewrite: (path:any) => { + console.log(path.replace(new RegExp(`^/svgConfig/customLargeScreen/data/file`), '/data/file')) + return path.replace(new RegExp(`^/svgConfig/customLargeScreen/data/file`), '/data/file') + }, + ws: true, + secure: true, + }, + } +} + +// 根据环境变量导出相应的配置 +export const proxyConfig = process.env.NODE_ENV === 'production' ? prodProxy : devProxy; diff --git a/src/App.vue b/src/App.vue index f0a3bbca..04025bcf 100644 --- a/src/App.vue +++ b/src/App.vue @@ -19,6 +19,27 @@ import { GoAppProvider } from '@/components/GoAppProvider' import { I18n } from '@/components/I18n' import { useSystemInit, useDarkThemeHook, useThemeOverridesHook, useCode, useLang } from '@/hooks' import { getToken } from '@/api/path' +import { onMounted, onUnmounted } from 'vue' +import { useRouterStore } from '@/store/modules/routerStore/routerStore' + +const routerStore = useRouterStore() +let handleMessage = function(event:{data:string}) { + const {data}:{data:any} = event + if(data.page === 'customLargeScreen' && data.type === 'setCallByParent') { + routerStore.setCallByParent(data.callByParent) + } +} +onMounted(() => { + window.addEventListener('message', handleMessage); + let obj = { + page: 'customLargeScreen', + type: 'bindPostMessageEvent' + } + window.parent.postMessage(JSON.stringify(obj), '*'); +}) +onUnmounted(() => { + window.removeEventListener('message', handleMessage); +}) getToken() diff --git a/src/components/Pages/ChartItemSetting/StylesSetting.vue b/src/components/Pages/ChartItemSetting/StylesSetting.vue index 5aaa118a..9906fef9 100644 --- a/src/components/Pages/ChartItemSetting/StylesSetting.vue +++ b/src/components/Pages/ChartItemSetting/StylesSetting.vue @@ -219,7 +219,7 @@ const presetImageList = ref([] as presetImageData[]) for (let i = 1; i <= 12; i++) { presetImageList.value.push({ index: i, - // src: logoImg, + src: '', hueRotate: i * 30 }) } diff --git a/src/packages/components/CustomComponents/CustomComponents/ComprehensivePUE/config.ts b/src/packages/components/CustomComponents/CustomComponents/ComprehensivePUE/config.ts index 2bf35369..adc4a800 100644 --- a/src/packages/components/CustomComponents/CustomComponents/ComprehensivePUE/config.ts +++ b/src/packages/components/CustomComponents/CustomComponents/ComprehensivePUE/config.ts @@ -2,11 +2,11 @@ import { PublicConfigClass } from '@/packages/public' import { CreateComponentType } from '@/packages/index.d' import { ComprehensivePUEConfig } from './index' import cloneDeep from 'lodash/cloneDeep' -import logo from '@/assets/logo.png' +// import logo from '@/assets/logo.png' export const option = { // 图片路径 - dataset: logo, + dataset: '', // 适应方式 fit: 'contain', // 圆角 diff --git a/src/packages/components/CustomComponents/CustomComponents/DeviceAlarmOverview/config.ts b/src/packages/components/CustomComponents/CustomComponents/DeviceAlarmOverview/config.ts index d375dc11..cbf392b6 100644 --- a/src/packages/components/CustomComponents/CustomComponents/DeviceAlarmOverview/config.ts +++ b/src/packages/components/CustomComponents/CustomComponents/DeviceAlarmOverview/config.ts @@ -2,11 +2,11 @@ import { PublicConfigClass } from '@/packages/public' import { CreateComponentType } from '@/packages/index.d' import { DeviceAlarmOverviewConfig } from './index' import cloneDeep from 'lodash/cloneDeep' -import logo from '@/assets/logo.png' +// import logo from '@/assets/logo.png' export const option = { // 图片路径 - dataset: logo, + dataset: '', // 适应方式 fit: 'contain', // 圆角 diff --git a/src/packages/components/CustomComponents/CustomComponents/RealTimeTraffic/config.ts b/src/packages/components/CustomComponents/CustomComponents/RealTimeTraffic/config.ts index a38658c2..3219dad7 100644 --- a/src/packages/components/CustomComponents/CustomComponents/RealTimeTraffic/config.ts +++ b/src/packages/components/CustomComponents/CustomComponents/RealTimeTraffic/config.ts @@ -2,11 +2,11 @@ import { PublicConfigClass } from '@/packages/public' import { CreateComponentType } from '@/packages/index.d' import { RealTimeTrafficConfig } from './index' import cloneDeep from 'lodash/cloneDeep' -import logo from '@/assets/logo.png' +// import logo from '@/assets/logo.png' export const option = { // 图片路径 - dataset: logo, + dataset: '', // 适应方式 fit: 'contain', // 圆角 diff --git a/src/packages/components/CustomComponents/CustomComponents/Theme1/config.ts b/src/packages/components/CustomComponents/CustomComponents/Theme1/config.ts index be2fccb1..4c97f0df 100644 --- a/src/packages/components/CustomComponents/CustomComponents/Theme1/config.ts +++ b/src/packages/components/CustomComponents/CustomComponents/Theme1/config.ts @@ -2,11 +2,11 @@ import { PublicConfigClass } from '@/packages/public' import { CreateComponentType } from '@/packages/index.d' import { Theme1Config } from './index' import cloneDeep from 'lodash/cloneDeep' -import bakground from '@/assets/customComponents/theme1/backgrond.jpg' +import background from '@/assets/customComponents/theme1/backgrond.jpg' export const option = { // 图片路径 - dataset: bakground, + dataset: background, // 适应方式 fit: 'contain', // 圆角 diff --git a/src/packages/components/CustomComponents/CustomComponents/Theme1/index.vue b/src/packages/components/CustomComponents/CustomComponents/Theme1/index.vue index 49d629c8..0d5826b7 100644 --- a/src/packages/components/CustomComponents/CustomComponents/Theme1/index.vue +++ b/src/packages/components/CustomComponents/CustomComponents/Theme1/index.vue @@ -120,13 +120,12 @@ const props = defineProps({ props.chartConfig.attr.w = 1920 props.chartConfig.attr.h = 1080 Object.assign(props.chartConfig.attr, {w: 1920, h: 1080, x: 0, y: 0}) -console.log(props.chartConfig) const { w, h } = toRefs(props.chartConfig.attr) const { dataset, fit, borderRadius } = toRefs(props.chartConfig.option) let date = ref(moment().format('yyyy-MM-DD')) -const weeks = ['周一', '周二', '周三', '周四', '周五', '周六', '周天'] +const weeks = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'] let time = ref(moment().format('HH:mm:ss ') + weeks[Number(moment().format('e'))]) let timer: unknown onMounted(() => { @@ -169,8 +168,13 @@ const getStyle = (radius: number) => { // 编辑更新 watch( () => props.chartConfig.option.dataset, - (newData: any) => { - option.dataset = newData + async (newData: any) => { + try { + const img = await import(newData); + option.dataset = img.default + } catch(e) { + console.log(e) + } }, { immediate: true @@ -178,8 +182,13 @@ watch( ) // 预览更新 -useChartDataFetch(props.chartConfig, useChartEditStore, (newData: any) => { - option.dataset = newData +useChartDataFetch(props.chartConfig, useChartEditStore, async (newData: any) => { + try { + const img = await import(newData); + option.dataset = img.default + } catch(e) { + console.log(e) + } }) diff --git a/src/packages/components/Informations/Mores/Image/config.ts b/src/packages/components/Informations/Mores/Image/config.ts index 80be43c0..05bd9e43 100644 --- a/src/packages/components/Informations/Mores/Image/config.ts +++ b/src/packages/components/Informations/Mores/Image/config.ts @@ -2,11 +2,11 @@ import { PublicConfigClass } from '@/packages/public' import { CreateComponentType } from '@/packages/index.d' import { ImageConfig } from './index' import cloneDeep from 'lodash/cloneDeep' -import logo from '@/assets/logo.png' +// import logo from '@/assets/logo.png' export const option = { // 图片路径 - dataset: logo, + dataset: '', // 适应方式 fit: 'contain', // 圆角 diff --git a/src/store/modules/packagesStore/packagesStore.ts b/src/store/modules/packagesStore/packagesStore.ts index f765ae71..a3a17b7a 100644 --- a/src/store/modules/packagesStore/packagesStore.ts +++ b/src/store/modules/packagesStore/packagesStore.ts @@ -18,15 +18,15 @@ export const usePackagesStore = defineStore({ }, actions: { addPhotos(newPhoto: ConfigType, index: number) { - this.newPhoto = newPhoto - this.packagesList.Photos.splice(index, 0, newPhoto) + // this.newPhoto = newPhoto + // this.packagesList.Photos.splice(index, 0, newPhoto) }, deletePhotos(photoInfo: ConfigType, index: number) { - this.packagesList.Photos.splice(index, 1) - const StoreKey = StorageEnum.GO_USER_MEDIA_PHOTOS - const userPhotosList = getLocalStorage(StoreKey) - userPhotosList.splice(index - 1, 1) - setLocalStorage(StoreKey, userPhotosList) + // this.packagesList.Photos.splice(index, 1) + // const StoreKey = StorageEnum.GO_USER_MEDIA_PHOTOS + // const userPhotosList = getLocalStorage(StoreKey) + // userPhotosList.splice(index - 1, 1) + // setLocalStorage(StoreKey, userPhotosList) } } }) diff --git a/src/store/modules/routerStore/routerStore.ts b/src/store/modules/routerStore/routerStore.ts new file mode 100644 index 00000000..15186518 --- /dev/null +++ b/src/store/modules/routerStore/routerStore.ts @@ -0,0 +1,19 @@ +import { defineStore } from 'pinia' + +export const useRouterStore = defineStore({ + id: 'useRouterStore', + state: () => ({ + // 为true是router交给parent调用自身不跳转 为false使用自身路由 + callByParent: false, + }), + getters: { + getCallByParent():boolean { + return this.callByParent + } + }, + actions: { + setCallByParent(callByParent: boolean) { + this.callByParent = callByParent + } + } +}) diff --git a/src/utils/router.ts b/src/utils/router.ts index 53ab7fc2..097a77c5 100644 --- a/src/utils/router.ts +++ b/src/utils/router.ts @@ -7,6 +7,8 @@ import { StorageEnum } from '@/enums/storageEnum' import { clearLocalStorage, getLocalStorage, clearCookie } from './storage' import router from '@/router' import { logoutApi } from '@/api/path' +import { useRouterStore } from '@/store/modules/routerStore/routerStore' +import { onMounted } from 'vue' /** * * 根据名字跳转路由 @@ -69,7 +71,8 @@ export const routerTurnByPath = ( if (query?.length) { fullPath = `${path}/${query.join('/')}` } - if (isCallByParent) { + const routerStore:any = useRouterStore() + if (routerStore && routerStore.getCallByParent) { // 获取父页面的 window 对象 var parentWindow = window.parent; const message = { diff --git a/src/views/chart/ContentConfigurations/components/ChartEvent/index.vue b/src/views/chart/ContentConfigurations/components/ChartEvent/index.vue index d0387481..9e7f116c 100644 --- a/src/views/chart/ContentConfigurations/components/ChartEvent/index.vue +++ b/src/views/chart/ContentConfigurations/components/ChartEvent/index.vue @@ -1,6 +1,6 @@