crowdsourcing.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  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"></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 { showAuthModal } from '@/hooks/useModal'
  45. import { swiperAdListTest } from '@/utils/testData'
  46. // import { userStore } from '@/store/user'
  47. import layoutPage from '@/layout'
  48. import ResumeStatus from '@/components/ResumeStatus'
  49. import { getJobAdvertisedHire } from '@/api/position.js'
  50. import { getDict } from '@/hooks/useDictionaries.js'
  51. import { dealDictArrayData } from '@/utils/position.js'
  52. import PositionList from '@/components/PositionList'
  53. import { onShow } from '@dcloudio/uni-app'
  54. // 设置自定义tabbar选中值
  55. onShow(() => {
  56. const currentPage = getCurrentPages()[0]; // 获取当前页面实例
  57. const currentTabBar = currentPage?.getTabBar?.();
  58. // 设置当前tab页的下标index
  59. currentTabBar?.setData({ selected: 3 });
  60. getList()
  61. })
  62. const swiperAdList = ref(swiperAdListTest)
  63. const items = reactive([])
  64. const pageInfo = ref({
  65. pageNo: 1,
  66. pageSize: 2
  67. })
  68. const loading = ref(false)
  69. const total = ref(0)
  70. const more = ref('more')
  71. const loadingMore = (e) => {
  72. if (total.value === items.length) {
  73. return
  74. }
  75. if (loading.value) {
  76. return
  77. }
  78. more.value = 'loading'
  79. pageInfo.value.pageNo++
  80. getList()
  81. }
  82. async function getList () {
  83. loading.value = true
  84. try {
  85. const { data } = await getJobAdvertisedHire({
  86. ...pageInfo.value
  87. })
  88. if (!data?.list) {
  89. pageInfo.pageNo--
  90. return
  91. }
  92. const _items = dealDictArrayData([], data.list)
  93. items.push(..._items.map(e => {
  94. return {
  95. job: e,
  96. enterprise: {
  97. welfareList: e.tagList,
  98. logoUrl: e.logoUrl,
  99. anotherName: e.anotherName,
  100. industryName: e.industryName,
  101. scaleName: e.scaleName
  102. }
  103. }
  104. }))
  105. total.value = +data.total
  106. more.value = items.length === total.value ? 'noMore' : 'more'
  107. } catch (error) {
  108. more.value = more
  109. pageInfo.pageNo--
  110. } finally {
  111. loading.value = false
  112. }
  113. }
  114. </script>
  115. <style scoped lang="scss">
  116. $defaultColor: #999;
  117. @mixin box {
  118. // border-radius: 24rpx;
  119. width: 100%;
  120. height: 100%;
  121. background: #FFF;
  122. overflow: hidden;
  123. }
  124. .content {
  125. height: 100vh;
  126. display: flex;
  127. flex-direction: column;
  128. &-top {
  129. &-title {
  130. padding: 24rpx;
  131. box-sizing: border-box;
  132. width: 100%;
  133. display: flex;
  134. justify-content: space-between;
  135. align-items: flex-end;
  136. background-color: #FFF;
  137. &-label {
  138. display: flex;
  139. align-items: flex-end;
  140. &-l {
  141. font-size: 46rpx;
  142. margin-right: 16rpx;
  143. }
  144. &-s {
  145. font-size: 24rpx;
  146. color: $defaultColor;
  147. }
  148. }
  149. &-local {
  150. color: $defaultColor;
  151. display: flex;
  152. align-items: flex-end;
  153. }
  154. }
  155. &-carousel {
  156. padding: 24rpx;
  157. }
  158. &-recommend {
  159. padding: 0 24rpx;
  160. &-box {
  161. @include box;
  162. &-title {
  163. display: flex;
  164. justify-content: space-between;
  165. align-items: flex-end;
  166. padding: 20rpx;
  167. font-size: 30rpx;
  168. .route {
  169. color: $defaultColor;
  170. font-size: .75em;
  171. }
  172. }
  173. }
  174. }
  175. }
  176. &-main {
  177. &-filter {
  178. padding: 24rpx;
  179. font-size: 30rpx;
  180. color: $defaultColor;
  181. display: flex;
  182. justify-content: space-between;
  183. &-type{
  184. &-item {
  185. padding: 20rpx;
  186. &.active {
  187. color: #000;
  188. }
  189. }
  190. }
  191. }
  192. &-list {
  193. width: 100%;
  194. padding: 0 24rpx 24rpx 24rpx;
  195. box-sizing: border-box;
  196. &-box {
  197. padding: 24rpx;
  198. margin-bottom: 24rpx;
  199. box-sizing: border-box;
  200. @include box;
  201. .top {
  202. width: 100%;
  203. display: flex;
  204. justify-content: space-between;
  205. .title {
  206. flex: 1;
  207. overflow: hidden; /* 隐藏超出部分 */
  208. white-space: nowrap; /* 不换行 */
  209. text-overflow: ellipsis; /* 超出部分显示省略号 */
  210. }
  211. .remuneration {
  212. color: aquamarine;
  213. }
  214. }
  215. .main {
  216. display: flex;
  217. font-size: 24rpx;
  218. margin: 28rpx 0;
  219. .tag {
  220. &.blue {
  221. background: aliceblue;
  222. color: royalblue;
  223. }
  224. font-size: 20rpx;
  225. border-radius: 8rpx;
  226. color: #666;
  227. background: #eee;
  228. padding: 6rpx 10rpx;
  229. margin-right: 20rpx;
  230. }
  231. }
  232. .bottom {
  233. color: #666;
  234. display: flex;
  235. justify-content: space-between;
  236. .origin {
  237. font-size: 0.8em;
  238. .interval {
  239. padding: 0 16rpx;
  240. }
  241. }
  242. .local {
  243. color: #aaa;
  244. font-size: 0.6em;
  245. }
  246. }
  247. }
  248. .noMore {
  249. font-size: 24rpx;
  250. color: $defaultColor;
  251. text-align: center;
  252. }
  253. }
  254. }
  255. }
  256. .scrollBox {
  257. height: 0;
  258. flex: 1;
  259. padding-bottom: 120rpx;
  260. }
  261. </style>