From f7fcf7fb2770630fe41b727460ea15b4fa52dcfd Mon Sep 17 00:00:00 2001 From: jinhhanhan <1683105490@qq.com> Date: Thu, 15 Jan 2026 15:01:39 +0800 Subject: [PATCH] =?UTF-8?q?chore:=E7=82=B9=E5=87=BB=E8=8B=B1=E6=96=87?= =?UTF-8?q?=E6=8C=89=E9=92=AE=EF=BC=8C=E9=A1=B5=E9=9D=A2=E4=B8=8D=E6=98=AF?= =?UTF-8?q?=E7=A9=BA=E7=99=BD=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/hover-nav/hover-nav.vue | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/components/hover-nav/hover-nav.vue b/components/hover-nav/hover-nav.vue index d93bb08..2a064fc 100644 --- a/components/hover-nav/hover-nav.vue +++ b/components/hover-nav/hover-nav.vue @@ -185,12 +185,29 @@ export default { uni.showToast({ title: '暂无联系电话', icon: 'none' }); } }, - toggleLanguage() { - this.currentLangIndex = this.currentLangIndex === 0 ? 1 : 0; - const targetLang = this.langIndexMap[this.currentLangIndex]; - let currentRoute = this.$util.getCurrentRoute().path; - this.$langConfig.change(targetLang, currentRoute); - }, + /** + * 切换中英文语言,并刷新当前页面(保留所有参数) + */ + toggleLanguage() { + this.currentLangIndex = this.currentLangIndex === 0 ? 1 : 0; + const targetLang = this.langIndexMap[this.currentLangIndex]; + + uni.setStorageSync('lang', targetLang); + + const pages = getCurrentPages(); + if (pages.length === 0) return; + + const currentPage = pages[pages.length - 1]; + const route = currentPage.route; + + console.log('【调试】切换语言:', targetLang, '路径:', route); + + if (uni.getSystemInfoSync().platform === 'browser') { + window.location.reload(); + } else { + uni.redirectTo({ url: `/${route}` }); + } + }, openKefuSelectPopup() { const kefuNames = this.kefuList.map(item => item.name); uni.showActionSheet({