diff --git a/src/api/axios.ts b/src/api/axios.ts index 0786045..0975a4a 100644 --- a/src/api/axios.ts +++ b/src/api/axios.ts @@ -4,7 +4,7 @@ import { ErrorPageNameMap } from "@/enums/pageEnum" import { redirectErrorPage } from '@/utils' const axiosInstance = axios.create({ - baseURL: import.meta.env.DEV ? import.meta.env.VITE_DEV_PATH : import.meta.env.VITE_PRO_PATH, + baseURL: import.meta.env.VITE_GLOB_API_URL, timeout: ResultEnum.TIMEOUT, }) diff --git a/src/components/Pages/ChartGlobImage/index.vue b/src/components/Pages/ChartGlobImage/index.vue index efd6bf4..daa2042 100644 --- a/src/components/Pages/ChartGlobImage/index.vue +++ b/src/components/Pages/ChartGlobImage/index.vue @@ -3,29 +3,29 @@ diff --git a/src/hooks/eventHandler.hook.ts b/src/hooks/eventHandler.hook.ts index 0c44e6a..dd3704f 100644 --- a/src/hooks/eventHandler.hook.ts +++ b/src/hooks/eventHandler.hook.ts @@ -2,14 +2,28 @@ import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore import { mapFun } from '@/hooks/ceshiFun.hook'; import { router } from '@/router'; import { previewUrl } from '@/utils'; +import { EventBus } from '@/utils/eventBus'; const chartEditStore = useChartEditStore(); const ceshiFunction = mapFun(); // 交互事件 -export const eventHandlerHook = (comonentList: any, elementList: any, params: any = null) => { +export const eventHandlerHook = ( + comonentList: any, + interactConfigEvents: any, + type: string, + params: any = null, +) => { let obj: any = {}; let index = 0; + const elementList: any = []; + for (let i = 0; i < interactConfigEvents.length; i++) { + if (interactConfigEvents[i].type == type) { + for (let j = 0; j < interactConfigEvents[i].movementList.length; j++) { + elementList.push(interactConfigEvents[i].movementList[j]); + } + } + } for (let i = 0; i < comonentList.length; i++) { for (let j = 0; j < elementList.length; j++) { if (elementList[j].movement == 'newaddress') { @@ -77,6 +91,13 @@ export const eventHandlerHook = (comonentList: any, elementList: any, params: an } } } + } else if (elementList[j].movement == 'communication') { + // 组件通信 + for (let k = 0; k < elementList[j].elementId.length; k++) { + if (comonentList[i].id == elementList[j].elementId[k]) { + EventBus.emit(elementList[j].elementId[k] + type, params); + } + } } } } diff --git a/src/packages/components/Icons/Default/Icon/index.vue b/src/packages/components/Icons/Default/Icon/index.vue index cb6dc7f..deea59f 100644 --- a/src/packages/components/Icons/Default/Icon/index.vue +++ b/src/packages/components/Icons/Default/Icon/index.vue @@ -30,56 +30,46 @@ }); const { w, h } = toRefs(props.chartConfig.attr); const { dataset, color, size, rotate } = toRefs(props.chartConfig.option); - // 单击交互 - const clickElementItem = ref([]); - // 双击交互 - const dbclickElementItem = ref([]); - // 右击交互 - const rightclickElementItem = ref([]); - // 鼠标移入交互 - const mouseenterElementItem = ref([]); - // 鼠标移出交互 - const mouseleaveElementItem = ref([]); - const list = props.chartConfig.events.interactConfigEvents; - for (let i = 0; i < list.length; i++) { - if (list[i].type == 'click') { - for (let j = 0; j < list[i].movementList.length; j++) { - clickElementItem.value.push(list[i].movementList[j]); - } - } else if (list[i].type == 'dblclick') { - for (let j = 0; j < list[i].movementList.length; j++) { - dbclickElementItem.value.push(list[i].movementList[j]); - } - } else if (list[i].type == 'rightclick') { - for (let j = 0; j < list[i].movementList.length; j++) { - rightclickElementItem.value.push(list[i].movementList[j]); - } - } else if (list[i].type == 'mousein') { - for (let j = 0; j < list[i].movementList.length; j++) { - mouseenterElementItem.value.push(list[i].movementList[j]); - } - } else if (list[i].type == 'mouseout') { - for (let j = 0; j < list[i].movementList.length; j++) { - mouseleaveElementItem.value.push(list[i].movementList[j]); - } - } - } - const clickBtn = () => { - eventHandlerHook(chartEditStore.getComponentList, clickElementItem.value); + const clickBtn = (val) => { + eventHandlerHook( + chartEditStore.getComponentList, + props.chartConfig.events.interactConfigEvents, + 'click', + val, + ); }; - const dblclickBtn = () => { - eventHandlerHook(chartEditStore.getComponentList, dbclickElementItem.value); + const dblclickBtn = (val) => { + eventHandlerHook( + chartEditStore.getComponentList, + props.chartConfig.events.interactConfigEvents, + 'dblclick', + val, + ); }; const rightclickBtn = (event) => { event.preventDefault(); // 阻止默认的右键菜单 - eventHandlerHook(chartEditStore.getComponentList, rightclickElementItem.value); + eventHandlerHook( + chartEditStore.getComponentList, + props.chartConfig.events.interactConfigEvents, + 'rightclick', + ); }; - const mouseenterBtn = () => { - eventHandlerHook(chartEditStore.getComponentList, mouseenterElementItem.value); + const mouseenterBtn = (val) => { + eventHandlerHook( + chartEditStore.getComponentList, + props.chartConfig.events.interactConfigEvents, + 'mousein', + val, + ); }; - const mouseleaveBtn = () => { - eventHandlerHook(chartEditStore.getComponentList, mouseleaveElementItem.value); + const mouseleaveBtn = (val) => { + eventHandlerHook( + chartEditStore.getComponentList, + props.chartConfig.events.interactConfigEvents, + 'mouseout', + val, + ); }; diff --git a/src/packages/components/Zhigan/Zhigan/LowerLeft/config.ts b/src/packages/components/Zhigan/Zhigan/LowerLeft/config.ts index 159d661..d35ccc1 100644 --- a/src/packages/components/Zhigan/Zhigan/LowerLeft/config.ts +++ b/src/packages/components/Zhigan/Zhigan/LowerLeft/config.ts @@ -17,12 +17,6 @@ export const option = { largeColor1: '#007343', largeColor2: '#89E5A1', }, - dataStyleClone:{ - smallColor1: '#00D586', - smallColor2: '#00AB4E', - largeColor1: '#007343', - largeColor2: '#89E5A1', - } } export default class Config extends PublicConfigClass implements CreateComponentType { diff --git a/src/packages/components/Zhigan/Zhigan/LowerLeft/config.vue b/src/packages/components/Zhigan/Zhigan/LowerLeft/config.vue index 7c1a172..496fa0e 100644 --- a/src/packages/components/Zhigan/Zhigan/LowerLeft/config.vue +++ b/src/packages/components/Zhigan/Zhigan/LowerLeft/config.vue @@ -50,7 +50,7 @@ 恢复默认 @@ -65,7 +65,7 @@ 恢复默认 @@ -80,7 +80,7 @@ 恢复默认 @@ -95,7 +95,7 @@ 恢复默认 @@ -116,4 +116,11 @@ required: true, }, }); + + const dataStyleClone = { + smallColor1: '#00D586', + smallColor2: '#00AB4E', + largeColor1: '#007343', + largeColor2: '#89E5A1', + }; diff --git a/src/packages/components/Zhigan/Zhigan/ModalCarousel/config.ts b/src/packages/components/Zhigan/Zhigan/ModalCarousel/config.ts index 12d2821..c5e0524 100644 --- a/src/packages/components/Zhigan/Zhigan/ModalCarousel/config.ts +++ b/src/packages/components/Zhigan/Zhigan/ModalCarousel/config.ts @@ -11,32 +11,6 @@ export const option = { 'https://naive-ui.oss-cn-beijing.aliyuncs.com/carousel-img/carousel2.jpeg', 'https://naive-ui.oss-cn-beijing.aliyuncs.com/carousel-img/carousel3.jpeg', ], - buttonStyle:{ - dotBottom: 5, - dotLeft: 37, - dotColor1: '#00611a', - dotColor2: '#00cc13', - - buttonWidth: 20, - buttonHeight: 60, - - buttonBottom: 37, - buttonLeftAndRight: 0, - buttonColor: '#A4A4A4FF', - - iconFontSize: 20, - iconColor: '#1EC233', - - borderWidth: 2, - borderColor: '#008000', - }, - buttonStyleClone:{ - dotColor1: '#00611a', - dotColor2: '#00cc13', - buttonColor: '#A4A4A4FF', - iconColor: '#1EC233', - borderColor: '#008000', - }, dataStyle: { // 自动播放 autoplay: true, @@ -60,6 +34,24 @@ export const option = { showArrow: true, // 图片样式 fit: "contain", + + dotBottom: 5, + dotLeft: 37, + dotColor1: '#00611a', + dotColor2: '#00cc13', + + buttonWidth: 20, + buttonHeight: 60, + + buttonBottom: 37, + buttonLeftAndRight: 0, + buttonColor: '#A4A4A4FF', + + iconFontSize: 20, + iconColor: '#1EC233', + + borderWidth: 2, + borderColor: '#008000', } } diff --git a/src/packages/components/Zhigan/Zhigan/ModalCarousel/config.vue b/src/packages/components/Zhigan/Zhigan/ModalCarousel/config.vue index 1d51156..7c22a53 100644 --- a/src/packages/components/Zhigan/Zhigan/ModalCarousel/config.vue +++ b/src/packages/components/Zhigan/Zhigan/ModalCarousel/config.vue @@ -89,12 +89,12 @@ - + - + @@ -102,14 +102,11 @@ - + 恢复默认 @@ -117,14 +114,11 @@ - + 恢复默认 @@ -132,26 +126,26 @@ - + @@ -162,13 +156,13 @@ 恢复默认 @@ -177,20 +171,17 @@ - + 恢复默认 @@ -202,20 +193,20 @@ 恢复默认 @@ -237,6 +228,14 @@ }, }); + const dataStyleClone = { + dotColor1: '#00611a', + dotColor2: '#00cc13', + buttonColor: '#A4A4A4FF', + iconColor: '#1EC233', + borderColor: '#008000', + }; + // 字典 const dotTypes = [ { diff --git a/src/packages/components/Zhigan/Zhigan/ModalCarousel/index.vue b/src/packages/components/Zhigan/Zhigan/ModalCarousel/index.vue index 5cc5cf8..da4d728 100644 --- a/src/packages/components/Zhigan/Zhigan/ModalCarousel/index.vue +++ b/src/packages/components/Zhigan/Zhigan/ModalCarousel/index.vue @@ -27,20 +27,20 @@
@@ -48,20 +48,20 @@
@@ -103,15 +103,14 @@ const option = reactive({ dataset: props.chartConfig.option.dataset, dataStyle: props.chartConfig.option.dataStyle, - buttonStyle: props.chartConfig.option.buttonStyle, }); diff --git a/src/packages/components/Zhigan/Zhigan/WeiXingYaoGan/index.vue b/src/packages/components/Zhigan/Zhigan/WeiXingYaoGan/index.vue index a29df54..181d672 100644 --- a/src/packages/components/Zhigan/Zhigan/WeiXingYaoGan/index.vue +++ b/src/packages/components/Zhigan/Zhigan/WeiXingYaoGan/index.vue @@ -1,7 +1,7 @@ @@ -46,10 +99,18 @@ import { useContextMenu } from './hooks/useContextMenu.hook'; import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'; import { useChartHistoryStore } from '@/store/modules/chartHistoryStore/chartHistoryStore'; - import { useDarkThemeHook, useThemeOverridesHook, useCode, useLang } from '@/hooks' - import { NConfigProvider } from 'naive-ui' + import { useDarkThemeHook, useThemeOverridesHook, useCode, useLang } from '@/hooks'; + import { NConfigProvider } from 'naive-ui'; + import { icon } from '@/plugins'; + import { ref } from 'vue'; + import { useGlobSetting } from '@/hooks/setting'; + import { uploadFile } from '@/api/demo/files'; + + const { apiUrl } = useGlobSetting(); + const uploadFileUrl = apiUrl + '/api/Files/Upload'; + const { DocumentTextIcon } = icon.ionicons5; // 暗黑主题 - const darkNTheme = useDarkThemeHook() + const darkNTheme = useDarkThemeHook(); const chartHistoryStoreStore = useChartHistoryStore(); const chartEditStore = useChartEditStore(); @@ -85,6 +146,35 @@ }, { passive: false }, ); + const previewFileList = ref([]); + // 关闭弹窗 + const closeModel = () => { + chartEditStore.setSaveGroupImgShow(false); + }; + const filePath = ref(); + // 保存多组合组件 + const saveCopyData = () => { + if (!filePath.value) { + window['$message'].warning('预览图不能为空'); + return; + } + chartEditStore.saveToGroup(filePath.value); + closeModel(); + }; + const beforeUpload = async (options) => { + const Loading = window['$loading']; + Loading && Loading.start(); + let uploadParams = new FormData(); + uploadParams.append('files', options.file.file); + const uploadRes = await uploadFile(uploadParams); + if (uploadRes.length > 0) { + window['$message'].success('上传成功!'); + filePath.value = uploadRes[0].filePath; + Loading && Loading.finish(); + } else { + window['$message'].error('上传失败!'); + } + };