Browse Source

授课记录

wkyy 2 years ago
parent
commit
02b48d9216
1 changed files with 45 additions and 4 deletions
  1. 45 4
      pages/teacher/lectureRecord/lectureRecord.vue

+ 45 - 4
pages/teacher/lectureRecord/lectureRecord.vue

@@ -12,18 +12,20 @@
 			</view>
 			<u-picker mode="time" :defaultTime="defaultTime" v-model="show" :params="params" @confirm="confirm">
 			</u-picker>
-			<view class="course">
+			<view class="course" @click="classShow = true">
 				<view class="text">
-					所有班级
+					{{className}}
 				</view>
 				<view class="icon">
 					<u-icon name="arrow-down-fill" color="#999999" size="10"></u-icon>
 				</view>
 			</view>
+			<u-select v-model="classShow" mode="single-column" :list="classList" @confirm="classConfirm"></u-select>
 		</view>
 
 		<view class="main">
-			<view class="details-box" v-for="(item,index) in callList" :key="index">
+			<view class="details-box" v-for="(item,index) in callList" :key="index"
+				v-if="classId == item.classId || classId == ''">
 				<view class="title-number">
 					<view class="title">
 						{{item.className}}
@@ -84,10 +86,15 @@
 
 <script>
 	import * as callNamesApi from '@/apis/teacher/callNames.js'
+	import * as myClassApi from '@/apis/teacher/myClass.js'
 	
 	export default {
 		data() {
 			return {
+				classShow: false,
+				classList: [],
+				classId: '',
+				className: '所有班级',
 				teachTime: '',
 				params: {
 					year: true,
@@ -116,13 +123,47 @@
 			this.teachTime = this.defaultTime;
 			
 			this.queryDateStart = year + '-' + month + '-' + '01';
-			this.queryDateEnd = year + '-' + month + '-' + day;
+			this.queryDateEnd = year + '-' + month + '-' + (new Date(year,month,0).getDate());
 			
 			this.getCallList();
+			this.getLoadMyClass();
 		},
 		methods: {
+			classConfirm(e) {
+				this.classId = e[0].value;
+				this.className = e[0].label;
+			},
+			getLoadMyClass() {
+				this.classList = [];
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				myClassApi.loadMyClass().then((res) => {
+					uni.hideLoading();
+					var list = res.data;
+					this.classList.push({
+						value: '',
+						label: '所有班级'
+					});
+					for (var i = 0; i < list.length; i++) {
+						this.classList.push({
+							value: list[i].classId,
+							label: list[i].className
+						});
+					}
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
 			confirm(params) {
 				this.teachTime = params.year + '-' + params.month;
+				this.queryDateStart = params.year + '-' + params.month + '-' + '01';
+				this.queryDateEnd = params.year + '-' + params.month + '-' + (new Date(params.year,params.month,0).getDate());
+				this.getCallList();
 			},
 			getCallList() {
 				this.callList = [];