清缓存

This commit is contained in:
lf 2024-06-19 15:05:02 +08:00
parent 15baf12899
commit 1365c942da
1 changed files with 15 additions and 0 deletions

View File

@ -29,6 +29,7 @@ const { safeAreaInsets } = uni.getSystemInfoSync()
const contentData = reactive<any>({}) const contentData = reactive<any>({})
const query = ref<string>('') const query = ref<string>('')
const useStore = useUserStore() const useStore = useUserStore()
let timer = null
interface SrcListType { interface SrcListType {
url?: string url?: string
@ -116,6 +117,15 @@ const initContent = async () => {
} }
onLoad(() => { 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 // activity_id
query.value = getUrlPathName() query.value = getUrlPathName()
if (!useStore.userInfo.srcList.url || useStore.userInfo.query !== query.value) { if (!useStore.userInfo.srcList.url || useStore.userInfo.query !== query.value) {
@ -128,6 +138,11 @@ onLoad(() => {
}) })
} }
}) })
onUnload(() => {
clearInterval(timer)
timer = null
})
</script> </script>
<style> <style>