Merge branch 'dev'

This commit is contained in:
奔跑的面条
2023-04-02 18:00:55 +08:00
37 changed files with 4605 additions and 1340 deletions
@@ -65,6 +65,7 @@ import { RequestHeader } from '../RequestHeader'
import { isDev } from '@/utils'
import { icon } from '@/plugins'
import {
graphUrl,
chartDataUrl,
chartSingleDataUrl,
rankListUrl,
@@ -80,7 +81,8 @@ import {
capsuleUrl,
wordCloudUrl,
treemapUrl,
threeEarth01Url
threeEarth01Url,
sankeyUrl
} from '@/api/mock'
const props = defineProps({
@@ -142,6 +144,12 @@ const apiList = [
},
{
value: `【三维地球】${threeEarth01Url}`
},
{
value: `【桑基图】${sankeyUrl}`
},
{
value: `【关系图】${graphUrl}`
}
]
</script>
@@ -24,6 +24,11 @@ export const syncData = () => {
})
}
// 同步数据到预览页
export const syncDataToPreview = () => {
dispatchEvent(new CustomEvent(SavePageEnum.CHART_TO_PREVIEW, { detail: chartEditStore.getStorageInfo }))
}
// 侦听器更新
const useSyncUpdateHandle = () => {
// 定义侦听器变量
@@ -48,8 +53,8 @@ const useSyncUpdateHandle = () => {
// document.hasFocus() && syncData()
// }, editToJsonInterval)
// 失焦同步数据(暂不开启)
// addEventListener('blur', syncData)
// 失焦同步数据
addEventListener('blur', syncDataToPreview)
// 监听编辑器保存事件 刷新工作台图表
addEventListener(SavePageEnum.JSON, updateFn)
@@ -61,7 +66,7 @@ const useSyncUpdateHandle = () => {
// 关闭侦听
const unUse = () => {
// clearInterval(timer)
// removeEventListener('blur', syncData)
removeEventListener('blur', syncDataToPreview)
removeEventListener(SavePageEnum.JSON, updateFn)
}
@@ -322,6 +322,15 @@ $asideBottom: 70px;
border-radius: 25px;
}
}
&::after {
content: '';
position: absolute;
left: 0;
width: 100%;
height: 10px;
bottom: -10px;
cursor: pointer;
}
}
/* 最小化 */
&.isMini {
@@ -348,6 +357,7 @@ $asideBottom: 70px;
50% {
opacity: 0;
bottom: calc(#{$dockMiniBottom} - 10px);
pointer-events: none;
}
100% {
opacity: 1;
@@ -362,15 +372,6 @@ $asideBottom: 70px;
display: none;
}
}
&::after {
content: '';
position: absolute;
left: 0;
width: 100%;
height: 20px;
bottom: -20px;
cursor: pointer;
}
}
}
</style>
@@ -11,7 +11,7 @@
<!-- 模块展示按钮 -->
<n-tooltip v-for="item in btnList" :key="item.key" placement="bottom" trigger="hover">
<template #trigger>
<n-button size="small" ghost :type="styleHandle(item)" @click="clickHandle(item)">
<n-button size="small" ghost :type="styleHandle(item)" :focusable="false" @click="clickHandle(item)">
<component :is="item.icon"></component>
</n-button>
</template>
+25 -25
View File
@@ -1,25 +1,25 @@
<template>
<preview :key="key"></preview>
</template>
<script setup lang="ts">
import { getSessionStorageInfo } from './utils'
import type { ChartEditStorageType } from './index.d'
import { SavePageEnum } from '@/enums/editPageEnum'
import { setSessionStorage } from '@/utils'
import { StorageEnum } from '@/enums/storageEnum'
import { ref } from 'vue'
import Preview from './index.vue'
let key = ref(Date.now())
// 数据变更 -> 组件销毁重建
;[SavePageEnum.JSON, SavePageEnum.CHART].forEach((saveEvent: string) => {
if (!window.opener) return
window.opener.addEventListener(saveEvent, async (e: any) => {
const localStorageInfo: ChartEditStorageType = await getSessionStorageInfo() as unknown as ChartEditStorageType
setSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST, [{ ...e.detail, id: localStorageInfo.id }])
key.value = Date.now()
})
})
</script>
<template>
<preview :key="key"></preview>
</template>
<script setup lang="ts">
import { getSessionStorageInfo } from './utils'
import type { ChartEditStorageType } from './index.d'
import { SavePageEnum } from '@/enums/editPageEnum'
import { setSessionStorage } from '@/utils'
import { StorageEnum } from '@/enums/storageEnum'
import { ref } from 'vue'
import Preview from './index.vue'
let key = ref(Date.now())
// 数据变更 -> 组件销毁重建
;[SavePageEnum.JSON, SavePageEnum.CHART_TO_PREVIEW].forEach((saveEvent: string) => {
if (!window.opener) return
window.opener.addEventListener(saveEvent, async (e: any) => {
const localStorageInfo: ChartEditStorageType = await getSessionStorageInfo() as unknown as ChartEditStorageType
setSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST, [{ ...e.detail, id: localStorageInfo.id }])
key.value = Date.now()
})
})
</script>
@@ -45,8 +45,7 @@ const collapsed = ref<boolean>(false)
const { getAsideCollapsedWidth } = toRefs(useSettingStore())
const route = useRoute()
const routeRame = computed(() => route.name)
const menuValue = ref(routeRame)
const menuValue = computed(() => route.name)
const menuOptions = menuOptionsInit()