huangsijun
2025-09-22 a78c011de350b188afb03beb2f26a73f35f71986
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<template>
    <view class="diy-banner-box pr" :class="itemData.style.imgShape"
        :style="'background-color:'+itemData.style.background+';'">
        <swiper class="swiper" :autoplay="autoplay" :interval="interval" :duration="duration" @change="changeSwiper"  :style="itemData.style.imgShape=='square'?'height:'+itemData.style.height+'rpx;':'height:'+(itemData.style.height*0.92)+'rpx;'">
            <swiper-item v-for="(item,index) in itemData.data" :key="index" @click="gotoPages(item)">
                <image :style="itemData.style.imgShape=='square'?'height:'+itemData.style.height+'rpx;':'height:'+(itemData.style.height*0.92)+'rpx;'" :src="item.imgUrl"></image>
            </swiper-item>
        </swiper>
        <view class="swiper-dots ww100 d-c-c" :class="itemData.style.btnShape">
            <view :class="current==index?'swiper-dot active':'swiper-dot'" v-for="(item,index) in itemData.data"
                :style="current==index?'background-color:'+indicatorActiveColor+';':''" :key="index">
            </view>
        </view>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                indicatorDots: true,
                autoplay: true,
                interval: 2000,
                duration: 500,
                indicatorActiveColor: '#ffffff',
                current: 0
            }
        },
        props: ['itemData'],
        created() {
            this.interval = this.itemData.params.interval;
            this.indicatorActiveColor = this.itemData.style.btnColor;
        },
        methods: {
            changeSwiper(e) {
                this.current = e.detail.current;
            },
            /*跳转页面*/
            gotoPages(e) {
                if(e.type && e.type == "小程序"){
                    wx.navigateToMiniProgram({
                      appId: e.inputname,
                      path: e.linkUrl,
                      extarData: {
                        open: 'happy'
                      },
                      envVersion: 'release',
                      success(res) {
                        // 打开成功
                        console.log("成功")
                      }
                    })
                    
                }else{
                    this.gotoPage(e.linkUrl);
                }
                //this.gotoPage(e.linkUrl);
            }
        }
    }
</script>
 
<style>
    .diy-banner-box{
        overflow: hidden;
    }
    .diy-banner-box,
    .diy-banner-box .swiper {
        width: 750rpx;
        /* background-color: #FFFFFF; */
    }
 
    .diy-banner-box.round,
    .diy-banner-box.round .swiper {
        width: 750rpx;
        /* background-color: #FFFFFF; */
    }
 
    .diy-banner-box image {
        width: 750rpx;
    }
    .diy-banner-box.round{
        padding: 30rpx;
        box-sizing: border-box;
    }
    .diy-banner-box.round image {
        width: 690rpx;
        border-radius: 12rpx;
    }
 
    .diy-banner-box.round .swiper-dots {
        position: absolute;
        bottom: 40rpx;
        left: 0;
        right: 0;
        margin: auto;
    }
 
    .diy-banner-box.square .swiper-dots {
        position: absolute;
        bottom: 20rpx;
        left: 0;
        right: 0;
        margin: auto;
    }
 
    .swiper-dots.square .swiper-dot {
        width: 14rpx;
        height: 14rpx;
        margin: 0 4rpx;
        background: #ebedf0;
        opacity: 0.3;
    }
 
    .swiper-dots.round .swiper-dot {
        width: 22rpx;
        height: 22rpx;
        margin: 0 4rpx;
        background: #ebedf0;
        opacity: 0.3;
        border-radius: 50%;
    }
 
    .swiper-dots.rectangle .swiper-dot {
        width: 40rpx;
        height: 6rpx;
        margin: 0 4rpx;
        background: #ebedf0;
        opacity: 0.3;
        border-radius: 4rpx;
    }
 
    .swiper-dots.round .swiper-dot.active,
    .swiper-dots.square .swiper-dot.active,
    .swiper-dots.rectangle .swiper-dot.active {
        opacity: 1;
    }
</style>