index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <layout-page>
  3. <scroll-view class="scrollBox" style="position:relative;">
  4. <view class="box">
  5. <view v-if="loading" class="vertical80-center">{{ loadingText }}</view>
  6. <view v-else>
  7. <view class="mt-5" style="display: flex;">
  8. <!-- 赏金 -->
  9. <view v-if="info.hire && info.hirePrice" class="hirePrice ss-m-r-10 d-flex align-center">
  10. <view class="iconfont icon-a-1_zhaopin ss-m-r-10" style="color: #e03506; font-size: 20px;"></view>
  11. <view>{{ `赏金:${commissionCalculation(info.hirePrice / 100, 1)}元` }}</view>
  12. </view>
  13. <image v-if="isJobFair" src="/static/svg/jobFair.svg" class="ss-m-r-10" style="width: 30px; height: 30px;"></image>
  14. <!-- 职位名称 -->
  15. <h2 class="JobName" style="flex: 1;">{{ formatName(info.name) }}</h2>
  16. </view>
  17. <!-- 职位地区 -->
  18. <view class="d-flex justify-space-between mt-5 align-center">
  19. <view style="font-size: 14px; flex: 1; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; margin-right: 30px;">
  20. <span>
  21. <span>{{positionInfo?.area?.str ?? '全国' }}</span>
  22. <span class="viewider-mx" v-if="positionInfo?.eduName">|</span>
  23. <span>{{positionInfo?.eduName }}</span>
  24. <span class="viewider-mx" v-if="positionInfo?.expName">|</span>
  25. <span>{{positionInfo?.expName }}</span>
  26. </span>
  27. </view>
  28. </view>
  29. <view class="d-flex justify-space-between mt-5 align-center">
  30. <!-- 薪资 -->
  31. <view>
  32. <span v-if="!info.payFrom && !info.payTo" class="salary w-600">面议</span>
  33. <span v-else class="salary w-600">{{ info.payFrom }}-{{ info.payTo }}/{{ positionInfo.payName }}</span>
  34. </view>
  35. </view>
  36. <view class="font-size-13 color-999 ss-m-t-10" style="text-align: end;">更新时间:{{ timesTampChange(info?.refreshTime || info.updateTime, 'Y-M-D h:m') }}</view>
  37. <!-- 标签 -->
  38. <view class="tagList mt">
  39. <view class="tag" v-for="(tag,i) in info?.tagList || []" :key="'tagList' + i">
  40. {{ tag }}
  41. </view>
  42. </view>
  43. <!-- 岗位职责 -->
  44. <view class="topLine fs14 mt-5">
  45. <view class="fs15 w-600 my5">岗位职责</view>
  46. <view v-if="!info.content"></view>
  47. <rich-text v-else class="htmlCss" :nodes="cleanedHtml(info.content)"></rich-text>
  48. </view>
  49. <!-- 岗位要求 -->
  50. <view class="topLine mt-5">
  51. <view class="fs15 w-600 my5">岗位要求</view>
  52. <view v-if="!info.requirement"></view>
  53. <rich-text v-else class="htmlCss" :nodes="cleanedHtml(info.requirement)"></rich-text>
  54. </view>
  55. <!-- HR信息 -->
  56. <view class="topLine mt-5 d-flex">
  57. <view class="avatarBox">
  58. <image style="width: 40px; height: 40px;" :src="info.enterprise?.logoUrl || 'https://minio.citupro.com/dev/menduner/company-avatar.png'"></image>
  59. </view>
  60. <view >
  61. <view class="contact-name">{{ info.contact?.name }}</view>
  62. <view class="contact-info">{{ formatName(info.enterprise?.anotherName || info.enterprise?.name) }} {{ info.contact?.postNameCn ? '· ' + info.contact?.postNameCn : '' }}</view>
  63. </view>
  64. </view>
  65. <!-- 工作地址 -->
  66. <view class="topLine mt-5">
  67. <view class="fs15 w-600 my5">工作地址</view>
  68. <view class="my10">
  69. <uni-icons
  70. type="map-pin-ellipse"
  71. color="#00B760"
  72. class="mr"
  73. size="25"
  74. ></uni-icons>
  75. <span style="color: var(--color-666);font-size: 15px;line-height: 26px;">{{ info.address || '' }}</span>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. </scroll-view>
  81. <view class="bottom-sticky" v-if="!loading && jobId">
  82. <view class="bottom-content">
  83. <button class="buttons btnStyle ss-m-l-15" type="primary" @click="handleEdit">编辑职位</button>
  84. </view>
  85. </view>
  86. </layout-page>
  87. </template>
  88. <script setup>
  89. import { commissionCalculation } from '@/utils/position'
  90. import { timesTampChange } from '@/utils/date'
  91. import layoutPage from '@/layout'
  92. import { ref, watch } from 'vue';
  93. import { getPositionDetails, getEnterprisePubJobTypePermission } from '@/api/position'
  94. import { dealDictObjData } from '@/utils/position'
  95. import { onLoad } from '@dcloudio/uni-app'
  96. import { userStore } from '@/store/user'
  97. import { formatName } from '@/utils/getText'
  98. const useUserStore = userStore()
  99. const loading = ref(false)
  100. const loadingText = ref('加载中 . . . ')
  101. // 职位详情
  102. const info = ref({})
  103. const positionInfo = ref({})
  104. const beenLogin = ref(false)
  105. // 监听登录状态
  106. watch(() => useUserStore.refreshToken, (newVal) => {
  107. beenLogin.value = Boolean(newVal)
  108. }, { immediate: true }, { deep: true })
  109. let jobId = ''
  110. const isJobFair = ref(false)
  111. let obj = {}
  112. const isEdit = ref(false)
  113. onLoad(async (options) => {
  114. jobId = options?.id || options?.jobId || obj?.jobId || ''
  115. // 招聘会进入的岗位
  116. if (options?.jobFairId) isJobFair.value = true
  117. // 职位是否可编辑
  118. if (options?.isEdit && options?.isEdit === 'true') isEdit.value = true
  119. if (jobId) {
  120. loading.value = true
  121. loadingText.value = '加载中 . . . '
  122. getPositionDetail()
  123. } else {
  124. loadingText.value = '加载失败 . . . '
  125. }
  126. })
  127. // 富文本内容处理,去除多余的换行空格等
  128. const cleanedHtml = (text) => {
  129. const cleaned = text.replace(/\n/g, '<br>')
  130. .replace(/\s+/g, ' ')
  131. .replace(/(^|\s+)<\/p>(\s*<p>|$)/g, '</p><p>')
  132. .replace(/<p>\s*(<br>)\s*<\/p>/g, '')
  133. .replace(/<pre([^>]*)>/g, '<div$1>')
  134. .replace(/<\/pre>/g, '</div>')
  135. .replace(/<p>\s*(<\/br>)\s*<\/p>/g, '').trim()
  136. return cleaned
  137. }
  138. // 职位详情
  139. async function getPositionDetail () {
  140. try {
  141. loading.value = true
  142. const { data } = await getPositionDetails({ id: jobId })
  143. info.value = data
  144. positionInfo.value = { ...dealDictObjData({}, info.value), ...info.value, enterprise: dealDictObjData({}, data.enterprise) }
  145. loading.value = false
  146. } finally {
  147. }
  148. }
  149. // 职位编辑
  150. const handleEdit = async () => {
  151. if (!isEdit.value) {
  152. uni.showToast({ title: '职位发布时间超过24小时的不支持编辑', icon: 'none', duration: 2000 })
  153. return
  154. }
  155. uni.showLoading({ title: '加载中 . . . ' })
  156. try {
  157. const { data } = await getEnterprisePubJobTypePermission()
  158. if (!data || !data.length) {
  159. uni.showToast({ title: '没有该操作权限,请联系平台管理员升级后再试', icon: 'none', duration: 2000 })
  160. return
  161. }
  162. uni.hideLoading()
  163. // 跳转编辑页面
  164. } catch {
  165. uni.hideLoading()
  166. }
  167. }
  168. </script>
  169. <style scoped lang="scss">
  170. @import '../../static/style/position/index.scss';
  171. .bottom-content {
  172. display: flex;
  173. justify-content: space-evenly;
  174. align-items: center;
  175. width: 100%;
  176. margin: 20rpx 0;
  177. .btnStyle {
  178. flex: 1;
  179. margin: 0 20rpx;
  180. }
  181. }
  182. </style>