position.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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.citupro.com/dev/menduner/miniProgram/banner1.gif',
  81. 'https://minio.citupro.com/dev/menduner/miniProgram/banner2.jpg',
  82. 'https://minio.citupro.com/dev/menduner/miniProgram/banner3.jpg',
  83. 'https://minio.citupro.com/dev/menduner/miniProgram/banner4.jpg'
  84. ]
  85. const filterList = ref([
  86. { label: '城市', dictType: 'areaTreeData', key: 'areaIds', map: { text: 'name', value: 'id' } },
  87. // { label: '行业', dictType: 'industryTreeData',key: 'industryIds', map: { text: 'nameCn', value: 'id' } },
  88. { label: '职位', dictType: 'positionTreeData',key: 'positionId', map: { text: 'nameCn', value: 'id' } },
  89. { label: '求职类型', dictType: 'menduner_job_type', key: 'jobType' },
  90. { label: '薪资待遇', dictType: 'menduner_pay_scope', key: 'payScope' },
  91. // { label: '工作经验', dictType: 'menduner_exp_type', key: 'expType' },
  92. ])
  93. const gridList = [
  94. { label: '优选集团', icon: '/static/svg/jituan.svg', path: '' },
  95. { label: '精选企业', icon: '/static/svg/qiye.svg', path: '' },
  96. { label: '门墩儿猎头', icon: '/static/svg/lietou.svg', path: '' },
  97. { label: '早报资讯', icon: '/static/svg/zixun.svg', specifications: 50, path: '' },
  98. { label: '联系我们', icon: '/static/svg/kefu.svg', path: '' }
  99. ]
  100. const handleGrid = (e) => {
  101. // uni.showToast({
  102. // icon: 'none',
  103. // title: '请前往网页版门墩儿查看'
  104. // })
  105. // inputDialog.value.open()
  106. }
  107. //
  108. const positionListData = ref([])
  109. const query = reactive({
  110. pageSize: 20,
  111. pageNo: 1,
  112. content: '',
  113. areaIds: [],
  114. industryIds: [],
  115. jobType: [],
  116. payScope: [],
  117. expType: []
  118. })
  119. //
  120. const getData = async () => {
  121. try {
  122. const res = await getJobAdvertisedSearch(query)
  123. const list = res?.data?.list || []
  124. positionListData.value.push(...list.map(e => {
  125. if (!e) {
  126. return e
  127. }
  128. e.job = { ...e.job, ...dealDictObjData({}, e.job) }
  129. e.enterprise = { ...e.enterprise, ...dealDictObjData({}, e.enterprise)}
  130. return e
  131. }))
  132. if (positionListData.value.length === +res.data.total) {
  133. more.value = 'noMore'
  134. return
  135. }
  136. } catch (error) {
  137. query.pageNo--
  138. more.value = 'more'
  139. }
  140. }
  141. getData()
  142. const handleSearch = (key, value) => {
  143. if (key === 'positionId' || key === 'payScope') {
  144. query[key] = value || null
  145. } else {
  146. query[key] = value ? [value] : []
  147. }
  148. onSearch()
  149. }
  150. const onSearch = () => {
  151. query.pageNo = 1
  152. positionListData.value = []
  153. getData()
  154. }
  155. const loadingMore = () => { // 加载更多
  156. more.value = 'loading'
  157. query.pageNo++
  158. getData()
  159. }
  160. </script>
  161. <style scoped lang="scss">
  162. .stick {
  163. z-index: 1;
  164. position: sticky;
  165. top: 0;
  166. }
  167. .stickFilter {
  168. z-index: 1;
  169. position: sticky;
  170. box-shadow: 0px 10rpx 12rpx 0px rgba(195, 195, 195, .25);
  171. top: 100rpx;
  172. }
  173. .px-0 { padding-left: 0 !important; padding-right: 0 !important; }
  174. .pb-10 {
  175. padding-bottom: 10px;
  176. }
  177. .pb-20 { padding-bottom: 20px; }
  178. .px-5 { padding-left: 5px; padding-right: 5px; }
  179. .px-10 { padding-left: 10px; padding-right: 10px; }
  180. .mx-10 { margin-left: 10px; margin-right: 10px }
  181. .mx-20 { margin-left: 20px; margin-right: 20px; }
  182. .mb-10 { margin-bottom: 10px; }
  183. .box {
  184. height: 100vh;
  185. overflow: hidden;
  186. padding-bottom: 120rpx;
  187. box-sizing: border-box;
  188. display: flex;
  189. flex-direction: column;
  190. }
  191. .scrollBox{
  192. flex: 1;
  193. height: 0 !important;
  194. padding-bottom: 24rpx;
  195. box-sizing: border-box;
  196. }
  197. :deep(.uni-searchbar__box) {
  198. width: calc(100% - 105px);
  199. height: 40px !important;
  200. border: 1px solid #00897B;
  201. padding-right: 20px;
  202. flex: none;
  203. }
  204. .search-btn {
  205. position: absolute;
  206. right: 11px;
  207. top: 10px;
  208. width: 110px;
  209. height: 40px;
  210. font-size: 16px;
  211. background-color: #00897B;
  212. color: #fff;
  213. border-radius: 0 5px 5px 0;
  214. z-index: 9;
  215. }
  216. :deep(.picker-view) {
  217. padding-bottom: 80px !important;
  218. }
  219. .shareQrCodePopupContent {
  220. width: 75vw;
  221. padding: 40rpx;
  222. margin-bottom: 20rpx;
  223. text-align: center;
  224. background-color: #fff;
  225. }
  226. </style>