crowdsourcing.vue 6.6 KB

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