Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mini-program-wepy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
mini-program-wepy
Commits
8f66be83
Commit
8f66be83
authored
May 18, 2020
by
ziyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improvement: 删除购物车
parent
661fb286
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
66 deletions
+19
-66
index.wpy
src/pages/index.wpy
+19
-66
No files found.
src/pages/index.wpy
View file @
8f66be83
...
@@ -46,17 +46,6 @@
...
@@ -46,17 +46,6 @@
float: right;
float: right;
font-size: 12px;
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{
.imgwrap{
margin:8px 0;
margin:8px 0;
}
}
...
@@ -165,7 +154,7 @@
...
@@ -165,7 +154,7 @@
</wxs>
</wxs>
<template>
<template>
<view class="video-wrapper">
<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">
<view id="myvideo">
<video-list videoList="{{videoList}}" bindchange="changeVideo"></video-list>
<video-list videoList="{{videoList}}" bindchange="changeVideo"></video-list>
</view>
</view>
...
@@ -179,12 +168,8 @@
...
@@ -179,12 +168,8 @@
<view>中奖概率1/3000</view>
<view>中奖概率1/3000</view>
</view>
</view>
<view class="rightcont">
<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 class="list-wrapper" vertical="true" circular="true" display-multiple-items="2" autoplay="true" interval="1500">
<swiper-item wx:for="{{adlist}}" wx:key="index" catch
touchmove="forbidMove"
>
<swiper-item wx:for="{{adlist}}" wx:key="index" catch
:touchmove
>
<view class="imgwrap">
<view class="imgwrap">
<image class="img" src="{{item.imgsrc}}"></image>
<image class="img" src="{{item.imgsrc}}"></image>
<view class="text">{{item.text}}</view>
<view class="text">{{item.text}}</view>
...
@@ -206,9 +191,9 @@
...
@@ -206,9 +191,9 @@
<view
<view
data-itemid="{{index}}"
data-itemid="{{index}}"
bindtap="toViewPage"
bindtap="toViewPage"
bindlongpress="longTap"
bindtouchstart="touchStart"
bindtouchstart="touchStart"
bindtouchend="touchEnd"
bindtouchend="touchEnd"
bindtouchmove="touchMove"
class="list-item {{item.select?'delete':''}} {{tools.computClass(current,index,list.length)}}"
class="list-item {{item.select?'delete':''}} {{tools.computClass(current,index,list.length)}}"
>
>
<image src="/static/images/test2.png" mode="widthFix"></image>
<image src="/static/images/test2.png" mode="widthFix"></image>
...
@@ -226,6 +211,7 @@
...
@@ -226,6 +211,7 @@
<script>
<script>
let touchDotX = 0, touchDotY = 0;
let touchDotX = 0, touchDotY = 0;
let startPositionX,startPositionY;
import wepy from '@wepy/core';
import wepy from '@wepy/core';
import store from '../store';
import store from '../store';
wepy.page({
wepy.page({
...
@@ -241,10 +227,6 @@
...
@@ -241,10 +227,6 @@
userInfo: {},
userInfo: {},
swiperItem:3,
swiperItem:3,
videoList:[],
videoList:[],
shopcarPosition: null,
bigshop: false,
carinfo:0,
shopcarlist:[],
},
},
computed: {
computed: {
...
@@ -252,15 +234,14 @@
...
@@ -252,15 +234,14 @@
},
},
methods: {
methods: {
moveSwiper
:function
(e){
moveSwiper(e){
if(e.$wx.detail.source === 'touch') {
if(e.$wx.detail.source === 'touch') {
this.current = e.$wx.detail.current;
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({
wx.navigateTo({
url: '/pages/auth'
url: '/pages/auth'
})
})
...
@@ -271,17 +252,6 @@
...
@@ -271,17 +252,6 @@
// console.log("起始点的坐标X:" + touchDotX);
// console.log("起始点的坐标X:" + touchDotX);
// console.log("起始点的坐标Y:" + touchDotY);
// 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) {
touchEnd(event) {
// console.log(event.currentTarget.dataset,2)
// console.log(event.currentTarget.dataset,2)
...
@@ -289,14 +259,6 @@
...
@@ -289,14 +259,6 @@
let touchMoveX = event.changedTouches[0].pageX;
let touchMoveX = event.changedTouches[0].pageX;
let touchMoveY = event.changedTouches[0].pageY;
let touchMoveY = event.changedTouches[0].pageY;
let current = event.currentTarget.dataset
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)之差
// 起始点的坐标(x0,y0)和手指离开时的坐标(x1,y1)之差
let tmX = touchMoveX - touchDotX;
let tmX = touchMoveX - touchDotX;
let tmY = touchMoveY - touchDotY;
let tmY = touchMoveY - touchDotY;
...
@@ -327,9 +289,6 @@
...
@@ -327,9 +289,6 @@
// console.log("手势未触发=====");
// console.log("手势未触发=====");
}
}
},
},
forbidMove(){
return;
},
changeVideo(e){
changeVideo(e){
if(e && e.activeId == 6) {
if(e && e.activeId == 6) {
let that = this;
let that = this;
...
@@ -386,16 +345,16 @@
...
@@ -386,16 +345,16 @@
});
});
}
}
this.list = [
this.list = [
{value:1,text:'这是测试的文字1'},
{value:1,text:'这是测试的文字1'
,selectItemStyle:''
},
{value:2,text:'这是测试的文字2'},
{value:2,text:'这是测试的文字2'
,selectItemStyle:''
},
{value:3,text:'这是测试的文字3'},
{value:3,text:'这是测试的文字3'
,selectItemStyle:''
},
{value:4,text:'这是测试的文字4'},
{value:4,text:'这是测试的文字4'
,selectItemStyle:''
},
{value:5,text:'这是测试的文字5'},
{value:5,text:'这是测试的文字5'
,selectItemStyle:''
},
{value:6,text:'这是测试的文字6'},
{value:6,text:'这是测试的文字6'
,selectItemStyle:''
},
{value:7,text:'这是测试的文字7'},
{value:7,text:'这是测试的文字7'
,selectItemStyle:''
},
{value:8,text:'这是测试的文字8'},
{value:8,text:'这是测试的文字8'
,selectItemStyle:''
},
{value:9,text:'这是测试的文字9'},
{value:9,text:'这是测试的文字9'
,selectItemStyle:''
},
{value:10,text:'这是测试的文字10'},
{value:10,text:'这是测试的文字10'
,selectItemStyle:''
},
];
];
this.adlist = [
this.adlist = [
{imgsrc:'/static/images/test1.jpg',text:'小明刚刚参与了抽奖'},
{imgsrc:'/static/images/test1.jpg',text:'小明刚刚参与了抽奖'},
...
@@ -418,12 +377,7 @@
...
@@ -418,12 +377,7 @@
this.videoList = urls.map((url, index) => ({ id: index + 1, url }))
this.videoList = urls.map((url, index) => ({ id: index + 1, url }))
},
},
onLoad () {
onLoad () {
const query = wx.createSelectorQuery();
query.select('#shopcar').boundingClientRect()
let that = this;
query.exec(function(res){
that.shopcarPosition = res[0];
})
},
},
});
});
</script>
</script>
...
@@ -433,7 +387,6 @@
...
@@ -433,7 +387,6 @@
usingComponents: {
usingComponents: {
'van-button': '../components/vant/button/index',
'van-button': '../components/vant/button/index',
'video-list': '~@/components/custom/videolist',
'video-list': '~@/components/custom/videolist',
'van-icon': '../components/vant/icon/index'
}
}
}
}
</config>
</config>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment