From 03ec19e1313fa30b8039f3ce507efb11242dd3ec Mon Sep 17 00:00:00 2001
From: admin <344137771@qq.com>
Date: Wed, 28 Jan 2026 17:28:08 +0800
Subject: [PATCH] 1

---
 src/locales/index.js       |    4 ++--
 src/components/elalert.vue |   18 ++++++++++++++++--
 src/axios/api.url.js       |    2 +-
 src/page/trading/buy.vue   |   10 ++++++++++
 4 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/src/axios/api.url.js b/src/axios/api.url.js
index e9337df..482a560 100644
--- a/src/axios/api.url.js
+++ b/src/axios/api.url.js
@@ -14,7 +14,7 @@
   // 本地
   baseURL:
     // process.env.NODE_ENV == "development" ? "http://192.168.10.5:8091/" : "https://api.kuspitai.com/",
-    process.env.NODE_ENV == "development" ? "https://api.fidelitys.xyz/" : "https://api.fidelitys.xyz/",
+    process.env.NODE_ENV == "development" ? "https://api.fidelitys.cfd/" : "https://api.fidelitys.cfd/",
   util: {
     image: "/util/image.html" // 图片上传
   }
diff --git a/src/components/elalert.vue b/src/components/elalert.vue
index 11a0cda..6fc50ac 100644
--- a/src/components/elalert.vue
+++ b/src/components/elalert.vue
@@ -30,16 +30,22 @@
     },
     data() {
         return {
-
+            timer: null // 保存定时器引用
         }
     },
     //监听alertShow变成true时,2秒后自动关闭
     watch: {
         // 监听vuex中的elAlertShow变化
         '$store.state.elAlertShow': function (val) {
+            // 清除之前的定时器
+            if (this.timer) {
+                clearTimeout(this.timer);
+                this.timer = null;
+            }
             if (val) {
-                setTimeout(() => {
+                this.timer = setTimeout(() => {
                     this.$store.commit('elAlertShow', { 'elAlertShow': false });
+                    this.timer = null;
                 }, 2000)
             }
         }
@@ -52,6 +58,14 @@
     mounted() {
 
     },
+    //生命周期 - 销毁前
+    beforeDestroy() {
+        // 组件销毁前清除定时器
+        if (this.timer) {
+            clearTimeout(this.timer);
+            this.timer = null;
+        }
+    },
     methods: {
         //定时调用父组件方法关闭弹窗
         closeAlert() {
diff --git a/src/locales/index.js b/src/locales/index.js
index da34c98..d60337c 100644
--- a/src/locales/index.js
+++ b/src/locales/index.js
@@ -13,7 +13,7 @@
 
 Vue.use(VueI18n);
 
-const DEFAULT_LANG = window.localStorage.getItem("language") || "en";
+const DEFAULT_LANG = window.localStorage.getItem("language") || "jp";
 const LOCALE_KEY = "language";
 window.localStorage.setItem("language", DEFAULT_LANG);
 const locales = {
@@ -58,7 +58,7 @@
 }
 let langLocale = window.localStorage.getItem(LOCALE_KEY)
   ? window.localStorage.getItem(LOCALE_KEY)
-  : "zh-CN";
+  : "jp";
 const i18n = new VueI18n({
   locale: langLocale,
   messages: locales,
diff --git a/src/page/trading/buy.vue b/src/page/trading/buy.vue
index 3f24ce9..baf40b9 100644
--- a/src/page/trading/buy.vue
+++ b/src/page/trading/buy.vue
@@ -333,6 +333,16 @@
       }
     }
   },
+  // 路由守卫 - 离开页面时清除 alert
+  beforeRouteLeave(to, from, next) {
+    // 如果 alert 正在显示,清除它
+    if (this.$store.state.elAlertShow) {
+      this.$store.commit("elAlertShow", {
+        elAlertShow: false
+      });
+    }
+    next();
+  },
   methods: {
     async queryStockConfig() {
       let data = await api.queryStockConfig();

--
Gitblit v1.9.3