|
@@ -29,16 +29,16 @@
|
|
</swiper>
|
|
</swiper>
|
|
|
|
|
|
<!-- 收缩情况下的日历轮播 -->
|
|
<!-- 收缩情况下的日历轮播 -->
|
|
- <swiper v-else key="shrinkSwiper" circular :style="{height: swiperHeight('close')}" :current="shrinkCurrent"
|
|
|
|
|
|
+ <!-- <swiper v-else key="shrinkSwiper" circular :style="{height: swiperHeight('close')}" :current="shrinkCurrent"
|
|
:duration="duration" :skip-hidden-item-layout="true" @change="e => shrinkCurrent = e.detail.current">
|
|
:duration="duration" :skip-hidden-item-layout="true" @change="e => shrinkCurrent = e.detail.current">
|
|
<swiper-item v-for="(swiper, swiperIndex) in 3" :key="swiperIndex" class="swiper-item">
|
|
<swiper-item v-for="(swiper, swiperIndex) in 3" :key="swiperIndex" class="swiper-item">
|
|
<DateBox :dates="calendarSwiperShrinkDates[swiperIndex]" :cellHeight="cellHeight"
|
|
<DateBox :dates="calendarSwiperShrinkDates[swiperIndex]" :cellHeight="cellHeight"
|
|
:dateActiveColor="dateActiveColor" :swiperMode="swiperMode" @chooseDate="chooseShrinkDate" />
|
|
:dateActiveColor="dateActiveColor" :swiperMode="swiperMode" @chooseDate="chooseShrinkDate" />
|
|
</swiper-item>
|
|
</swiper-item>
|
|
- </swiper>
|
|
|
|
|
|
+ </swiper> -->
|
|
</view>
|
|
</view>
|
|
|
|
|
|
- <!-- 日历切换模式 -->
|
|
|
|
|
|
+ <!-- 日历切换模式
|
|
<!-- <view class="calendar_toggle" @tap="swiperMode = swiperMode === 'open' ? 'close' : 'open'">
|
|
<!-- <view class="calendar_toggle" @tap="swiperMode = swiperMode === 'open' ? 'close' : 'open'">
|
|
<view class="icon" :class="{down: swiperMode === 'close'}"></view>
|
|
<view class="icon" :class="{down: swiperMode === 'close'}"></view>
|
|
</view> -->
|
|
</view> -->
|
|
@@ -47,7 +47,8 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import {
|
|
import {
|
|
- mapState,mapMutations
|
|
|
|
|
|
+ mapState,
|
|
|
|
+ mapMutations
|
|
} from 'vuex'
|
|
} from 'vuex'
|
|
import {
|
|
import {
|
|
parseTime,
|
|
parseTime,
|
|
@@ -100,11 +101,10 @@
|
|
swiperMode: this.mode, // 日历轮播显示模式 open:展开 close:收缩
|
|
swiperMode: this.mode, // 日历轮播显示模式 open:展开 close:收缩
|
|
dateCache: {}, // 日期缓存
|
|
dateCache: {}, // 日期缓存
|
|
emitTimer: null, // 日期改变向父级传递当前选中日期计时器
|
|
emitTimer: null, // 日期改变向父级传递当前选中日期计时器
|
|
- dateClick: false ,// 是否进行了日期的点击选择
|
|
|
|
- noAttendArr: [],//缺卡天数暂存
|
|
|
|
- noAttend: [],//缺卡天数
|
|
|
|
- isAttendArr: [],//打卡天数暂存
|
|
|
|
- isAttend: [],//打卡天数
|
|
|
|
|
|
+ dateClick: false, // 是否进行了日期的点击选择
|
|
|
|
+
|
|
|
|
+ noAttend: [], //缺卡天数暂存
|
|
|
|
+ isAttend: [], //打卡天数暂存
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -184,7 +184,7 @@
|
|
}
|
|
}
|
|
this.emitTimer = setTimeout(() => {
|
|
this.emitTimer = setTimeout(() => {
|
|
this.emitDate()
|
|
this.emitDate()
|
|
- }, this.duration + 200)
|
|
|
|
|
|
+ }, this.duration + 1)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -193,7 +193,7 @@
|
|
this.init() // 初始化数据
|
|
this.init() // 初始化数据
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- ...mapMutations('m_children', ['updateNoAttendNum','updateIsAttendNum']),
|
|
|
|
|
|
+ ...mapMutations('m_children', ['updateNoAttendNum', 'updateIsAttendNum']),
|
|
// 初始化数据
|
|
// 初始化数据
|
|
init() {
|
|
init() {
|
|
if (this.selectedDate === null) this.selectedDate = this.today // 默认选中日期为当天
|
|
if (this.selectedDate === null) this.selectedDate = this.today // 默认选中日期为当天
|
|
@@ -218,8 +218,6 @@
|
|
const year = this.getAssignDateInfo(false, 0)
|
|
const year = this.getAssignDateInfo(false, 0)
|
|
const month = this.getAssignDateInfo(false, 1)
|
|
const month = this.getAssignDateInfo(false, 1)
|
|
const cur = this.generateCalendar(year, month)
|
|
const cur = this.generateCalendar(year, month)
|
|
- this.noAttend = this.noAttendArr
|
|
|
|
- this.isAttend = this.isAttendArr
|
|
|
|
this.updateIsAttendNum(this.isAttend)
|
|
this.updateIsAttendNum(this.isAttend)
|
|
this.updateNoAttendNum(this.noAttend)
|
|
this.updateNoAttendNum(this.noAttend)
|
|
const prev = this.generateCalendar(month === 1 ? year - 1 : year, month === 1 ? 12 : month - 1)
|
|
const prev = this.generateCalendar(month === 1 ? year - 1 : year, month === 1 ? 12 : month - 1)
|
|
@@ -237,9 +235,9 @@
|
|
// 初始化日期信息完毕执行回调函数
|
|
// 初始化日期信息完毕执行回调函数
|
|
cb && cb()
|
|
cb && cb()
|
|
},
|
|
},
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
// 生成展开的日历数据
|
|
// 生成展开的日历数据
|
|
generateCalendar(year, month) {
|
|
generateCalendar(year, month) {
|
|
let calendarDate = []
|
|
let calendarDate = []
|
|
@@ -276,7 +274,7 @@
|
|
isSelected: false,
|
|
isSelected: false,
|
|
isToday: false,
|
|
isToday: false,
|
|
type: 'cur',
|
|
type: 'cur',
|
|
- isAttend: 0,//未打卡
|
|
|
|
|
|
+ isAttend: 0, //未打卡
|
|
}
|
|
}
|
|
|
|
|
|
// 今天的日期在不在里面
|
|
// 今天的日期在不在里面
|
|
@@ -292,7 +290,7 @@
|
|
month: month === 12 ? 1 : month + 1,
|
|
month: month === 12 ? 1 : month + 1,
|
|
date: i,
|
|
date: i,
|
|
type: 'next',
|
|
type: 'next',
|
|
- isAttend: 0,//未打卡
|
|
|
|
|
|
+ isAttend: 0, //未打卡
|
|
}
|
|
}
|
|
this.theDateIsToday(item)
|
|
this.theDateIsToday(item)
|
|
calendarDate.push(item)
|
|
calendarDate.push(item)
|
|
@@ -312,37 +310,40 @@
|
|
}
|
|
}
|
|
//当月时间
|
|
//当月时间
|
|
let currentMonth = (new Date).getMonth() + 1;
|
|
let currentMonth = (new Date).getMonth() + 1;
|
|
- //当月缺卡记录
|
|
|
|
- let noAttendArr = 0
|
|
|
|
- //当月打卡记录
|
|
|
|
- let isAttendArr = 0
|
|
|
|
//判断是否打卡和时间对比并修改数据
|
|
//判断是否打卡和时间对比并修改数据
|
|
- let todayDate = Date.now()//毫秒数
|
|
|
|
|
|
+ let todayDate = Date.now() //毫秒数
|
|
calendarDate.forEach(item => {
|
|
calendarDate.forEach(item => {
|
|
- if (this.records.find(x => x.month === item.month && x.year === item.year && x.date === item.date)) {
|
|
|
|
- item.isAttend = 1//已打卡
|
|
|
|
|
|
+ if (this.records.find(x => x.month === item.month && x.year === item.year && x.date === item
|
|
|
|
+ .date)) {
|
|
|
|
+ item.isAttend = 1 //已打卡
|
|
}
|
|
}
|
|
//判断是否在当前日期之后
|
|
//判断是否在当前日期之后
|
|
let valueTime = (new Date(`${item.year}/${item.month}/${item.date}`)).getTime();
|
|
let valueTime = (new Date(`${item.year}/${item.month}/${item.date}`)).getTime();
|
|
- if(valueTime>todayDate){
|
|
|
|
- item.isAttend = -1//时间未到
|
|
|
|
- }
|
|
|
|
- //当月缺卡次数
|
|
|
|
- if(item.month === currentMonth && item.isAttend === 0 && item.type === 'cur'){
|
|
|
|
- noAttendArr++
|
|
|
|
- }
|
|
|
|
- //当月打卡次数
|
|
|
|
- if(item.month === currentMonth && item.isAttend === 1 && item.type === 'cur'){
|
|
|
|
- isAttendArr++
|
|
|
|
|
|
+ if (valueTime > todayDate) {
|
|
|
|
+ item.isAttend = -1 //时间未到
|
|
}
|
|
}
|
|
|
|
+ //判断是否为周末
|
|
|
|
+ // if(){}
|
|
})
|
|
})
|
|
- this.noAttendArr = noAttendArr
|
|
|
|
- this.isAttendArr = isAttendArr
|
|
|
|
-
|
|
|
|
|
|
+ //未打卡
|
|
|
|
+ let noAttendArr = calendarDate.filter(x => x.month === currentMonth && x.isAttend === 0 && x.type ===
|
|
|
|
+ 'cur')
|
|
|
|
+ //打卡
|
|
|
|
+ let isAttendArr = calendarDate.filter(x => x.month === currentMonth && x.isAttend === 1 && x.type ===
|
|
|
|
+ 'cur')
|
|
|
|
+ // //前一月打卡
|
|
|
|
+ // let prevIsAttendArr = calendarDate.filter(x => x.month === currentMonth-1 && x.isAttend === 1 && x.type ===
|
|
|
|
+ // 'prev')
|
|
|
|
+ // let prevNoAttendArr = calendarDate.filter(x => x.month === currentMonth-1 && x.isAttend === 0 && x.type ===
|
|
|
|
+ // 'prev')
|
|
|
|
+ // console.log(prevIsAttendArr);
|
|
|
|
+ // console.log(prevNoAttendArr);
|
|
|
|
+ this.noAttend = noAttendArr.length
|
|
|
|
+ this.isAttend = isAttendArr.length
|
|
|
|
+
|
|
return calendarDate
|
|
return calendarDate
|
|
},
|
|
},
|
|
|
|
|
|
-
|
|
|
|
// 判断日期是否为今天
|
|
// 判断日期是否为今天
|
|
theDateIsToday(item) {
|
|
theDateIsToday(item) {
|
|
if (item.year + '-' + item.month + '-' + item.date === this.getAssignDateInfo(true, 0) + '-' + this
|
|
if (item.year + '-' + item.month + '-' + item.date === this.getAssignDateInfo(true, 0) + '-' + this
|