diff --git a/src/hooks/eventHandler.hook.ts b/src/hooks/eventHandler.hook.ts index 421bfca..0c44e6a 100644 --- a/src/hooks/eventHandler.hook.ts +++ b/src/hooks/eventHandler.hook.ts @@ -1,6 +1,7 @@ import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'; import { mapFun } from '@/hooks/ceshiFun.hook'; import { router } from '@/router'; +import { previewUrl } from '@/utils'; const chartEditStore = useChartEditStore(); const ceshiFunction = mapFun(); @@ -20,6 +21,12 @@ export const eventHandlerHook = (comonentList: any, elementList: any, params: an }); window.open(routeUrl.href, '_blank'); return; + } else if (elementList[j].skipType == 'publishLink') { + const routeUrl = router.resolve({ + path: previewUrl(elementList[j].url), + }); + window.open(routeUrl.href, '_blank'); + return; } else { window.open(elementList[j].url, '_blank'); return; @@ -28,6 +35,12 @@ export const eventHandlerHook = (comonentList: any, elementList: any, params: an if (elementList[j].skipType == 'routeLink') { router.replace(elementList[j].url); return; + } else if (elementList[j].skipType == 'publishLink') { + const routeUrl = router.resolve({ + path: previewUrl(elementList[j].url), + }); + window.open(routeUrl.href, '_self'); + return; } else { window.open(elementList[j].url, '_self'); return; diff --git a/src/router/routes/index.ts b/src/router/routes/index.ts index 783ad0b..957216f 100644 --- a/src/router/routes/index.ts +++ b/src/router/routes/index.ts @@ -12,6 +12,7 @@ import { usePermissionStore } from '@/store/modules/permission'; import { getMainPage } from '@/api/path/project.api'; import { usePermissionStore } from '@/store/modules/permission'; import { useUserStore } from '@/store/modules/user'; +import { previewPath } from '@/utils'; // import.meta.glob() 直接引入所有的模块 Vite 独有的功能 const modules = import.meta.glob('./modules/**/*.ts', { eager: true }); @@ -74,9 +75,10 @@ export const RootRoute: AppRouteRecordRaw = { }, beforeEnter: async (to, from, next) => { const mainPage = await getMainPage(); + const path = previewPath(mainPage); if (to.fullPath == '/') { if (mainPage) { - next(mainPage.split('#')[1]); + next(path.split('#')[1]); } else { next(); } diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts index 6c87e1b..9a5f6d8 100644 --- a/src/store/modules/permission.ts +++ b/src/store/modules/permission.ts @@ -28,6 +28,7 @@ import { router } from '@/router'; import { LAYOUT } from '@/router/constant'; import dayjs from 'dayjs'; import { getMainPage } from '@/api/path/project.api'; +import { previewPath } from '@/utils'; interface PermissionState { // Permission code list @@ -393,8 +394,9 @@ export const usePermissionStore = defineStore({ try { const homePage = await getMainPage(); + const path = previewPath(homePage); if (hoemPage) { - window.open(hoemPage, '_self'); + window.open(path, '_self'); } else { patcher(routes); } diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index fcff9d2..7bb50ce 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -26,6 +26,7 @@ import { h } from 'vue'; import md5 from 'js-md5'; import { useMultipleTabStore } from '@/store/modules/multipleTab'; import { getMainPage } from '@/api/path/project.api'; +import { previewPath } from '@/utils'; interface UserState { userInfo: Nullable; @@ -166,9 +167,11 @@ export const useUserStore = defineStore({ permissionStore.setDynamicAddedRoute(true); } const homePage = await getMainPage(); + const path = previewPath(homePage); + // 配置主页面后,进入主页面 if (homePage) { - router.replace(homePage.split('#')[1]); + router.replace(path.split('#')[1]); } else { goHome && (await router.replace(userInfo?.homePath || PageEnum.BASE_HOME)); // goHome && (await router.replace(userInfo?.homePath || PageEnum.SUBJECT_HOME)); diff --git a/src/utils/router.ts b/src/utils/router.ts index 5659ede..d13f737 100644 --- a/src/utils/router.ts +++ b/src/utils/router.ts @@ -200,3 +200,9 @@ export const previewPath = (id?: string | number) => { const previewPath = `${origin}${pathname}${path}/${id || fetchRouteParamsLocation()}`; return previewPath; }; +// 跳转地址 +export const previewUrl = (id?: string | number) => { + const path = fetchPathByName(PreviewEnum.CHART_PREVIEW_NAME, 'href'); + const previewPath = `${path.split('#')[1]}/${id || fetchRouteParamsLocation()}`; + return previewPath; +}; diff --git a/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventInteractionConfiguration/components/EventItem.vue b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventInteractionConfiguration/components/EventItem.vue index b71c18b..0b2506e 100644 --- a/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventInteractionConfiguration/components/EventItem.vue +++ b/src/views/chart/ContentConfigurations/components/ChartEvent/components/ChartEventInteractionConfiguration/components/EventItem.vue @@ -129,137 +129,6 @@ const { chartEditStore } = useTargetData(); - const funSelectOptions = ref([ - { - // 事件名称(用于选择显示) - label: 'ceshi点击', - // 事件名(用于触发) - value: 'ceshiClick', - }, - { - label:"根据坐标定位地图视角", - value: 'handlerFlyToPoint' - }, - { - label:"添加任意类型图层", - value: 'handlerAddLayer' - }, - { - label:"隐藏指定图层", - value: 'handlerHiddenLayer' - },{ - label:"显示指定图层", - value: 'handlerShowLayer' - }, - { - label:"删除指定图层", - value: 'handlerRemoveLayer' - }, - { - label:"跳转到指定图层", - value: 'handlerFlyToLayer' - }, - { - label:"添加单个矢量数据", - value: 'handlerAddEntity' - }, - { - label:"隐藏单个矢量数据", - value:"handlerHiddenEntity" - }, - { - label:"显示单个矢量数据", - value:"handlerShowEntity" - }, - { - label:"移除单个矢量数据", - value:"handlerRemoveEntity" - }, - { - label:"定位和高亮矢量数据", - value:"handlerFlyToEntity" - }, - { - label:"清除全部矢量数据", - value:"handlerClearEntityLayer" - }, - { - label:"隐藏全部矢量数据", - value:"handlerHiddenEntityLayer" - }, - { - label:"显示全部矢量数据", - value:"handlerShowEntityLayer" - }, - { - label:"点击地图拾取坐标", - value:"handlerGetPoint" - }, - { - label:"绘制贴地线", - value:"handlerDrawLine" - }, - { - label:"绘制图标点", - value:"handlerDrawPoint" - }, - { - label:"绘制贴地自由线", - value:"handlerDrawBrushLine" - }, - { - label:"军事标绘", - value:"handlerDrawJun" - }, - { - label:"绘制贴地矩形", - value:"handlerDrawRectangle" - }, - { - label:"绘制贴地面", - value:"handlerDrawPolygon" - }, - { - label:"清除图层绘制", - value:"handlerClearDraw" - }, - { - label:"贴地距离测量", - value:"handlerMeasureSurfaceLength" - }, - { - label:"绘制自由线", - value:"drawBrushLine", - }, - { - label:"空间距离测量", - value:"handlerMeasureLength" - }, - { - label:"贴地面积测量", - value:"handlerMeasureSurfaceArea" - }, - { - label:"水平面积测量", - value:"handlerMeasureArea" - }, - { - label:"坐标点位测量", - value:"handlerMeasurePoint" - }, - { - label:"高度差测量", - value:"handlerMeasureHeight" - }, - { - label:"清空测量数据", - value:"handlerClearMeasure" - },{ - label:"添加三维模型", - value:"handlerAddModel" - } -]); - const routeOptions = ref([]); const skipTypeOptions = ref([ { @@ -373,12 +242,18 @@ publishOptions.value = data.items.map((item) => { return { label: item.projectName, - value: previewPath(item.id), + // value: previewPath(item.id), + value: item.id, }; }); }; onMounted(() => { - routeOptions.value = []; + routeOptions.value = [ + { + label: '首页', + value: '/dashboard/analysis', + }, + ]; getRouteList(); getPublishedPageList(); }); diff --git a/src/views/demo/system/homepage/index.vue b/src/views/demo/system/homepage/index.vue index 1161313..c1c4b70 100644 --- a/src/views/demo/system/homepage/index.vue +++ b/src/views/demo/system/homepage/index.vue @@ -63,7 +63,7 @@ publishOptions.value = data.items.map((item) => { return { label: item.projectName, - value: previewPath(item.id), + value: item.id, }; }); }; diff --git a/src/views/preview/suspenseIndex.vue b/src/views/preview/suspenseIndex.vue index a12de95..5aea605 100644 --- a/src/views/preview/suspenseIndex.vue +++ b/src/views/preview/suspenseIndex.vue @@ -30,7 +30,7 @@