From 1365c942da6b3b7fcbefadb8fae5f89b2ab901ba Mon Sep 17 00:00:00 2001 From: lf <1534621107@qq.com> Date: Wed, 19 Jun 2024 15:05:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/index/index.vue | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index a8e4013..c32c31a 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -29,6 +29,7 @@ const { safeAreaInsets } = uni.getSystemInfoSync() const contentData = reactive({}) const query = ref('') const useStore = useUserStore() +let timer = null interface SrcListType { url?: string @@ -116,6 +117,15 @@ const initContent = async () => { } onLoad(() => { + timer = setInterval(async () => { + const params = { + activity_code: query.value || '', + } + const res: any = await getContent(params) + if (JSON.stringify(res.data) !== JSON.stringify(useStore.userInfo.contentData)) { + initContent() + } + }, 60000) // activity_id 方式 query.value = getUrlPathName() if (!useStore.userInfo.srcList.url || useStore.userInfo.query !== query.value) { @@ -128,6 +138,11 @@ onLoad(() => { }) } }) + +onUnload(() => { + clearInterval(timer) + timer = null +})