KELECHUAN 3 年 前
コミット
adc43e9209

+ 49 - 21
information/children.js

@@ -47,55 +47,76 @@ export default {
 			time: '16:00-16:50',
 			timeFrame: '上午第三节'
 		}],
-		
+
 		//打卡记录
 		records: [{
 			date: 28,
 			month: 3,
-			year: 2022
-		},{
+			year: 2022,
+			time: '08:25'
+		}, {
 			date: 29,
 			month: 3,
-			year: 2022
-		},{
+			year: 2022,
+			time: '08:27'
+		}, {
 			date: 30,
 			month: 3,
-			year: 2022
-		},{
+			year: 2022,
+			time: '08:15'
+		}, {
 			date: 31,
 			month: 3,
-			year: 2022
+			year: 2022,
+			time: '08:19'
 		}, {
 			date: 2,
 			month: 4,
-			year: 2022
+			year: 2022,
+			time: '08:25'
 		}, {
 			date: 3,
 			month: 4,
-			year: 2022
+			year: 2022,
+			time: '08:09'
 		}, {
 			date: 4,
 			month: 4,
-			year: 2022
-		},{
+			year: 2022,
+			time: '08:20'
+		}, {
 			date: 5,
 			month: 4,
-			year: 2022
-		},{
+			year: 2022,
+			time: '08:02'
+		}, {
 			date: 6,
 			month: 4,
-			year: 2022
-		},{
+			year: 2022,
+			time: '08:05'
+		}, {
 			date: 7,
 			month: 4,
-			year: 2022
-		},{
+			year: 2022,
+			time: '08:22'
+		}, {
 			date: 8,
 			month: 4,
-			year: 2022
+			year: 2022,
+			time: '08:25'
+		}, {
+			date: 11,
+			month: 4,
+			year: 2022,
+			time: '08:20'
 		}],
 		//评测作业活动内容
 		homeworkDetail: '',
+		//日历打卡统计数据
+		calendar: {
+			isAttendNum: '',
+			noAttendNum: '',
+		},
 
 	}),
 	//模块方法(修改数据)
