articleDetails.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <view class="content">
  3. <view class="detail-cont">
  4. <view class="title">{{item.title}}</view>
  5. <view class="info">
  6. <view class="reads">阅读数:{{item.views}}</view>
  7. <view class="time">{{item.publishTime}}</view>
  8. </view>
  9. <!-- 正文 -->
  10. <view class="full-text">
  11. <view v-html="item.contents"></view>
  12. </view>
  13. </view>
  14. <!-- 咨询按钮 -->
  15. <view class="inquiry">
  16. <view class="content">
  17. <image src="https://cos.his.cdwjyyh.com/fs/20250417/2c3a31fbaad9417192b5547e7f072c45.png" mode=""></image>
  18. <text class="text">咨询</text>
  19. <button class="contact-btn" open-type="contact"></button>
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. import {getArticleById} from '@/api/article'
  26. export default {
  27. data() {
  28. return {
  29. baseUrl:uni.getStorageSync('requestPath'),
  30. articleId:null,
  31. item:{},
  32. };
  33. },
  34. onLoad(option) {
  35. this.articleId=option.articleId;
  36. },
  37. onShow() {
  38. this.getArticleById();
  39. },
  40. //发送给朋友
  41. onShareAppMessage(res) {
  42. return {
  43. title: this.item.title,
  44. path: '/pages_index/articleDetails?articleId='+this.articleId,
  45. }
  46. },
  47. //分享到朋友圈
  48. onShareTimeline(res) {
  49. return {
  50. title: this.item.title,
  51. query:'articleId='+this.articleId,//页面参数
  52. }
  53. },
  54. methods:{
  55. getArticleById(){
  56. let data = {articleId:this.articleId};
  57. getArticleById(data).then(
  58. res => {
  59. if(res.code==200){
  60. this.item=res.data;
  61. }else{
  62. uni.showToast({
  63. icon:'none',
  64. title: "请求失败",
  65. });
  66. }
  67. },
  68. rej => {}
  69. );
  70. },
  71. }
  72. }
  73. </script>
  74. <style lang="scss">
  75. page{
  76. height: 100%;
  77. }
  78. .content{
  79. height: 100%;
  80. display: flex;
  81. flex-direction: column;
  82. }
  83. .detail-cont{
  84. flex: 1;
  85. padding: 40upx;
  86. overflow-y: auto;
  87. .title{
  88. font-size: 40upx;
  89. font-family: PingFang SC;
  90. // font-weight: bold;
  91. color: #222222;
  92. line-height: 70upx;
  93. }
  94. .info{
  95. display: flex;
  96. align-items: center;
  97. font-size: 24upx;
  98. font-family: PingFang SC;
  99. font-weight: 500;
  100. color: #999999;
  101. line-height: 48upx;
  102. margin: 23upx 0;
  103. .reads{
  104. margin-right: 30upx;
  105. }
  106. }
  107. .full-text{
  108. font-size: 36upx;
  109. font-family: PingFang SC;
  110. // font-weight: 500;
  111. color: #222222;
  112. line-height: 60upx;
  113. }
  114. }
  115. .recent-reads{
  116. flex-shrink: 0;
  117. box-sizing: border-box;
  118. height: 121upx;
  119. background: #FFFFFF;
  120. border-top: 1px solid #F0F0F0;
  121. padding: 0 40upx 0 37upx;
  122. display: flex;
  123. align-items: center;
  124. justify-content: space-between;
  125. .left{
  126. display: flex;
  127. align-items: center;
  128. .label{
  129. font-size: 28upx;
  130. font-family: PingFang SC;
  131. font-weight: 500;
  132. color: #666666;
  133. line-height: 1;
  134. margin-right: 20upx;
  135. }
  136. .peop-box{
  137. display: flex;
  138. align-items: center;
  139. .head-box{
  140. margin-right: 28upx;
  141. display: flex;
  142. align-items: center;
  143. .head{
  144. width: 48upx;
  145. height: 48upx;
  146. border-radius: 50%;
  147. overflow: hidden;
  148. box-shadow: 0 0 0 1px #fff;
  149. margin-right: -10upx;
  150. image{
  151. width: 100%;
  152. height: 100%;
  153. }
  154. }
  155. }
  156. .arrow{
  157. width: 13upx;
  158. height: 23upx;
  159. }
  160. }
  161. }
  162. .share-btn{
  163. position: relative;
  164. width: 240upx;
  165. height: 80upx;
  166. line-height: 80upx;
  167. font-size: 30upx;
  168. font-family: PingFang SC;
  169. font-weight: 500;
  170. color: #FFFFFF;
  171. background: #C39A58;
  172. border-radius: 40upx;
  173. display: flex;
  174. align-items: center;
  175. justify-content: center;
  176. image{
  177. width: 32upx;
  178. height: 32upx;
  179. margin-right: 15upx;
  180. }
  181. .share{
  182. position: absolute;
  183. width: 100%;
  184. height: 100%;
  185. opacity: 0;
  186. }
  187. }
  188. }
  189. .inquiry{
  190. width: 131upx;
  191. height: 131upx;
  192. position: fixed;
  193. right: 22upx;
  194. bottom: 193upx;
  195. z-index: 99;
  196. .content{
  197. position: relative;
  198. image{
  199. width: 100%;
  200. height: 100%;
  201. position: absolute;
  202. top: 0;
  203. left: 0;
  204. z-index: 9;
  205. }
  206. .text{
  207. position: absolute;
  208. top: 70upx;
  209. left: 50%;
  210. transform: translateX(-50%);
  211. z-index: 10;
  212. font-size: 22upx;
  213. font-family: PingFang SC;
  214. font-weight: bold;
  215. color: #C39A58;
  216. line-height: 1;
  217. }
  218. }
  219. }
  220. .contact-btn{
  221. display: inline-block;
  222. position: absolute;
  223. top: 0;
  224. left: 0;
  225. width: 100%;
  226. height: 100%;
  227. opacity: 0;
  228. z-index: 9999;
  229. }
  230. </style>