join.vue 5.4 KB

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