Commit 8f66be83 authored by ziyu's avatar ziyu

improvement: 删除购物车

parent 661fb286
......@@ -46,17 +46,6 @@
float: right;
font-size: 12px;
}
.shopcar {
float: right;
margin-right:20px;
width:36px;
height:40px;
position: relative;
}
.van-info{position:absolute;z-index:3;top:-8px;right:0;min-width:16px;padding:0 3px;font-family:PingFang SC,Helvetica Neue,Arial,sans-serif;font-size:12px;font-weight:500;line-height:14px;color:#fff;text-align:center;white-space:nowrap;background-color:#f44;border:1px solid #fff;border-radius:16px;-webkit-transform:translateX(50%);transform:translateX(50%);box-sizing:border-box;-webkit-transform-origin:100%;transform-origin:100%}
.shopcar.bigshop {
transform: scale(1.2,1.2);
}
.imgwrap{
margin:8px 0;
}
......@@ -165,7 +154,7 @@
</wxs>
<template>
<view class="video-wrapper">
<!-- <video autoplay class="video" id="myvideo" controls="{{false}}" direction="{{90}}" loop="{{true}}" src="https://xyqblogo.lkbang.net/VID_20200508_171710.mp4"></video> -->
<!-- <video autoplay class="video" id="myvideo" controls="{{false}}" selectItemStyle="{{90}}" loop="{{true}}" src="https://xyqblogo.lkbang.net/VID_20200508_171710.mp4"></video> -->
<view id="myvideo">
<video-list videoList="{{videoList}}" bindchange="changeVideo"></video-list>
</view>
......@@ -179,12 +168,8 @@
<view>中奖概率1/3000</view>
</view>
<view class="rightcont">
<view class="shopcar" id="shopcar">
<van-icon name="shopping-cart-o" size="{{bigshop?'4em':'2.5em'}}" />
<view class="van-info">{{carinfo}}</view>
</view>
<swiper class="list-wrapper" vertical="true" circular="true" display-multiple-items="2" autoplay="true" interval="1500">
<swiper-item wx:for="{{adlist}}" wx:key="index" catchtouchmove="forbidMove">
<swiper-item wx:for="{{adlist}}" wx:key="index" catch:touchmove>
<view class="imgwrap">
<image class="img" src="{{item.imgsrc}}"></image>
<view class="text">{{item.text}}</view>
......@@ -206,9 +191,9 @@
<view
data-itemid="{{index}}"
bindtap="toViewPage"
bindlongpress="longTap"
bindtouchstart="touchStart"
bindtouchend="touchEnd"
bindtouchmove="touchMove"
class="list-item {{item.select?'delete':''}} {{tools.computClass(current,index,list.length)}}"
>
<image src="/static/images/test2.png" mode="widthFix"></image>
......@@ -226,6 +211,7 @@
<script>
let touchDotX = 0, touchDotY = 0;
let startPositionX,startPositionY;
import wepy from '@wepy/core';
import store from '../store';
wepy.page({
......@@ -241,10 +227,6 @@
userInfo: {},
swiperItem:3,
videoList:[],
shopcarPosition: null,
bigshop: false,
carinfo:0,
shopcarlist:[],
},
computed: {
......@@ -252,15 +234,14 @@
},
methods: {
moveSwiper:function(e){
moveSwiper(e){
if(e.$wx.detail.source === 'touch') {
this.current = e.$wx.detail.current;
// this.setData({
// current: e.$wx.detail.current,
// })
}
},
toViewPage: function() {
toViewPage() {
//解决长按触发tap事件的bug
if(this.islongTap) {this.islongTap =false; return;}
wx.navigateTo({
url: '/pages/auth'
})
......@@ -271,17 +252,6 @@
// console.log("起始点的坐标X:" + touchDotX);
// console.log("起始点的坐标Y:" + touchDotY);
},
touchMove(event) {
let touchX = event.touches[0].pageX;
let touchY = event.touches[0].pageY;
//如果元素拖动到购物车范围
let {left, top, bottom, right} = this.shopcarPosition
if(touchX>left-10 && touchX<right+10) {
if(touchY>top-10 && touchY< bottom +10) {
this.bigshop = true;
}
}
},
// 移动结束处理动画
touchEnd(event) {
// console.log(event.currentTarget.dataset,2)
......@@ -289,14 +259,6 @@
let touchMoveX = event.changedTouches[0].pageX;
let touchMoveY = event.changedTouches[0].pageY;
let current = event.currentTarget.dataset
if(this.bigshop) {
this.bigshop = false;
if(current && current.itemid !== undefined) {
this.shopcarlist.push(this.list[current.itemid])
this.carinfo += 1 ;
}
return;
}
// 起始点的坐标(x0,y0)和手指离开时的坐标(x1,y1)之差
let tmX = touchMoveX - touchDotX;
let tmY = touchMoveY - touchDotY;
......@@ -327,9 +289,6 @@
// console.log("手势未触发=====");
}
},
forbidMove(){
return;
},
changeVideo(e){
if(e && e.activeId == 6) {
let that = this;
......@@ -386,16 +345,16 @@
});
}
this.list = [
{value:1,text:'这是测试的文字1'},
{value:2,text:'这是测试的文字2'},
{value:3,text:'这是测试的文字3'},
{value:4,text:'这是测试的文字4'},
{value:5,text:'这是测试的文字5'},
{value:6,text:'这是测试的文字6'},
{value:7,text:'这是测试的文字7'},
{value:8,text:'这是测试的文字8'},
{value:9,text:'这是测试的文字9'},
{value:10,text:'这是测试的文字10'},
{value:1,text:'这是测试的文字1',selectItemStyle:''},
{value:2,text:'这是测试的文字2',selectItemStyle:''},
{value:3,text:'这是测试的文字3',selectItemStyle:''},
{value:4,text:'这是测试的文字4',selectItemStyle:''},
{value:5,text:'这是测试的文字5',selectItemStyle:''},
{value:6,text:'这是测试的文字6',selectItemStyle:''},
{value:7,text:'这是测试的文字7',selectItemStyle:''},
{value:8,text:'这是测试的文字8',selectItemStyle:''},
{value:9,text:'这是测试的文字9',selectItemStyle:''},
{value:10,text:'这是测试的文字10',selectItemStyle:''},
];
this.adlist = [
{imgsrc:'/static/images/test1.jpg',text:'小明刚刚参与了抽奖'},
......@@ -418,12 +377,7 @@
this.videoList = urls.map((url, index) => ({ id: index + 1, url }))
},
onLoad () {
const query = wx.createSelectorQuery();
query.select('#shopcar').boundingClientRect()
let that = this;
query.exec(function(res){
that.shopcarPosition = res[0];
})
},
});
</script>
......@@ -433,7 +387,6 @@
usingComponents: {
'van-button': '../components/vant/button/index',
'video-list': '~@/components/custom/videolist',
'van-icon': '../components/vant/icon/index'
}
}
</config>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment