quanwei
2025-10-31 f226d5fe6327e31bb471a96b7370cf94689c6608
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<template>
    <view class="diy-window" :style="{ background: itemData.style.background, padding: itemData.style.paddingTop + 'px ' + itemData.style.paddingLeft + 'px' }">
        <view class="data-list" v-if="itemData.style.layout > -1" :class="'column__' + itemData.style.layout">
            <view class="item" :key="index" v-for="(item, index) in itemData.data"  @click="gotoPages(item)">
                <view class="item-image" :style="{ padding: itemData.style.paddingTop + 'px ' + itemData.style.paddingLeft + 'px' }">
                    <image :src="item.imgUrl" mode="aspectFill"></image>
                </view>
            </view>
        </view>
        <view class="display" v-else :style="{ padding: itemData.style.paddingTop + 'px ' + itemData.style.paddingLeft + 'px' }">
            <view class="img-box-wrap-1">
                <view class="img-box" @click="gotoPages(itemData.data[0])">
                    <image :src="itemData.data[0].imgUrl" mode="aspectFill"></image>
                </view>
            </view>
            <view class="percent-w50 d-s-c d-c" >
                
                    <view class="img-box-wrap-2" v-if="itemData.data.length >= 2">
                        <view class="img-box" @click="gotoPages(itemData.data[1])">
                            <image :src="itemData.data[1].imgUrl" mode="aspectFill"></image>
                        </view>
                    </view>
                    <view class="d-s-c img-box-wrap-3">
                        <view class="img-box-wrap-4" v-if="itemData.data.length >= 3">
                            <view class="img-box" @click="gotoPages(itemData.data[2])">
                                <image :src="itemData.data[2].imgUrl" mode="aspectFill"></image>
                            </view>
                        </view>
                        <view class="img-box-wrap-4" v-if="itemData.data.length >= 4">
                            <view class="img-box" @click="gotoPages(itemData.data[3])">
                                <image :src="itemData.data[3].imgUrl" mode="aspectFill"></image>
                            </view>
                        </view>
                    </view>
            </view>
        </view>
    </view>
</template>
 
<script>
 
export default {
    data() {
        return {};
    },
    props: ['itemData'],
    methods: {
        /*跳转页面*/
        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-window{
        /* margin: 20rpx;
        border-radius: 20rpx; */
        overflow: hidden;
        box-shadow: 0 0 8rpx rgba(0, 0, 0, 0.1);
    }
    
.diy-window .data-list {
    display: flex;
    flex-wrap: wrap;
}
 
.diy-window image{
    width: 100%;
    height: 100%;
}
.diy-window .data-list.column__2 .item {
    width: 50%;
}
.diy-window .data-list.column__3 .item {
    width: 33.333333333333%;
}
.diy-window .data-list.column__4 .item {
    width: 25%;
}
.diy-window .data-list.column__5 .item {
    width: 50%;
}
.diy-window .data-list.column__2 .item {
    position: relative;
    padding-top: 50%;
}
.diy-window .data-list.column__3 .item {
    position: relative;
    padding-top: 33.3333333%;
}
.diy-window .data-list.column__4 .item {
    position: relative;
    padding-top: 25%;
}
.diy-window .data-list.column__5 .item {
    position: relative;
    padding-top: 20%;
}
.diy-window .data-list .item .item-image,
.diy-window .display .img-box {
    position: absolute;
    box-sizing: border-box;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
 
.diy-window .display {
    display: flex;
}
.diy-window .display .img-box-wrap-1 {
    position: relative;
    width: 50%;
    padding-top: 50%;
}
.diy-window .display .img-box-wrap-2 {
    position: relative;
    width: 100%;
    height: 50%;
}
 
.diy-window .display .percent-w50 {
    box-sizing: border-box;
    width: 50%;
}
.diy-window .display .img-box .item-image {
    height: 100%;
}
.diy-window .display .img-box-wrap-3 {
    width: 100%;
    height: 50%;
}
.diy-window .display .img-box-wrap-4 {
    position: relative;
    width: 50%;
    height: 100%;
}
</style>