<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>
|