index.vue 11 KB

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