diff --git a/src/pages/console/order/Detail.vue b/src/pages/console/order/Detail.vue index 5ccf43ae..d102f11a 100644 --- a/src/pages/console/order/Detail.vue +++ b/src/pages/console/order/Detail.vue @@ -99,6 +99,7 @@ interface IData { payWay: PayWay | undefined; order: IOrder | undefined; loading: boolean; + refreshTimer: number | undefined; } export default defineComponent({ @@ -112,7 +113,8 @@ export default defineComponent({ payWay: PayWay.WechatPay, OrderState: OrderState, order: undefined, - loading: false + loading: false, + refreshTimer: undefined }; }, computed: { @@ -128,6 +130,11 @@ export default defineComponent({ this.onFetchData(); this.onCheck(); }, + unmounted() { + if (this.refreshTimer) { + clearTimeout(this.refreshTimer); + } + }, methods: { onFetchData() { this.loading = true; @@ -147,7 +154,7 @@ export default defineComponent({ .then(({ data: data }: { data: IOrderDetailResponse }) => { this.order = data; if (this.order.state === OrderState.PAID) { - setTimeout(() => { + this.refreshTimer = setTimeout(() => { if (this.redirect) { window.location.replace(this.redirect?.toString()); } diff --git a/src/utils/env.ts b/src/utils/env.ts index 46d0ce53..9824b16d 100644 --- a/src/utils/env.ts +++ b/src/utils/env.ts @@ -1,7 +1,7 @@ import { ENV_LOCAL, ENV_PRODUCTION, ENV_TEST } from '@/constants'; const PATTERN_TEST_ENV = '.test.zhishuyun.com'; -const PATTERN_LOCAL_ENV = '.lcoal.zhishuyun.com'; +const PATTERN_LOCAL_ENV = '.local.zhishuyun.com'; /** * Get env of App, return local, test, production diff --git a/vite.config.ts b/vite.config.ts index 4368dd3b..19066900 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -20,7 +20,7 @@ const getAuthEndpoint = () => { const getDataEndpoint = () => { switch (process.env.NODE_ENV) { case 'local': - return 'https://auth.test.zhishuyun.com'; + return 'http://localhost:8007'; case 'test': return 'https://data.test.zhishuyun.com'; case 'production':