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.browseNumber}}
  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.getNewsDetail();
  40. },
  41. methods: {
  42. getNewsDetail() {
  43. uni.showLoading({
  44. title: "加载中",
  45. mask: true,
  46. })
  47. API.newsDetail({
  48. id:this.id
  49. }).then((res) => {
  50. uni.hideLoading()
  51. var newsDetail = res.data.newsInfo;
  52. if(newsDetail.content){
  53. var reg=new RegExp('alt','gi');
  54. newsDetail.content=newsDetail.content.replace(reg,'width="100%" height="100%" /> <p')
  55. }
  56. this.newsDetail=newsDetail
  57. }).catch(error => {
  58. uni.showToast({icon: 'none',
  59. title: error,
  60. icon: "none"
  61. })
  62. })
  63. }
  64. }
  65. }
  66. </script>
  67. <style>
  68. page {
  69. background: #F0F0F2;
  70. padding-bottom: 120px;
  71. }
  72. </style>
  73. <style lang="scss" scoped>
  74. .main{
  75. padding: 40rpx 32rpx;
  76. background-color: #fff;
  77. .title{
  78. color: rgba(16, 16, 16, 1);
  79. font-size: 40rpx;
  80. text-align: justify;
  81. line-height: 48rpx;
  82. }
  83. .date-views{
  84. margin-top: 64rpx;
  85. display: flex;
  86. justify-content: space-between;
  87. align-items: center;
  88. margin-bottom: 32rpx;
  89. .date{
  90. color: rgba(119, 119, 119, 1);
  91. font-size: 24rpx;
  92. }
  93. .views{
  94. display: flex;
  95. align-items: center;
  96. color: rgba(119, 119, 119, 1);
  97. font-size: 12px;
  98. img{
  99. width: 32rpx;
  100. height: 32rpx;
  101. vertical-align: middle;
  102. margin-right: 8rpx;
  103. }
  104. }
  105. }
  106. .content{
  107. color: rgba(51, 51, 51, 1);
  108. font-size: 32rpx;
  109. line-height: 56rpx;
  110. margin-top: 40rpx;
  111. }
  112. .news-picture{
  113. margin-top: 32rpx;
  114. height: 310rpx;
  115. overflow: hidden;
  116. img{
  117. width: 100%;
  118. height: 100%;
  119. }
  120. }
  121. .picture-title{
  122. color: rgba(119, 119, 119, 1);
  123. font-size: 24rpx;
  124. margin-top: 16rpx;
  125. text-align: center;
  126. }
  127. }
  128. </style>