You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

168 lines
3.1 KiB
JavaScript

Component({
data: {
sex: 1,
morePeople: false,
recordList: [
{
id: 0,
name: '李红霞',
tel: 13488887125,
gender: '女',
checked: false
},
{
id: 1,
name: '张卫国',
tel: 13488887125,
gender: '男',
checked: false
},
{
id: 2,
name: '王丽丽',
tel: 13488887125,
gender: '男',
checked: false
},
{
id: 3,
name: '王丽丽',
tel: 13488887125,
gender: '男',
checked: false
},
{
id: 4,
name: '王丽丽',
tel: 13488887125,
gender: '男',
checked: false
},
]
},
properties: {
// 抽屉高度
height: {
type: String,
value: "",
},
drawerType: {
type: String,
value: "",
},
//抽屉显示隐藏
show: {
type: Boolean,
value: false
},
titleText: {
type: String,
value: ''
},
// 是否需要显示tabbar
hideTabbar: {
type: Boolean,
value: false
},
cancerShow: {
type: Boolean,
value: true
},
//
touchClose: {
type: Boolean,
value: true
},
},
methods: {
/**
* 阻止滑动穿透
*
*
*/
modalMove () {
// console.log(this.data.color);
return false;
},
// 触摸开始事件
handletouchtart: function (event) {
this.data.lastX = event.touches[0].pageX;
this.data.lastY = event.touches[0].pageY;
},
filterTouchStart (event) {
this.handletouchtart(event);
},
filterTouchMove (event) {
let tx = this.handletouchmove(event);
if (this.data.touchClose) {
if (tx.ty > 100) {
this.hideLeft();
}
} else {
return false
}
},
/**
* 页面滑动事件监听
*
*
*/
handletouchmove: function (event) {
let that = this;
var currentX = event.touches[0].pageX;
var currentY = event.touches[0].pageY;
var tx = currentX - this.data.lastX;
var ty = currentY - this.data.lastY;
var text = "";
//左右方向滑动
if (Math.abs(tx) > Math.abs(ty)) {
return {
tx,
};
}
//上下方向滑动
else {
return {
ty,
};
}
},
hideLeft () {
// this.data.show = false
// this.setData({
// show: false
// })
var eventDetail = {
type: this.data.drawerType
};
this.triggerEvent("hidedrawer", eventDetail);
if (this.data.hideTabbar) {
setTimeout(() => {
this.getTabBar().setData({
isShow: true,
});
}, 200);
}
},
changeSex (e) {
this.setData({
sex: e.currentTarget.dataset.type
})
},
addPersion () {
wx.navigateTo({
url: '/pages/mine/vitaeList/index?type=add'
})
},
handlerMore () {
this.setData({
morePeople: !this.data.morePeople
})
}
}
})