1
admin
2026-01-28 03ec19e1313fa30b8039f3ce507efb11242dd3ec
1
4 files modified
34 ■■■■ changed files
src/axios/api.url.js 2 ●●● patch | view | raw | blame | history
src/components/elalert.vue 18 ●●●● patch | view | raw | blame | history
src/locales/index.js 4 ●●●● patch | view | raw | blame | history
src/page/trading/buy.vue 10 ●●●●● patch | view | raw | blame | history
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" // 图片上传
  }
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() {
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,
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();