index.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <template>
  2. <view class="ss-p-b-30">
  3. <view class="mar p-tb ss-m-x-30">
  4. <view class="f-horizon">
  5. <image style="width: 80px; height: 80px;" :src="info.logoUrl || 'https://minio.citupro.com/dev/menduner/company-avatar.png'"></image>
  6. <view class="f-straight ss-m-l-10" style="flex: 1;position: relative;">
  7. <view class="title-des font-weight-bold" style="max-width: 60vw;">{{ formatName(info.anotherName || info.name) }}</view>
  8. <view class="color-999 ellipsis font-size-14" style="max-width: 60vw;">
  9. <span>{{ !!info.industryName? info.industryName : ''}}</span>
  10. <span class="ss-m-x-10" v-if="info?.industryName && info?.scaleName"> | </span>
  11. <span>{{ info.scaleName || '' }}</span>
  12. </view>
  13. <view class="collect-icon" @click="handleFollow">
  14. <uni-icons :type="isCollection ? 'heart-filled' : 'heart'" color="#fc6d5e" size="25"></uni-icons>
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="ss-m-t-30" style="background-color: #fff;">
  20. <uni-segmented-control :current="current" :values="items" @clickItem="changeControl" styleType="text" activeColor="#00897B"></uni-segmented-control>
  21. </view>
  22. <view v-if="current === 0" style="height: 20rpx; background-color: #f8f8fa;"></view>
  23. <!-- 企业信息 -->
  24. <view v-if="current === 0" class="ss-m-t-30 ss-m-x-30 ss-p-b-30">
  25. <span v-for="(tag, i) in info.tagList" :key="i" class="ss-m-r-10 ss-m-b-10" style="display: inline-block;">
  26. <uni-tag :text="tag" inverted="false" size="default" custom-style="background-color: #eef1f7;color:#7f828b;border-color:#eef1f7; display: inline-block;"/>
  27. </span>
  28. <!-- 简介 -->
  29. <view class="ss-m-t-30">
  30. <h4>企业简介</h4>
  31. <view v-if="info.introduce" class="ss-m-t-20" style="color: #606371;" v-html="info.introduce?.replace(/\n/g, '</br>')"></view>
  32. <view v-else></view>
  33. </view>
  34. <!-- 福利标签 -->
  35. <view class="topLine"></view>
  36. <view >
  37. <h4>企业福利标签</h4>
  38. <view class="ss-m-t-20" v-if="info?.welfareList?.length">
  39. <span v-for="(tag, i) in info.welfareList" :key="i" class="ss-m-r-10 ss-m-b-10" style="display: inline-block;">
  40. <uni-tag :text="tag" inverted="false" size="default" custom-style="background-color: #eef1f7;color:#7f828b;border-color:#eef1f7; display: inline-block;"/>
  41. </span>
  42. </view>
  43. <view v-else></view>
  44. </view>
  45. <!-- 网址 -->
  46. <view class="topLine"></view>
  47. <view>
  48. <h4>企业网址</h4>
  49. <view class="ss-m-t-20">
  50. <uni-link v-if="info.website" :href="info.website" :text="info.website" color="#00897B"></uni-link>
  51. <view v-else></view>
  52. </view>
  53. </view>
  54. <view class="topLine"></view>
  55. <!-- 工商信息 -->
  56. <view>
  57. <h4>工商信息</h4>
  58. <view v-if="info.business && Object.keys(info.business).length">
  59. <view class="ss-m-y-15" v-for="k in business" :key="k.value">
  60. <view>{{ k.name }}</view>
  61. <view class="color-666 ss-m-t-5">
  62. {{ info.business[k.value] ? k.value === 'establishmentTime' ? timesTampChange(info.business[k.value], 'Y-M-D') : info.business[k.value] : '' }}
  63. </view>
  64. </view>
  65. </view>
  66. <view v-else></view>
  67. </view>
  68. <!-- 地址 -->
  69. <view class="topLine"></view>
  70. <view>
  71. <h4>企业地址</h4>
  72. <view class="ss-m-t-20" v-if="info?.business?.address">
  73. <uni-icons type="map-pin-ellipse" color="#00897B" size="20"></uni-icons>
  74. <span class="color-666 font-size-15">{{ info?.business?.address }}</span>
  75. </view>
  76. <view v-else></view>
  77. </view>
  78. <view class="topLine"></view>
  79. <!-- 企业相册 -->
  80. <view>
  81. <h4>企业相册</h4>
  82. <view class="ss-m-t-20" v-if="info?.albumList">
  83. <swiper class="swiper-box" :indicator-dots="true" indicator-active-color="#fff">
  84. <swiper-item v-for="(item ,index) in info?.albumList" :key="index" style="overflow-x:hidden;overflow-y: auto;">
  85. <image v-if="checkIsImage(item)" class="ac-imgs" :src="item" @click="previewImage(index)"></image>
  86. <video v-else :id="'albumListVideo'+index" class="ac-imgs" :src="item" @error="videoErrorCallback" controls></video>
  87. </swiper-item>
  88. </swiper>
  89. </view>
  90. <view v-else></view>
  91. </view>
  92. </view>
  93. <!-- 招聘岗位 -->
  94. <view v-if="current == 1">
  95. <scroll-view class="scrollBox defaultBgc" scroll-y="true" @scrolltolower="loadingMore">
  96. <view v-if="positionList.length > 0">
  97. <PositionList class="pb-10" :list="positionList" :noMore="false"></PositionList>
  98. <uni-load-more :status="status" />
  99. </view>
  100. <view v-else class="nodata-img-parents">
  101. <image src="https://minio.citupro.com/dev/static/nodata.png" mode="widthFix" class="nodata-img-child"></image>
  102. </view>
  103. </scroll-view>
  104. </view>
  105. </view>
  106. </template>
  107. <script setup>
  108. import { ref } from 'vue'
  109. import { onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
  110. import { getEnterpriseDetails, enterpriseClick, getEnterpriseSubscribeCheck, getEnterpriseUnsubscribe, getEnterpriseSubscribe } from '@/api/user'
  111. import { dealDictObjData } from '@/utils/position'
  112. import { timesTampChange } from '@/utils/date'
  113. import { getJobAdvertisedSearch } from '@/api/position'
  114. import { getAccessToken } from '@/utils/request'
  115. import PositionList from '@/components/PositionList'
  116. import { checkIsImage } from '@/utils'
  117. import { formatName } from '@/utils/getText'
  118. const current = ref(0)
  119. const items = ['企业介绍', '招聘职位']
  120. const info = ref({})
  121. const id = ref(null)
  122. const title = ref('')
  123. const business = [
  124. { name: '成立日期', value: 'establishmentTime' },
  125. { name: '注册资金', value: 'registeredCapital' },
  126. { name: '统一社会信用代码', value: 'code' },
  127. ]
  128. const status = ref('more')
  129. const queryParams = ref({
  130. pageNo: 1,
  131. pageSize: 10,
  132. enterpriseId: id.value
  133. })
  134. const positionList = ref([])
  135. // 预览
  136. const previewImage = (i) => {
  137. uni.previewImage({
  138. current: i,
  139. urls: info.value.albumList
  140. })
  141. }
  142. // 企业埋点
  143. const enterpriseClickFn = async () => {
  144. if (!id.value) return
  145. await enterpriseClick({ id: id.value })
  146. }
  147. enterpriseClickFn()
  148. // 效验求职者是否关注该企业
  149. const isCollection = ref(false)
  150. const getCollectionStatus = async () => {
  151. if (!getAccessToken()) return isCollection.value = false
  152. const data = await getEnterpriseSubscribeCheck({ enterpriseId: id.value })
  153. isCollection.value = data.data
  154. }
  155. // 关注&取消关注企业
  156. const handleFollow = async () => {
  157. if (!id.value) return
  158. const api = isCollection.value ? getEnterpriseUnsubscribe : getEnterpriseSubscribe
  159. await api(isCollection.value ? id.value : { enterpriseId: id.value })
  160. getCollectionStatus()
  161. }
  162. // 企业详情
  163. const getData = async () => {
  164. const { data } = await getEnterpriseDetails(id.value)
  165. title.value = formatName(data.enterprise.anotherName || data.enterprise.name)
  166. info.value = data.enterprise ? { ...data, ...dealDictObjData({}, data.enterprise) } : data
  167. getCollectionStatus()
  168. }
  169. // 招聘职位列表
  170. const getPositionList = async () => {
  171. queryParams.value.enterpriseId = id.value
  172. const { data } = await getJobAdvertisedSearch(queryParams.value)
  173. const list = data?.list || []
  174. if (list?.length) {
  175. list.forEach(e => {
  176. e.job = { ...e.job, ...dealDictObjData({}, e.job) }
  177. e.enterprise = { ...e.enterprise, ...dealDictObjData({}, e.enterprise)}
  178. })
  179. positionList.value = positionList.value.concat(list)
  180. }
  181. status.value = list?.length < queryParams.value.pageSize ? 'noMore' : 'more'
  182. }
  183. const loadingMore = () => {
  184. status.value = 'loading'
  185. queryParams.value.pageNo++
  186. getPositionList()
  187. }
  188. onLoad(async (options) => {
  189. id.value = options?.id || ''
  190. if (id.value) await getData()
  191. })
  192. wx.showShareMenu({
  193. withShareTicket: true,
  194. menus: ['shareAppMessage', 'shareTimeline']
  195. })
  196. onShareAppMessage(() => {
  197. if(!title.value){
  198. setTimeout(() => {},1000)
  199. }
  200. return {
  201. title: title.value || '门墩儿 专注顶尖招聘',
  202. path: '/pagesB/companyDetail/index?id=' + id.value
  203. }
  204. })
  205. onShareTimeline(() => {
  206. if(!title.value){
  207. setTimeout(() => {},1000)
  208. }
  209. return {
  210. title: title.value || '门墩儿 专注顶尖招聘',
  211. path: '/pagesB/companyDetail/index?id=' + id.value
  212. }
  213. })
  214. const changeControl = (e) =>{
  215. current.value = e.currentIndex
  216. if (current.value === 0) getData()
  217. else getPositionList()
  218. }
  219. const videoErrorCallback = (e) =>{
  220. uni.showToast({
  221. title: e?.target?.errMsg || '播放错误',
  222. icon: 'none'
  223. })
  224. }
  225. </script>
  226. <style scoped lang="scss">
  227. .title-des {
  228. color: #37576c;
  229. font-size: 17px;
  230. margin-right: 30px;
  231. margin-top: 1px;
  232. vertical-align: middle;
  233. flex: 1;
  234. }
  235. .title-text{
  236. font-weight: 700;
  237. font-size: 18px;
  238. }
  239. .topLine {
  240. border-top: 1px solid #EDEDED;
  241. margin: 20px 0;
  242. }
  243. .swiper-box {
  244. height: 29vh;
  245. }
  246. .ac-imgs{
  247. width: 100%;
  248. height: 29vh;
  249. border-radius: 20px;
  250. }
  251. .collect-icon {
  252. position: absolute;
  253. top: 3px;
  254. right: 10px;
  255. }
  256. .scrollBox {
  257. height: 100vh;
  258. }
  259. </style>