ArticleDetails.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <template>
  2. <view class="ArticleDetails">
  3. <view class="Articletitle">
  4. {{ info.title }}
  5. </view>
  6. <view class="subtitle">
  7. <view class="subtitle_left">
  8. <view class="subtitle_left_item">
  9. {{info.columnIdName}}
  10. <text style="color: #fff;margin: 0 10rpx;">{{ '|' }}</text>
  11. {{info.subIdName}}
  12. </view>
  13. <!-- <view class="subtitle_left_item">{{info.subIdName}}</view> -->
  14. </view>
  15. <view class="subtitle_right">
  16. <u--image width="40rpx" height="40rpx" src="/static/index/iconm_shitu.png" ></u--image>
  17. {{ info.views || 0 }}
  18. </view>
  19. </view>
  20. <!-- <view class="time">
  21. {{ info.time }}
  22. </view> -->
  23. <view class="videoBox" v-if="info.videoUrl!=''">
  24. <!-- 视频组件 -->
  25. <video style="width: 710rpx;" :src="info.videoUrl"></video>
  26. </view>
  27. <view class="vHtml" v-if="info.content!=''">
  28. <u-parse class="vHtml" :content="info.content"></u-parse>
  29. </view>
  30. <view class="linebox">
  31. </view>
  32. <view>
  33. <!-- 评论组件 -->
  34. <comment :topicId="info.id"></comment>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import comment from '@/pages/components/comment.vue'
  40. import {getArticleDetailByOpen} from '@/http/api/common.js'
  41. export default {
  42. data() {
  43. return {
  44. info:{
  45. title:'',
  46. readNum:999,
  47. time:'',
  48. content:'',
  49. columnIdName:'',
  50. subIdName:'',
  51. videoUrl:'',
  52. id:''
  53. },
  54. showVido:false
  55. }
  56. },
  57. components: {
  58. comment
  59. },
  60. async onLoad(e) {
  61. if (e?.id != '') {
  62. await this.initData(e?.id)
  63. }else{
  64. uni.showToast({
  65. title: '参数错误',
  66. duration: 2000
  67. });
  68. }
  69. },
  70. onShow() {
  71. },
  72. computed:{
  73. },
  74. methods: {
  75. async initData(id){
  76. let query = {
  77. id:id
  78. }
  79. //获取文章详情
  80. let res = await getArticleDetailByOpen(query)
  81. if (res.data.code == 200) {
  82. this.info = res.data.data
  83. if (this.info.videoList && this.info.videoList.length>0) {
  84. this.info.videoUrl = this.info.videoList[0].fileUrl || ''
  85. }else{
  86. this.info.videoUrl = ''
  87. }
  88. // if (this.info.columnIdName == '视频资讯') {
  89. // this.info.videoUrl = this.info.videoList[0].fileUrl
  90. // this.showVido = true
  91. // }else{
  92. // this.showVido = false
  93. // }
  94. }
  95. }
  96. }
  97. }
  98. </script>
  99. <style>
  100. .ArticleDetails{
  101. width: 750rpx;
  102. margin: 0 auto;
  103. display: flex;
  104. flex-direction: column;
  105. align-items: flex-start;
  106. padding-left: 20rpx;
  107. }
  108. .Articletitle{
  109. width: 710rpx;
  110. height: 112rpx;
  111. font-size: 40rpx;
  112. font-family: PingFang SC, PingFang SC;
  113. font-weight: bold;
  114. color: #333333;
  115. /* line-height: 56rpx; */
  116. display: flex;
  117. align-items: center;
  118. /* display: -webkit-box; */
  119. word-break: break-all;
  120. text-overflow: ellipsis;
  121. overflow: hidden;
  122. -webkit-box-orient: vertical;
  123. -webkit-line-clamp:2;
  124. }
  125. .subtitle{
  126. width: 710rpx;
  127. height: 48rpx;
  128. display: flex;
  129. margin-top: 33rpx;
  130. justify-content: space-between;
  131. }
  132. .subtitle_left{
  133. width: 304rpx;
  134. height: 48rpx;
  135. display: flex;
  136. }
  137. .subtitle_left_item{
  138. width: 300rpx;
  139. height: 48rpx;
  140. margin-left: 4rpx;
  141. background: #EAF0FF;
  142. border-radius: 8rpx 8rpx 8rpx 8rpx;
  143. text-align: center;
  144. font-size: 28rpx;
  145. font-weight: 400;
  146. color: #46A6FF;
  147. line-height: 40rpx;
  148. }
  149. .subtitle_right{
  150. width: 85rpx;
  151. height: 48rpx;
  152. font-size: 28rpx;
  153. font-weight: 500;
  154. color: #999999;
  155. display: flex;
  156. }
  157. .time{
  158. width: 300rpx;
  159. height: 33rpx;
  160. font-size: 28rpx;
  161. font-weight: 400;
  162. color: #999999;
  163. line-height: 40rpx;
  164. margin-top: 20rpx;
  165. margin-bottom: 40rpx;
  166. }
  167. .vHtml{
  168. width: 710rpx;
  169. line-height: 48rpx;
  170. }
  171. .vHtml >>> img {
  172. vertical-align: middle;
  173. border-style: none;
  174. width: 100%;
  175. height: auto;
  176. border-radius: 16rpx;
  177. margin:40rpx 0 ;
  178. }
  179. .vHtml >>> p {
  180. margin-top: 30rpx;
  181. margin-bottom: 30rpx;
  182. }
  183. .vHtml >>> h1{
  184. margin-top: 30rpx;
  185. margin-bottom: 30rpx;
  186. }
  187. .videoBox{
  188. width: 710rpx;
  189. margin: 24rpx 0;
  190. }
  191. .linebox{
  192. width: 750rpx;
  193. height: 100rpx;
  194. border-bottom: 30rpx solid #EEEEEE;
  195. margin-left: -18rpx;
  196. }
  197. </style>