crowdsourcing.vue 5.7 KB

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