detail.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. <template>
  2. <view class="container">
  3. <view class="tui-news-title">{{detail.title}}</view>
  4. <view class="tui-sub-info">
  5. <view class="tui-sub-left">
  6. <text class="tui-author">{{detail.cate}}</text>
  7. <text>{{detail.create_time}}</text>
  8. </view>
  9. <view class="tui-sub-right">阅读 2453</view>
  10. </view>
  11. <view class="tui-news-content">
  12. <uParse :html="detail.content" ref="article" :tag-style="tagStyle"></uParse>
  13. </view>
  14. <!--加载loadding-->
  15. <tui-loadmore v-if="loadding" :index="3" type="primary"></tui-loadmore>
  16. <tui-nomore v-if="!pullUpOn" backgroundColor="#fff" text="没有更多评论"></tui-nomore>
  17. <!--加载loadding-->
  18. <view class="tui-safearea-bottom"></view>
  19. </view>
  20. </template>
  21. <script>
  22. import uParse from '@/components/jyf-parser/jyf-parser';
  23. export default {
  24. components: {
  25. uParse
  26. },
  27. data() {
  28. return {
  29. detail:{},
  30. fabulous: 123,
  31. isFabulous: false,
  32. isCollection: false,
  33. pageIndex: 1,
  34. loadding: false,
  35. pullUpOn: true
  36. }
  37. },
  38. onLoad: function(e) {
  39. let _this = this;
  40. _this.$request.get('article.detail', {
  41. id: e.id,
  42. showLoading:true
  43. }).then(res => {
  44. //console.log(res);
  45. if (res.errno == 0) {
  46. _this.detail = res.data;
  47. }
  48. });
  49. },
  50. computed: {
  51. iconColor() {
  52. return this.isFabulous ? '#5677fc' : '#333'
  53. },
  54. itemIconColor() {
  55. return function(isFabulous) {
  56. return isFabulous ? '#5677fc' : '#9a9a9a'
  57. }
  58. },
  59. iconName() {
  60. return function(isFabulous) {
  61. return isFabulous ? 'agree-fill' : 'agree'
  62. }
  63. }
  64. },
  65. methods: {
  66. btnFabulous: function() {
  67. this.fabulous = this.isFabulous ? 123 : 124;
  68. this.isFabulous = !this.isFabulous
  69. },
  70. collection: function() {
  71. this.isCollection = !this.isCollection
  72. if (this.isCollection) {
  73. this.tui.toast("收藏成功!");
  74. }
  75. },
  76. btnCmt: function() {
  77. uni.navigateTo({
  78. url: '../comment/comment'
  79. })
  80. },
  81. cmtAll: function() {
  82. uni.navigateTo({
  83. url: '../commentList/commentList'
  84. })
  85. },
  86. cmtReply: function() {
  87. uni.navigateTo({
  88. url: '../commentReply/commentReply'
  89. })
  90. }
  91. },
  92. /**
  93. * 页面相关事件处理函数--监听用户下拉动作
  94. */
  95. onPullDownRefresh: function() {
  96. setTimeout(() => {
  97. uni.stopPullDownRefresh()
  98. }, 200);
  99. },
  100. }
  101. </script>
  102. <style>
  103. page {
  104. background: #fff;
  105. color: #333;
  106. }
  107. .container {
  108. padding: 40rpx 30rpx 110rpx 30rpx;
  109. box-sizing: border-box;
  110. }
  111. .tui-news-title {
  112. font-size: 48rpx;
  113. font-weight: 500;
  114. text-align: justify;
  115. }
  116. .tui-sub-info {
  117. padding-top: 30rpx;
  118. display: flex;
  119. align-items: center;
  120. justify-content: space-between;
  121. font-size: 28rpx;
  122. color: #999;
  123. }
  124. .tui-author {
  125. color: #5677fc;
  126. padding-right: 20rpx;
  127. }
  128. .tui-news-content {
  129. padding-top: 40rpx;
  130. }
  131. .tui-article {
  132. /* text-indent: 2em; */
  133. font-size: 34rpx;
  134. padding-bottom: 40rpx;
  135. line-height: 60rpx;
  136. text-align: justify;
  137. word-break: break-all;
  138. word-wrap: break-word;
  139. }
  140. .tui-article-pic {
  141. width: 100%;
  142. display: block;
  143. margin-bottom: 40rpx;
  144. }
  145. .tui-news-source {
  146. font-size: 24rpx;
  147. color: #999;
  148. }
  149. .tui-operate-box {
  150. display: flex;
  151. align-items: center;
  152. justify-content: space-between;
  153. padding: 60rpx 40rpx;
  154. box-sizing: border-box;
  155. }
  156. .tui-black {
  157. color: #333;
  158. padding-left: 12rpx;
  159. }
  160. .tui-cmt-title {
  161. font-size: 30rpx;
  162. font-weight: bold;
  163. position: relative;
  164. }
  165. .tui-cmt-title::after {
  166. content: '';
  167. position: absolute;
  168. left: -18rpx;
  169. top: 18%;
  170. width: 6rpx;
  171. height: 64%;
  172. background: #5677fc;
  173. }
  174. .tui-cmtbox {
  175. padding-bottom: 20rpx;
  176. }
  177. .tui-cmt-cell {
  178. display: flex;
  179. align-items: flex-start;
  180. justify-content: space-between;
  181. padding-top: 44rpx;
  182. }
  183. .tui-avatar {
  184. width: 64rpx;
  185. height: 64rpx;
  186. border-radius: 32rpx;
  187. display: block;
  188. flex-shrink: 0;
  189. }
  190. .tui-cmt-detail {
  191. width: 100%;
  192. padding-left: 16rpx;
  193. box-sizing: border-box;
  194. }
  195. .tui-header-box {
  196. display: flex;
  197. align-items: flex-start;
  198. justify-content: space-between;
  199. font-size: 30rpx;
  200. }
  201. .tui-cmt-nickname {
  202. color: #5677fc;
  203. }
  204. .tui-fabulous {
  205. color: #9a9a9a;
  206. }
  207. .tui-fabulous text {
  208. padding-right: 4rpx;
  209. font-size: 24rpx;
  210. }
  211. .tui-cmt-content {
  212. font-size: 32rpx;
  213. color: #333;
  214. text-align: justify;
  215. padding-top: 8rpx;
  216. word-break: break-all;
  217. word-wrap: break-word;
  218. }
  219. .tui-reply-box {
  220. border-radius: 8rpx;
  221. overflow: hidden;
  222. margin-top: 16rpx;
  223. }
  224. .tui-cell-last {
  225. display: flex;
  226. align-items: center;
  227. word-wrap: break-word;
  228. color: #5677fc;
  229. }
  230. .tui-flex-1 {
  231. flex: 1;
  232. width: 100%;
  233. }
  234. .tui-reply-nickname {
  235. font-size: 24rpx;
  236. color: #7a7a7a;
  237. padding-bottom: 8rpx;
  238. }
  239. .tui-footer {
  240. display: flex;
  241. align-items: center;
  242. font-size: 24rpx;
  243. margin-top: 16rpx;
  244. color: #9a9a9a;
  245. }
  246. .tui-primary {
  247. color: #5677fc !important;
  248. }
  249. .tui-ml {
  250. margin-left: 16rpx;
  251. }
  252. .tui-operation {
  253. width: 100%;
  254. height: 100rpx;
  255. overflow: hidden;
  256. background: #fff;
  257. display: flex;
  258. align-items: center;
  259. justify-content: space-between;
  260. position: fixed;
  261. left: 0;
  262. bottom: 0;
  263. z-index: 99999;
  264. padding-bottom: env(safe-area-inset-bottom);
  265. }
  266. .tui-safearea-bottom {
  267. width: 100%;
  268. height: env(safe-area-inset-bottom);
  269. }
  270. .tui-operation::before {
  271. content: '';
  272. position: absolute;
  273. top: 0;
  274. right: 0;
  275. left: 0;
  276. border-top: 1rpx solid #eaeef1;
  277. -webkit-transform: scaleY(0.5);
  278. transform: scaleY(0.5);
  279. }
  280. .tui-operation-left {
  281. display: flex;
  282. align-items: center;
  283. }
  284. .tui-operation-item {
  285. flex: 1;
  286. display: flex;
  287. align-items: center;
  288. justify-content: center;
  289. flex-direction: column;
  290. position: relative;
  291. }
  292. .tui-operation-right {
  293. height: 100rpx;
  294. box-sizing: border-box;
  295. padding-top: 0;
  296. }
  297. .tui-right-flex {
  298. display: flex;
  299. align-items: center;
  300. justify-content: center;
  301. }
  302. .tui-btn-comment {
  303. height: 64rpx;
  304. width: 84%;
  305. background: #ededed;
  306. color: #999;
  307. border-radius: 8rpx;
  308. font-size: 28rpx;
  309. display: flex;
  310. align-items: center;
  311. padding-left: 20rpx;
  312. box-sizing: border-box;
  313. padding-top: 0;
  314. margin-left: 30rpx;
  315. }
  316. .tui-col-7 {
  317. width: 58.33333333%;
  318. }
  319. .tui-col-5 {
  320. width: 41.66666667%;
  321. }
  322. .tui-share-btn {
  323. display: block;
  324. background: none;
  325. margin: 0;
  326. padding: 0;
  327. }
  328. </style>