123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- <template>
- <view>
- <view class="cu-bar bg-transparent">
- <view class="action">
- <text class="cuIcon-back text-gray"></text>
- </view>
- <view class="content text-bold">
- </view>
- <view class="action">
- <text class="cuIcon-cardboardfill text-grey"></text>
- <text class="cuIcon-add text-red"></text>发布
- </view>
- </view>
- <view class="cu-bar bg-transparent search">
- <view class="cu-avatar round "
- style="background-image:url(https://ossweb-img.qq.com/images/lol/web201310/skin/big91012.jpg);"></view>
- <view class="text-left padding">
- 在XX创作的第1274天
- </view>
- <view class="action">
- <view class="padding-xs">
- <view class='cu-tag round light bg-red'>实名认证</view>
- </view>
- </view>
- </view>
- <luyj-grid-link :list="list" @gridExc="clickGrid"></luyj-grid-link>
- <view class="tower-swiper" @touchmove="TowerMove" @touchstart="TowerStart" @touchend="TowerEnd">
- <view class="tower-item" :class="item.zIndex==1?'none':''" v-for="(item,index) in swiperList" :key="index"
- :style="[{'--index': item.zIndex,'--left':item.mLeft}]" :data-direction="direction">
- <view class="swiper-item">
- <image :src="item.url" mode="aspectFill" v-if="item.type=='image'"></image>
- </view>
- </view>
- </view>
- <scroll-view scroll-x class="bg-green nav text-center">
- <view class="cu-item" :class="0==TabCur?'text-white cur':''" @tap="tabSelect" data-id="0">
- <text class="cuIcon-camerafill"></text> 数码
- </view>
- <view class="cu-item" :class="1==TabCur?'text-white cur':''" @tap="tabSelect" data-id="1">
- <text class="cuIcon-upstagefill"></text> 排行榜
- </view>
- <view class="cu-item" :class="2==TabCur?'text-white cur':''" @tap="tabSelect" data-id="2">
- <text class="cuIcon-clothesfill"></text> 皮肤
- </view>
- </scroll-view>
- </view>
- </template>
- <script>
- import data from '@/common/data/data.js'; // 数据
- export default {
- data() {
- return {
- TabCur: 0,
- scrollLeft: 0,
- list: data.current_list,
- cardCur: 0,
- swiperList: [{
- id: 0,
- type: 'image',
- url: 'https://ossweb-img.qq.com/images/lol/web201310/skin/big84000.jpg'
- }, {
- id: 1,
- type: 'image',
- url: 'https://ossweb-img.qq.com/images/lol/web201310/skin/big37006.jpg',
- }, {
- id: 2,
- type: 'image',
- url: 'https://ossweb-img.qq.com/images/lol/web201310/skin/big39000.jpg'
- }, {
- id: 3,
- type: 'image',
- url: 'https://ossweb-img.qq.com/images/lol/web201310/skin/big10001.jpg'
- }, {
- id: 4,
- type: 'image',
- url: 'https://ossweb-img.qq.com/images/lol/web201310/skin/big25011.jpg'
- }, {
- id: 5,
- type: 'image',
- url: 'https://ossweb-img.qq.com/images/lol/web201310/skin/big21016.jpg'
- }, {
- id: 6,
- type: 'image',
- url: 'https://ossweb-img.qq.com/images/lol/web201310/skin/big99008.jpg'
- }],
- dotStyle: false,
- towerStart: 0,
- direction: ''
- }
- },
- onLoad() {
- this.TowerSwiper('swiperList');
- // 初始化towerSwiper 传已有的数组名即可
- },
- methods: {
- tabSelect(e) {
- this.TabCur = e.currentTarget.dataset.id;
- this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
- },
- DotStyle(e) {
- this.dotStyle = e.detail.value
- },
- // cardSwiper
- cardSwiper(e) {
- this.cardCur = e.detail.current
- },
- // towerSwiper
- // 初始化towerSwiper
- TowerSwiper(name) {
- let list = this[name];
- for (let i = 0; i < list.length; i++) {
- list[i].zIndex = parseInt(list.length / 2) + 1 - Math.abs(i - parseInt(list.length / 2))
- list[i].mLeft = i - parseInt(list.length / 2)
- }
- this.swiperList = list
- },
-
- // towerSwiper触摸开始
- TowerStart(e) {
- this.towerStart = e.touches[0].pageX
- },
-
- // towerSwiper计算方向
- TowerMove(e) {
- this.direction = e.touches[0].pageX - this.towerStart > 0 ? 'right' : 'left'
- },
-
- // towerSwiper计算滚动
- TowerEnd(e) {
- let direction = this.direction;
- let list = this.swiperList;
- if (direction == 'right') {
- let mLeft = list[0].mLeft;
- let zIndex = list[0].zIndex;
- for (let i = 1; i < this.swiperList.length; i++) {
- this.swiperList[i - 1].mLeft = this.swiperList[i].mLeft
- this.swiperList[i - 1].zIndex = this.swiperList[i].zIndex
- }
- this.swiperList[list.length - 1].mLeft = mLeft;
- this.swiperList[list.length - 1].zIndex = zIndex;
- } else {
- let mLeft = list[list.length - 1].mLeft;
- let zIndex = list[list.length - 1].zIndex;
- for (let i = this.swiperList.length - 1; i > 0; i--) {
- this.swiperList[i].mLeft = this.swiperList[i - 1].mLeft
- this.swiperList[i].zIndex = this.swiperList[i - 1].zIndex
- }
- this.swiperList[0].mLeft = mLeft;
- this.swiperList[0].zIndex = zIndex;
- }
- this.direction = ""
- this.swiperList = this.swiperList
- },
- }
- }
- </script>
- <style>
- .tower-swiper .tower-item {
- transform: scale(calc(0.5 + var(--index) / 10));
- margin-left: calc(var(--left) * 100upx - 150upx);
- z-index: var(--index);
- }
- </style>
|