aaa
doum
2026-06-08 3ac279c9df7181c9f21d35a689a321b990b87b22
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
<template>
    <view class="img" :class="{ 'img--open': opacity === 1 }" :style="{ opacity: opacity, zIndex: zindex }" @click="close">
        <view class="img_content" @click.stop>
            <view class="img_content_tu">
                <image
                    v-if="imgList.length > 1"
                    class="arrow"
                    src="@/static/ic_left@2x.png"
                    mode="widthFix"
                    @click="prev"></image>
                <view class="img_content_tu_nr">
                    <swiper
                        style="width: 100%; height: 100%;"
                        @change="handlechange"
                        :current="mycurrent"
                        :indicator-dots="imgList.length > 1"
                        indicator-color="rgba(255,255,255,0.35)"
                        indicator-active-color="#ffffff"
                        :circular="imgList.length > 1"
                        :duration="300">
                        <swiper-item v-for="(item, index) in imgList" :key="index">
                            <view class="swiper-item">
                                <image :src="item" class="preview-image" mode="aspectFit" />
                            </view>
                        </swiper-item>
                    </swiper>
                </view>
                <image
                    v-if="imgList.length > 1"
                    class="arrow"
                    src="@/static/ic_right@2x.png"
                    mode="widthFix"
                    @click="next"></image>
            </view>
            <view class="img_content_close" @click="close">
                <image src="@/static/ic_close@2x.png" mode="widthFix"></image>
            </view>
        </view>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                opacity: 0,
                zindex: '-1',
                mycurrent: 0
            }
        },
        props: {
            imgList: {
                type: Array,
                default: () => []
            }
        },
        methods: {
            next() {
                if (this.imgList.length <= 1) return
                this.mycurrent = (this.mycurrent + 1) % this.imgList.length
            },
            prev() {
                if (this.imgList.length <= 1) return
                this.mycurrent = (this.mycurrent - 1 + this.imgList.length) % this.imgList.length
            },
            handlechange(e) {
                this.mycurrent = e.detail.current
            },
            open(i) {
                this.mycurrent = i || 0
                this.zindex = 9999
                this.opacity = 1
            },
            close() {
                this.zindex = '-1'
                this.opacity = 0
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    .img {
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.65);
        position: fixed;
        transition: opacity 0.2s;
        top: 0;
        left: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        pointer-events: none;
 
        &.img--open {
            pointer-events: auto;
        }
 
        .img_content {
            display: flex;
            flex-direction: column;
            pointer-events: auto;
 
            .img_content_tu {
                display: flex;
                align-items: center;
 
                .img_content_tu_nr {
                    width: 600px;
                    height: 600px;
                    padding: 24px;
                    box-sizing: border-box;
                    background: rgba(255, 255, 255, 0.95);
                    border-radius: 8px;
                    margin: 0 24px;
                    display: flex;
                    align-items: center;
                    justify-content: center;
 
                    .swiper-item {
                        width: 100%;
                        height: 100%;
                        display: flex;
                        align-items: center;
                        justify-content: center;
                    }
 
                    .preview-image {
                        width: 100%;
                        height: 100%;
                    }
                }
 
                .arrow {
                    width: 64px;
                    height: 64px;
                    flex-shrink: 0;
                    cursor: pointer;
                }
            }
 
            .img_content_close {
                width: 100%;
                display: flex;
                align-items: center;
                justify-content: center;
                margin-top: 32px;
                cursor: pointer;
 
                image {
                    width: 56px;
                    height: 56px;
                }
            }
        }
    }
</style>