join.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <view class="box defaultBgc">
  3. <view style="background-color: #fff;">
  4. <uni-search-bar
  5. v-model="query.name"
  6. radius="5"
  7. placeholder="输入关键字"
  8. cancelButton="none"
  9. :focus="false"
  10. @clear="handleSearch"
  11. @confirm="handleSearch"
  12. ></uni-search-bar>
  13. </view>
  14. <scroll-view class="scrollBox" :scroll-y="true" @scrolltolower="loadingMore" style="position:relative;">
  15. <uni-card v-for="(item, index) in items" :key="index" class="mList" :is-shadow="true" :border='false' shadow="0px 0px 3px 1px rgba(0,0,0,0.1)">
  16. <view class="list-shape" style="border-radius: 12px;">
  17. <view>
  18. <view class="titleBox">
  19. <view style="display: flex;align-items: center;">
  20. <rich-text v-if="item.name?.indexOf('style') !== -1" class="job-name" :nodes="item.name"></rich-text>
  21. <view v-else class="job-name">{{ formatName(item.name) }}</view>
  22. </view>
  23. </view>
  24. <view class="d-flex align-center justify-space-between ss-m-t-20">
  25. <view class="font-size-13 ellipsis" style="flex: 1;">
  26. <span class="tag-gap" style="color: #808080;">
  27. <span>{{item.area?.str ?? '全国' }}</span>
  28. <span class="divider-mx" v-if="item.eduName">|</span>
  29. <span>{{item.eduName }}</span>
  30. <span class="divider-mx" v-if="item.expName">|</span>
  31. <span>{{item.expName }}</span>
  32. <span class="divider-mx">|</span>
  33. <span>{{!item.payFrom && !item.payTo ? '面议' : `${item.payFrom}-${item.payTo}${item.payName ? '/' + item.payName : ''}` }}</span>
  34. </span>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="sub-li-bottom">
  39. <view class="sub-li-bottom-item" @tap.stop="handleJoin(item)">添加至招聘会</view>
  40. </view>
  41. </view>
  42. </uni-card>
  43. <uni-load-more :status="more" />
  44. </scroll-view>
  45. </view>
  46. </template>
  47. <script setup>
  48. import { ref } from 'vue'
  49. import { onLoad } from '@dcloudio/uni-app'
  50. import { formatName } from '@/utils/getText.js'
  51. import { joinJobFairPosition, getJobFairPositionList } from '@/api/jobFair.js'
  52. import { dealDictArrayData } from '@/utils/position'
  53. const query = ref({
  54. pageSize: 10,
  55. pageNo: 1,
  56. name: null,
  57. jobFairId: null
  58. })
  59. const items = ref([])
  60. const more = ref('more')
  61. const total = ref(0)
  62. const getData = async () => {
  63. try {
  64. more.value = 'loading'
  65. const { data } = await getJobFairPositionList(query.value)
  66. if (!data.list.length) {
  67. more.value = 'noMore'
  68. items.value = []
  69. total.value = 0
  70. return
  71. }
  72. const list = dealDictArrayData([], data.list)
  73. items.value = items.value.concat(list)
  74. total.value = data.total
  75. if (items.value.length === +data.total) {
  76. more.value = 'noMore'
  77. return
  78. }
  79. } catch {
  80. query.value.pageNo--
  81. more.value = 'more'
  82. }
  83. }
  84. // 关键字搜索
  85. const handleSearch = () => {
  86. total.value = 0
  87. items.value = []
  88. query.value.pageNo = 1
  89. getData()
  90. }
  91. // 加载更多
  92. const loadingMore = () => {
  93. if (more.value === 'noMore') return
  94. more.value = 'loading'
  95. query.value.pageNo++
  96. getData()
  97. }
  98. onLoad(async (options) => {
  99. query.value.jobFairId = options.jobFairId
  100. query.value.pageNo = 1
  101. await getData()
  102. })
  103. // 加入职位
  104. const handleJoin = async (item) => {
  105. uni.showLoading({ title: '加载中' })
  106. try {
  107. await joinJobFairPosition({ jobId: item.id, jobFairId: query.value.jobFairId })
  108. uni.hideLoading()
  109. uni.showToast({ title: '加入成功', icon: 'success' })
  110. setTimeout(() => {
  111. uni.navigateBack({ delta: 1 })
  112. }, 1000)
  113. } catch (e) {
  114. uni.hideLoading()
  115. uni.showToast({ title: e.message })
  116. }
  117. }
  118. </script>
  119. <style scoped lang="scss">
  120. .box {
  121. height: 100vh;
  122. overflow: hidden;
  123. box-sizing: border-box;
  124. display: flex;
  125. flex-direction: column;
  126. }
  127. .scrollBox{
  128. flex: 1;
  129. padding-bottom: 24rpx;
  130. box-sizing: border-box;
  131. height: 0 !important;
  132. }
  133. .stickFilter {
  134. z-index: 1;
  135. position: sticky;
  136. box-shadow: 0px 10rpx 12rpx 0px rgba(195, 195, 195, .25);
  137. top: 110rpx;
  138. background-color: #fff;
  139. }
  140. .job-name {
  141. font-size: 16px;
  142. font-weight: 700;
  143. color: #0E100F;
  144. max-width: 80vw;
  145. overflow: hidden;
  146. white-space: nowrap;
  147. text-overflow: ellipsis;
  148. }
  149. .sub-li-bottom {
  150. display: flex;
  151. justify-content: space-between;
  152. margin-top: 10px;
  153. padding-top: 10px;
  154. font-size: 13px;
  155. color: #00B760;
  156. &-item {
  157. width: 100%;
  158. height: 35px;
  159. line-height: 35px;
  160. text-align: center;
  161. background-color: #f7f8fa;
  162. border-radius: 4px;
  163. }
  164. }
  165. .list-shape {
  166. background-color: #fff;
  167. border-radius: 12px 12px 0 0;
  168. .titleBox {
  169. display: flex;
  170. align-items: center;
  171. justify-content: space-between;
  172. }
  173. }
  174. .tag-gap{
  175. margin: 10rpx 10rpx 10rpx 0;
  176. }
  177. .divider-mx{
  178. margin: 0 10rpx;
  179. }
  180. .divider {
  181. color:#e4d4d2;
  182. }
  183. .mList {
  184. margin-bottom: 20rpx;
  185. }
  186. </style>