Browse Source

五分钟内不触发弹窗

lifanagju_citu 7 tháng trước cách đây
mục cha
commit
398c5098bd
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      src/views/recruit/personal/home/index.vue

+ 5 - 1
src/views/recruit/personal/home/index.vue

@@ -89,7 +89,11 @@ const handleOpenAdvertise = () => {
 
 const adDialog = ref(false)
 onMounted(() => {
-  adDialog.value = true
+  const lastTime = localStorage.getItem('adDialogTime')
+  localStorage.setItem('adDialogTime', Date.now())
+  if (!lastTime || (Date.now() - Number(lastTime) > 300000)) {
+    adDialog.value = true
+  }
 })
 const adClick = () => {
   if (!getToken()) router.push('/login')