mirror of
https://gitee.com/dromara/go-view.git
synced 2025-04-06 03:58:04 +08:00
Merge branch 'dev' of https://gitee.com/MTrun/go-view into master-fetch-dev
This commit is contained in:
commit
b6903a777a
12
pnpm-lock.yaml
generated
12
pnpm-lock.yaml
generated
@ -1,6 +1,8 @@
|
|||||||
lockfileVersion: 5.4
|
lockfileVersion: 5.4
|
||||||
|
|
||||||
specifiers:
|
specifiers:
|
||||||
|
'@amap/amap-jsapi-loader': ^1.0.1
|
||||||
|
'@amap/amap-jsapi-types': ^0.0.8
|
||||||
'@commitlint/cli': ^17.0.2
|
'@commitlint/cli': ^17.0.2
|
||||||
'@commitlint/config-conventional': ^17.0.2
|
'@commitlint/config-conventional': ^17.0.2
|
||||||
'@types/color': ^3.0.3
|
'@types/color': ^3.0.3
|
||||||
@ -65,6 +67,8 @@ specifiers:
|
|||||||
vuedraggable: ^4.1.0
|
vuedraggable: ^4.1.0
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@amap/amap-jsapi-loader': 1.0.1
|
||||||
|
'@amap/amap-jsapi-types': 0.0.8
|
||||||
'@types/color': 3.0.3
|
'@types/color': 3.0.3
|
||||||
'@types/crypto-js': 4.1.1
|
'@types/crypto-js': 4.1.1
|
||||||
'@types/keymaster': 1.6.30
|
'@types/keymaster': 1.6.30
|
||||||
@ -132,6 +136,14 @@ devDependencies:
|
|||||||
|
|
||||||
packages:
|
packages:
|
||||||
|
|
||||||
|
/@amap/amap-jsapi-loader/1.0.1:
|
||||||
|
resolution: {integrity: sha512-nPyLKt7Ow/ThHLkSvn2etQlUzqxmTVgK7bIgwdBRTg2HK5668oN7xVxkaiRe3YZEzGzfV2XgH5Jmu2T73ljejw==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
|
/@amap/amap-jsapi-types/0.0.8:
|
||||||
|
resolution: {integrity: sha512-q0FyZDIJcXjsMLGc3oS9rjfJsErOvt9rcp6AgzY4k14vo7bBhdq4eKwoSdVp/pYjR/rfaKBns5v10ycZOFwf/A==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@ampproject/remapping/2.2.0:
|
/@ampproject/remapping/2.2.0:
|
||||||
resolution: {integrity: sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==}
|
resolution: {integrity: sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==}
|
||||||
engines: {node: '>=6.0.0'}
|
engines: {node: '>=6.0.0'}
|
||||||
|
13
src/App.vue
13
src/App.vue
@ -1,9 +1,9 @@
|
|||||||
<template>
|
<template>
|
||||||
<n-config-provider
|
<n-config-provider
|
||||||
:locale="zhCN"
|
|
||||||
:theme="darkTheme"
|
:theme="darkTheme"
|
||||||
:hljs="hljsTheme"
|
:hljs="hljsTheme"
|
||||||
:date-locale="dateZhCN"
|
:locale="locale"
|
||||||
|
:date-locale="dateLocale"
|
||||||
:theme-overrides="overridesTheme"
|
:theme-overrides="overridesTheme"
|
||||||
>
|
>
|
||||||
<go-app-provider>
|
<go-app-provider>
|
||||||
@ -14,11 +14,10 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { zhCN, dateZhCN, NConfigProvider } from 'naive-ui'
|
import { NConfigProvider } from 'naive-ui'
|
||||||
import { GoAppProvider } from '@/components/GoAppProvider'
|
import { GoAppProvider } from '@/components/GoAppProvider'
|
||||||
import { I18n } from '@/components/I18n'
|
import { I18n } from '@/components/I18n'
|
||||||
|
import { useSystemInit, useDarkThemeHook, useThemeOverridesHook, useCode, useLang } from '@/hooks'
|
||||||
import { useSystemInit, useDarkThemeHook, useThemeOverridesHook, useCode } from '@/hooks'
|
|
||||||
|
|
||||||
// 暗黑主题
|
// 暗黑主题
|
||||||
const darkTheme = useDarkThemeHook()
|
const darkTheme = useDarkThemeHook()
|
||||||
@ -31,4 +30,8 @@ const hljsTheme = useCode()
|
|||||||
|
|
||||||
// 系统全局数据初始化
|
// 系统全局数据初始化
|
||||||
useSystemInit()
|
useSystemInit()
|
||||||
|
|
||||||
|
// 全局语言
|
||||||
|
const { locale, dateLocale } = useLang()
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -3,4 +3,5 @@ export * from '@/hooks/usePreviewScale.hook'
|
|||||||
export * from '@/hooks/useCode.hook'
|
export * from '@/hooks/useCode.hook'
|
||||||
export * from '@/hooks/useChartDataFetch.hook'
|
export * from '@/hooks/useChartDataFetch.hook'
|
||||||
export * from '@/hooks/useSystemInit.hook'
|
export * from '@/hooks/useSystemInit.hook'
|
||||||
export * from '@/hooks/useLifeHandler.hook'
|
export * from '@/hooks/useLifeHandler.hook'
|
||||||
|
export * from '@/hooks/useLang.hook'
|
24
src/hooks/useLang.hook.ts
Normal file
24
src/hooks/useLang.hook.ts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import { computed } from 'vue'
|
||||||
|
import { LangEnum } from '@/enums/styleEnum'
|
||||||
|
import { useLangStore } from '@/store/modules/langStore/langStore'
|
||||||
|
import { zhCN, enUS, dateEnUS, dateZhCN } from 'naive-ui'
|
||||||
|
|
||||||
|
type LangStoreType = typeof useLangStore
|
||||||
|
|
||||||
|
// 语言切换
|
||||||
|
export const useLang = () => {
|
||||||
|
const lang = useLangStore()
|
||||||
|
|
||||||
|
const locale = computed(() => {
|
||||||
|
return lang.getLang === LangEnum.ZH ? zhCN : enUS
|
||||||
|
})
|
||||||
|
|
||||||
|
const dateLocale = computed(() => {
|
||||||
|
return lang.getLang === LangEnum.ZH ? dateZhCN : dateEnUS
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
locale,
|
||||||
|
dateLocale
|
||||||
|
}
|
||||||
|
}
|
@ -67,7 +67,7 @@ watch(
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
try {
|
try {
|
||||||
if (navigator.userAgent.indexOf('Chrome') < -1 || navigator.userAgent.indexOf('Edg') > -1) {
|
if (navigator.userAgent.indexOf('Chrome') < -1 || navigator.userAgent.indexOf('Edg') > -1) {
|
||||||
window['$message'].error('此组件仅在【谷歌】浏览器上能正常展示!')
|
window['$message'].error('三维地图组件仅在【谷歌】浏览器上能正常展示!')
|
||||||
chartEditStore.removeComponentList(undefined, false)
|
chartEditStore.removeComponentList(undefined, false)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import cloneDeep from 'lodash/cloneDeep'
|
|||||||
|
|
||||||
export const option = {
|
export const option = {
|
||||||
// 网站路径
|
// 网站路径
|
||||||
dataset: "https://cn.vuejs.org/",
|
dataset: "https://www.mtruning.club/",
|
||||||
// 圆角
|
// 圆角
|
||||||
borderRadius: 10
|
borderRadius: 10
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
// * 外部路径地址
|
// * 外部路径地址
|
||||||
|
|
||||||
// 项目文档地址
|
// 项目文档地址
|
||||||
export const docPath = "http://www.mtruning.club:81/"
|
export const docPath = "https://www.mtruning.club/"
|
||||||
|
|
||||||
// 项目源码
|
// 项目源码
|
||||||
export const giteeSourceCodePath = "https://gitee.com/MTrun/go-view/"
|
export const giteeSourceCodePath = "https://gitee.com/dromara/go-view"
|
||||||
|
|
||||||
// 赞助
|
// 赞助
|
||||||
export const sponsorPath = "http://www.mtruning.club:81/more/sponsor.html"
|
export const sponsorPath = "https://www.mtruning.club/sponsor/"
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import type { App } from 'vue';
|
import type { App } from 'vue';
|
||||||
import { createPinia } from 'pinia';
|
import { createPinia } from 'pinia';
|
||||||
|
|
||||||
const store = createPinia();
|
const pinia = createPinia();
|
||||||
|
|
||||||
export function setupStore(app: App<Element>) {
|
export function setupStore(app: App<Element>) {
|
||||||
app.use(store);
|
app.use(pinia);
|
||||||
}
|
}
|
||||||
|
|
||||||
export { store };
|
export { pinia };
|
||||||
|
@ -6,10 +6,8 @@ import i18n from '@/i18n/index'
|
|||||||
import { setLocalStorage, getLocalStorage, reloadRoutePage } from '@/utils'
|
import { setLocalStorage, getLocalStorage, reloadRoutePage } from '@/utils'
|
||||||
import { StorageEnum } from '@/enums/storageEnum'
|
import { StorageEnum } from '@/enums/storageEnum'
|
||||||
import { useSettingStore } from '@/store/modules/settingStore/settingStore'
|
import { useSettingStore } from '@/store/modules/settingStore/settingStore'
|
||||||
const settingStore = useSettingStore()
|
|
||||||
|
|
||||||
const { GO_LANG_STORE } = StorageEnum
|
const { GO_LANG_STORE } = StorageEnum
|
||||||
|
|
||||||
const storageLang: LangStateType = getLocalStorage(GO_LANG_STORE)
|
const storageLang: LangStateType = getLocalStorage(GO_LANG_STORE)
|
||||||
|
|
||||||
// 语言
|
// 语言
|
||||||
@ -17,7 +15,7 @@ export const useLangStore = defineStore({
|
|||||||
id: 'useLangStore',
|
id: 'useLangStore',
|
||||||
state: (): LangStateType =>
|
state: (): LangStateType =>
|
||||||
storageLang || {
|
storageLang || {
|
||||||
lang,
|
lang
|
||||||
},
|
},
|
||||||
getters: {
|
getters: {
|
||||||
getLang(): LangEnum {
|
getLang(): LangEnum {
|
||||||
@ -26,6 +24,8 @@ export const useLangStore = defineStore({
|
|||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
changeLang(lang: LangEnum): void {
|
changeLang(lang: LangEnum): void {
|
||||||
|
const settingStore = useSettingStore()
|
||||||
|
|
||||||
if (this.lang === lang) return
|
if (this.lang === lang) return
|
||||||
this.lang = lang
|
this.lang = lang
|
||||||
i18n.global.locale = lang
|
i18n.global.locale = lang
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
@collapse="collapsedHandle"
|
@collapse="collapsedHandle"
|
||||||
@expand="expandHandle"
|
@expand="expandHandle"
|
||||||
>
|
>
|
||||||
<content-box class="go-content-layers go-boderbox" :show-top="false" :depth="2">
|
<content-box class="go-content-configurations go-boderbox" :show-top="false" :depth="2">
|
||||||
<!-- 页面配置 -->
|
<!-- 页面配置 -->
|
||||||
<n-tabs v-if="!selectTarget" class="tabs-box" size="small" type="segment">
|
<n-tabs v-if="!selectTarget" class="tabs-box" size="small" type="segment">
|
||||||
<n-tab-pane
|
<n-tab-pane
|
||||||
@ -160,7 +160,7 @@ const chartsTabList = [
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@include go(content-layers) {
|
@include go(content-configurations) {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
.tabs-box {
|
.tabs-box {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
@ -12,14 +12,18 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, toRefs, computed, watch } from 'vue'
|
import { ref, toRefs, computed, watch, nextTick, onBeforeUnmount } from 'vue'
|
||||||
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
import { useChartEditStore } from '@/store/modules/chartEditStore/chartEditStore'
|
||||||
import { useDesignStore } from '@/store/modules/designStore/designStore'
|
import { useDesignStore } from '@/store/modules/designStore/designStore'
|
||||||
|
import { useChartLayoutStore } from '@/store/modules/chartLayoutStore/chartLayoutStore'
|
||||||
|
|
||||||
const chartEditStore = useChartEditStore()
|
const chartEditStore = useChartEditStore()
|
||||||
|
const chartLayoutStore = useChartLayoutStore()
|
||||||
const designStore = useDesignStore()
|
const designStore = useDesignStore()
|
||||||
|
|
||||||
const { width, height } = toRefs(chartEditStore.getEditCanvasConfig)
|
const { width, height } = toRefs(chartEditStore.getEditCanvasConfig)
|
||||||
|
const { scale, lockScale } = toRefs(chartEditStore.getEditCanvas)
|
||||||
|
const { getLayers, getCharts, getDetails } = toRefs(chartLayoutStore)
|
||||||
|
|
||||||
const configShow = ref(true)
|
const configShow = ref(true)
|
||||||
|
|
||||||
@ -49,25 +53,47 @@ const canvasBox = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const scale = computed(() => {
|
|
||||||
return chartEditStore.getEditCanvas.scale
|
|
||||||
})
|
|
||||||
|
|
||||||
// 颜色
|
// 颜色
|
||||||
const themeColor = computed(() => {
|
const themeColor = computed(() => {
|
||||||
return designStore.getAppTheme
|
return designStore.getAppTheme
|
||||||
})
|
})
|
||||||
|
|
||||||
// 处理标尺重制大小
|
// 处理标尺重制大小
|
||||||
|
const ruleChangeHandle = () => {
|
||||||
|
configShow.value = false
|
||||||
|
setTimeout(() => {
|
||||||
|
configShow.value = true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const ruleChangeHandleTimeOut = () => {
|
||||||
|
if (lockScale.value) {
|
||||||
|
setTimeout(() => {
|
||||||
|
ruleChangeHandle()
|
||||||
|
}, 500)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => scale.value,
|
() => scale.value,
|
||||||
() => {
|
() => ruleChangeHandle()
|
||||||
configShow.value = false
|
|
||||||
setTimeout(() => {
|
|
||||||
configShow.value = true
|
|
||||||
})
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => getLayers.value,
|
||||||
|
() => ruleChangeHandleTimeOut()
|
||||||
|
)
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => getCharts.value,
|
||||||
|
() => ruleChangeHandleTimeOut()
|
||||||
|
)
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => getDetails.value,
|
||||||
|
() => ruleChangeHandleTimeOut()
|
||||||
|
)
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -55,8 +55,8 @@ getDataBySession()
|
|||||||
|
|
||||||
// 返回父窗口
|
// 返回父窗口
|
||||||
function back() {
|
function back() {
|
||||||
opener.name = Date.now()
|
window.opener.name = Date.now()
|
||||||
window.open(opener.location.href, opener.name)
|
window.open(window.opener.location.href, window.opener.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 导入json文本
|
// 导入json文本
|
||||||
@ -71,7 +71,7 @@ async function importJSON() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 同步 [画布页失去焦点时同步数据到JSON页,JSON页Ctrl+S 时同步数据到画布页]
|
// 同步 [画布页失去焦点时同步数据到JSON页,JSON页Ctrl+S 时同步数据到画布页]
|
||||||
opener.addEventListener(SavePageEnum.CHART, (e: any) => {
|
window.opener.addEventListener(SavePageEnum.CHART, (e: any) => {
|
||||||
setSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST, [e.detail])
|
setSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST, [e.detail])
|
||||||
content.value = JSON.stringify(e.detail, undefined, 2)
|
content.value = JSON.stringify(e.detail, undefined, 2)
|
||||||
})
|
})
|
||||||
@ -87,14 +87,14 @@ addEventListener('blur', updateSync)
|
|||||||
|
|
||||||
// 同步更新
|
// 同步更新
|
||||||
function updateSync() {
|
function updateSync() {
|
||||||
if (!opener) {
|
if (!window.opener) {
|
||||||
return window['$message'].error('源窗口已关闭,视图同步失败')
|
return window['$message'].error('源窗口已关闭,视图同步失败')
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const detail = JSON.parse(content.value)
|
const detail = JSON.parse(content.value)
|
||||||
delete detail.id
|
delete detail.id
|
||||||
// 保持id不变
|
// 保持id不变
|
||||||
opener.dispatchEvent(new CustomEvent(SavePageEnum.JSON, { detail }))
|
window.opener.dispatchEvent(new CustomEvent(SavePageEnum.JSON, { detail }))
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
window['$message'].error('内容格式有误')
|
window['$message'].error('内容格式有误')
|
||||||
console.log(e)
|
console.log(e)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<Preview :key="key"></Preview>
|
<preview :key="key"></preview>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@ -16,10 +16,10 @@ let localStorageInfo: ChartEditStorageType = getSessionStorageInfo() as unknown
|
|||||||
|
|
||||||
// 数据变更 -> 同步sessionStorage -> reload页面 (重新执行Mounted)
|
// 数据变更 -> 同步sessionStorage -> reload页面 (重新执行Mounted)
|
||||||
;[SavePageEnum.JSON, SavePageEnum.CHART].forEach((saveEvent: string) => {
|
;[SavePageEnum.JSON, SavePageEnum.CHART].forEach((saveEvent: string) => {
|
||||||
opener.addEventListener(saveEvent, (e: any) => {
|
if (!window.opener) return
|
||||||
|
window.opener.addEventListener(saveEvent, (e: any) => {
|
||||||
setSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST, [{ ...e.detail, id: localStorageInfo.id }])
|
setSessionStorage(StorageEnum.GO_CHART_STORAGE_LIST, [{ ...e.detail, id: localStorageInfo.id }])
|
||||||
key.value = Date.now()
|
key.value = Date.now()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
2
types/global.d.ts
vendored
2
types/global.d.ts
vendored
@ -7,6 +7,8 @@ interface Window {
|
|||||||
$vue: any
|
$vue: any
|
||||||
// 键盘按键记录
|
// 键盘按键记录
|
||||||
$KeyboardActive?: { [T: string]: boolean }
|
$KeyboardActive?: { [T: string]: boolean }
|
||||||
|
// 编辑 JSON 的存储对象
|
||||||
|
opener: any
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user