ContentHeader.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. <template>
  2. <section class="content-title-container bg-white">
  3. <span
  4. v-if="showHeaderType"
  5. class="page-tag red fixed-header-top-left"
  6. :class="{ 'rectangle-tag': IsSunPublishContent }"
  7. >
  8. {{ headerType }}
  9. </span>
  10. <!-- <span class="forecast fixed-header-right" v-if="otherModel.forecastShow">
  11. <span class="j-icon j-base-icon icon-ai"></span>
  12. <span class="forecast-text">中标预测</span>
  13. </span> -->
  14. <h2
  15. class="article-title"
  16. :class="{ 'van-multi-ellipsis--l2': false }"
  17. v-html="content.titleHighlighted"
  18. />
  19. <div class="tag-list">
  20. <a
  21. v-for="(tag, index) in content.tags"
  22. :key="index"
  23. class="j-tag-item border gray round"
  24. :class="[tag.className]"
  25. :href="tag.link"
  26. >{{ tag.label }}</a>
  27. </div>
  28. <div v-if="showCollection" class="tag-list">
  29. <span
  30. v-for="tag in collectionTags"
  31. :key="tag.id"
  32. class="j-tag-item blue round text-underline"
  33. @click="onCollectionTagClick(tag)"
  34. >{{ tag.label }}</span>
  35. </div>
  36. <div class="sub-info-line">
  37. <span class="info-publish-time">{{ content.time }}</span>
  38. <span v-if="cbPersonText" class="info-canbiao-persons">
  39. 参标人:{{ cbPersonText }}
  40. </span>
  41. <!-- 无参标人和时间一行 -->
  42. <div v-else-if="showRenMaiButton" class="sub-info-line">
  43. <div v-if="showCreditReport" class="creditreport-button" @click="creditReport">
  44. <span class="creditreport-text">投标企业信用报告</span>
  45. </div>
  46. <div
  47. class="relationship-button"
  48. @click="findRenMai"
  49. >
  50. <span class="relationship-icon j-icon j-base-icon icon-renmai" />
  51. <span class="relationship-text">找人脉</span>
  52. </div>
  53. </div>
  54. <div v-else class="sub-info-line">
  55. <div v-if="showCreditReport" class="creditreport-button" @click="creditReport">
  56. <span class="creditreport-text">投标企业信用报告</span>
  57. </div>
  58. </div>
  59. </div>
  60. <div v-if="showRenMaiButton2" class="sub-info-line">
  61. <div class="sub-info-line-l" />
  62. <div class="sub-info-line-r">
  63. <!-- 有参标人时候另起一行 -->
  64. <div
  65. v-if="cbPersonText && showRenMaiButton"
  66. class="relationship-button"
  67. @click="findRenMai"
  68. >
  69. <span class="relationship-icon j-icon j-base-icon icon-renmai" />
  70. <span class="relationship-text">找人脉</span>
  71. </div>
  72. </div>
  73. </div>
  74. </section>
  75. </template>
  76. <script>
  77. import { Icon } from 'vant'
  78. import { mapState } from 'vuex'
  79. import { LINKS } from '@/data'
  80. import { openAppOrWxPage } from '@/utils/'
  81. import { getUserResource } from '@/api/modules/bi'
  82. const articleTypeArr = ['采购意向', '预告', '招标']
  83. export default {
  84. name: 'ContentHeader',
  85. components: {
  86. [Icon.name]: Icon
  87. },
  88. props: {
  89. beforeLeavePage: Function
  90. },
  91. data() {
  92. return {
  93. renmai: {
  94. loading: false
  95. }
  96. }
  97. },
  98. computed: {
  99. ...mapState({
  100. content: state => state.article.mainModel.content,
  101. summary: state => state.article.mainModel.summary,
  102. otherModel: state => state.article.otherModel,
  103. IsSunPublishContent() {
  104. return this.content.IsSunPublishContent || false
  105. },
  106. yyszbContent() {
  107. return this.content.yyszbContent
  108. },
  109. showHeaderType() {
  110. if (!this.headerType) {
  111. return false
  112. }
  113. return this.content.isSelfSite || this.IsSunPublishContent
  114. },
  115. showCollection() {
  116. if (this.IsSunPublishContent) {
  117. return false
  118. }
  119. return this.collectionTags.length > 0
  120. },
  121. headerType() {
  122. if (this.IsSunPublishContent) {
  123. return this.content.publicType
  124. }
  125. else {
  126. return '业主委托项目'
  127. }
  128. }
  129. }),
  130. cbPersonText() {
  131. if (this.IsSunPublishContent) {
  132. return ''
  133. }
  134. const { inBiddingPersonList: bList } = this.otherModel
  135. if (Array.isArray(bList) && bList.length > 0) {
  136. const list = bList.map(b => b.trim()).filter(b => !!b)
  137. if (list.length > 1) {
  138. return `${list.slice(0, 1).join(',')} 等`
  139. }
  140. else {
  141. return list.join(',')
  142. }
  143. }
  144. else {
  145. return ''
  146. }
  147. },
  148. showCreditReport() {
  149. return articleTypeArr.includes(this.content?._ob?.topType || this.content?._ob?.subType || '')
  150. },
  151. showRenMaiButton() {
  152. if (this.IsSunPublishContent) {
  153. return ''
  154. }
  155. if (this.yyszbContent) {
  156. return
  157. }
  158. return articleTypeArr.includes(this.content?._ob?.topType)
  159. },
  160. showRenMaiButton2() {
  161. return !(this.IsSunPublishContent || this.yyszbContent)
  162. },
  163. collectionTags() {
  164. return this.otherModel.collectionTags
  165. }
  166. },
  167. methods: {
  168. async onCollectionTagClick(tag) {
  169. if (this.beforeLeavePage) {
  170. await this.beforeLeavePage()
  171. }
  172. openAppOrWxPage(LINKS.标讯收藏, {
  173. query: {
  174. tag: tag.id || tag.lid
  175. }
  176. })
  177. },
  178. async checkHasRemMaiPower() {
  179. this.renmai.loading = true
  180. try {
  181. const res = await getUserResource()
  182. if (res && Array.isArray(res.data)) {
  183. return res.data.includes('bi_rmgl')
  184. }
  185. }
  186. catch (error) {
  187. console.log(error)
  188. }
  189. finally {
  190. this.renmai.loading = false
  191. }
  192. },
  193. creditReport() {
  194. const buyer = this.summary?.buyers[0]?.name
  195. const typeName = this.content?._ob?.topType || this.content?._ob?.subType
  196. const breaker_name = `投标企业信用报告_${typeName}`
  197. // 区分标讯类型埋点
  198. try {
  199. window.__EasyJTrack.addTrack(breaker_name, {
  200. breaker_name
  201. })
  202. }
  203. catch (e) {
  204. console.log(e)
  205. }
  206. this.$router.push({
  207. path: '/order/create/creditreport',
  208. query: buyer ? { buyer } : {}
  209. })
  210. },
  211. async findRenMai() {
  212. const hasPower = await this.checkHasRemMaiPower()
  213. if (hasPower) {
  214. this.$dialog.confirm({
  215. title: '温馨提示',
  216. message: '人脉相关功能目前仅支持在PC端使用',
  217. className: 'j-confirm-dialog',
  218. showCancelButton: false,
  219. confirmButtonText: '我知道了'
  220. })
  221. }
  222. else {
  223. // 弹窗
  224. // this.$toast('暂无权限')
  225. // 跳转大会员落地页
  226. openAppOrWxPage(LINKS.人脉落地页面)
  227. }
  228. }
  229. }
  230. }
  231. </script>
  232. <style lang="scss" scoped>
  233. .fixed-header-top-left {
  234. position: absolute;
  235. left: -1px;
  236. top: 2px;
  237. }
  238. .content-title-container {
  239. position: relative;
  240. padding: 24px 16px 12px;
  241. .page-tag {
  242. padding: 1px 8px;
  243. background: rgba(251, 72, 61, 0.1);
  244. color: #fb483d;
  245. font-size: 12px;
  246. line-height: 18px;
  247. border-radius: 0 10px 10px 0;
  248. }
  249. .rectangle-tag {
  250. border: 1px solid #fb483d;
  251. border-left: 0;
  252. border-radius: 0;
  253. }
  254. }
  255. .text-underline {
  256. text-decoration: underline;
  257. }
  258. .article-title {
  259. font-size: 18px;
  260. font-weight: 400;
  261. line-height: 26px;
  262. color: #171826;
  263. }
  264. .tag-list {
  265. margin: 8px 0 4px;
  266. display: flex;
  267. flex-wrap: wrap;
  268. .j-tag-item {
  269. margin-bottom: 4px;
  270. &:not(:last-of-type) {
  271. margin-right: 4px;
  272. }
  273. }
  274. }
  275. .sub-info-line {
  276. margin-bottom: 2px;
  277. position: relative;
  278. display: flex;
  279. align-items: center;
  280. justify-content: space-between;
  281. font-size: 12px;
  282. line-height: 18px;
  283. color: #9b9ca3;
  284. }
  285. .info-canbiao-persons {
  286. font-size: 13px;
  287. left: 20px;
  288. color: #5f5e64;
  289. }
  290. .fixed-header-right {
  291. position: absolute;
  292. right: 0;
  293. bottom: 38px;
  294. }
  295. .forecast {
  296. display: flex;
  297. justify-content: center;
  298. align-items: center;
  299. width: 84px;
  300. height: 28px;
  301. background: $main;
  302. border-radius: 14px 0px 0px 14px;
  303. .icon-ai {
  304. width: 16px;
  305. height: 16px;
  306. }
  307. .forecast-text {
  308. font-size: 13px;
  309. line-height: 20px;
  310. color: $white;
  311. }
  312. }
  313. .sub-info-line-r {
  314. display: flex;
  315. align-items: center;
  316. }
  317. .creditreport-button {
  318. display: flex;
  319. align-items: center;
  320. justify-content: space-between;
  321. margin-right: 10px;
  322. padding: 2px 8px;
  323. line-height: 20px;
  324. color: #fff;
  325. background: linear-gradient(to right, #5FD4E3, #28C1E2);
  326. border-radius: 4px;
  327. }
  328. .relationship-button {
  329. // position: relative;
  330. // right: -16px;
  331. // top: 0;
  332. display: flex;
  333. align-items: center;
  334. justify-content: space-between;
  335. padding: 2px 12px;
  336. height: 24px;
  337. color: #fff;
  338. background: linear-gradient(to right, #5FD4E3, #28C1E2);
  339. border-radius: 4px;
  340. .j-icon {
  341. margin-right: 4px;
  342. width: 12px;
  343. height: 12px;
  344. }
  345. }
  346. </style>