position.vue 7.2 KB

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