| | |
| | | // 本地 |
| | | 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" // 图片上传 |
| | | } |
| | |
| | | }, |
| | | 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) |
| | | } |
| | | } |
| | |
| | | mounted() { |
| | | |
| | | }, |
| | | //生命周期 - 销毁前 |
| | | beforeDestroy() { |
| | | // 组件销毁前清除定时器 |
| | | if (this.timer) { |
| | | clearTimeout(this.timer); |
| | | this.timer = null; |
| | | } |
| | | }, |
| | | methods: { |
| | | //定时调用父组件方法关闭弹窗 |
| | | closeAlert() { |
| | |
| | | |
| | | 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 = { |
| | |
| | | } |
| | | let langLocale = window.localStorage.getItem(LOCALE_KEY) |
| | | ? window.localStorage.getItem(LOCALE_KEY) |
| | | : "zh-CN"; |
| | | : "jp"; |
| | | const i18n = new VueI18n({ |
| | | locale: langLocale, |
| | | messages: locales, |
| | |
| | | } |
| | | } |
| | | }, |
| | | // 路由守卫 - 离开页面时清除 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(); |