points-view.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <template>
  2. <view >
  3. <swiper class="screen-swiper square-dot margin-sm" style="height: 260rpx;min-height: 268rpx;"
  4. :indicator-dots="true" :circular="true" :autoplay="true" interval="5000" duration="500">
  5. <swiper-item>
  6. <div>
  7. <div id="launch-btn"></div>
  8. </div>
  9. </swiper-item>
  10. <swiper-item v-if="item.type!=0" v-for="(item,index) in adsList" :key="index">
  11. <u-image @click="jump(item.path)" style="width: 100%;height: 268rpx;" :src="item.url"
  12. mode="aspectFill"></u-image>
  13. </swiper-item>
  14. </swiper>
  15. <goods :goodsList="goodsList" :activityId="activityId"></goods>
  16. <view style="height: 50rpx;">
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. import goods from "@/components/goods/goods.vue"
  22. import {
  23. wx_launch
  24. } from "../../common/utils/wx_launch.js"; // 引入公共js文件
  25. export default {
  26. components: {
  27. goods
  28. },
  29. props: {
  30. activityId: {
  31. type: String,
  32. default: '',
  33. }
  34. },
  35. data() {
  36. return {
  37. goodsList: [],
  38. adsList: [],
  39. appletList: []
  40. }
  41. },
  42. created() {
  43. this.$shareConfig({}, this)
  44. this.fetchGoodsList();
  45. },
  46. async mounted() {
  47. let res = await this.$u.api.pointsGoods.ads({
  48. activityId: this.activityId
  49. })
  50. this.adsList = res.records;
  51. this.appletList = this.adsList.filter(item => item.type == 0)
  52. let image=this.appletList[0].url
  53. let appid=this.appletList[0].path
  54. // 自定义html内容
  55. let content = `
  56. <image class="img" src="${image}"
  57. mode="scaleToFill"></image>
  58. <style>
  59. .img{
  60. z-index:999,
  61. width:100%;
  62. height: 268rpx;
  63. }
  64. </style>
  65. `
  66. let launchParams = {
  67. eleId: "launch-btn", // 元素id
  68. url: "pages/home/home.html", // 跳转小程序的页面路径
  69. appid,
  70. content // 自定义的html内容
  71. };
  72. wx_launch(launchParams);
  73. },
  74. methods: {
  75. async fetchAds() {
  76. let res = await this.$u.api.pointsGoods.ads({
  77. activityId: this.activityId
  78. })
  79. this.adsList = res.records;
  80. this.appletList = this.adsList.filter(item => item.type == 0)
  81. },
  82. fetchGoodsList() {
  83. this.$u.api.pointsGoods.list({
  84. activityId: this.activityId
  85. }).then(res => {
  86. this.goodsList = res.records;
  87. })
  88. },
  89. jump(url) {
  90. uni.navigateTo({
  91. url: '/pages/web-view/web-view?url=' + url
  92. })
  93. }
  94. }
  95. }
  96. </script>
  97. <style>
  98. </style>