jobItem.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <view>
  3. <view v-if="list?.length" class="ss-p-b-30 ss-p-t-20 ss-p-x-30">
  4. <view v-for="(item, index) in list" :key="index" class="mList">
  5. <view v-if="item?.hrName" class="d-flex align-center item-top">
  6. <view class="avatarBox">
  7. <image class="enterAvatar" :src="getUserAvatar(item.hrHeadImg)"></image>
  8. </view>
  9. <view class="ss-m-l-20 label-text">{{ item?.hrName }}</view>
  10. </view>
  11. <view class="list-shape" :style="{'border-radius': item?.hrName ? '0 0 12px 12px' : '12px'}">
  12. <view @tap.stop="handleToDetail(item)">
  13. <view class="titleBox">
  14. <view style="display: flex;align-items: center;">
  15. <image src="/static/svg/jobFair.svg" class=" ss-m-r-10" style="width: 20px; height: 20px;"></image>
  16. <rich-text v-if="item.name?.indexOf('style') !== -1" class="job-name" :nodes="item.name"></rich-text>
  17. <view v-else class="job-name">{{ formatName(item.name) }}</view>
  18. </view>
  19. </view>
  20. <view class="d-flex align-center justify-space-between ss-m-t-20">
  21. <view class="font-size-13 ellipsis" style="flex: 1;">
  22. <span class="tag-gap" style="color: #808080;">
  23. <span>{{item.area?.str ?? '全国' }}</span>
  24. <span class="divider-mx" v-if="item.eduName">|</span>
  25. <span>{{item.eduName }}</span>
  26. <span class="divider-mx" v-if="item.expName">|</span>
  27. <span>{{item.expName }}</span>
  28. <span class="divider-mx">|</span>
  29. <span>{{!item.payFrom && !item.payTo ? '面议' : `${item.payFrom}-${item.payTo}${item.payName ? '/' + item.payName : ''}` }}</span>
  30. </span>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="sub-li-bottom ss-m-t-20">
  35. <view class="sub-li-bottom-item color-primary" @tap.stop="handleToResume(item)">{{ item.count || 0 }} 已投递简历</view>
  36. <view v-if="tab === 0" class="sub-li-bottom-item color-error" @tap.stop="handleAction(0, item.id)">关闭</view>
  37. <view v-else class="sub-li-bottom-item color-primary" @tap.stop="handleAction(1, item.id)">激活</view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. <uni-popup ref="popup" type="dialog">
  43. <uni-popup-dialog
  44. type="warn"
  45. cancelText="取消"
  46. confirmText="确定"
  47. title="系统提示"
  48. :content="`是否确认${actionType === 0 ? '关闭' : '激活'}此职位?`"
  49. @confirm="handleActionConfirm"
  50. @close="handleActionClose"
  51. ></uni-popup-dialog>
  52. </uni-popup>
  53. </view>
  54. </template>
  55. <script setup>
  56. import { ref } from 'vue'
  57. import { formatName } from '@/utils/getText'
  58. import { getUserAvatar } from '@/utils/avatar'
  59. import { closeJobAdvertised, enableJobAdvertised } from '@/api/new/position'
  60. const emit = defineEmits(['refresh'])
  61. const props = defineProps({
  62. list: Array,
  63. jobFairId: [String, Number],
  64. jobFairName: String,
  65. tab: Number
  66. })
  67. // 查看职位详情
  68. const handleToDetail = (val) => {
  69. uni.navigateTo({
  70. url: `/pagesB/positionDetail/index?jobId=${val.id}&jobFairId=${props.jobFairId}&isEdit=${val.edit}`
  71. })
  72. }
  73. // 查看职位投递简历
  74. const handleToResume = (val) => {
  75. uni.navigateTo({
  76. url: `/pagesA/resume/index?jobId=${val.id}&jobName=${formatName(val.name)}&jobFairId=${props.jobFairId}&jobFairName=${props.jobFairName}`
  77. })
  78. }
  79. // 职位激活、关闭
  80. const popup = ref()
  81. const actionId = ref('')
  82. const actionType = ref('')
  83. const handleAction = (type, id) => {
  84. actionId.value = id
  85. actionType.value = type
  86. popup.value.open()
  87. }
  88. const handleActionClose = () => {
  89. actionId.value = ''
  90. actionType.value = ''
  91. popup.value.close()
  92. }
  93. const handleActionConfirm = async () => {
  94. if (!actionId.value || !props.jobFairId) {
  95. uni.showToast({ title: '正在维护中,请稍后再试', icon: 'none', duration: 2000 })
  96. return
  97. }
  98. uni.showLoading({ title: '加载中' })
  99. const api = actionType.value === 0 ? closeJobAdvertised : enableJobAdvertised
  100. try {
  101. await api(actionId.value)
  102. uni.showToast({ title: '操作成功', icon: 'none' })
  103. emit('refresh')
  104. } finally {
  105. uni.hideLoading()
  106. actionId.value = ''
  107. actionType.value = ''
  108. }
  109. }
  110. </script>
  111. <style scoped lang="scss">
  112. .enterAvatar{
  113. width: 60rpx;
  114. height: 60rpx;
  115. margin: auto;
  116. border-radius: 50%;
  117. }
  118. .avatarBox {
  119. max-width: 60rpx;
  120. max-height: 60rpx;
  121. }
  122. .item-top {
  123. padding: 20rpx 30rpx;
  124. background: linear-gradient(90deg,#f5fcfc,#fcfbfa);
  125. border-radius: 12px 12px 0 0;
  126. font-size: 28rpx;
  127. color: #0E100F;
  128. .label-text {
  129. max-width: 100%;
  130. text-overflow: ellipsis;
  131. white-space: nowrap;
  132. overflow: hidden;
  133. }
  134. }
  135. .job-name {
  136. font-size: 16px;
  137. font-weight: 700;
  138. color: #0E100F;
  139. max-width: 80vw;
  140. overflow: hidden;
  141. white-space: nowrap;
  142. text-overflow: ellipsis;
  143. }
  144. .sub-li-bottom {
  145. display: flex;
  146. justify-content: space-between;
  147. margin-top: 10px;
  148. font-size: 13px;
  149. color: #666;
  150. &-item {
  151. width: 50%;
  152. height: 35px;
  153. line-height: 35px;
  154. text-align: center;
  155. margin-right: 15px;
  156. background-color: #f7f8fa;
  157. border-radius: 4px;
  158. &:nth-child(2) {
  159. margin-right: 0;
  160. }
  161. }
  162. }
  163. .salary-text {
  164. float: right;
  165. color: #00B760;
  166. font-weight: 700;
  167. }
  168. .list-shape {
  169. background-color: #fff;
  170. padding: 30rpx;
  171. .titleBox {
  172. display: flex;
  173. align-items: center;
  174. justify-content: space-between;
  175. }
  176. }
  177. .tag-gap{
  178. margin: 10rpx 10rpx 10rpx 0;
  179. }
  180. .divider-mx{
  181. margin: 0 10rpx;
  182. }
  183. .divider {
  184. color:#e4d4d2;
  185. }
  186. .mList {
  187. margin-bottom: 20rpx;
  188. position: relative;
  189. box-shadow: 1px 2px 12px rgba(0, 0, 0, 0.17);
  190. background-color: #fbfbfb;
  191. border-radius: 12px;
  192. }
  193. </style>