detail.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  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. <u-parse :content="item.contents" :tagStyle="tagStyle"></u-parse>
  12. </view>
  13. </view>
  14. <!-- 最近阅读 -->
  15. <!-- <view class="recent-reads">
  16. <view class="left">
  17. <text class="label">最近阅读</text>
  18. <view class="peop-box" @click="showUsers">
  19. <view class="head-box">
  20. <view class="head" v-for="(subitem,j) in views" :key="j">
  21. <image :src="subitem.avatar==null?'https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/my_heads_icon.png':subitem.avatar" mode=""></image>
  22. </view>
  23. </view>
  24. <image class="arrow" src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/shopping/arrow_gray.png" mode=""></image>
  25. </view>
  26. </view>
  27. <view class="share-btn">
  28. <image src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/shopping/share.png" mode=""></image>
  29. <text>分享</text>
  30. <button class="share" data-name="shareBtn" open-type="share">分享</button>
  31. </view>
  32. </view> -->
  33. <!-- 咨询按钮 -->
  34. <!-- <view class="inquiry">
  35. <view class="content">
  36. <image src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/2c3a31fbaad9417192b5547e7f072c45.png" mode=""></image>
  37. <text class="text">咨询</text>
  38. <button class="contact-btn" open-type="contact"></button>
  39. </view>
  40. </view> -->
  41. </view>
  42. </template>
  43. <script>
  44. import {getArticleByArticleId,updateView} from '@/api/article'
  45. export default {
  46. data() {
  47. return {
  48. articleId:null,
  49. item:{},
  50. views:[],
  51. tagStyle: {
  52. img: 'display: block;'
  53. }
  54. };
  55. },
  56. onLoad(option) {
  57. this.articleId=option.articleId;
  58. this.$isLogin().then(res => {
  59. if(res){
  60. this.updateView();
  61. }
  62. })
  63. },
  64. onShow() {
  65. this.getArticleByArticleId();
  66. },
  67. methods:{
  68. updateView(){
  69. updateView(this.articleId).then(
  70. res => {
  71. },
  72. rej => {}
  73. );
  74. },
  75. getArticleByArticleId(){
  76. let data = {articleId:this.articleId};
  77. getArticleByArticleId(data).then(
  78. res => {
  79. if(res.code==200){
  80. this.item=res.data;
  81. this.views=res.views;
  82. }else{
  83. uni.showToast({
  84. icon:'none',
  85. title: "请求失败",
  86. });
  87. }
  88. },
  89. rej => {}
  90. );
  91. },
  92. // 查看阅读用户
  93. showUsers() {
  94. uni.navigateTo({
  95. url: './readUsers?articleId='+this.articleId
  96. })
  97. }
  98. }
  99. }
  100. </script>
  101. <style lang="scss">
  102. page{
  103. height: 100%;
  104. }
  105. .content{
  106. height: 100%;
  107. display: flex;
  108. flex-direction: column;
  109. }
  110. .detail-cont{
  111. flex: 1;
  112. padding: 40upx;
  113. overflow-y: auto;
  114. .title{
  115. font-size: 40upx;
  116. font-family: PingFang SC;
  117. // font-weight: bold;
  118. color: #222222;
  119. line-height: 70upx;
  120. }
  121. .info{
  122. display: flex;
  123. align-items: center;
  124. font-size: 24upx;
  125. font-family: PingFang SC;
  126. font-weight: 500;
  127. color: #999999;
  128. line-height: 48upx;
  129. margin: 23upx 0;
  130. .reads{
  131. margin-right: 30upx;
  132. }
  133. }
  134. .full-text{
  135. font-size: 36upx;
  136. font-family: PingFang SC;
  137. // font-weight: 500;
  138. color: #222222;
  139. line-height: 60upx;
  140. display: block;
  141. }
  142. }
  143. .recent-reads{
  144. flex-shrink: 0;
  145. box-sizing: border-box;
  146. height: 121upx;
  147. background: #FFFFFF;
  148. border-top: 1px solid #F0F0F0;
  149. padding: 0 40upx 0 37upx;
  150. display: flex;
  151. align-items: center;
  152. justify-content: space-between;
  153. .left{
  154. display: flex;
  155. align-items: center;
  156. .label{
  157. font-size: 28upx;
  158. font-family: PingFang SC;
  159. font-weight: 500;
  160. color: #666666;
  161. line-height: 1;
  162. margin-right: 20upx;
  163. }
  164. .peop-box{
  165. display: flex;
  166. align-items: center;
  167. .head-box{
  168. margin-right: 28upx;
  169. display: flex;
  170. align-items: center;
  171. .head{
  172. width: 48upx;
  173. height: 48upx;
  174. border-radius: 50%;
  175. overflow: hidden;
  176. box-shadow: 0 0 0 1px #fff;
  177. margin-right: -10upx;
  178. image{
  179. width: 100%;
  180. height: 100%;
  181. }
  182. }
  183. }
  184. .arrow{
  185. width: 13upx;
  186. height: 23upx;
  187. }
  188. }
  189. }
  190. .share-btn{
  191. position: relative;
  192. width: 240upx;
  193. height: 80upx;
  194. line-height: 80upx;
  195. font-size: 30upx;
  196. font-family: PingFang SC;
  197. font-weight: 500;
  198. color: #FFFFFF;
  199. background: #2583EB;
  200. border-radius: 40upx;
  201. display: flex;
  202. align-items: center;
  203. justify-content: center;
  204. image{
  205. width: 32upx;
  206. height: 32upx;
  207. margin-right: 15upx;
  208. }
  209. .share{
  210. position: absolute;
  211. width: 100%;
  212. height: 100%;
  213. opacity: 0;
  214. }
  215. }
  216. }
  217. .inquiry{
  218. width: 131upx;
  219. height: 131upx;
  220. position: fixed;
  221. right: 22upx;
  222. bottom: 193upx;
  223. z-index: 99;
  224. .content{
  225. position: relative;
  226. image{
  227. width: 100%;
  228. height: 100%;
  229. position: absolute;
  230. top: 0;
  231. left: 0;
  232. z-index: 9;
  233. }
  234. .text{
  235. position: absolute;
  236. top: 70upx;
  237. left: 50%;
  238. transform: translateX(-50%);
  239. z-index: 10;
  240. font-size: 22upx;
  241. font-family: PingFang SC;
  242. font-weight: bold;
  243. color: #2583EB;
  244. line-height: 1;
  245. }
  246. }
  247. }
  248. .contact-btn{
  249. display: inline-block;
  250. position: absolute;
  251. top: 0;
  252. left: 0;
  253. width: 100%;
  254. height: 100%;
  255. opacity: 0;
  256. z-index: 9999;
  257. }
  258. </style>