小程序端工程代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

125 lines
3.2 KiB

  1. <template>
  2. <view class="newsDetail">
  3. <view class="title">{{ articleInfo.title }}</view>
  4. <view class="list acea-row row-middle">
  5. <view class="label cart-color line1">新闻专区</view>
  6. <view class="item"> <text class="iconfont icon-shenhezhong"></text>{{ articleInfo.addTime }} </view>
  7. <view class="item"> <text class="iconfont icon-liulan"></text>{{ articleInfo.visit }} </view>
  8. </view>
  9. <view class="conter" v-html="articleInfo.content"></view>
  10. </view>
  11. </template>
  12. <style scoped lang="less">
  13. .newsDetail .picTxt {
  14. width: 6.9 * 100rpx;
  15. height: 2 * 100rpx;
  16. border-radius: 0.2 * 100rpx;
  17. border: 1px solid #e1e1e1;
  18. position: relative;
  19. margin: 0.3 * 100rpx auto 0 auto;
  20. }
  21. .newsDetail .picTxt .pictrue {
  22. width: 2 * 100rpx;
  23. height: 2 * 100rpx;
  24. }
  25. .newsDetail .picTxt .pictrue image {
  26. width: 100%;
  27. height: 100%;
  28. border-radius: 0.2 * 100rpx 0 0 0.2 * 100rpx;
  29. display: block;
  30. }
  31. .newsDetail .picTxt .text {
  32. width: 4.6 * 100rpx;
  33. }
  34. .newsDetail .picTxt .text .name {
  35. font-size: 0.3 * 100rpx;
  36. color: #282828;
  37. }
  38. .newsDetail .picTxt .text .money {
  39. font-size: 0.24 * 100rpx;
  40. margin-top: 0.4 * 100rpx;
  41. font-weight: bold;
  42. }
  43. .newsDetail .picTxt .text .money .num {
  44. font-size: 0.36 * 100rpx;
  45. }
  46. .newsDetail .picTxt .text .y_money {
  47. font-size: 0.26 * 100rpx;
  48. color: #999;
  49. text-decoration: line-through;
  50. }
  51. .newsDetail .picTxt .label {
  52. position: absolute;
  53. background-color: #303131;
  54. width: 1.6 * 100rpx;
  55. height: 0.5 * 100rpx;
  56. right: -0.07 * 100rpx;
  57. border-radius: 0.25 * 100rpx 0 0.06 * 100rpx 0.25 * 100rpx;
  58. text-align: center;
  59. line-height: 0.5 * 100rpx;
  60. bottom: 0.24 * 100rpx;
  61. }
  62. .newsDetail .picTxt .label .span {
  63. background-image: linear-gradient(to right, #fff71e 0%, #f9b513 100%);
  64. background-image: -webkit-linear-gradient(to right, #fff71e 0%, #f9b513 100%);
  65. background-image: -moz-linear-gradient(to right, #fff71e 0%, #f9b513 100%);
  66. -webkit-background-clip: text;
  67. -webkit-text-fill-color: transparent;
  68. }
  69. .newsDetail .picTxt .label:after {
  70. content: ' ';
  71. position: absolute;
  72. width: 0;
  73. height: 0;
  74. border-bottom: 0.08 * 100rpx solid #303131;
  75. border-right: 0.08 * 100rpx solid transparent;
  76. top: -0.08 * 100rpx;
  77. right: 0;
  78. }
  79. .newsDetail .bnt {
  80. color: #fff;
  81. font-size: 0.3 * 100rpx;
  82. width: 6.9 * 100rpx;
  83. height: 0.9 * 100rpx;
  84. border-radius: 0.45 * 100rpx;
  85. margin: 0.48 * 100rpx auto 0 auto;
  86. text-align: center;
  87. line-height: 0.9 * 100rpx;
  88. }
  89. </style>
  90. <script>
  91. import { getArticleDetails } from '@/api/public'
  92. export default {
  93. name: 'NewsDetail',
  94. components: {},
  95. props: {},
  96. data: function() {
  97. return {
  98. articleInfo: {},
  99. }
  100. },
  101. watch: {
  102. $yroute(to) {
  103. if (to.name === 'NewsDetail') this.articleDetails()
  104. },
  105. },
  106. mounted: function() {
  107. this.articleDetails()
  108. },
  109. methods: {
  110. updateTitle() {
  111. // document.title = this.articleInfo.title || this.$yroute.meta.title;
  112. },
  113. articleDetails: function() {
  114. let that = this,
  115. id = this.$yroute.query.id
  116. getArticleDetails(id).then(res => {
  117. res.data.content = res.data.content.replace(/\<img/gi, '<img style="max-width:100% !important; height:auto"')
  118. that.articleInfo = res.data
  119. console.log(that.articleInfo)
  120. that.updateTitle()
  121. })
  122. },
  123. },
  124. }
  125. </script>