海南旅游项目 前端仓库
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.

123 lines
3.8 KiB

4 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
  1. <template>
  2. <view>
  3. <view class="lf-m-l-32 lf-m-r-32" v-if="$isRight(title_content)">
  4. <view>
  5. <view class="lf-font-32 lf-color-333 lf-m-t-30 lf-m-b-20">
  6. {{title_content.title}}
  7. </view>
  8. <view class="lf-flex lf-m-b-24">
  9. <view class="lf-color-999 lf-font-24" v-if="title_content.updated_at">
  10. 发布于<text class="lf-m-l-10">{{title_content.updated_at}}</text>
  11. </view>
  12. <view class="lf-color-999 lf-font-24 lf-m-l-30" v-if="title_content.author">
  13. 作者<text class="lf-m-l-10">{{title_content.author}}</text>
  14. </view>
  15. </view>
  16. </view>
  17. <rich-text :nodes="formatRichText(content)" v-if="content"></rich-text>
  18. <lf-nocontent v-else></lf-nocontent>
  19. </view>
  20. <!-- 活动列表 -->
  21. <view class="content" v-if="list">
  22. <view class="item" v-for="(item,index) in list" :key="index" @click="$url('/pages/goodsDetail/index?goods_id='+item.id)">
  23. <view class="cover">
  24. <image :src="item.picture" class="lf-w-100 lf-h-100" mode="aspectFill"></image>
  25. </view>
  26. <view style="width: 420rpx;">
  27. <view class="lf-font-28 lf-color-333 lf-line-2" style="height: 78rpx;">{{item.title}}</view>
  28. <view class="lf-font-24 lf-color-gray lf-line-2" style="height: 64rpx;">本套票只包含两个成人不可带小孩本套票只包含两个成人不可带小孩本套票只包含两个成人不可带小孩</view>
  29. <view class="lf-flex lf-m-t-25">
  30. <lf-price :price="item.price"></lf-price>
  31. <text class="lf-font-24 lf-color-gray lf-line-through lf-m-l-15">¥{{item.original_price}}</text>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <!-- 加载 -->
  37. <view class="loading-more">
  38. <!-- <text v-if="list.length" :class="{'loading-more-text': loadingClass}">{{ loadingText }}</text> -->
  39. </view>
  40. <u-back-top :scroll-top="pageScrollTop" :custom-style="{background: 'rgba(51, 51 51, 0.3)'}"></u-back-top>
  41. </view>
  42. </template>
  43. <script>
  44. export default {
  45. data(){
  46. return {
  47. content: '',
  48. article_id: 0,
  49. title_content: '',
  50. list: [],
  51. loadingClass: false,
  52. loadingText: '已加载全部数据~',
  53. page: 1,
  54. isPage: true,
  55. pageSize: 20,
  56. }
  57. },
  58. onLoad(e){
  59. this.article_id = e.article_id
  60. if(this.article_id) {
  61. this.getData();
  62. }
  63. },
  64. methods: {
  65. // 富文本处理
  66. formatRichText(richText){
  67. if(richText != null){
  68. let newRichText= richText.replace(/<img[^>]*>/gi, function(match, capture){
  69. match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, '');
  70. match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, '');
  71. match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, '');
  72. return match;
  73. });
  74. newRichText = newRichText.replace(/style="[^"]+"/gi,function(match, capture){
  75. match = match.replace(/width:[^;]+;/gi, 'width:100%;').replace(/width:[^;]+;/gi, 'width:100%;');
  76. return match;
  77. });
  78. newRichText = newRichText.replace(/<br[^>]*\/>/gi, '');
  79. newRichText = newRichText.replace(/\<img/gi, '<img style="width:100%;height:auto;display:block;margin:10px 0;"');
  80. return newRichText;
  81. }else{
  82. return null;
  83. }
  84. },
  85. getData(){
  86. this.$http(this.API.API_FINDARTICLEDETAILS,{id: this.article_id}).then(res => {
  87. this.content = res.data?.content;
  88. this.title_content = res.data
  89. this.list = res.data?.product
  90. console.log(this.content)
  91. })
  92. }
  93. }
  94. }
  95. </script>
  96. <style lang="scss" scoped="scoped">
  97. .content{
  98. padding: 0 32rpx;
  99. box-sizing: border-box;
  100. width: 750rpx;
  101. height: max-content;
  102. margin-top: 30rpx;
  103. .item{
  104. width: 100%;
  105. height: auto;
  106. border-bottom: 1rpx solid #E5E5E5;
  107. padding: 30rpx 0;
  108. display: flex;
  109. &:last-child{
  110. border-bottom: none;
  111. }
  112. .cover{
  113. width: 250rpx;
  114. height: 210rpx;
  115. border-radius: 20rpx;
  116. overflow: hidden;
  117. margin-right: 15rpx;
  118. }
  119. }
  120. }
  121. </style>