You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
224 lines
5.8 KiB
224 lines
5.8 KiB
<template>
|
|
<view>
|
|
|
|
<view class="swiperMain">
|
|
<view class="swiperHead">
|
|
<!--组件-->
|
|
<swiperNavBar :scrollIntoView="scrollIntoView" :swiperTabList='swiperTabList'
|
|
:swiperTabIdx='swiperTabIdx' :currentSwiperWidth='currentSwiperWidth'
|
|
:currentSwiperHeight='currentSwiperHeight' :swiperCurrentSize='swiperCurrentSize'
|
|
:swiperColor='swiperColor' :swiperCurrentColor='swiperCurrentColor'
|
|
:currentSwiperLineShow="currentSwiperLineShow"
|
|
:currentSwiperLineActiveWidth="currentSwiperLineActiveWidth"
|
|
:currentSwiperLineActiveHeight="currentSwiperLineActiveHeight"
|
|
:currentSwiperLineActiveBg="currentSwiperLineActiveBg"
|
|
:currentSwiperLineAnimatie="currentSwiperLineAnimatie" v-if=" swiperTabList.length > 1 "
|
|
@change="CurrentTab">
|
|
</swiperNavBar>
|
|
<!--组件-->
|
|
</view>
|
|
<!--内容-->
|
|
<view class="swiperCont" :style="{ paddingTop:currentSwiperHeight + 'rpx' }">
|
|
<swiper class="swiper" :style="{ height:mainHeight + 'px' }" :current="swiperTabIdx"
|
|
@change="SwiperChange">
|
|
<swiper-item class="swiperItem" v-for="(item,index) in swiperTabList" :key='index'>
|
|
<!-- {{ item }} -->
|
|
<view class="contsitem" v-for="(item,index) in productList" :key='index'
|
|
:class="[producval == item ? 'activecol' : 'contsitem']" @click="changepro(item)">
|
|
<view class="title">连续包月</view>
|
|
<view class="price">¥<text style="font-size: 24px;">12.2</text></view>
|
|
<view class="fgprice">¥12.2</view>
|
|
</view>
|
|
</swiper-item>
|
|
</swiper>
|
|
|
|
<view class="subbtn" @click="jumpcom()">提交</view>
|
|
</view>
|
|
</view>
|
|
|
|
</view>
|
|
</template>
|
|
<script>
|
|
import swiperNavBar from '../../components/swiperNavBar.vue';
|
|
export default {
|
|
data() {
|
|
return {
|
|
//导航
|
|
scrollIntoView: 0, //设置哪个方向可滚动,则在哪个方向滚动到该元素
|
|
swiperTabList: ['腾讯视频', '爱奇艺视频', '优酷视频', '酷狗音乐', 'QQ音乐', '芒果TV'], //导航列表
|
|
swiperTabIdx: 0,
|
|
swiperCurrentSize: '26rpx', //导航的字体大小
|
|
swiperColor: '#333333', //导航栏字体未选中前颜色
|
|
swiperCurrentColor: '#1D63FF', //选中当前导航栏字体颜色
|
|
currentSwiperWidth: '23%', //当前导航的宽度 % upx rpx px (导航超出可左右滑动 )
|
|
currentSwiperHeight: 100, //当前导航的高度度 rpx px
|
|
mainHeight: 200, //全屏或者局部滑动设置的高度
|
|
currentSwiperLineShow: true, //是否显示导航栏的线条 (线条距离标题太近的话可自行修改.swiperLine的css)
|
|
currentSwiperLineActiveBg: '#1D63FF', //当前选中的导航栏线条颜色
|
|
currentSwiperLineActiveWidth: '30rpx', //当前选中的导航栏线条的宽度 upx rpx px
|
|
currentSwiperLineActiveHeight: '6rpx', //当前选中的导航栏线条的高度度 upx rpx px
|
|
currentSwiperLineAnimatie: 300, //当前选中的导航栏线条过渡效果
|
|
productList: [1, 2, 3, 4, 5, 6, 7, 8],
|
|
producval: '1'
|
|
|
|
//(全屏出现滚动条 去掉paddingTop 但导航栏会遮住部分内容 自行改.swiperCont .swiper里css)
|
|
//也可获取导航栏的高度 屏幕高度减去导航栏高度 = 你的内容全屏高度 不会出现滚动条
|
|
}
|
|
},
|
|
onLoad() {
|
|
|
|
},
|
|
components: {
|
|
swiperNavBar
|
|
},
|
|
onReady() {
|
|
|
|
this.mainHeight = uni.getSystemInfoSync().windowHeight; //获取屏幕的高度使得全屏左右滑动
|
|
console.log(this.mainHeight)
|
|
|
|
},
|
|
methods: {
|
|
|
|
//tab点击事件 自行完善需要的代码
|
|
CurrentTab: function(index, item) {
|
|
this.swiperTabIdx = index;
|
|
this.scrollIntoView = Math.max(0, index - 1);
|
|
//console.log(index + '----' + item)
|
|
},
|
|
//滑动事件 自行完善需要的代码
|
|
SwiperChange: function(e) {
|
|
//console.log(e)
|
|
//console.log(e.detail)
|
|
// console.log(e.detail.current);
|
|
this.swiperTabIdx = e.detail.current;
|
|
this.scrollIntoView = Math.max(0, e.detail.current - 1);
|
|
},
|
|
//选择充值
|
|
changepro(item) {
|
|
this.producval = item;
|
|
},
|
|
//跳转确定订单
|
|
jumpcom(){
|
|
uni.navigateTo({
|
|
url:'../rec-confirmation/rec-confirmation'
|
|
})
|
|
}
|
|
}
|
|
|
|
}
|
|
</script>
|
|
<style lang="scss">
|
|
page {
|
|
background: #F8F8F8;
|
|
}
|
|
|
|
.swiperMain {
|
|
width: 100%;
|
|
}
|
|
|
|
.swiperHead {
|
|
position: fixed;
|
|
top: 0;
|
|
z-index: 10;
|
|
width: 100%;
|
|
background: #FFFFFF;
|
|
}
|
|
|
|
.swiperHead scroll-view {
|
|
display: flex;
|
|
flex-direction: row;
|
|
flex-wrap: nowrap;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.swiperTab {
|
|
display: inline-flex;
|
|
flex-direction: column;
|
|
text-align: center;
|
|
}
|
|
|
|
.swiperCont {
|
|
width: 100%;
|
|
padding-top: 70rpx;
|
|
background-color: #f0f0f0;
|
|
}
|
|
|
|
/* #ifdef H5 */
|
|
.swiperHead {
|
|
position: fixed;
|
|
top: 44px;
|
|
z-index: 10;
|
|
width: 100%;
|
|
background: #FFFFFF;
|
|
}
|
|
|
|
/* #endif */
|
|
|
|
.swiper {
|
|
width: 100%;
|
|
height: 400rpx;
|
|
}
|
|
|
|
.swiperItem {
|
|
overflow: auto;
|
|
background: #ffffff;
|
|
text-align: center;
|
|
color: #333333;
|
|
font-size: 30upx;
|
|
}
|
|
|
|
.contsitem {
|
|
width: 20%;
|
|
height: 110px;
|
|
border-radius: 5px;
|
|
margin-top: 20px;
|
|
display: inline-block;
|
|
text-align: center;
|
|
margin-left: 4%;
|
|
background-color: #f0f0f0;
|
|
float: left;
|
|
}
|
|
|
|
.title {
|
|
color: #333333;
|
|
font-size: 14px;
|
|
padding-top: 15px;
|
|
}
|
|
|
|
.price {
|
|
font-size: 14px;
|
|
padding-top: 5px;
|
|
font-weight: bold;
|
|
color: #caba60;
|
|
}
|
|
|
|
.fgprice {
|
|
color: #999999;
|
|
text-decoration: line-through;
|
|
font-size: 14px;
|
|
}
|
|
|
|
.activecol {
|
|
background-color: #edd076;
|
|
}
|
|
|
|
.swiperItem image {
|
|
width: 100%;
|
|
height: 100%;
|
|
display: block;
|
|
}
|
|
|
|
.subbtn {
|
|
width: 80%;
|
|
height: 45px;
|
|
line-height: 45px;
|
|
margin-left: 10%;
|
|
background-color: #1D63FF;
|
|
color: #FFFFFF;
|
|
border-radius: 20px;
|
|
margin-top: 80px;
|
|
position: absolute;
|
|
bottom: 40px;
|
|
text-align: center;
|
|
}
|
|
</style>
|
|
|