@@ -109,7 +130,6 @@ export default {
 		updateChildrenSemesterList(state, semesterList) {
 			state.semesterList = semesterList
 		},
-
 		//更新学生信息
 		updateChildrenInfo(state, childreninfo) {
 			state.childreninfo = childreninfo
@@ -121,9 +141,17 @@ export default {
 			this.commit('m_children/saveChildrenGradeToStorage')
 		},
 		//更新评测作业活动信息
-		updateHomeworkDetail(state, homeworkDetail){
+		updateHomeworkDetail(state, homeworkDetail) {
 			state.homeworkDetail = homeworkDetail
 		},
+		//更新日历页未打卡数据
+		updateNoAttendNum(state, noAttendNum) {
+			state.calendar.noAttendNum = noAttendNum
+		},
+		//更新日历页已打卡数据
+		updateIsAttendNum(state, isAttendNum) {
+			state.calendar.isAttendNum = isAttendNum
+		},
 
 		//持久化存储
 		//学生信息

+ 52 - 22
pages/home/home.vue

@@ -4,7 +4,8 @@
 		<top-box v-bind:timeStamp="timeStamp"></top-box>
 		<!-- 滚动条 -->
 		<view class="notice">
-			<u-notice-bar :text="noticeMsg" mode="closable" bgColor="rgba(73, 125, 220, 0.25)" color="#FFF" url="/subpkg/mymsg/mymsg"></u-notice-bar>
+			<u-notice-bar :text="noticeMsg" mode="closable" bgColor="rgba(73, 125, 220, 0.25)" color="#FFF"
+				url="/subpkg/mymsg/mymsg"></u-notice-bar>
 		</view>
 		<!-- 卡片区域 -->
 		<view class="card-box">
@@ -15,9 +16,10 @@
 					<view :class="icon.class"></view>
 					<text class="info-text">今日课程</text>
 					<view style="display: flex; align-items: center;margin: 0 10rpx 0 auto;">
-						<view class="t-icon t-icon-liebiao" style="width: 30rpx; height: 30rpx;"
-							@click="navClass"></view>
-						<view class="msg" style="margin-left: 10rpx; font-size: 14px;color: #3C9CFF;" @click="navClass">课程列表</view>
+						<view class="t-icon t-icon-liebiao" style="width: 30rpx; height: 30rpx;" @click="navClass">
+						</view>
+						<view class="msg" style="margin-left: 10rpx; font-size: 14px;color: #3C9CFF;" @click="navClass">
+							课程列表</view>
 					</view>
 
 				</view>
@@ -25,7 +27,8 @@
 			</view>
 
 			<!-- 今日打卡 -->
-			<view class="card-item" @click="navCalendar(attendanceData.attendance,attendanceData.attendanceTime,attendanceData.attendanceQuality)">
+			<view class="card-item"
+				@click="navCalendar(attendanceData.attendance,attendanceData.attendanceTime,attendanceData.attendanceQuality)">
 				<view class="card-info">
 					<view :class="icon.record"></view>
 					<text class="info-text">今日打卡</text>
@@ -38,17 +41,21 @@
 					</view>
 					<view class="home-title-text">
 						<view class="msg">打卡时间:</view>
-						<view style="margin-left: 10rpx;">
-							<!-- <u-tag text="8点15分" plain shape="circle"></u-tag> -->
+						<view style="margin-left: 10rpx;" v-if="attendanceData.attendance === '已打卡'">
+
 							<view style="display: flex; align-items: center; margin-left: 10rpx;">
 								<view class="number-box">{{attendanceData.attendanceTimeAfter[0]}}</view>
 								<view style="color: #3C9CFF;">:</view>
 								<view class="number-box">{{attendanceData.attendanceTimeAfter[1]}}</view>
 							</view>
 						</view>
+						<view v-if="attendanceData.attendance === '未打卡'" style="margin: 10rpx 0 10rpx 25rpx;">
+							<u-tag :text="attendanceData.attendanceTime" plain shape="circle"></u-tag>
+						</view>
+
 					</view>
 					<view class="home-title-text">
-						<view class="msg">本日出勤:</view>
+						<view class="msg">出勤效率:</view>
 						<view class="card-content">{{attendanceData.attendanceQuality}}</view>
 					</view>
 				</view>
@@ -100,7 +107,7 @@
 	export default {
 		computed: {
 			...mapState('m_chart', ['todayData']),
-			...mapState('m_children', ['childreninfo', 'classList']),
+			...mapState('m_children', ['childreninfo', 'classList', 'records']),
 			...mapState('m_parent', ['myData'])
 		},
 		data() {
@@ -112,14 +119,16 @@
 				//打卡数据
 				attendanceData: {
 					//出勤状况
-					attendance: '已打卡',
+					attendance: '',
 					//打卡时间
-					attendanceTime: '08:27',
+					attendanceTime: '',
 					//处理后时间
 					attendanceTimeAfter: [],
 					//出勤质量
-					attendanceQuality: '良好'
+					attendanceQuality: ''
 				},
+
+
 				//属性(不修改)
 				//图标
 				icon: {
@@ -137,29 +146,50 @@
 				activityOpts: {},
 				//时间戳
 				timeStamp: '',
-
 			}
 		},
 		onLoad() {
-			this.setOpts()
-			this.$getTimeStamp()
-			this.getNoticeMsg()
-			this.getClassCurrent()
-			this.getAttendanceTimeAfter()
+			this.init()
 		},
 		onPullDownRefresh() {
-			this.$getTimeStamp()
-			this.getClassCurrent()
-			console.log('refresh')
+			this.init()
 			setTimeout(function() {
 				uni.stopPullDownRefresh()
 			}, 1000);
 		},
 		methods: {
+			//页面方法初始化
+			init() {
+				this.$getTimeStamp()
+				this.setOpts()
+				this.getNoticeMsg()
+				this.getClassCurrent()
+				this.getTodayAttendance()
+				this.getAttendanceTimeAfter()
+			},
 			//获取滚动通知
 			getNoticeMsg() {
 				this.noticeMsg = `您有 ${this.myData.msgList.length} 个通知,请点击查看`
 			},
+			//展示今日打卡
+			getTodayAttendance() {
+				//获得当前时间时间戳
+				let timeNow = (new Date()).format("yyyy-M-dd")
+				let timeArr = timeNow.split("-")
+				let info = this.records.filter(x => x.year == timeArr[0] && x.month == timeArr[1] && x.date == timeArr[2])
+				if (info.length === 0) {
+					//出勤状况
+					this.attendanceData.attendance = '未打卡',
+					//打卡时间
+					this.attendanceData.attendanceTime = '未记录',
+					//出勤质量
+					this.attendanceData.attendanceQuality = '未记录'
+				} else {
+					this.attendanceData.attendance = '已打卡'
+					this.attendanceData.attendanceTime = info[0].time
+					this.attendanceData.attendanceQuality = info[0].time>'08:15'? '一般':'优秀'
+				}
+			},
 			//计算当前课程
 			getClassCurrent() {
 				//当前时间戳是否在课程时间段内
@@ -207,7 +237,7 @@
 					url: `/pages/homework/homework?index=${index}`
 				})
 			},
-			navCalendar(attendance,attendanceTime,attendanceQuality) {
+			navCalendar(attendance, attendanceTime, attendanceQuality) {
 				uni.navigateTo({
 					url: `/subpkg/calendarmsg/calendarmsg?attendance=${attendance}&attendanceTime=${attendanceTime}&attendanceQuality=${attendanceQuality}`
 				})

+ 24 - 16
subpkg/calendarmsg/calendarmsg.vue

@@ -1,24 +1,24 @@
 <template>
 	<view>
-		<back :text="'今日打卡'"></back>
+		<back :text="'打卡详情'"></back>
 
 		<view class="card-box">
 
 			<view class="card-item">
 				<view class="total">
-					<view class="total-title">打卡汇总</view>
+					<view class="total-title">本月打卡</view>
 					<view class="total-content">
 						<view class="number-box">
-							<view class="number">{{records.length}}</view>
+							<view class="number">{{calendar.isAttendNum}}</view>
 							<view class="number-detail">打卡次数</view>
 						</view>
 						<view class="number-box">
-							<view class="number">1</view>
+							<view class="number">{{calendar.noAttendNum}}</view>
 							<view class="number-detail">缺卡次数</view>
 						</view>
 						<view class="number-box">
-							<view class="number">优秀</view>
-							<view class="number-detail">出勤质量</view>
+							<view class="number">{{monthAttendQuality}}</view>
+							<view class="number-detail">本月出勤质量</view>
 						</view>
 					</view>
 				</view>
@@ -26,7 +26,7 @@
 
 			<view class="card-item">
 				<view class="calendar_container">
-					<zsyCalendar :sundayIndex="6" @change="dateHandler" @chooseDate="chooseDate" />
+					<zsyCalendar :sundayIndex="6" @change="dateHandler" @chooseDate="chooseDate"/>
 				</view>
 				<view class="state-box">
 					<view class="state"
@@ -39,7 +39,7 @@
 							<text class="msg-text">{{attendanceTime}}</text>
 						</view>
 						<view class="flex">
-							<text class="msg-text" style="font-weight: normal;font-size: 28rpx;">出勤速度:</text>
+							<text class="msg-text" style="font-weight: normal;font-size: 28rpx;">出勤效率:</text>
 							<text class="msg-text">{{attendanceQuality}}</text>
 						</view>
 					</view>
@@ -62,7 +62,7 @@
 			zsyCalendar
 		},
 		computed: {
-			...mapState('m_children', ['records']),
+			...mapState('m_children', ['records','calendar']),
 		},
 		data() {
 			return {
@@ -72,32 +72,40 @@
 				attendanceQuality: '',
 				//当月天数
 				// monthDates: '',
+				monthAttendQuality: '',
 			};
 		},
 		onLoad(options) {
 			this.attendance = options.attendance
 			this.attendanceTime = options.attendanceTime
 			this.attendanceQuality = options.attendanceQuality
+			this.getMonthAttendQuality()
 		},
 		methods: {
+			//判断本月出勤质量
+			getMonthAttendQuality() {
+				this.monthAttendQuality = this.calendar.noAttendNum <= 5? '优秀':'一般'
+			},
 			//日历事件
 			dateHandler(e) {},
 			//选择日期
 			chooseDate(dateInfo, dateIndex) {
+				// console.log(dateInfo);
 				if (dateInfo.isAttend === 1) {
 					this.attendance = '已打卡'
-					this.attendanceTime = '08:27'
-					this.attendanceQuality = '良好'
+					this.attendanceTime = this.records.filter(x => x.date === dateInfo.date && x.month === dateInfo.month && x.year === x.year)[0].time
+					// console.log(info);
+					this.attendanceQuality = this.attendanceTime>'08:15'? '一般':'优秀'
 				}
 				if (dateInfo.isAttend === 0) {
 					this.attendance = '未打卡'
-					this.attendanceTime = '无打卡'
-					this.attendanceQuality = '记录'
+					this.attendanceTime = '未记录'
+					this.attendanceQuality = '记录'
 				}
 				if (dateInfo.isAttend === -1) {
-					this.attendance = '未记录'
-					this.attendanceTime = '无打卡'
-					this.attendanceQuality = '记录'
+					this.attendance = '未到日期'
+					this.attendanceTime = '未记录'
+					this.attendanceQuality = '记录'
 				}
 			},
 

+ 51 - 14
subpkg/subscribecenter/subscribecenter.vue

@@ -6,21 +6,34 @@
 		<view class="bg1"></view>
 		<view class="bg2"></view>
 
-		<view class="vipcard">
-			<view class="flex">
-				<view class="t-icon t-icon-huiyuan1"></view>
-				<view class="card-title">{{myData.subscribeLevel}}</view>
-			</view>
-			<view class="card-detail">{{endTime}} 到期</view>
-			<view class="card-detail">{{myData.subscribePrivilege}}</view>
-			<view class="btn-box">
-				<view class="border-box">
-					<view class="btn-text">升级版本</view>
+		<view class="vipcard" style="display: flex; align-items: center;">
+			<view>
+				<view class="flex">
+					<view class="t-icon t-icon-huiyuan1"></view>
+					<view class="card-title">{{myData.subscribeLevel}}</view>
 				</view>
-				<view class="border-box">
-					<view class="btn-text">订阅续费</view>
+				<view class="card-detail">{{endTime}} 到期</view>
+				<view class="card-detail">{{myData.subscribePrivilege}}</view>
+				<view class="btn-box">
+					<view class="border-box">
+						<view class="btn-text">升级版本</view>
+					</view>
+					<view class="border-box">
+						<view class="btn-text">订阅续费</view>
+					</view>
 				</view>
 			</view>
+			<view class="flex">
+				<view class="border-right"></view>
+				<view class="border-right" style="margin-left: -480rpx;"></view>
+				<view class="border-right" style="margin-left: -480rpx;"></view>
+				<view class="border-right" style="margin-left: -480rpx;"></view>
+				<view class="border-right" style="margin-left: -480rpx;"></view>
+				<view class="border-right" style="margin-left: -480rpx;"></view>
+				<view class="border-right" style="margin-left: -480rpx;"></view>
+				<view class="border-right" style="margin-left: -480rpx;"></view>
+				<view class="border-right" style="margin-left: -480rpx;"></view>
+			</view>
 		</view>
 
 		<view class="flex" style="margin: 50rpx 0 0 50rpx;">
@@ -30,7 +43,9 @@
 		
 		<view class="flex" style="margin: 50rpx 0 0 50rpx;justify-content: space-around;">
 			<view class="flex" style="flex-direction: column;" v-for="(item,index) in data" :key="index">
-				<view :class="item.icon"></view>
+				<view class="circle-box">
+					<view :class="item.icon"></view>
+				</view>
 				<view style="color: #FFF; font-size: 28rpx;margin-top: 20rpx;">{{item.text}}</view>
 			</view>
 		</view>
@@ -124,6 +139,7 @@
 		background: linear-gradient(to right, #f8e4bf, #e1bc87);
 		border-radius: $card-border-radius;
 		padding: 50rpx;
+		overflow: hidden;
 
 		.card-title {
 			margin-left: 20rpx;
@@ -139,7 +155,7 @@
 		}
 
 		.btn-box {
-			width: 40%;
+			width: 270rpx;
 			margin-top: 80rpx;
 			display: flex;
 			align-items: center;
@@ -172,4 +188,25 @@
 		width: 40rpx;
 		background-repeat: no-repeat;
 	}
+	.circle-box{
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		width: 80rpx;
+		height: 80rpx;
+		border-radius: 50%;
+		background-color: #FFF;
+		.t-icon {
+			height: 80rpx;
+			width: 80rpx;
+			background-repeat: no-repeat;
+		}
+	}
+	.border-right{
+		margin-left: 120rpx;
+		height: 500rpx;
+		width: 500rpx;
+		border-radius: 50%;
+		border: 1px solid #b4986b;
+	}
 </style>

+ 29 - 4
subpkg/zsy-calendar/zsy-calendar.vue

@@ -39,15 +39,15 @@
 		</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>
+		</view> -->
 	</view>
 </template>
 
 <script>
 	import {
-		mapState,
+		mapState,mapMutations
 	} from 'vuex'
 	import {
 		parseTime,
@@ -100,7 +100,11 @@
 				swiperMode: this.mode, // 日历轮播显示模式 open:展开 close:收缩
 				dateCache: {}, // 日期缓存
 				emitTimer: null, // 日期改变向父级传递当前选中日期计时器
-				dateClick: false // 是否进行了日期的点击选择
+				dateClick: false ,// 是否进行了日期的点击选择
+				noAttendArr: [],//缺卡天数暂存
+				noAttend: [],//缺卡天数
+				isAttendArr: [],//打卡天数暂存
+				isAttend: [],//打卡天数
 			}
 		},
 		computed: {
@@ -189,6 +193,7 @@
 			this.init() // 初始化数据
 		},
 		methods: {
+			...mapMutations('m_children', ['updateNoAttendNum','updateIsAttendNum']),
 			// 初始化数据
 			init() {
 				if (this.selectedDate === null) this.selectedDate = this.today // 默认选中日期为当天
@@ -213,6 +218,10 @@
 				const year = this.getAssignDateInfo(false, 0)
 				const month = this.getAssignDateInfo(false, 1)
 				const cur = this.generateCalendar(year, month)
+				this.noAttend = this.noAttendArr
+				this.isAttend = this.isAttendArr
+				this.updateIsAttendNum(this.isAttend)
+				this.updateNoAttendNum(this.noAttend)
 				const prev = this.generateCalendar(month === 1 ? year - 1 : year, month === 1 ? 12 : month - 1)
 				const next = this.generateCalendar(month === 12 ? year + 1 : year, month === 12 ? 1 : month + 1)
 				// 根据current来判断相邻的轮播存放哪些日历数据
@@ -301,6 +310,12 @@
 						}
 					}
 				}
+				//当月时间
+				let currentMonth = (new Date).getMonth() + 1;
+				//当月缺卡记录
+				let noAttendArr = 0
+				//当月打卡记录
+				let isAttendArr = 0
 				//判断是否打卡和时间对比并修改数据
 				let todayDate = Date.now()//毫秒数
 				calendarDate.forEach(item => {
@@ -312,7 +327,17 @@
 					 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++
+					}
 				})
+				this.noAttendArr = noAttendArr
+				this.isAttendArr = isAttendArr
 				
 				return calendarDate
 			},