articleDetail.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view>
  3. <u-navbar back-text="内容详情" back-icon-size="28" back-icon-color="#ffffff"
  4. :background="{backgroundColor: '#2795FD',}" :back-text-style="{color: '#ffffff'}"></u-navbar>
  5. <view class="main">
  6. <view class="title">
  7. {{newsDetail.title}}
  8. </view>
  9. <view class="date-views">
  10. <view class="date">
  11. {{newsDetail.createTime}}
  12. </view>
  13. <view class="views">
  14. <view class="icon">
  15. <img src="@/assets/img/riLine-eye-line Copy@1x.png" alt="">
  16. </view>
  17. <view class="number">
  18. {{newsDetail.readNum}}
  19. </view>
  20. </view>
  21. </view>
  22. <u-line color="#e6e6e6"/>
  23. <view class="content news-content" v-html="newsDetail.content" >
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. import * as API from '@/apis/pagejs/packages.js'
  30. export default {
  31. data() {
  32. return {
  33. id: '',
  34. newsDetail: {},
  35. }
  36. },
  37. onLoad(op) {
  38. this.id =op.id;
  39. //this.getNewsInfoDetail();
  40. },
  41. methods: {
  42. getNewsInfoDetail() {
  43. uni.showLoading({
  44. title: "加载中",
  45. mask: true,
  46. })
  47. API.newsInfoDetail(this.id).then((res) => {
  48. uni.hideLoading()
  49. this.newsDetail = res.data;
  50. this.$nextTick(()=>{
  51. var list =document.getElementsByClassName("news-content")[0].getElementsByTagName("img");
  52. for(var i=0;i<list.length;i++){
  53. list[i].style='width: 100%;height: 100%;'
  54. }
  55. })
  56. }).catch(error => {
  57. uni.showToast({icon: 'none',
  58. title: error,
  59. icon: "none"
  60. })
  61. })
  62. }
  63. }
  64. }
  65. </script>
  66. <style>
  67. page {
  68. background: #F0F0F2;
  69. padding-bottom: 120px;
  70. }
  71. </style>
  72. <style lang="scss" scoped>
  73. .main{
  74. padding: 40rpx 32rpx;
  75. background-color: #fff;
  76. .title{
  77. color: rgba(16, 16, 16, 1);
  78. font-size: 40rpx;
  79. text-align: justify;
  80. line-height: 48rpx;
  81. }
  82. .date-views{
  83. margin-top: 64rpx;
  84. display: flex;
  85. justify-content: space-between;
  86. align-items: center;
  87. margin-bottom: 32rpx;
  88. .date{
  89. color: rgba(119, 119, 119, 1);
  90. font-size: 24rpx;
  91. }
  92. .views{
  93. display: flex;
  94. align-items: center;
  95. color: rgba(119, 119, 119, 1);
  96. font-size: 12px;
  97. img{
  98. width: 32rpx;
  99. height: 32rpx;
  100. vertical-align: middle;
  101. margin-right: 8rpx;
  102. }
  103. }
  104. }
  105. .content{
  106. color: rgba(51, 51, 51, 1);
  107. font-size: 32rpx;
  108. line-height: 56rpx;
  109. margin-top: 40rpx;
  110. }
  111. .news-picture{
  112. margin-top: 32rpx;
  113. height: 310rpx;
  114. overflow: hidden;
  115. img{
  116. width: 100%;
  117. height: 100%;
  118. }
  119. }
  120. .picture-title{
  121. color: rgba(119, 119, 119, 1);
  122. font-size: 24rpx;
  123. margin-top: 16rpx;
  124. text-align: center;
  125. }
  126. }
  127. </style>