position.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <view>
  3. <Navbar></Navbar>
  4. <view class="box defaultBgc">
  5. <scroll-view class="scrollBox" scroll-y="true" @scrolltolower="loadingMore" style="position:relative;">
  6. <view>
  7. <SwiperAd :list="swiperAdList" :strType="false" @click="handleToDetails"></SwiperAd>
  8. <!-- 五宫格菜单 -->
  9. <view class="white-bgc ss-p-t-10">
  10. <uni-grid :column="5" @change="handleGrid" :showBorder="false">
  11. <uni-grid-item v-for="(val, index) in gridList" :index="index" :key="index">
  12. <view class="d-flex align-center flex-column justify-center" style="width: 100%; height: 100%; border: none;">
  13. <image :src="val.icon" style="width: 35px; height: 35px;"></image>
  14. <text class="text color-666 font-size-14 ss-m-t-15">{{ val.label }}</text>
  15. </view>
  16. </uni-grid-item>
  17. </uni-grid>
  18. </view>
  19. <!-- 搜索条 -->
  20. <view class="white-bgc stick ss-p-t-10">
  21. <view style="position: relative;">
  22. <uni-search-bar
  23. v-model="query.content"
  24. placeholder="请输入职位/公司关键字"
  25. cancelButton="none"
  26. :focus="false"
  27. bgColor="#fff"
  28. @confirm="onSearch($event.value)"
  29. @clear="query.content = ''; onSearch()"
  30. >
  31. </uni-search-bar>
  32. <button class="search-btn" @tap.stop="onSearch">搜索</button>
  33. </view>
  34. </view>
  35. <view class="white-bgc px-10 stickFilter">
  36. <FilterList :list="filterList" idValue="label" @change="handleSearch"></FilterList>
  37. </view>
  38. <PositionList :list="positionListData" :noMore="false"></PositionList>
  39. <uni-load-more :status="more" />
  40. </view>
  41. </scroll-view>
  42. <AdvertisePop></AdvertisePop>
  43. <uni-popup ref="inputDialog" type="dialog">
  44. <view class="shareQrCodePopupContent">
  45. <view class="ss-m-b-10">请前往网页版门墩儿查看</view>
  46. <uni-link href="https://www.menduner.com" text="点击复制网页地址" color="#00897B" fontSize="16" copyTips="已复制,请在电脑端打开"></uni-link>
  47. </view>
  48. </uni-popup>
  49. </view>
  50. </view>
  51. </template>
  52. <script setup>
  53. import { ref, reactive } from 'vue'
  54. import SwiperAd from '@/components/SwiperAd'
  55. import FilterList from '@/components/FilterList'
  56. import PositionList from '@/components/PositionList'
  57. import AdvertisePop from '@/components/Advertisement'
  58. import { dealDictObjData } from '@/utils/position'
  59. import { getJobAdvertisedSearch } from '@/api/position'
  60. import { onShow, onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
  61. import Navbar from '@/components/Navbar'
  62. import { getRewardEventList } from '@/utils/eventList'
  63. // 设置自定义tabbar选中值
  64. onShow(() => {
  65. const currentPage = getCurrentPages()[0]; // 获取当前页面实例
  66. const currentTabBar = currentPage?.getTabBar?.();
  67. // 设置当前tab页的下标index
  68. currentTabBar?.setData({ selected: 0 });
  69. })
  70. onLoad(() => {
  71. wx.showShareMenu({
  72. withShareTicket: true,
  73. menus: ['shareAppMessage', 'shareTimeline']
  74. })
  75. onShareAppMessage(() => {
  76. return {
  77. title: '门墩儿 专注顶尖招聘',
  78. path: '/pages/index/position'
  79. }
  80. })
  81. onShareTimeline(() => {
  82. return {
  83. title: '门墩儿 专注顶尖招聘',
  84. path: '/pages/index/position'
  85. }
  86. })
  87. if (!uni.getStorageSync('token')) getRewardEventList()
  88. })
  89. const inputDialog = ref()
  90. const more = ref('more')
  91. const swiperAdList = [
  92. { src: 'https://minio.menduner.com/dev/menduner/banner/IHG.gif', id: '577540545828753408' },
  93. { src: 'https://minio.menduner.com/dev/menduner/banner/Marriott.jpg', id: '734173233779183616' },
  94. { src: 'https://minio.menduner.com/dev/menduner/banner/UrCove.jpg', id: '277182701256183808' },
  95. { src: 'https://minio.menduner.com/dev/menduner/miniProgram/Grand-Mercure.jpg', id: '120281807903133696' }
  96. ]
  97. const filterList = ref([
  98. { label: '城市', dictType: 'areaTreeDataExtend', key: 'areaIds', map: { text: 'name', value: 'id' } },
  99. // { label: '行业', dictType: 'industryTreeData',key: 'industryIds', map: { text: 'nameCn', value: 'id' } },
  100. { label: '职位', dictType: 'positionTreeData',key: 'positionId', map: { text: 'nameCn', value: 'id' } },
  101. { label: '求职类型', dictType: 'menduner_job_type', key: 'jobType' },
  102. { label: '薪资待遇', dictType: 'menduner_pay_scope', key: 'payScope' },
  103. // { label: '工作经验', dictType: 'menduner_exp_type', key: 'expType' },
  104. ])
  105. const gridList = [
  106. { label: '优选集团', icon: '/static/img/group.png', path: '' },
  107. { label: '精选企业', icon: '/static/img/enterprise.png', path: '' },
  108. { label: '门墩儿猎头', icon: '/static/img/headhunting.png', path: '' },
  109. { label: '早报资讯', icon: '/static/img/information.png', specifications: 50, path: '' },
  110. { label: '联系我们', icon: '/static/img/contact.png', path: '' }
  111. ]
  112. // 跳转企业详情
  113. const handleToDetails = ({ id }) => {
  114. if (!id) return
  115. uni.navigateTo({
  116. url: `/pagesB/companyDetail/index?id=${id}`
  117. })
  118. }
  119. const handleGrid = (e) => {
  120. // uni.showToast({
  121. // icon: 'none',
  122. // title: '请前往网页版门墩儿查看'
  123. // })
  124. // inputDialog.value.open()
  125. // wx79f9c2db3c3a35e3
  126. }
  127. //
  128. const positionListData = ref([])
  129. const query = reactive({
  130. pageSize: 20,
  131. pageNo: 1,
  132. content: '',
  133. areaIds: [],
  134. industryIds: [],
  135. jobType: [],
  136. payScope: [],
  137. expType: []
  138. })
  139. //
  140. const getData = async () => {
  141. try {
  142. const res = await getJobAdvertisedSearch(query)
  143. const list = res?.data?.list || []
  144. positionListData.value.push(...list.map(e => {
  145. if (!e) {
  146. return e
  147. }
  148. e.job = { ...e.job, ...dealDictObjData({}, e.job) }
  149. e.enterprise = { ...e.enterprise, ...dealDictObjData({}, e.enterprise)}
  150. return e
  151. }))
  152. if (positionListData.value.length === +res.data.total) {
  153. more.value = 'noMore'
  154. return
  155. }
  156. } catch (error) {
  157. query.pageNo--
  158. more.value = 'more'
  159. }
  160. }
  161. getData()
  162. const handleSearch = (key, value) => {
  163. if (key === 'positionId' || key === 'payScope') {
  164. query[key] = value || null
  165. } else {
  166. query[key] = value ? [value] : []
  167. }
  168. onSearch()
  169. }
  170. const onSearch = () => {
  171. query.pageNo = 1
  172. positionListData.value = []
  173. getData()
  174. }
  175. const loadingMore = () => { // 加载更多
  176. more.value = 'loading'
  177. query.pageNo++
  178. getData()
  179. }
  180. </script>
  181. <style scoped lang="scss">
  182. .stick {
  183. z-index: 1;
  184. position: sticky;
  185. top: 0;
  186. }
  187. .stickFilter {
  188. z-index: 1;
  189. position: sticky;
  190. box-shadow: 0px 10rpx 12rpx 0px rgba(195, 195, 195, .25);
  191. top: 100rpx;
  192. }
  193. .px-0 { padding-left: 0 !important; padding-right: 0 !important; }
  194. .pb-10 {
  195. padding-bottom: 10px;
  196. }
  197. .pb-20 { padding-bottom: 20px; }
  198. .px-5 { padding-left: 5px; padding-right: 5px; }
  199. .px-10 { padding-left: 10px; padding-right: 10px; }
  200. .mx-10 { margin-left: 10px; margin-right: 10px }
  201. .mx-20 { margin-left: 20px; margin-right: 20px; }
  202. .mb-10 { margin-bottom: 10px; }
  203. .box {
  204. height: 100vh;
  205. overflow: hidden;
  206. padding-bottom: 120rpx;
  207. box-sizing: border-box;
  208. display: flex;
  209. flex-direction: column;
  210. }
  211. .scrollBox{
  212. flex: 1;
  213. height: 0 !important;
  214. padding-bottom: 24rpx;
  215. box-sizing: border-box;
  216. }
  217. :deep(.uni-searchbar__box) {
  218. width: calc(100% - 105px);
  219. height: 40px !important;
  220. border: 1px solid #00897B;
  221. padding-right: 20px;
  222. flex: none;
  223. }
  224. .search-btn {
  225. position: absolute;
  226. right: 11px;
  227. top: 10px;
  228. width: 110px;
  229. height: 40px;
  230. font-size: 16px;
  231. background-color: #00897B;
  232. color: #fff;
  233. border-radius: 0 5px 5px 0;
  234. z-index: 9;
  235. }
  236. :deep(.picker-view) {
  237. padding-bottom: 80px !important;
  238. }
  239. .shareQrCodePopupContent {
  240. width: 75vw;
  241. padding: 40rpx;
  242. margin-bottom: 20rpx;
  243. text-align: center;
  244. background-color: #fff;
  245. }
  246. </style>