From 1c398191129b86a4759db4fb475cbacba9f8a3af Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sat, 24 Jun 2023 19:30:28 +0800 Subject: [PATCH] add switch to desktop/mobile link --- src/lib/version.js | 15 +++++++++++ src/locales/en.js | 2 ++ src/locales/zh_Hans.js | 2 ++ src/views/desktop/MainLayout.vue | 44 ++++++++++++++++++++----------- src/views/mobile/SettingsPage.vue | 6 +++++ 5 files changed, 53 insertions(+), 16 deletions(-) diff --git a/src/lib/version.js b/src/lib/version.js index 38af68b0..1b95aaf8 100644 --- a/src/lib/version.js +++ b/src/lib/version.js @@ -16,3 +16,18 @@ export function getVersion() { export function getBuildTime() { return __EZBOOKKEEPING_BUILD_UNIX_TIME__; // eslint-disable-line } + +export function getMobileVersionPath() { + if (isProduction()) { + return '../mobile'; + } else { + return 'mobile.html'; + } +} +export function getDesktopVersionPath() { + if (isProduction()) { + return '../desktop'; + } else { + return 'desktop.html'; + } +} diff --git a/src/locales/en.js b/src/locales/en.js index bd1ddd9c..cb05a6b3 100644 --- a/src/locales/en.js +++ b/src/locales/en.js @@ -1132,6 +1132,8 @@ export default { 'Exchange rates data has been updated': 'Exchange rates data has been updated', 'Exchange rates data is up to date': 'Exchange rates data is up to date', 'Unable to get exchange rates data': 'Unable to get exchange rates data', + 'Switch to Mobile Version': 'Switch to Mobile Version', + 'Switch to Desktop Version': 'Switch to Desktop Version', 'About': 'About', 'Build Time': 'Build Time', 'Official Website': 'Official Website', diff --git a/src/locales/zh_Hans.js b/src/locales/zh_Hans.js index 3013e7b4..c7ae4372 100644 --- a/src/locales/zh_Hans.js +++ b/src/locales/zh_Hans.js @@ -1132,6 +1132,8 @@ export default { 'Exchange rates data has been updated': '汇率数据已更新', 'Exchange rates data is up to date': '汇率数据已是最新', 'Unable to get exchange rates data': '无法获取汇率数据', + 'Switch to Mobile Version': '切换到移动版', + 'Switch to Desktop Version': '切换到桌面版', 'About': '关于', 'Build Time': '编译时间', 'Official Website': '官方网站', diff --git a/src/views/desktop/MainLayout.vue b/src/views/desktop/MainLayout.vue index 6170b7b7..dce955ee 100644 --- a/src/views/desktop/MainLayout.vue +++ b/src/views/desktop/MainLayout.vue @@ -16,10 +16,10 @@ @ps-scroll-y="handleNavScroll" > + @@ -175,6 +181,7 @@ import { useSettingsStore } from '@/stores/setting.js'; import { useUserStore } from '@/stores/user.js'; import { getSystemTheme } from '@/lib/ui.js'; +import { getMobileVersionPath } from '@/lib/version.js'; import { mdiMenu, @@ -186,6 +193,7 @@ import { mdiChartPieOutline, mdiSwapHorizontal, mdiCogOutline, + mdiCellphone, mdiInformationOutline, mdiThemeLightDark, mdiWeatherSunny, @@ -214,6 +222,7 @@ export default { statistics: mdiChartPieOutline, exchangeRates: mdiSwapHorizontal, settings: mdiCogOutline, + mobile: mdiCellphone, about: mdiInformationOutline, themeAuto: mdiThemeLightDark, themeLight: mdiWeatherSunny, @@ -230,6 +239,9 @@ export default { const { mdAndDown } = useDisplay(); return mdAndDown.value; }, + mobileVersionPath() { + return getMobileVersionPath(); + }, currentNickName() { return this.userStore.currentUserNickname || this.$t('User'); }, diff --git a/src/views/mobile/SettingsPage.vue b/src/views/mobile/SettingsPage.vue index e80ff171..464ce4ed 100644 --- a/src/views/mobile/SettingsPage.vue +++ b/src/views/mobile/SettingsPage.vue @@ -92,6 +92,8 @@ + + @@ -105,6 +107,7 @@ import { useUserStore } from '@/stores/user.js'; import { useExchangeRatesStore } from '@/stores/exchangeRates.js'; import currencyConstants from '@/consts/currency.js'; +import { getDesktopVersionPath } from '@/lib/version.js'; export default { props: [ @@ -123,6 +126,9 @@ export default { version() { return 'v' + this.$version; }, + desktopVersionPath() { + return getDesktopVersionPath(); + }, allTimezones() { return this.$locale.getAllTimezones(true); },