position.vue 7.6 KB

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