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 +})