| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <template>
- <view >
- <swiper class="screen-swiper square-dot margin-sm" style="height: 260rpx;min-height: 268rpx;"
- :indicator-dots="true" :circular="true" :autoplay="true" interval="5000" duration="500">
- <swiper-item>
- <div>
- <div id="launch-btn"></div>
- </div>
- </swiper-item>
- <swiper-item v-if="item.type!=0" v-for="(item,index) in adsList" :key="index">
- <u-image @click="jump(item.path)" style="width: 100%;height: 268rpx;" :src="item.url"
- mode="aspectFill"></u-image>
- </swiper-item>
- </swiper>
- <goods :goodsList="goodsList" :activityId="activityId"></goods>
- <view style="height: 50rpx;">
-
- </view>
- </view>
- </template>
- <script>
- import goods from "@/components/goods/goods.vue"
- import {
- wx_launch
- } from "../../common/utils/wx_launch.js"; // 引入公共js文件
- export default {
- components: {
- goods
- },
- props: {
- activityId: {
- type: String,
- default: '',
- }
- },
- data() {
- return {
- goodsList: [],
- adsList: [],
- appletList: []
- }
- },
- created() {
- this.$shareConfig({}, this)
- this.fetchGoodsList();
- },
- async mounted() {
- let res = await this.$u.api.pointsGoods.ads({
- activityId: this.activityId
- })
- this.adsList = res.records;
- this.appletList = this.adsList.filter(item => item.type == 0)
- let image=this.appletList[0].url
- let appid=this.appletList[0].path
- // 自定义html内容
- let content = `
- <image class="img" src="${image}"
- mode="scaleToFill"></image>
- <style>
- .img{
- z-index:999,
- width:100%;
- height: 268rpx;
- }
- </style>
- `
- let launchParams = {
- eleId: "launch-btn", // 元素id
- url: "pages/home/home.html", // 跳转小程序的页面路径
- appid,
- content // 自定义的html内容
- };
- wx_launch(launchParams);
- },
- methods: {
- async fetchAds() {
- let res = await this.$u.api.pointsGoods.ads({
- activityId: this.activityId
- })
- this.adsList = res.records;
- this.appletList = this.adsList.filter(item => item.type == 0)
- },
- fetchGoodsList() {
- this.$u.api.pointsGoods.list({
- activityId: this.activityId
- }).then(res => {
- this.goodsList = res.records;
- })
- },
- jump(url) {
- uni.navigateTo({
- url: '/pages/web-view/web-view?url=' + url
- })
- }
- }
- }
- </script>
- <style>
- </style>
|