crowdsourcing.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <template>
  2. <layout-page>
  3. <view class="content defaultBgc">
  4. <view class="content-top">
  5. <view class="content-top-title">
  6. <view class="content-top-title-label">
  7. <text class="content-top-title-label-l">全员猎寻</text>
  8. <text class="content-top-title-label-s">海量岗位 | 推荐有赏</text>
  9. </view>
  10. </view>
  11. </view>
  12. <scroll-view class="scrollBox" scroll-y="true" @scrolltolower="loadingMore" style="position:relative;">
  13. <view class="content-top">
  14. <view class="content-top-carousel">
  15. <view class="content-top-carousel-box">
  16. <SwiperAd :list="swiperAdList" imgUrlKey="img" :strType="false" @click="handleToDetails"></SwiperAd>
  17. </view>
  18. </view>
  19. <view class="content-top-recommend">
  20. <view class="content-top-recommend-box">
  21. <resume-status>
  22. <template #header>
  23. <view class="content-top-recommend-box-title">
  24. <text class="title">我的推荐</text>
  25. </view>
  26. </template>
  27. </resume-status>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="content-main">
  32. <view class="content-main-list">
  33. <PositionList :list="items" :noMore="false"></PositionList>
  34. <uni-load-more :status="more" />
  35. </view>
  36. </view>
  37. </scroll-view>
  38. </view>
  39. </layout-page>
  40. </template>
  41. <script setup>
  42. import { ref, reactive } from 'vue'
  43. import SwiperAd from '@/components/SwiperAd'
  44. import layoutPage from '@/layout'
  45. import ResumeStatus from '@/components/ResumeStatus'
  46. import { getJobAdvertisedHire } from '@/api/position.js'
  47. import { dealDictArrayData } from '@/utils/position.js'
  48. import PositionList from '@/components/PositionList'
  49. import { getWebContent } from '@/api/common'
  50. import { onShow, onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
  51. // 设置自定义tabbar选中值
  52. onShow(() => {
  53. const currentPage = getCurrentPages()[0]; // 获取当前页面实例
  54. const currentTabBar = currentPage?.getTabBar?.();
  55. // 设置当前tab页的下标index
  56. currentTabBar?.setData({ selected: 3 });
  57. })
  58. // 获取轮播图
  59. const swiperAdList = ref([])
  60. const getSystemWebContent = async () => {
  61. const { data } = await getWebContent()
  62. swiperAdList.value = data.appHomeCarousel || []
  63. }
  64. getSystemWebContent()
  65. const items = reactive([])
  66. const pageInfo = ref({
  67. pageNo: 1,
  68. pageSize: 20
  69. })
  70. const loading = ref(false)
  71. const total = ref(0)
  72. const more = ref('more')
  73. // 跳转企业详情
  74. const handleToDetails = ({ link, title }) => {
  75. // if (id) {
  76. // uni.navigateTo({ url: `/pagesB/companyDetail/index?id=${id}` })
  77. // }
  78. if (link) {
  79. uni.navigateTo({ url: `/pages/addWebView/index?url=${link}&title=${title || '风尚榜奖投票'}` })
  80. }
  81. }
  82. onLoad(() => {
  83. getList()
  84. wx.showShareMenu({
  85. withShareTicket: true,
  86. menus: ['shareAppMessage', 'shareTimeline']
  87. })
  88. onShareAppMessage(() => {
  89. return {
  90. title: '门墩儿 专注顶尖招聘',
  91. path: '/pages/index/position',
  92. imageUrl: '../../static/img/share-poster.jpg'
  93. }
  94. })
  95. onShareTimeline(() => {
  96. return {
  97. title: '门墩儿 专注顶尖招聘',
  98. path: '/pages/index/position',
  99. imageUrl: '../../static/img/share-poster.jpg'
  100. }
  101. })
  102. })
  103. const loadingMore = (e) => {
  104. if (total.value === items.length) {
  105. return
  106. }
  107. if (loading.value) {
  108. return
  109. }
  110. more.value = 'loading'
  111. pageInfo.value.pageNo++
  112. getList()
  113. }
  114. async function getList () {
  115. loading.value = true
  116. try {
  117. const { data } = await getJobAdvertisedHire({
  118. ...pageInfo.value
  119. })
  120. if (!data?.list) {
  121. pageInfo.pageNo--
  122. return
  123. }
  124. const _items = dealDictArrayData([], data.list)
  125. items.push(..._items.map(e => {
  126. return {
  127. job: e,
  128. enterprise: {
  129. welfareList: e.tagList,
  130. logoUrl: e.logoUrl,
  131. anotherName: e.anotherName,
  132. industryName: e.industryName,
  133. scaleName: e.scaleName
  134. }
  135. }
  136. }))
  137. total.value = +data.total
  138. more.value = items.length === total.value ? 'noMore' : 'more'
  139. } catch (error) {
  140. more.value = more
  141. pageInfo.pageNo--
  142. } finally {
  143. loading.value = false
  144. }
  145. }
  146. </script>
  147. <style scoped lang="scss">
  148. $defaultColor: #999;
  149. @mixin box {
  150. // border-radius: 24rpx;
  151. width: 100%;
  152. height: 100%;
  153. background: #FFF;
  154. overflow: hidden;
  155. }
  156. .content {
  157. height: 100vh;
  158. display: flex;
  159. flex-direction: column;
  160. &-top {
  161. &-title {
  162. padding: 24rpx;
  163. box-sizing: border-box;
  164. width: 100%;
  165. display: flex;
  166. justify-content: space-between;
  167. align-items: flex-end;
  168. background-color: #FFF;
  169. &-label {
  170. display: flex;
  171. align-items: flex-end;
  172. &-l {
  173. font-size: 46rpx;
  174. margin-right: 16rpx;
  175. }
  176. &-s {
  177. font-size: 24rpx;
  178. color: $defaultColor;
  179. }
  180. }
  181. &-local {
  182. color: $defaultColor;
  183. display: flex;
  184. align-items: flex-end;
  185. }
  186. }
  187. // &-carousel {
  188. // padding: 24rpx;
  189. // }
  190. &-recommend {
  191. padding: 0 24rpx;
  192. &-box {
  193. @include box;
  194. &-title {
  195. display: flex;
  196. justify-content: space-between;
  197. align-items: flex-end;
  198. padding: 20rpx;
  199. font-size: 30rpx;
  200. .route {
  201. color: $defaultColor;
  202. font-size: .75em;
  203. }
  204. }
  205. }
  206. }
  207. }
  208. &-main {
  209. &-filter {
  210. padding: 24rpx;
  211. font-size: 30rpx;
  212. color: $defaultColor;
  213. display: flex;
  214. justify-content: space-between;
  215. &-type{
  216. &-item {
  217. padding: 20rpx;
  218. &.active {
  219. color: #000;
  220. }
  221. }
  222. }
  223. }
  224. &-list {
  225. width: 100%;
  226. // padding: 0 24rpx 24rpx 24rpx;
  227. box-sizing: border-box;
  228. &-box {
  229. padding: 24rpx;
  230. margin-bottom: 24rpx;
  231. box-sizing: border-box;
  232. @include box;
  233. .top {
  234. width: 100%;
  235. display: flex;
  236. justify-content: space-between;
  237. .title {
  238. flex: 1;
  239. overflow: hidden; /* 隐藏超出部分 */
  240. white-space: nowrap; /* 不换行 */
  241. text-overflow: ellipsis; /* 超出部分显示省略号 */
  242. }
  243. .remuneration {
  244. color: aquamarine;
  245. }
  246. }
  247. .main {
  248. display: flex;
  249. font-size: 24rpx;
  250. margin: 28rpx 0;
  251. .tag {
  252. &.blue {
  253. background: aliceblue;
  254. color: royalblue;
  255. }
  256. font-size: 20rpx;
  257. border-radius: 8rpx;
  258. color: #666;
  259. background: #eee;
  260. padding: 6rpx 10rpx;
  261. margin-right: 20rpx;
  262. }
  263. }
  264. .bottom {
  265. color: #666;
  266. display: flex;
  267. justify-content: space-between;
  268. .origin {
  269. font-size: 0.8em;
  270. .interval {
  271. padding: 0 16rpx;
  272. }
  273. }
  274. .local {
  275. color: #aaa;
  276. font-size: 0.6em;
  277. }
  278. }
  279. }
  280. .noMore {
  281. font-size: 24rpx;
  282. color: $defaultColor;
  283. text-align: center;
  284. }
  285. }
  286. }
  287. }
  288. .scrollBox {
  289. height: 0;
  290. flex: 1;
  291. padding-bottom: 120rpx;
  292. }
  293. </style>