onedetail.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <template>
  2. <view>
  3. <rich-text :nodes="nodes"></rich-text>
  4. <view v-if="aricte.ad_type!=0" class="aricte" :class="isclose?'closeacrile':''">
  5. <view style="display: flex;justify-content: space-between;">
  6. <view>{{aricte.ad_title}}</view>
  7. <view style="color:#4399FC;" @click="close">x关闭</view>
  8. </view>
  9. <view @click="godetail" style="padding: 10upx 0upx;position: relative;">
  10. <image :src=" pictureUrl + '/' + aricte.ad_image" style="height: 600upx;width: 100%;" />
  11. <view style="color: #fff;position: absolute;bottom: 20upx;left: 20upx;">广告</view>
  12. </view>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. export default {
  18. data() {
  19. return {
  20. isclose: false,
  21. pictureUrl: this.pictureUrl,
  22. article_id: '',
  23. nodes:'',
  24. aricte: {}
  25. }
  26. },
  27. onLoad(a) {
  28. this.article_id = a.id;
  29. let name = a.name;
  30. uni.setNavigationBarTitle({
  31. title: name
  32. });
  33. this.getactrile();
  34. },
  35. methods: {
  36. godetail() {
  37. console.log(this.aricte.ad_type)
  38. if(this.aricte.ad_type == 1) {
  39. //商品
  40. let id = this.aricte.goods_id; // 商品Id
  41. let store_id = this.aricte.store_id; // 商品Id
  42. uni.navigateTo({
  43. url:`/pages/index/shop?id=${id}&store_id=${store_id}`
  44. })
  45. // uni.navigateTo({
  46. // url:`/pages/index/shop/?id=${id}&store_id=${store_id}`
  47. // })
  48. }else if(this.aricte.ad_type == 2) {
  49. //商品
  50. let id = this.aricte.store_id; // 商品Id
  51. uni.navigateTo({
  52. url: `/pages/index/hotel?id=${id}`
  53. });
  54. }
  55. },
  56. close() {
  57. this.isclose = true;
  58. },
  59. getactrile() {
  60. this.request({
  61. url: '/v1/entry/news_desc',
  62. method: 'post',
  63. data: {
  64. article_id: this.article_id
  65. },
  66. success: (res) => {
  67. let { data } = res.data;
  68. this.aricte = data;
  69. this.nodes = data.article_content;
  70. }
  71. })
  72. }
  73. },
  74. }
  75. </script>
  76. <style>
  77. .aricte {
  78. background-color: #EEEEEE;
  79. }
  80. .closeacrile {
  81. display: none;
  82. }
  83. </style>