articleDetail.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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. <image v-if="false" src="http://oss.xiaoxinda.com/enterprise/editor/2023/8/e3335976-7e10-4c2d-a322-ba384a86fc78/下载.png" :show-menu-by-longpress="true" ></image>
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import * as API from '@/apis/pagejs/packages.js'
  31. export default {
  32. data() {
  33. return {
  34. id: '',
  35. newsDetail: {},
  36. }
  37. },
  38. onLoad(op) {
  39. this.id =op.id;
  40. this.getNewsDetail();
  41. },
  42. methods: {
  43. timestart(){
  44. console.log("aaa1")
  45. },
  46. timeend(){
  47. console.log("aaa2")
  48. },
  49. saveImg(){
  50. console.log("aaa3")
  51. },
  52. getNewsDetail() {
  53. uni.showLoading({
  54. title: "加载中",
  55. mask: true,
  56. })
  57. API.newsDetail({
  58. id:this.id
  59. }).then((res) => {
  60. uni.hideLoading()
  61. var newsDetail = res.data.newsInfo;
  62. if(newsDetail.content){
  63. var reg=new RegExp('alt','gi');
  64. newsDetail.content=newsDetail.content.replace(reg,'width="100%" height="100%" /> <p')
  65. }
  66. this.newsDetail=newsDetail
  67. }).catch(error => {
  68. uni.showToast({icon: 'none',
  69. title: error,
  70. icon: "none"
  71. })
  72. })
  73. }
  74. }
  75. }
  76. </script>
  77. <style>
  78. page {
  79. background: #F0F0F2;
  80. padding-bottom: 120px;
  81. }
  82. </style>
  83. <style lang="scss" scoped>
  84. .main{
  85. padding: 40rpx 32rpx;
  86. background-color: #fff;
  87. .title{
  88. color: rgba(16, 16, 16, 1);
  89. font-size: 40rpx;
  90. text-align: justify;
  91. line-height: 48rpx;
  92. }
  93. .date-views{
  94. margin-top: 64rpx;
  95. display: flex;
  96. justify-content: space-between;
  97. align-items: center;
  98. margin-bottom: 32rpx;
  99. .date{
  100. color: rgba(119, 119, 119, 1);
  101. font-size: 24rpx;
  102. }
  103. .views{
  104. display: flex;
  105. align-items: center;
  106. color: rgba(119, 119, 119, 1);
  107. font-size: 12px;
  108. img{
  109. width: 32rpx;
  110. height: 32rpx;
  111. vertical-align: middle;
  112. margin-right: 8rpx;
  113. }
  114. }
  115. }
  116. .content{
  117. color: rgba(51, 51, 51, 1);
  118. font-size: 32rpx;
  119. line-height: 56rpx;
  120. margin-top: 40rpx;
  121. }
  122. .news-picture{
  123. margin-top: 32rpx;
  124. height: 310rpx;
  125. overflow: hidden;
  126. img{
  127. width: 100%;
  128. height: 100%;
  129. }
  130. }
  131. .picture-title{
  132. color: rgba(119, 119, 119, 1);
  133. font-size: 24rpx;
  134. margin-top: 16rpx;
  135. text-align: center;
  136. }
  137. }
  138. </style>