articleDetail.vue 3.4 KB

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