From 5acddc9d1e343e4d5b76fd6e92b664925257b561 Mon Sep 17 00:00:00 2001 From: hx <190679152@qq.com> Date: Thu, 19 Mar 2026 11:14:47 +0800 Subject: [PATCH] =?UTF-8?q?b=E7=AB=AF=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Breadcrumb/index.vue | 2 +- src/components/device/TrajectoryDialog.vue | 21 +- src/layout/components/Navbar.vue | 57 ++- src/layout/components/Sidebar/Logo.vue | 107 ++++- src/layout/components/Sidebar/index.vue | 8 +- src/main.js | 7 + src/plugins/download.js | 14 +- src/store/modules/settings.js | 2 + src/utils/language.js | 109 +++++ src/utils/request.js | 122 ++--- src/views/device/device/index.vue | 367 +++++++-------- src/views/login.vue | 22 +- src/views/system/menu/index.vue | 493 ++++++++++----------- 13 files changed, 800 insertions(+), 531 deletions(-) create mode 100644 src/utils/language.js diff --git a/src/components/Breadcrumb/index.vue b/src/components/Breadcrumb/index.vue index 080595a..b19fb14 100644 --- a/src/components/Breadcrumb/index.vue +++ b/src/components/Breadcrumb/index.vue @@ -47,7 +47,7 @@ export default { } // 判断是否为首页 if (!this.isDashboard(matched[0])) { - matched = [{ path: "/index", meta: { title: "首页" } }].concat(matched) + matched = [{ path: "/index", meta: { title: this.$t("common.home") } }].concat(matched) } this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false) }, diff --git a/src/components/device/TrajectoryDialog.vue b/src/components/device/TrajectoryDialog.vue index 823c9cf..cece6be 100644 --- a/src/components/device/TrajectoryDialog.vue +++ b/src/components/device/TrajectoryDialog.vue @@ -754,22 +754,25 @@ export default { return this.parseTime ? this.parseTime(value) : value; }, formatCoordinateValue(value) { - if (value === null || value === undefined || value === "") { + if (value === null || value === undefined) { return "-"; } - let strValue = String(value); - const [integerPart, decimalPart] = strValue.split("."); + const strValue = String(value).trim(); + if (!strValue || strValue === "-") { + return "-"; + } + const match = strValue.match(/^([+-]?\d+)(?:\.(\d+))?$/); + if (!match) { + return "-"; + } + const integerPart = match[1]; + const decimalPart = match[2] || ""; const fixedDecimal = decimalPart.slice(0, 2).padEnd(2, "0"); return `${integerPart}.${fixedDecimal}`; }, formatTrackCoordinates(lat, lng) { - const latText = - lat === null || lat === undefined || lat === "" ? "-" : lat; - const lngText = - lng === null || lng === undefined || lng === "" ? "-" : lng; - - return `${this.formatCoordinateValue(latText)} / ${this.formatCoordinateValue(lngText)}`; + return `${this.formatCoordinateValue(lat)} / ${this.formatCoordinateValue(lng)}`; }, getPointTrackTime(point) { if (!point) { diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index e8dffd5..6a59d0c 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -9,15 +9,29 @@ @@ -27,10 +41,10 @@ - 个人中心 + {{ $t("navbar.profile") }} - 退出登录 + {{ $t("navbar.logout") }} @@ -52,6 +66,7 @@ import SizeSelect from '@/components/SizeSelect' import Search from '@/components/HeaderSearch' import RuoYiGit from '@/components/RuoYi/Git' import RuoYiDoc from '@/components/RuoYi/Doc' +import { getLanguage, setLanguage, languageOptions } from '@/utils/language' export default { emits: ['setLayout'], @@ -65,6 +80,11 @@ export default { RuoYiGit, RuoYiDoc }, + data() { + return { + languageOptions + } + }, computed: { ...mapGetters([ 'sidebar', @@ -81,6 +101,9 @@ export default { get() { return this.$store.state.settings.topNav } + }, + currentLanguage() { + return this.$store.state.settings.language || getLanguage() } }, methods: { @@ -91,15 +114,23 @@ export default { this.$emit('setLayout') }, logout() { - this.$confirm('确定注销并退出系统吗?', '提示', { - confirmButtonText: '确定', - cancelButtonText: '取消', + this.$confirm(this.$t('navbar.logoutConfirm'), this.$t('common.tips'), { + confirmButtonText: this.$t('common.confirm'), + cancelButtonText: this.$t('common.cancel'), type: 'warning' }).then(() => { this.$store.dispatch('LogOut').then(() => { location.href = '/index' }) }).catch(() => {}) + }, + changeLanguage(lang) { + const normalized = setLanguage(lang) + this.$store.dispatch('settings/changeSetting', { key: 'language', value: normalized }) + if (typeof document !== 'undefined') { + document.documentElement.setAttribute('lang', normalized) + } + window.location.reload() } } } @@ -167,6 +198,14 @@ export default { } } + .lang-menu { + .lang-trigger { + display: inline-flex; + align-items: center; + gap: 4px; + } + } + .avatar-container { margin-right: 0px; padding-right: 0px; diff --git a/src/layout/components/Sidebar/Logo.vue b/src/layout/components/Sidebar/Logo.vue index 4ec53eb..e2a3dda 100644 --- a/src/layout/components/Sidebar/Logo.vue +++ b/src/layout/components/Sidebar/Logo.vue @@ -1,13 +1,22 @@ -