From afed1cb6b3229e5cf67349d06f41b9c217d3fc0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Sat, 5 Nov 2022 15:23:01 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20=E5=A4=84=E7=90=86=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E8=AF=AD=E8=A8=80=EF=BC=8CUI=E6=A1=86=E6=9E=B6=E4=B8=8D?= =?UTF-8?q?=E4=BC=9A=E5=8F=98=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pnpm-lock.yaml | 12 ++++++++++++ src/App.vue | 13 ++++++++----- src/hooks/index.ts | 3 ++- src/hooks/useLang.hook.ts | 24 ++++++++++++++++++++++++ src/store/index.ts | 6 +++--- src/store/modules/langStore/langStore.ts | 6 +++--- 6 files changed, 52 insertions(+), 12 deletions(-) create mode 100644 src/hooks/useLang.hook.ts diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c6c30227..eb14f9e6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,6 +1,8 @@ lockfileVersion: 5.4 specifiers: + '@amap/amap-jsapi-loader': ^1.0.1 + '@amap/amap-jsapi-types': ^0.0.8 '@commitlint/cli': ^17.0.2 '@commitlint/config-conventional': ^17.0.2 '@types/color': ^3.0.3 @@ -65,6 +67,8 @@ specifiers: vuedraggable: ^4.1.0 dependencies: + '@amap/amap-jsapi-loader': 1.0.1 + '@amap/amap-jsapi-types': 0.0.8 '@types/color': 3.0.3 '@types/crypto-js': 4.1.1 '@types/keymaster': 1.6.30 @@ -132,6 +136,14 @@ devDependencies: 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: resolution: {integrity: sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==} engines: {node: '>=6.0.0'} diff --git a/src/App.vue b/src/App.vue index 1865e459..2fa191d8 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,9 +1,9 @@ diff --git a/src/hooks/index.ts b/src/hooks/index.ts index bc9825fb..5ecfe3dd 100644 --- a/src/hooks/index.ts +++ b/src/hooks/index.ts @@ -2,4 +2,5 @@ export * from '@/hooks/useTheme.hook' export * from '@/hooks/usePreviewScale.hook' export * from '@/hooks/useCode.hook' export * from '@/hooks/useChartDataFetch.hook' -export * from '@/hooks/useLifeHandler.hook' \ No newline at end of file +export * from '@/hooks/useLifeHandler.hook' +export * from '@/hooks/useLang.hook' \ No newline at end of file diff --git a/src/hooks/useLang.hook.ts b/src/hooks/useLang.hook.ts new file mode 100644 index 00000000..f165ce6d --- /dev/null +++ b/src/hooks/useLang.hook.ts @@ -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 + } +} diff --git a/src/store/index.ts b/src/store/index.ts index efaf6c97..4e303ea9 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -1,10 +1,10 @@ import type { App } from 'vue'; import { createPinia } from 'pinia'; -const store = createPinia(); +const pinia = createPinia(); export function setupStore(app: App) { - app.use(store); + app.use(pinia); } -export { store }; +export { pinia }; diff --git a/src/store/modules/langStore/langStore.ts b/src/store/modules/langStore/langStore.ts index 9eb7bdeb..d1795e6c 100644 --- a/src/store/modules/langStore/langStore.ts +++ b/src/store/modules/langStore/langStore.ts @@ -6,10 +6,8 @@ import i18n from '@/i18n/index' import { setLocalStorage, getLocalStorage, reloadRoutePage } from '@/utils' import { StorageEnum } from '@/enums/storageEnum' import { useSettingStore } from '@/store/modules/settingStore/settingStore' -const settingStore = useSettingStore() const { GO_LANG_STORE } = StorageEnum - const storageLang: LangStateType = getLocalStorage(GO_LANG_STORE) // 语言 @@ -17,7 +15,7 @@ export const useLangStore = defineStore({ id: 'useLangStore', state: (): LangStateType => storageLang || { - lang, + lang }, getters: { getLang(): LangEnum { @@ -26,6 +24,8 @@ export const useLangStore = defineStore({ }, actions: { changeLang(lang: LangEnum): void { + const settingStore = useSettingStore() + if (this.lang === lang) return this.lang = lang i18n.global.locale = lang From 8d05953b8bdb8a1c710280d2feb8e819fc23591b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Sat, 5 Nov 2022 15:45:29 +0800 Subject: [PATCH 2/4] =?UTF-8?q?chore:=20=E4=BF=AE=E6=94=B9=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/settings/pathConst.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/settings/pathConst.ts b/src/settings/pathConst.ts index 74cbb91d..d3c604a6 100644 --- a/src/settings/pathConst.ts +++ b/src/settings/pathConst.ts @@ -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/" From c35dd6fad90f55fa266b221dc0563584bbcc7119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=94=E8=B7=91=E7=9A=84=E9=9D=A2=E6=9D=A1?= <1262327911@qq.com> Date: Sat, 5 Nov 2022 21:16:34 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E9=94=81=E5=AE=9A?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E4=BF=AE=E6=94=B9=E6=A8=A1=E5=9D=97=E9=9A=90?= =?UTF-8?q?=E8=97=8F=E5=B1=95=E7=A4=BA=EF=BC=8C=E6=A0=87=E5=B0=BA=E4=B8=8D?= =?UTF-8?q?=E4=BC=9A=E8=87=AA=E9=80=82=E5=BA=94=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chart/ContentConfigurations/index.vue | 4 +- .../ContentEdit/components/EditRule/index.vue | 48 ++++++++++++++----- 2 files changed, 39 insertions(+), 13 deletions(-) diff --git a/src/views/chart/ContentConfigurations/index.vue b/src/views/chart/ContentConfigurations/index.vue index 0f8a8609..110a3c2f 100644 --- a/src/views/chart/ContentConfigurations/index.vue +++ b/src/views/chart/ContentConfigurations/index.vue @@ -14,7 +14,7 @@ @collapse="collapsedHandle" @expand="expandHandle" > - +