crowdsourcing.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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. &-box {
  167. @include box;
  168. &-title {
  169. display: flex;
  170. justify-content: space-between;
  171. align-items: flex-end;
  172. padding: 20rpx;
  173. font-size: 30rpx;
  174. .route {
  175. color: $defaultColor;
  176. font-size: .75em;
  177. }
  178. }
  179. }
  180. }
  181. }
  182. &-main {
  183. &-filter {
  184. padding: 24rpx;
  185. font-size: 30rpx;
  186. color: $defaultColor;
  187. display: flex;
  188. justify-content: space-between;
  189. &-type{
  190. &-item {
  191. padding: 20rpx;
  192. &.active {
  193. color: #000;
  194. }
  195. }
  196. }
  197. }
  198. &-list {
  199. width: 100%;
  200. // padding: 0 24rpx 24rpx 24rpx;
  201. box-sizing: border-box;
  202. &-box {
  203. padding: 24rpx;
  204. margin-bottom: 24rpx;
  205. box-sizing: border-box;
  206. @include box;
  207. .top {
  208. width: 100%;
  209. display: flex;
  210. justify-content: space-between;
  211. .title {
  212. flex: 1;
  213. overflow: hidden; /* 隐藏超出部分 */
  214. white-space: nowrap; /* 不换行 */
  215. text-overflow: ellipsis; /* 超出部分显示省略号 */
  216. }
  217. .remuneration {
  218. color: aquamarine;
  219. }
  220. }
  221. .main {
  222. display: flex;
  223. font-size: 24rpx;
  224. margin: 28rpx 0;
  225. .tag {
  226. &.blue {
  227. background: aliceblue;
  228. color: royalblue;
  229. }
  230. font-size: 20rpx;
  231. border-radius: 8rpx;
  232. color: #666;
  233. background: #eee;
  234. padding: 6rpx 10rpx;
  235. margin-right: 20rpx;
  236. }
  237. }
  238. .bottom {
  239. color: #666;
  240. display: flex;
  241. justify-content: space-between;
  242. .origin {
  243. font-size: 0.8em;
  244. .interval {
  245. padding: 0 16rpx;
  246. }
  247. }
  248. .local {
  249. color: #aaa;
  250. font-size: 0.6em;
  251. }
  252. }
  253. }
  254. .noMore {
  255. font-size: 24rpx;
  256. color: $defaultColor;
  257. text-align: center;
  258. }
  259. }
  260. }
  261. }
  262. .scrollBox {
  263. height: 0;
  264. flex: 1;
  265. padding-bottom: 120rpx;
  266. }
  267. </style>