crowdsourcing.vue 6.7 KB

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