join.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <view class="box defaultBgc">
  3. <view style="background-color: #fff; margin-bottom: 10px;">
  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?.enterpriseName" class="d-flex align-center item-top">
  17. <view class="avatarBox">
  18. <image class="enterAvatar default-border default-radius" :src="item.enterpriseLogo || 'https://minio.citupro.com/dev/menduner/company-avatar.png'"></image>
  19. </view>
  20. <view class="ss-m-l-20 label-text">{{ formatName(item?.enterpriseName) }} - {{ 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. const query = ref({
  60. pageSize: 10,
  61. pageNo: 1,
  62. name: null,
  63. jobFairId: null
  64. })
  65. const items = ref([])
  66. const more = ref('more')
  67. const total = ref(0)
  68. const getData = async () => {
  69. try {
  70. more.value = 'loading'
  71. const { data } = await getJobFairPositionList(query.value)
  72. if (!data.list.length) {
  73. more.value = 'noMore'
  74. items.value = []
  75. total.value = 0
  76. return
  77. }
  78. const list = dealDictArrayData([], data.list)
  79. items.value = items.value.concat(list)
  80. total.value = data.total
  81. if (items.value.length === +data.total) {
  82. more.value = 'noMore'
  83. return
  84. }
  85. } catch {
  86. query.value.pageNo--
  87. more.value = 'more'
  88. }
  89. }
  90. // 关键字搜索
  91. const handleSearch = () => {
  92. total.value = 0
  93. items.value = []
  94. query.value.pageNo = 1
  95. getData()
  96. }
  97. // 加载更多
  98. const loadingMore = () => {
  99. if (more.value === 'noMore') return
  100. more.value = 'loading'
  101. query.value.pageNo++
  102. getData()
  103. }
  104. onLoad(async (options) => {
  105. query.value.jobFairId = options.jobFairId
  106. query.value.pageNo = 1
  107. await getData()
  108. })
  109. // 加入职位
  110. const handleJoin = async (item) => {
  111. uni.showLoading({ title: '加载中' })
  112. try {
  113. await joinJobFairPosition({ jobId: item.id, jobFairId: query.value.jobFairId })
  114. uni.hideLoading()
  115. uni.showToast({ title: '加入成功', icon: 'success' })
  116. setTimeout(() => {
  117. uni.navigateBack({ delta: 1 })
  118. }, 1000)
  119. } catch (e) {
  120. uni.hideLoading()
  121. }
  122. }
  123. </script>
  124. <style scoped lang="scss">
  125. .enterAvatar{
  126. width: 60rpx;
  127. height: 60rpx;
  128. margin: auto;
  129. }
  130. .avatarBox {
  131. max-width: 60rpx;
  132. max-height: 60rpx;
  133. }
  134. .item-top {
  135. padding: 20rpx 30rpx;
  136. background: linear-gradient(90deg,#f5fcfc,#fcfbfa);
  137. border-radius: 12px 12px 0 0;
  138. font-size: 28rpx;
  139. color: #0E100F;
  140. .label-text {
  141. max-width: 100%;
  142. text-overflow: ellipsis;
  143. white-space: nowrap;
  144. overflow: hidden;
  145. }
  146. }
  147. .box {
  148. height: 100vh;
  149. overflow: hidden;
  150. box-sizing: border-box;
  151. display: flex;
  152. flex-direction: column;
  153. }
  154. .scrollBox{
  155. flex: 1;
  156. padding-bottom: 24rpx;
  157. box-sizing: border-box;
  158. height: 0 !important;
  159. }
  160. .stickFilter {
  161. z-index: 1;
  162. position: sticky;
  163. box-shadow: 0px 10rpx 12rpx 0px rgba(195, 195, 195, .25);
  164. top: 110rpx;
  165. background-color: #fff;
  166. }
  167. .job-name {
  168. font-size: 16px;
  169. font-weight: 700;
  170. color: #0E100F;
  171. max-width: 80vw;
  172. overflow: hidden;
  173. white-space: nowrap;
  174. text-overflow: ellipsis;
  175. }
  176. .sub-li-bottom {
  177. display: flex;
  178. justify-content: space-between;
  179. margin-top: 10px;
  180. padding-top: 10px;
  181. font-size: 13px;
  182. color: #00B760;
  183. &-item {
  184. width: 100%;
  185. height: 35px;
  186. line-height: 35px;
  187. text-align: center;
  188. background-color: #f7f8fa;
  189. border-radius: 4px;
  190. }
  191. }
  192. .list-shape {
  193. background-color: #fff;
  194. border-radius: 0 0 12px 12px;
  195. padding: 30rpx;
  196. .titleBox {
  197. display: flex;
  198. align-items: center;
  199. justify-content: space-between;
  200. }
  201. }
  202. .tag-gap{
  203. margin: 10rpx 10rpx 10rpx 0;
  204. }
  205. .divider-mx{
  206. margin: 0 10rpx;
  207. }
  208. .divider {
  209. color:#e4d4d2;
  210. }
  211. .mList {
  212. border-radius: 12px;
  213. margin: 0 30rpx 20rpx 30rpx;
  214. box-shadow: 1px 2px 12px rgba(0, 0, 0, 0.17);
  215. }
  216. </style>