position.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  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 class="text color-666 font-size-14 ss-m-t-15" @click="handleGrid1">https://www.yuandianpx.cn</view>
  19. <view class="text color-666 font-size-14 ss-m-t-15" @click="handleGrid2">https://6b29.yuandianpx.cn/18/#/vote?act=31</view>
  20. <view class="text color-666 font-size-14 ss-m-t-15" @click="handleGrid3">https://api.yuandianpx.cn/webapi/login/weiXinLogin?act=31</view> -->
  21. </view>
  22. <!-- 搜索条 -->
  23. <view class="white-bgc stick ss-p-t-10">
  24. <view style="position: relative;">
  25. <uni-search-bar
  26. v-model="query.content"
  27. placeholder="请输入职位/公司关键字"
  28. cancelButton="none"
  29. :focus="false"
  30. bgColor="#fff"
  31. @confirm="onSearch($event.value)"
  32. @clear="query.content = ''; onSearch()"
  33. >
  34. </uni-search-bar>
  35. <button class="search-btn" @tap.stop="onSearch">搜索</button>
  36. </view>
  37. </view>
  38. <view class="white-bgc px-10 stickFilter">
  39. <FilterList :list="filterList" idValue="label" @change="handleSearch"></FilterList>
  40. </view>
  41. <PositionList :list="positionListData" :noMore="false"></PositionList>
  42. <uni-load-more :status="more" />
  43. </view>
  44. </scroll-view>
  45. <AdvertisePop></AdvertisePop>
  46. <uni-popup ref="inputDialog" type="dialog">
  47. <view class="shareQrCodePopupContent">
  48. <view class="ss-m-b-10">请前往网页版门墩儿查看</view>
  49. <uni-link href="https://www.menduner.com" text="点击复制网页地址" color="#00897B" fontSize="16" copyTips="已复制,请在电脑端打开"></uni-link>
  50. </view>
  51. </uni-popup>
  52. </view>
  53. </view>
  54. </template>
  55. <script setup>
  56. import { ref, reactive } from 'vue'
  57. import SwiperAd from '@/components/SwiperAd'
  58. import FilterList from '@/components/FilterList'
  59. import PositionList from '@/components/PositionList'
  60. import AdvertisePop from '@/components/Advertisement'
  61. import { dealDictObjData } from '@/utils/position'
  62. import { getJobAdvertisedSearch } from '@/api/position'
  63. import { onShow, onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
  64. import Navbar from '@/components/Navbar'
  65. import { getRewardEventList } from '@/utils/eventList'
  66. import { getMorningNewsArticle } from '@/api/content'
  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. imageUrl: '../../static/img/share-poster.jpg'
  84. }
  85. })
  86. onShareTimeline(() => {
  87. return {
  88. title: '门墩儿 专注顶尖招聘',
  89. path: '/pages/index/position',
  90. imageUrl: '../../static/img/share-poster.jpg'
  91. }
  92. })
  93. if (!uni.getStorageSync('token')) getRewardEventList()
  94. })
  95. const inputDialog = ref()
  96. const more = ref('more')
  97. const swiperAdList = [
  98. { src: 'https://minio.menduner.com/dev/menduner/banner/IHG.gif', id: '577540545828753408' },
  99. { src: 'https://minio.citupro.com/dev/menduner/preferredGroup/SWISS-HOTEL-MANAGEMENT-SCHOOL-MBA.jpg' },
  100. { src: 'https://minio.menduner.com/dev/menduner/banner/Marriott.jpg', id: '734173233779183616' },
  101. { src: 'https://minio.menduner.com/dev/menduner/banner/UrCove.jpg', id: '277182701256183808' },
  102. { src: 'https://minio.menduner.com/dev/menduner/miniProgram/Grand-Mercure.jpg', id: '120281807903133696' },
  103. { src: 'https://minio.menduner.com/dev/5eb89c28816dbc7613986ac994d2d760cc9fada84e17a78970c424904c26667c.jpg', id: '735167920258289664' },
  104. { src: 'https://minio.menduner.com/dev/c2fc649b5aec3811c7a171b199bc2e67bb1649e63b471e48a59c8a6ead6aa047.jpg', weiXinPublicUrl: 'https://mp.weixin.qq.com/s/lI7_iHY1yaEqrb_kG1MusA' },
  105. { src: 'https://minio.menduner.com/dev/fbff08c5608d746380f859a97241109fe4726f776a25301d7d0fb43d9ba7df67.png', weiXinPublicUrl: 'https://mp.weixin.qq.com/s/NrxuXTi7kB9AngNBYJ3v4A' }
  106. ]
  107. const filterList = ref([
  108. { label: '城市', dictType: 'areaTreeDataExtend', key: 'areaIds', map: { text: 'name', value: 'id' } },
  109. // { label: '行业', dictType: 'industryTreeData',key: 'industryIds', map: { text: 'nameCn', value: 'id' } },
  110. { label: '职位', dictType: 'positionTreeData',key: 'positionId', map: { text: 'nameCn', value: 'id' } },
  111. { label: '求职类型', dictType: 'menduner_job_type', key: 'jobType' },
  112. { label: '薪资待遇', dictType: 'menduner_pay_scope', key: 'payScope' },
  113. // { label: '工作经验', dictType: 'menduner_exp_type', key: 'expType' },
  114. ])
  115. const gridList = [
  116. { label: '优选集团', icon: '/static/img/group.png', path: '' },
  117. { label: '精选企业', icon: '/static/img/enterprise.png', path: '/pagesB/recommendEnterprise/index' },
  118. { label: '门墩儿猎头', icon: '/static/img/headhunting.png', path: '' },
  119. { label: '早报资讯', icon: '/static/img/information.png', id: 'morningNews' },
  120. { label: '奖项报名', icon: '/static/img/contact.png', weiXinPublicUrl: 'https://mp.weixin.qq.com/s/lI7_iHY1yaEqrb_kG1MusA' }
  121. // { label: '奖项报名', icon: '/static/img/contact.png', weiXinPublicUrl: 'https://6b29.yuandianpx.cn/18/#/vote?act=31' }
  122. ]
  123. // 跳转企业详情
  124. const handleToDetails = ({ id, weiXinPublicUrl }) => {
  125. if (id) {
  126. uni.navigateTo({ url: `/pagesB/companyDetail/index?id=${id}` })
  127. }
  128. if (weiXinPublicUrl) {
  129. uni.navigateTo({ url: `/pages/addWebView/index?url=${weiXinPublicUrl}&title=风尚年度榜奖项报名` })
  130. }
  131. }
  132. // const handleGrid1 = async (e) => {
  133. // uni.navigateTo({ url: `/pages/addWebView/index?url=https://www.yuandianpx.cn` })
  134. // }
  135. // const handleGrid2 = async (e) => {
  136. // uni.navigateTo({ url: `/pages/addWebView/index?url=https://6b29.yuandianpx.cn/18/#/vote?act=31` })
  137. // }
  138. // const handleGrid3 = async (e) => {
  139. // uni.navigateTo({ url: `/pages/addWebView/index?url=https://api.yuandianpx.cn/webapi/login/weiXinLogin?act=31` })
  140. // }
  141. const handleGrid = async (e) => {
  142. // uni.showToast({
  143. // icon: 'none',
  144. // title: '请前往网页版门墩儿查看'
  145. // })
  146. // inputDialog.value.open()
  147. const index = e.detail.index
  148. const obj = gridList[index]
  149. // 早报资讯
  150. if (obj?.id === 'morningNews') {
  151. try {
  152. const { data } = await getMorningNewsArticle()
  153. if (data && Object.keys(data).length && data.url) {
  154. uni.navigateTo({
  155. url: `/pages/addWebView/index?url=${data.url}&title=门墩儿早报`
  156. })
  157. } else uni.showToast({ icon: 'none', title: '暂无早报资讯内容' })
  158. } catch (err) {
  159. uni.showToast({ icon: 'none', title: err.msg })
  160. }
  161. }
  162. if (obj?.path) {
  163. uni.navigateTo({
  164. url: obj.path
  165. })
  166. }
  167. if (obj?.weiXinPublicUrl) {
  168. uni.navigateTo({ url: `/pages/addWebView/index?url=${obj?.weiXinPublicUrl}&title=风尚年度榜奖项报名` })
  169. }
  170. }
  171. const positionListData = ref([])
  172. const query = reactive({
  173. pageSize: 20,
  174. pageNo: 1,
  175. hire: false,
  176. content: '',
  177. areaIds: [],
  178. industryIds: [],
  179. jobType: [],
  180. payScope: [],
  181. expType: []
  182. })
  183. const getData = async () => {
  184. try {
  185. const res = await getJobAdvertisedSearch(query)
  186. const list = res?.data?.list || []
  187. positionListData.value.push(...list.map(e => {
  188. if (!e) {
  189. return e
  190. }
  191. e.job = { ...e.job, ...dealDictObjData({}, e.job) }
  192. e.enterprise = { ...e.enterprise, ...dealDictObjData({}, e.enterprise)}
  193. return e
  194. }))
  195. if (positionListData.value.length === +res.data.total) {
  196. more.value = 'noMore'
  197. return
  198. }
  199. } catch (error) {
  200. query.pageNo--
  201. more.value = 'more'
  202. }
  203. }
  204. getData()
  205. const handleSearch = (key, value) => {
  206. if (key === 'positionId' || key === 'payScope') {
  207. query[key] = value || null
  208. } else {
  209. query[key] = value ? [value] : []
  210. }
  211. onSearch()
  212. }
  213. const onSearch = () => {
  214. query.pageNo = 1
  215. positionListData.value = []
  216. getData()
  217. }
  218. const loadingMore = () => { // 加载更多
  219. more.value = 'loading'
  220. query.pageNo++
  221. getData()
  222. }
  223. </script>
  224. <style scoped lang="scss">
  225. .stick {
  226. z-index: 1;
  227. position: sticky;
  228. top: 0;
  229. }
  230. .stickFilter {
  231. z-index: 1;
  232. position: sticky;
  233. box-shadow: 0px 10rpx 12rpx 0px rgba(195, 195, 195, .25);
  234. top: 120rpx;
  235. }
  236. .px-0 { padding-left: 0 !important; padding-right: 0 !important; }
  237. .pb-10 {
  238. padding-bottom: 10px;
  239. }
  240. .pb-20 { padding-bottom: 20px; }
  241. .px-5 { padding-left: 5px; padding-right: 5px; }
  242. .px-10 { padding-left: 10px; padding-right: 10px; }
  243. .mx-10 { margin-left: 10px; margin-right: 10px }
  244. .mx-20 { margin-left: 20px; margin-right: 20px; }
  245. .mb-10 { margin-bottom: 10px; }
  246. .box {
  247. height: 100vh;
  248. overflow: hidden;
  249. padding-bottom: 120rpx;
  250. box-sizing: border-box;
  251. display: flex;
  252. flex-direction: column;
  253. }
  254. .scrollBox{
  255. flex: 1;
  256. height: 0 !important;
  257. padding-bottom: 24rpx;
  258. box-sizing: border-box;
  259. }
  260. :deep(.uni-searchbar__box) {
  261. width: calc(100% - 105px);
  262. height: 40px !important;
  263. border: 1px solid #00897B;
  264. padding-right: 20px;
  265. flex: none;
  266. }
  267. .search-btn {
  268. position: absolute;
  269. right: 11px;
  270. top: 10px;
  271. width: 110px;
  272. height: 40px;
  273. font-size: 16px;
  274. background-color: #00897B;
  275. color: #fff;
  276. border-radius: 0 5px 5px 0;
  277. z-index: 9;
  278. }
  279. :deep(.picker-view) {
  280. padding-bottom: 80px !important;
  281. }
  282. .shareQrCodePopupContent {
  283. width: 75vw;
  284. padding: 40rpx;
  285. margin-bottom: 20rpx;
  286. text-align: center;
  287. background-color: #fff;
  288. }
  289. </style>