crowdsourcing.vue 5.9 KB

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