position.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  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. import { getMorningNewsArticle } from '@/api/content'
  64. // 设置自定义tabbar选中值
  65. onShow(() => {
  66. const currentPage = getCurrentPages()[0]; // 获取当前页面实例
  67. const currentTabBar = currentPage?.getTabBar?.();
  68. // 设置当前tab页的下标index
  69. currentTabBar?.setData({ selected: 0 });
  70. })
  71. onLoad(() => {
  72. wx.showShareMenu({
  73. withShareTicket: true,
  74. menus: ['shareAppMessage', 'shareTimeline']
  75. })
  76. onShareAppMessage(() => {
  77. return {
  78. title: '门墩儿 专注顶尖招聘',
  79. path: '/pages/index/position',
  80. imageUrl: '../../static/img/share-poster.jpg'
  81. }
  82. })
  83. onShareTimeline(() => {
  84. return {
  85. title: '门墩儿 专注顶尖招聘',
  86. path: '/pages/index/position',
  87. imageUrl: '../../static/img/share-poster.jpg'
  88. }
  89. })
  90. if (!uni.getStorageSync('token')) getRewardEventList()
  91. })
  92. const inputDialog = ref()
  93. const more = ref('more')
  94. const swiperAdList = [
  95. { src: 'https://minio.menduner.com/dev/menduner/banner/IHG.gif', id: '577540545828753408' },
  96. { src: 'https://minio.citupro.com/dev/menduner/preferredGroup/SWISS-HOTEL-MANAGEMENT-SCHOOL-MBA.jpg' },
  97. { src: 'https://minio.menduner.com/dev/menduner/banner/Marriott.jpg', id: '734173233779183616' },
  98. { src: 'https://minio.menduner.com/dev/menduner/banner/UrCove.jpg', id: '277182701256183808' },
  99. { src: 'https://minio.menduner.com/dev/menduner/miniProgram/Grand-Mercure.jpg', id: '120281807903133696' },
  100. // { src: 'https://minio.menduner.com/dev/5eb89c28816dbc7613986ac994d2d760cc9fada84e17a78970c424904c26667c.jpg', id: '735167920258289664' },
  101. { src: 'https://minio.menduner.com/dev/c2fc649b5aec3811c7a171b199bc2e67bb1649e63b471e48a59c8a6ead6aa047.jpg', weiXinPublicUrl: 'https://mp.weixin.qq.com/s/lI7_iHY1yaEqrb_kG1MusA' },
  102. { src: 'https://minio.menduner.com/dev/fbff08c5608d746380f859a97241109fe4726f776a25301d7d0fb43d9ba7df67.png', weiXinPublicUrl: 'https://mp.weixin.qq.com/s/NrxuXTi7kB9AngNBYJ3v4A' }
  103. ]
  104. const filterList = ref([
  105. { label: '城市', dictType: 'areaTreeDataExtend', key: 'areaIds', map: { text: 'name', value: 'id' } },
  106. // { label: '行业', dictType: 'industryTreeData',key: 'industryIds', map: { text: 'nameCn', value: 'id' } },
  107. { label: '职位', dictType: 'positionTreeData',key: 'positionId', map: { text: 'nameCn', value: 'id' } },
  108. { label: '求职类型', dictType: 'menduner_job_type', key: 'jobType' },
  109. { label: '薪资待遇', dictType: 'menduner_pay_scope', key: 'payScope' },
  110. // { label: '工作经验', dictType: 'menduner_exp_type', key: 'expType' },
  111. ])
  112. const gridList = [
  113. { label: '门墩儿猎头', icon: '/static/img/headhunting.png', path: '' },
  114. { label: '精选企业', icon: '/static/img/enterprise.png', path: '/pagesB/recommendEnterprise/index' },
  115. { label: '酒店英语', icon: '/static/img/group.png', path: '' },
  116. { label: '早报资讯', icon: '/static/img/information.png', id: 'morningNews' },
  117. { label: '风尚榜投票', icon: '/static/img/contact.png', weiXinPublicUrl: 'https%3A%2F%2F6b29.yuandianpx.cn%2F18%2F%23%2Fvote%3Fact%3D31', title:'中国酒店YOUNG风尚榜投票' }
  118. ]
  119. // 跳转企业详情
  120. const handleToDetails = ({ id, weiXinPublicUrl, title }) => {
  121. if (id) {
  122. uni.navigateTo({ url: `/pagesB/companyDetail/index?id=${id}` })
  123. }
  124. if (weiXinPublicUrl) {
  125. uni.navigateTo({ url: `/pages/addWebView/index?url=${weiXinPublicUrl}&title=${title || '风尚榜奖投票'}` })
  126. }
  127. }
  128. const handleGrid = async (e) => {
  129. // uni.showToast({
  130. // icon: 'none',
  131. // title: '请前往网页版门墩儿查看'
  132. // })
  133. // inputDialog.value.open()
  134. const index = e.detail.index
  135. const obj = gridList[index]
  136. // 早报资讯
  137. if (obj?.id === 'morningNews') {
  138. try {
  139. const { data } = await getMorningNewsArticle()
  140. if (data && Object.keys(data).length && data.url) {
  141. uni.navigateTo({
  142. url: `/pages/addWebView/index?url=${data.url}&title=门墩儿早报`
  143. })
  144. } else uni.showToast({ icon: 'none', title: '暂无早报资讯内容' })
  145. } catch (err) {
  146. uni.showToast({ icon: 'none', title: err.msg })
  147. }
  148. }
  149. if (obj?.path) {
  150. uni.navigateTo({
  151. url: obj.path
  152. })
  153. }
  154. if (obj?.weiXinPublicUrl) {
  155. uni.navigateTo({ url: `/pages/addWebView/index?url=${obj?.weiXinPublicUrl}&title=风尚榜奖投票` })
  156. }
  157. }
  158. const positionListData = ref([])
  159. const query = reactive({
  160. pageSize: 20,
  161. pageNo: 1,
  162. hire: false,
  163. content: '',
  164. areaIds: [],
  165. industryIds: [],
  166. jobType: [],
  167. payScope: [],
  168. expType: []
  169. })
  170. const getData = async () => {
  171. try {
  172. const res = await getJobAdvertisedSearch(query)
  173. const list = res?.data?.list || []
  174. positionListData.value.push(...list.map(e => {
  175. if (!e) {
  176. return e
  177. }
  178. e.job = { ...e.job, ...dealDictObjData({}, e.job) }
  179. e.enterprise = { ...e.enterprise, ...dealDictObjData({}, e.enterprise)}
  180. return e
  181. }))
  182. if (positionListData.value.length === +res.data.total) {
  183. more.value = 'noMore'
  184. return
  185. }
  186. } catch (error) {
  187. query.pageNo--
  188. more.value = 'more'
  189. }
  190. }
  191. getData()
  192. const handleSearch = (key, value) => {
  193. if (key === 'positionId' || key === 'payScope') {
  194. query[key] = value || null
  195. } else {
  196. query[key] = value ? [value] : []
  197. }
  198. onSearch()
  199. }
  200. const onSearch = () => {
  201. query.pageNo = 1
  202. positionListData.value = []
  203. getData()
  204. }
  205. const loadingMore = () => { // 加载更多
  206. more.value = 'loading'
  207. query.pageNo++
  208. getData()
  209. }
  210. </script>
  211. <style scoped lang="scss">
  212. .stick {
  213. z-index: 1;
  214. position: sticky;
  215. top: 0;
  216. }
  217. .stickFilter {
  218. z-index: 1;
  219. position: sticky;
  220. box-shadow: 0px 10rpx 12rpx 0px rgba(195, 195, 195, .25);
  221. top: 120rpx;
  222. }
  223. .px-0 { padding-left: 0 !important; padding-right: 0 !important; }
  224. .pb-10 {
  225. padding-bottom: 10px;
  226. }
  227. .pb-20 { padding-bottom: 20px; }
  228. .px-5 { padding-left: 5px; padding-right: 5px; }
  229. .px-10 { padding-left: 10px; padding-right: 10px; }
  230. .mx-10 { margin-left: 10px; margin-right: 10px }
  231. .mx-20 { margin-left: 20px; margin-right: 20px; }
  232. .mb-10 { margin-bottom: 10px; }
  233. .box {
  234. height: 100vh;
  235. overflow: hidden;
  236. padding-bottom: 120rpx;
  237. box-sizing: border-box;
  238. display: flex;
  239. flex-direction: column;
  240. }
  241. .scrollBox{
  242. flex: 1;
  243. height: 0 !important;
  244. padding-bottom: 24rpx;
  245. box-sizing: border-box;
  246. }
  247. :deep(.uni-searchbar__box) {
  248. width: calc(100% - 105px);
  249. height: 40px !important;
  250. border: 1px solid #00897B;
  251. padding-right: 20px;
  252. flex: none;
  253. }
  254. .search-btn {
  255. position: absolute;
  256. right: 11px;
  257. top: 10px;
  258. width: 110px;
  259. height: 40px;
  260. font-size: 16px;
  261. background-color: #00897B;
  262. color: #fff;
  263. border-radius: 0 5px 5px 0;
  264. z-index: 9;
  265. }
  266. :deep(.picker-view) {
  267. padding-bottom: 80px !important;
  268. }
  269. .shareQrCodePopupContent {
  270. width: 75vw;
  271. padding: 40rpx;
  272. margin-bottom: 20rpx;
  273. text-align: center;
  274. background-color: #fff;
  275. }
  276. </style>