index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <div>
  3. <!-- 顶部广告图 -->
  4. <div class="banner"></div>
  5. <div class="stickyBox py-5">
  6. <headSearch @handleSearch="handleSearch"></headSearch>
  7. </div>
  8. <hotJobs></hotJobs>
  9. <div v-if="leftAdvertise.length" class="advertiseBox">
  10. <div v-for="val in leftAdvertise" :key="val.mark" class="advertise" :style="{'width': val.show ? '180px' : '20px'}">
  11. <div v-if="val.show">
  12. <div class="advertise-title d-inline-block">
  13. <span>广告</span>
  14. <v-icon class="float-right cursor-pointer pb-1" color="primary" size="28" @click="val.show = false">mdi-close</v-icon>
  15. </div>
  16. <img class="advertise-img cursor-pointer" :src="val.img" @click="handleLeftClick(val)">
  17. </div>
  18. <div v-else class="advertise-box cursor-pointer" @mouseenter="val.show = true"></div>
  19. </div>
  20. </div>
  21. <div class="default-width mb-5" :style="{'margin-top': leftAdvertise.length * (-372) + 'px'}">
  22. <homeJobTypeCard></homeJobTypeCard>
  23. <advertisementPage class="my-3"></advertisementPage>
  24. <hotPromotedPositions></hotPromotedPositions>
  25. <PopularEnterprises class="mt-10"></PopularEnterprises>
  26. </div>
  27. </div>
  28. <!-- 快速填写简易人才信息-弹窗 -->
  29. <!-- <simplePage v-if="showSimplePage" :closeable="true" closeText="暂时跳过" @close="handleInfoClose" @simpleInfoReady="handleUpdateInfo"></simplePage> -->
  30. <!-- 广告弹窗 -->
  31. <v-dialog
  32. v-model="adDialog"
  33. max-width="900"
  34. :persistent="false"
  35. >
  36. <div style="cursor: pointer; margin: 0 auto; position: relative;">
  37. <v-img :src="dialogAdvertise.img" :width="adImgWidth" style="height: auto;border-radius: 4px;" @click="adClick"></v-img>
  38. <span style="color: #ddddddcc; font-size: 32px; position: absolute; right: 0px; top: 0px;" class="mdi mdi-close-circle-outline cursor-pointer px-3" @click="adDialog = false"></span>
  39. </div>
  40. </v-dialog>
  41. </template>
  42. <script setup>
  43. defineOptions({ name:'personal-index'})
  44. // import simplePage from './components/simple.vue'
  45. import headSearch from '@/components/headSearch'
  46. import hotJobs from './components/hotJobs.vue'
  47. import homeJobTypeCard from './components/homeJobTypeCard'
  48. import hotPromotedPositions from './components/hotPromotedPositions.vue'
  49. import PopularEnterprises from './components/popularEnterprises.vue'
  50. import advertisementPage from './components/advertisement/index.vue'
  51. import { useRouter } from 'vue-router'
  52. import { onMounted, ref } from 'vue'
  53. // import { useUserStore } from '@/store/user'
  54. import { getToken } from '@/utils/auth'
  55. import { getWebContent } from '@/api/common'
  56. import { getRewardEventList } from '@/utils/eventList'
  57. if (!getToken()) getRewardEventList()
  58. // 获取广告图
  59. const leftAdvertise = ref([])
  60. const dialogAdvertise = ref({})
  61. const getSystemWebContent = async () => {
  62. const data = await getWebContent()
  63. // 弹窗广告
  64. dialogAdvertise.value = data.pcAdvertisement ? data.pcAdvertisement[0] : {}
  65. // 左侧广告
  66. if (data.pcLeft) leftAdvertise.value = data.pcLeft.map(e => {
  67. e.show = true
  68. return e
  69. })
  70. }
  71. // 弹窗广告跳转
  72. const adClick = () => {
  73. if (!getToken()) router.push(dialogAdvertise.value.link)
  74. }
  75. // 左侧广告跳转
  76. const handleLeftClick = (val) => {
  77. if (val.link === '/recruit/enterprise/position/add') {
  78. const url = getToken(1) ? val.link : '/login?entLogin=true'
  79. if (!getToken(1)) localStorage.setItem('enterpriseRedirect', '/recruit/enterprise/position/add')
  80. window.open(url)
  81. } else window.open(val.link)
  82. }
  83. const router = useRouter()
  84. const handleSearch = (val) => {
  85. if (val) router.push(`/recruit/personal/position?content=${val}`)
  86. }
  87. // const store = useUserStore()
  88. // const simple = ref(localStorage.getItem('simpleCompleteDialogHaveBeenShow'))
  89. // const showSimplePage = ref(false) // 只提示一次
  90. // if (!getToken()) showSimplePage.value = false
  91. // nextTick(() => {
  92. // if (getToken()) {
  93. // showSimplePage.value = simple.value && JSON.parse(simple.value) ? true : false
  94. // }
  95. // })
  96. // const handleInfoClose = () => {
  97. // localStorage.setItem('simpleCompleteDialogHaveBeenShow', false)
  98. // }
  99. // 更新用户基本信息
  100. // const handleUpdateInfo = async () => {
  101. // handleInfoClose()
  102. // await store.getUserBaseInfos(null)
  103. // }
  104. const adImgWidth = ref(document?.documentElement?.clientWidth ?
  105. Math.floor(document.documentElement.clientWidth/2.2) > 500 ?
  106. Math.floor(document.documentElement.clientWidth/2.2) : 500
  107. : 900
  108. )
  109. const adDialog = ref(false)
  110. onMounted(async () => {
  111. await getSystemWebContent()
  112. const lastTime = localStorage.getItem('adDialogTime')
  113. localStorage.setItem('adDialogTime', Date.now())
  114. if (!lastTime || (Date.now() - Number(lastTime) > 300000)) {
  115. // 无数据不弹窗
  116. adDialog.value = dialogAdvertise.value && Object.keys(dialogAdvertise.value).length ? true : false
  117. }
  118. })
  119. </script>
  120. <style lang="scss" scoped>
  121. .stickyBox {
  122. position: sticky;
  123. top: 48px;
  124. z-index: 999;
  125. background-color: var(--default-bgc);
  126. }
  127. .advertiseBox {
  128. position: sticky;
  129. top: 128px;
  130. z-index: 999;
  131. width: 15px;
  132. max-width: 180px;
  133. }
  134. .advertise {
  135. // position: sticky;
  136. // top: 128px;
  137. // z-index: 999;
  138. height: 372px;
  139. &-box {
  140. position: relative;
  141. width: 15px;
  142. height: 100%;
  143. background-color: #00897B;
  144. &::after {
  145. content: "";
  146. position: absolute;
  147. top: 50%;
  148. margin-left: 3px;
  149. transform: translateY(-50%);
  150. border-width: 10px; // 12px
  151. border-style: solid;
  152. border-color: transparent transparent transparent orange;
  153. }
  154. }
  155. &-title {
  156. width: 100%;
  157. color: #000;
  158. font-size: 14px;
  159. background-color: #d5d5d5;
  160. border-left: 3px solid #00897B;
  161. padding: 8px 5px 0 16px;
  162. border-radius: 4px 4px 0 0;
  163. }
  164. &-img {
  165. width: 100%;
  166. height: 100%;
  167. border-radius: 0 0 4px 4px;
  168. object-fit: cover;
  169. }
  170. }
  171. // .content-box {
  172. // margin-top: -372px - 372px;
  173. // }
  174. .banner {
  175. width: 100%;
  176. height: 110px;
  177. background: url("@/assets/headerBg.jpg") no-repeat;
  178. background-size: contain;
  179. }
  180. .common-width {
  181. width: 1160px;
  182. max-width: 1160px;
  183. min-width: 1160px;
  184. margin: 0 auto;
  185. }
  186. </style>