Browse Source

宽度调整

lifanagju_citu 7 months ago
parent
commit
9140d46b66
1 changed files with 6 additions and 12 deletions
  1. 6 12
      src/views/recruit/personal/home/index.vue

+ 6 - 12
src/views/recruit/personal/home/index.vue

@@ -47,7 +47,7 @@ import hotPromotedPositions from './components/hotPromotedPositions.vue'
 import PopularEnterprises from './components/popularEnterprises.vue'
 import advertisementPage from './components/advertisement/index.vue'
 import { useRouter } from 'vue-router'
-import { nextTick, onMounted, ref, watch } from 'vue'
+import { nextTick, onMounted, ref } from 'vue'
 import { useUserStore } from '@/store/user'
 import { getToken } from '@/utils/auth'
 import { getRewardEventList } from '@/utils/eventList'
@@ -86,21 +86,15 @@ const handleOpenAdvertise = () => {
   window.open('https://mp.weixin.qq.com/s/Us_cWsRpGQBnLFBrZGynLA')
 }
 
-const adImgWidth = ref(900)
-watch(
-  () => document?.documentElement?.clientWidth, 
-  (newVal) => {
-    if (newVal) {
-      const num = newVal/2.2
-      adImgWidth.value = Math.floor(num) > 500 ? Math.floor(num) : 500
-    }
-  },
-  { immediate: true },
-  { deep: true }
+const adImgWidth = ref(document?.documentElement?.clientWidth ?
+  Math.floor(document.documentElement.clientWidth/2.2) > 500 ?
+  Math.floor(document.documentElement.clientWidth/2.2) : 500
+  : 900
 )
 
 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)) {