|
|
@ -1,8 +1,8 @@ |
|
|
|
<template> |
|
|
|
<view class="bg-gray-50"> |
|
|
|
<view class="bg-gray-50" @touchmove="onMove"> |
|
|
|
<view class="relative"> |
|
|
|
<!-- 日历 --> |
|
|
|
<Calendar @selected-change="onDateChange" :show-back="true" :dot-list="days" /> |
|
|
|
<Calendar @selected-change="onDateChange" :show-back="true" :dot-list="days" ref="calendar" /> |
|
|
|
<!-- 上传 导入wbs --> |
|
|
|
<Upload @show-alert="onShowAlert" /> |
|
|
|
</view> |
|
|
@ -27,6 +27,8 @@ |
|
|
|
<script> |
|
|
|
import { mapState, mapMutations } from 'vuex'; |
|
|
|
|
|
|
|
let prevY = 0; |
|
|
|
|
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
@ -41,6 +43,7 @@ export default { |
|
|
|
title: '', |
|
|
|
description: '', |
|
|
|
}, |
|
|
|
calendar: null, |
|
|
|
}; |
|
|
|
}, |
|
|
|
|
|
|
@ -58,6 +61,10 @@ export default { |
|
|
|
this.getProjects(); |
|
|
|
}, |
|
|
|
|
|
|
|
onReady() { |
|
|
|
this.calendar = this.$refs.calendar; |
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
...mapMutations('project', ['setProjects']), |
|
|
|
|
|
|
@ -89,6 +96,19 @@ export default { |
|
|
|
this.alert.show = true; |
|
|
|
setTimeout(() => (this.alert.show = false), 10000); |
|
|
|
}, |
|
|
|
|
|
|
|
// 监听触摸滑动 切换日历的模式 月/周 |
|
|
|
onMove(event) { |
|
|
|
const y = event.changedTouches[0].pageY; |
|
|
|
if (y - prevY > 0) { |
|
|
|
// 向下滑动 如果是周视图weekMode=true 就 变成 月视图weekMode=false |
|
|
|
this.calendar.weekMode && (this.calendar.weekMode = false); |
|
|
|
} else if (y - prevY < 0) { |
|
|
|
// 向上滑动 如果是月视图weekMode=false 就变成 周视图weekMode=true |
|
|
|
!this.calendar.weekMode && (this.calendar.weekMode = true); |
|
|
|
} |
|
|
|
prevY = y; |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
</script> |
|
|
|