ContentHeader.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <template>
  2. <section class="content-title-container bg-white">
  3. <span
  4. class="j-tag-item border red fixed-header-top-left"
  5. v-if="content.isSelfSite"
  6. >
  7. 业主委托项目
  8. </span>
  9. <!-- <span class="forecast fixed-header-right" v-if="otherModel.forecastShow">
  10. <span class="j-icon j-base-icon icon-ai"></span>
  11. <span class="forecast-text">中标预测</span>
  12. </span> -->
  13. <h2
  14. class="article-title"
  15. :class="{ 'van-multi-ellipsis--l2': false }"
  16. v-html="content.titleHighlighted"
  17. ></h2>
  18. <div class="tag-list">
  19. <a
  20. class="j-tag-item border gray round"
  21. v-for="(tag, index) in content.tags"
  22. :key="index"
  23. :href="tag.link"
  24. >{{ tag.label }}</a>
  25. </div>
  26. <div class="tag-list">
  27. <span
  28. class="j-tag-item blue round text-underline"
  29. v-for="tag in collectionTags"
  30. :key="tag.id"
  31. @click="onCollectionTagClick(tag)"
  32. >{{ tag.label }}</span>
  33. </div>
  34. <div class="sub-info-line">
  35. <span class="info-publish-time">{{ content.time }}</span>
  36. <span class="info-canbiao-persons" v-if="cbPersonText">
  37. 参标人:{{ cbPersonText }}
  38. </span>
  39. </div>
  40. </section>
  41. </template>
  42. <script>
  43. import { Icon } from 'vant'
  44. import { mapState } from 'vuex'
  45. import { LINKS } from '@/data'
  46. import { openAppOrWxPage } from '@/utils/'
  47. export default {
  48. name: 'ContentHeader',
  49. components: {
  50. [Icon.name]: Icon
  51. },
  52. props: {
  53. beforeLeavePage: Function
  54. },
  55. computed: {
  56. ...mapState({
  57. content: (state) => state.article.mainModel.content,
  58. summary: (state) => state.article.mainModel.summary,
  59. otherModel: (state) => state.article.otherModel
  60. }),
  61. cbPersonText() {
  62. const { inBiddingPersonList: bList } = this.otherModel
  63. if (Array.isArray(bList) && bList.length > 0) {
  64. const list = bList.map((b) => b.trim()).filter((b) => !!b)
  65. if (list.length > 1) {
  66. return `${list.slice(0, 1).join(',')} 等`
  67. } else {
  68. return list.join(',')
  69. }
  70. } else {
  71. return ''
  72. }
  73. },
  74. collectionTags() {
  75. return this.otherModel.collectionTags
  76. }
  77. },
  78. created() {},
  79. methods: {
  80. async onCollectionTagClick(tag) {
  81. if (this.beforeLeavePage) {
  82. await this.beforeLeavePage()
  83. }
  84. openAppOrWxPage(LINKS.标讯收藏, {
  85. query: {
  86. tag: tag.id || tag.lid
  87. }
  88. })
  89. }
  90. }
  91. }
  92. </script>
  93. <style lang="scss" scoped>
  94. .fixed-header-top-left {
  95. position: absolute;
  96. left: -1px;
  97. top: 1px;
  98. }
  99. .content-title-container {
  100. position: relative;
  101. padding: 24px 16px 12px;
  102. }
  103. .text-underline {
  104. text-decoration: underline;
  105. }
  106. .article-title {
  107. font-size: 18px;
  108. font-weight: 400;
  109. line-height: 26px;
  110. color: #171826;
  111. }
  112. .tag-list {
  113. margin: 8px 0 4px;
  114. display: flex;
  115. flex-wrap: wrap;
  116. .j-tag-item {
  117. margin-bottom: 4px;
  118. &:not(:last-of-type) {
  119. margin-right: 4px;
  120. }
  121. }
  122. }
  123. .sub-info-line {
  124. display: flex;
  125. align-items: center;
  126. justify-content: space-between;
  127. font-size: 12px;
  128. line-height: 18px;
  129. color: #9b9ca3;
  130. }
  131. .info-canbiao-persons {
  132. font-size: 14px;
  133. left: 20px;
  134. color: #5f5e64;
  135. }
  136. .fixed-header-right {
  137. position: absolute;
  138. right: 0;
  139. bottom: 38px;
  140. }
  141. .forecast {
  142. display: flex;
  143. justify-content: center;
  144. align-items: center;
  145. width: 84px;
  146. height: 28px;
  147. background: $main;
  148. border-radius: 14px 0px 0px 14px;
  149. .icon-ai {
  150. width: 16px;
  151. height: 16px;
  152. }
  153. .forecast-text {
  154. font-size: 13px;
  155. line-height: 20px;
  156. color: $white;
  157. }
  158. }
  159. </style>