moveStart(e){
var touch;
if(e.changedTouches){
touch = e.changedTouches[0];
}else{
touch = e
}
this.move_start_x = touch.clientX
this.move_start_y = touch.clientY
this.move_start_calendarHeight = this.calendarHeight
this.can_move = true
this.move_mode = 0
this.$parent.can_click = true
},
// 手机端端移动
move(e){
if(!this.can_move)return
var touch;
if(e.changedTouches){
touch = e.changedTouches[0];
}else{
touch = e
}
this.$parent.can_click = false
if(this.can_change_mode){
if(Math.abs(touch.clientX - this.move_start_x) > Math.abs(touch.clientY - this.move_start_y)){
this.move_mode = 1
}else{
this.move_mode = 2
}
this.can_change_mode = false
}
console.log(this.move_mode)
// 左右移动
if(this.move_mode == 1){
this.calendarMove.x = touch.clientX - this.move_start_x
}
// 上下移动
if(this.move_mode == 2){
this.$parent.get3month()
let move_width = Math.abs(touch.clientY - this.move_start_y)
if(touch.clientY > this.move_start_y){
this.calendarHeight = this.move_start_calendarHeight + move_width
this.calendarMove.y = -((this.line_num*40 > move_width)?this.line_num*40 - move_width:0)
}else{
this.calendarHeight = this.move_start_calendarHeight - move_width
this.calendarMove.y = -((move_width<=this.line_num*40)?move_width:this.line_num*40)
}
}
},
// 手机端端结束移动
moveEnd(e){
this.can_move = false
if(this.move_mode == 0)return
var touch;
if(e.changedTouches){
touch = e.changedTouches[0];
}else{
touch = e
}
this.can_change_mode = true
if(this.move_mode == 1){
if(this.move_start_x < touch.clientX){
if(this.move_start_x - touch.clientX < -50){
this.calendarMove.x = this.itemWidth
this.move_index = -1
}else{
this.calendarMove.x = 0
}
}else{
// console.log(this.move_start_x - touch.clientX)
if(this.move_start_x - touch.clientX > 50){
this.calendarMove.x = -this.itemWidth
this.move_index = 1
}else{
this.calendarMove.x = 0
}
}
}
if(this.move_mode == 2){
if(this.move_start_y - touch.clientY < 0){
if(this.move_start_y - touch.clientY < -50){
this.move_init(true)
}else{
this.move_init(false)
}
}else{
if(this.move_start_y - touch.clientY > 50){
this.move_init(false)
}else{
this.move_init(true)
}
}
}
this.transition = true
setTimeout(()=> {
this.transition = false
if(this.move_mode == 1){
this.$emit('on-change',this.move_index,this.is_week)










