MrShi
10 天以前 eb7a808aaf7dd0a6dd2ff70f9ef3f8ce0b1e31d1
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
<template>
    <view class="guide-page">
        <swiper class="guide-page__swiper" :current="current" circular @change="handleSwiperChange">
            <swiper-item v-for="(item, index) in guideList" :key="index">
                <view class="guide-page__slide">
                    <image class="guide-page__image" :src="item.imgurlFull" mode="widthFix"></image>
                </view>
            </swiper-item>
        </swiper>
 
        <view class="guide-page__dots">
            <view
                v-for="(item, index) in guideList"
                :key="index"
                class="guide-page__dot"
                :class="{ 'guide-page__dot--active': current === index }"
            ></view>
        </view>
 
        <view class="guide-page__footer">
            <view class="guide-page__action">
                <button class="guide-page__button" hover-class="guide-page__button--hover" @click="jump">立即体验</button>
            </view>
        </view>
    </view>
</template>
 
<script>
    import { mapState } from 'vuex'
    export default {
        computed: {
            ...mapState(['token'])
        },
        data() {
            return {
                current: 0,
                guideList: []
            };
        },
        onLoad() {
            this.getBannerList();
        },
        methods: {
            handleSwiperChange(event) {
                this.current = event.detail.current;
            },
            getBannerList() {
                this.$u.api.getBannerList({ position: 1 }).then(res => {
                    if (res.code === 200 && res.data) {
                        this.guideList = res.data;
                    }
                })
            },
            jump() {
                if (!this.token) {
                    uni.navigateTo({
                        url: '/pages/login/login'
                    })
                    return
                }
                this.$u.api.checkToken({ token: this.token }).then(res => {
                    if (res.data) {
                        uni.switchTab({
                            url: '/pages/index/index'
                        })
                    } else {
                        uni.navigateTo({
                            url: '/pages/login/login'
                        })
                    }
                })
            }
        }
    };
</script>
 
<style lang="scss" scoped>
    .guide-page {
        position: relative;
        min-height: 100vh;
        background: #d9d9d9;
 
        &__swiper {
            height: 100vh;
        }
 
        &__slide {
            height: 100vh;
        }
 
        &__image {
            display: block;
            width: 100%;
            height: 100%;
        }
 
        &__footer {
            position: absolute;
            left: 0;
            right: 0;
            bottom: 0;
            padding: 24rpx 0 calc(env(safe-area-inset-bottom) + 30rpx);
            background: #ffffff;
        }
 
        &__dots {
            position: absolute;
            left: 0;
            right: 0;
            bottom: calc(env(safe-area-inset-bottom) + 154rpx);
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 18rpx;
        }
 
        &__dot {
            width: 14rpx;
            height: 14rpx;
            border-radius: 50%;
            background: rgba(255, 255, 255, 0.58);
            transition: all 0.2s ease;
 
            &--active {
                width: 40rpx;
                border-radius: 7rpx;
                background: #ffffff;
            }
        }
 
        &__action {
            padding: 0 40rpx;
        }
 
        &__button {
            width: 320rpx;
            height: 88rpx;
            line-height: 88rpx;
            background: #007AFF;
            color: #ffffff;
            font-size: 32rpx;
            border-radius: 44rpx;
            border: 0;
 
            &--hover {
                opacity: 0.9;
            }
        }
    }
</style>