position.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  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. </view>
  45. </layout-page>
  46. </view>
  47. </template>
  48. <script setup>
  49. import { ref, reactive } from 'vue'
  50. import SwiperAd from '@/components/SwiperAd'
  51. import FilterList from '@/components/FilterList'
  52. import PositionList from '@/components/PositionList'
  53. import AdvertisePop from '@/components/Advertisement'
  54. import { dealDictObjData } from '@/utils/position'
  55. import { getJobAdvertisedSearch } from '@/api/position'
  56. import { showAuthModal } from '@/hooks/useModal'
  57. import { onShow, onLoad } from '@dcloudio/uni-app'
  58. import layoutPage from '@/layout'
  59. import Navbar from '@/components/Navbar'
  60. import { getRewardEventList } from '@/utils/eventList'
  61. // 设置自定义tabbar选中值
  62. onShow(() => {
  63. const currentPage = getCurrentPages()[0]; // 获取当前页面实例
  64. const currentTabBar = currentPage?.getTabBar?.();
  65. // 设置当前tab页的下标index
  66. currentTabBar?.setData({ selected: 0 });
  67. })
  68. onLoad(() => {
  69. if (!uni.getStorageSync('token')) getRewardEventList()
  70. })
  71. const more = ref('more')
  72. const swiperAdList = [
  73. 'https://minio.citupro.com/dev/menduner/miniProgram/banner1.gif',
  74. 'https://minio.citupro.com/dev/menduner/miniProgram/banner2.jpg',
  75. 'https://minio.citupro.com/dev/menduner/miniProgram/banner3.jpg',
  76. 'https://minio.citupro.com/dev/menduner/miniProgram/banner4.jpg'
  77. ]
  78. const filterList = ref([
  79. { label: '城市', dictType: 'areaTreeData', key: 'areaIds', map: { text: 'name', value: 'id' } },
  80. // { label: '行业', dictType: 'industryTreeData',key: 'industryIds', map: { text: 'nameCn', value: 'id' } },
  81. { label: '职位', dictType: 'positionTreeData',key: 'positionId', map: { text: 'nameCn', value: 'id' } },
  82. { label: '求职类型', dictType: 'menduner_job_type', key: 'jobType' },
  83. { label: '薪资待遇', dictType: 'menduner_pay_scope', key: 'payScope' },
  84. // { label: '工作经验', dictType: 'menduner_exp_type', key: 'expType' },
  85. ])
  86. const gridList = [
  87. { label: '优选集团', icon: '/static/svg/jituan.svg', path: '' },
  88. { label: '精选企业', icon: '/static/svg/qiye.svg', path: '' },
  89. { label: '门墩儿猎头', icon: '/static/svg/lietou.svg', path: '' },
  90. { label: '早报资讯', icon: '/static/svg/zixun.svg', specifications: 50, path: '' },
  91. { label: '联系我们', icon: '/static/svg/kefu.svg', path: '' }
  92. ]
  93. const handleGrid = (e) => {
  94. uni.showToast({
  95. icon: 'none',
  96. title: '请前往网页版门墩儿查看'
  97. })
  98. }
  99. //
  100. const positionListData = ref([])
  101. const query = reactive({
  102. pageSize: 20,
  103. pageNo: 1,
  104. content: '',
  105. areaIds: [],
  106. industryIds: [],
  107. jobType: [],
  108. payScope: [],
  109. expType: []
  110. })
  111. //
  112. const getData = async () => {
  113. try {
  114. const res = await getJobAdvertisedSearch(query)
  115. const list = res?.data?.list || []
  116. positionListData.value.push(...list.map(e => {
  117. if (!e) {
  118. return e
  119. }
  120. e.job = { ...e.job, ...dealDictObjData({}, e.job) }
  121. e.enterprise = { ...e.enterprise, ...dealDictObjData({}, e.enterprise)}
  122. return e
  123. }))
  124. if (positionListData.value.length === +res.data.total) {
  125. more.value = 'noMore'
  126. return
  127. }
  128. } catch (error) {
  129. query.pageNo--
  130. more.value = 'more'
  131. }
  132. }
  133. getData()
  134. const handleSearch = (key, value) => {
  135. if (key === 'positionId' || key === 'payScope') {
  136. query[key] = value || null
  137. } else {
  138. query[key] = value ? [value] : []
  139. }
  140. onSearch()
  141. }
  142. const onSearch = () => {
  143. query.pageNo = 1
  144. positionListData.value = []
  145. getData()
  146. }
  147. const loadingMore = () => { // 加载更多
  148. more.value = 'loading'
  149. query.pageNo++
  150. getData()
  151. }
  152. </script>
  153. <style scoped lang="scss">
  154. .stick {
  155. z-index: 1;
  156. position: sticky;
  157. top: 0;
  158. }
  159. .stickFilter {
  160. z-index: 1;
  161. position: sticky;
  162. box-shadow: 0px 10rpx 12rpx 0px rgba(195, 195, 195, .25);
  163. top: 100rpx;
  164. }
  165. .px-0 { padding-left: 0 !important; padding-right: 0 !important; }
  166. .pb-10 {
  167. padding-bottom: 10px;
  168. }
  169. .pb-20 { padding-bottom: 20px; }
  170. .px-5 { padding-left: 5px; padding-right: 5px; }
  171. .px-10 { padding-left: 10px; padding-right: 10px; }
  172. .mx-10 { margin-left: 10px; margin-right: 10px }
  173. .mx-20 { margin-left: 20px; margin-right: 20px; }
  174. .mb-10 { margin-bottom: 10px; }
  175. .box {
  176. height: 100vh;
  177. overflow: hidden;
  178. padding-bottom: 120rpx;
  179. box-sizing: border-box;
  180. display: flex;
  181. flex-direction: column;
  182. }
  183. .scrollBox{
  184. flex: 1;
  185. height: 0 !important;
  186. padding-bottom: 24rpx;
  187. box-sizing: border-box;
  188. }
  189. :deep(.uni-searchbar__box) {
  190. width: calc(100% - 105px);
  191. height: 40px !important;
  192. border: 1px solid #00897B;
  193. padding-right: 20px;
  194. flex: none;
  195. }
  196. .search-btn {
  197. position: absolute;
  198. right: 11px;
  199. top: 10px;
  200. width: 110px;
  201. height: 40px;
  202. font-size: 16px;
  203. background-color: #00897B;
  204. color: #fff;
  205. border-radius: 0 5px 5px 0;
  206. z-index: 9;
  207. }
  208. </style>