wkyy 2 年之前
父節點
當前提交
3bafa0b33a

+ 1 - 0
apis/login.js

@@ -1,4 +1,5 @@
  import requestWhite from '@/apis/utils/requestWhite.js';
+ 
 import Qs from 'qs';
 
 export function findByOpenId(data) {

+ 2 - 2
apis/parents/classSchedule.js

@@ -1,8 +1,8 @@
 import requestStudent from '@/apis/utils/requestStudent.js';
 import Qs from 'qs';
 
-export function courseList(data) {
-	var url='/mobile/student/courseList';
+export function loadMySchedule(data) {
+	var url='/mobile/student/loadMySchedule';
 	return requestStudent({
 		method: 'post',
 		data: data,

+ 31 - 19
apis/utils/mixin.js

@@ -1,5 +1,15 @@
 var prefix = 'jp-education-teacher' + process.car.NODE_ENV + '_';
-
+function	getprefix(){
+		
+		var url=window.location.href.split("#")[1]
+		if(url.indexOf("/pages/parents/") == 0){
+			return prefix+"parents-"
+		}
+		if(url.indexOf("/pages/teacher/") == 0){
+			return prefix+"teacher-"
+		}
+		return prefix
+	}
 var app = {
 	getGzDate : (key) => {
 		var tdate=new Date( ).toJSON().substr(0,10).replace("T"," ")
@@ -82,10 +92,27 @@ var app = {
 		uni.removeStorageSync(prefix + 'getElderModeClass');
 		//uni.removeStorageSync(prefix+'wx_openId');
 		
-	},
+	},
+
+	getToken : (options) => {
+		//不同权限 ,不同token
+	
+		return uni.getStorageSync(getprefix() + 'token')
+	},
+	setToken : (value) => {
+		uni.setStorageSync(getprefix() + 'token', value)
+		
+		if(value){
+			var tdate=new Date( +new Date() + 8 * 3600 * 1000 ).toJSON().substr(0,15).replace("T"," ")
+			uni.setStorageSync(prefix + 'token_tdate', tdate)
+		}
+	}
+	,
+	setPersonInfo : (value) => uni.setStorageSync(getprefix() + 'personInfo', value),
 	
-	getPersonInfo : () => {
-		 return uni.getStorageSync(prefix + 'personInfo')
+	getPersonInfo : () => {
+	
+		 return uni.getStorageSync(getprefix() + 'personInfo')
 	},
 	getPersonInfoPlus : () => {
 		 return uni.getStorageSync(prefix + 'personInfoPlus')
@@ -101,7 +128,6 @@ var app = {
 		 return uni.getStorageSync(prefix + 'xpgj_wx_user_info')
 	},
 
-	setPersonInfo : (value) => uni.setStorageSync(prefix + 'personInfo', value),
 	
 	setStudentId : (value) => uni.setStorageSync(prefix + 'studentId', value),
 	getStudentId : () => {
@@ -112,20 +138,6 @@ var app = {
 	
 	setUserInfo : (value) => uni.setStorageSync(prefix + 'xpgj_wx_user_info', value),
 	
-	getToken : (options) => {
-		//不同权限 ,不同token
-	
-		return uni.getStorageSync(prefix + 'token')
-	},
-	setToken : (value) => {
-		uni.setStorageSync(prefix + 'token', value)
-		
-		if(value){
-			var tdate=new Date( +new Date() + 8 * 3600 * 1000 ).toJSON().substr(0,15).replace("T"," ")
-			uni.setStorageSync(prefix + 'token_tdate', tdate)
-		}
-	}
-	,
 	getGetElderModeClass : () => {
 		 return uni.getStorageSync(prefix + 'getElderModeClass')
 	},

+ 2 - 2
config/.env.dev.js

@@ -9,8 +9,8 @@ const UNI_APP = {
 
 	//openId:"oK9Wr57rAcNzihDN2PEdptprT0As", 
 	// openId:"oK9Wr54VbEh3xvWYmD_zT5NbH4AY",//zkx
-	openId:"123456",
-	//openId:"oK9Wr59rru-i3bm7dtTtxnkR-i4s",//杨所
+	// openId:"123456",
+	openId:"oK9Wr59rru-i3bm7dtTtxnkR-i4s",//杨所
 	//openId:"oK9Wr5zv8lvirni3txbxRkmpg8d0",//
 	
 	

+ 1 - 1
pages.json

@@ -180,7 +180,7 @@
             
         }
         ,{
-					"path": "components/cropImage",
+					"path": "pages/components/cropImage",
 					"style": {
 							"navigationStyle": "custom"
 						}

+ 0 - 0
components/cropImage.vue → pages/components/cropImage.vue


+ 0 - 0
components/limeClipper/README.md → pages/components/limeClipper/README.md


+ 0 - 0
components/limeClipper/images/photo.svg → pages/components/limeClipper/images/photo.svg


+ 0 - 0
components/limeClipper/images/rotate.svg → pages/components/limeClipper/images/rotate.svg


+ 0 - 0
components/limeClipper/index.css → pages/components/limeClipper/index.css


+ 0 - 0
components/limeClipper/limeClipper.vue → pages/components/limeClipper/limeClipper.vue


+ 0 - 0
components/limeClipper/utils.js → pages/components/limeClipper/utils.js


+ 27 - 9
pages/parents/classSchedule/classSchedule.vue

@@ -20,7 +20,7 @@
 		<view class="date-item">
 			<view class="item" v-for="(item,index) in weekDate" :key="index"
 				:class="activeClass == index ? 'checked' : ''" @click="activeClassClick(item,index)">
-				<view class="dot" :class="activeClass == index ? 'dot-checked' : ''">
+				<view :class="item.isDotShow ? 'dot' : ''" :style="activeClass == index ? 'background-color: #fff;' : ''">
 
 				</view>
 				<view class="week ">
@@ -41,11 +41,11 @@
 			</view>
 			<view class="infos">
 				<view class="title">
-					中国舞十级班
+					{{item.className}}
 				</view>
 				<view class="tag">
 					<view class="item">
-						二楼舞蹈一教室
+						{{item.classroom}}
 					</view>
 					<view class="item">
 						{{item.coursePeriods}}
@@ -58,7 +58,7 @@
 							<img src="../../../assets/img/teachercard.png" alt="">
 						</view>
 						<view class="name">
-							{{item.courseTeachersN}}老师
+							{{item.teacherNames}}老师
 						</view>
 					</view>
 
@@ -67,7 +67,7 @@
 							课次
 						</view>
 						<view class="num">
-							22
+							{{item.courseAmount + item.freeAmount}}
 						</view>
 
 					</view>
@@ -139,22 +139,39 @@
 				activeClass: 0,
 				weekDate1: '',
 				courseList: [],
+				studentId: ''
 			}
 		},
 		onReady() {
+			if(this.carhelp.getStudentId()) {
+				this.studentId = this.carhelp.getStudentId().studentId;
+			}
 			this.getToday();
 		},
 		methods: {
 			getCourseList() {
+				this.courseList = [];
 				uni.showLoading({
 					title: "加载中",
 					mask: true,
 				})
-				classScheduleApi.courseList({
-					queryDate: this.date,
+				classScheduleApi.loadMySchedule({
+					studentId: this.studentId,
+					startDate: this.weekDate[0].day,
+					endDate: this.weekDate[6].day
 				}).then((response) => {
 					uni.hideLoading();
-					this.courseList =  response.data.courseList;
+					var list =  response.data;
+					for (var i = 0; i < list.length; i++) {
+						if(this.date == list[i].courseDate) {
+							this.courseList.push(list[i]);
+						}
+						for (var j = 0; j < this.weekDate.length; j++) {
+							if(this.weekDate[j].day == list[i].courseDate) {
+								this.weekDate[j].isDotShow = true;
+							}
+						}
+					}
 				}).catch(error => {
 					uni.showToast({
 						title: error,
@@ -180,7 +197,8 @@
 						if (i == j) {
 							this.weekDate.push({
 								week: this.weekN[j],
-								day: this.getFormatDate(new Date(weekDate2.setDate(this.weekDate1.getDate() + i)))
+								day: this.getFormatDate(new Date(weekDate2.setDate(this.weekDate1.getDate() + i))),
+								isDotShow: false
 							})
 						}
 					}

+ 106 - 11
pages/parents/homePage/homePage.vue

@@ -109,23 +109,27 @@
 				<img src="../../../assets/img/riFill-calendar-todo-fill@1x.png" alt="">最近课程
 			</view>
 			<view class="course-infos">
-				<view class="info-box" @click="gotoUrl('pages/teacher/callNames/classCall')">
-					<view class="position today">
+				<view class="info-box" v-for="(item,index) in courseList" :key="index"
+					@click="gotoUrl('pages/parents/classSchedule/classScheduleDetails')">
+					<view class="position today" v-if="item.courseDate == date">
 					</view>
+					<view class="position tomorrow" v-if="item.courseDate == tomorrow">
+						明
+					</view>
 					<view class="class-name">
-						周开琴书法班1
+						{{item.className}}
 					</view>
 					<view class="location-time">
 						<view class="location">
-							4楼6教室
+							{{item.classroom}}
 						</view>
 						<view class="time">
-							09:30-10:45
+							{{item.coursePeriods}}
 						</view>
 					</view>
 					<view class="date">
-						2023.1.3
+						{{item.courseDate}}
 					</view>
 				</view>
 				<view class="info-box info-box2">
@@ -155,14 +159,15 @@
 		<view class="recommend">
 			<view class="title">
 				<view class="title">
-					<img src="../../../assets/img/riFill-award-fill@1x.png" alt="">最近课程
+					<img src="../../../assets/img/riFill-award-fill@1x.png" alt="">课程推荐
 				</view>
 			</view>
 			<view class="classify">
-				<view class="item chosen">
-					全部
+				<view class="item" v-for="(item,index) in chosenList" :key="index"
+					:class="chosenActive == index ? 'chosen' : ''" @click="chosenClick(item,index)">
+					{{item.name}}
 				</view>
-				<view class="item">
+				<!-- <view class="item">
 					精品试听
 				</view>
 				<view class="item">
@@ -170,7 +175,7 @@
 				</view>
 				<view class="item">
 					机构推荐
-				</view>
+				</view> -->
 			</view>
 			
 			<view class="infos-box">
@@ -273,6 +278,7 @@
 </template>
 
 <script>
+	import * as classScheduleApi from '@/apis/parents/classSchedule.js'
 	import * as mineApi from '@/apis/parents/mine.js'
 	import ParentsTabbar from '@/components/ParentsTabbar.vue'
 	
@@ -282,6 +288,20 @@
 		},
 		data() {
 			return {
+				chosenList: [
+					{name: '全部'},
+					{name: '精品试听'},
+					{name: '为您优选'},
+					{name: '机构推荐'}
+				],
+				chosenActive: 0,
+				date: '',
+				tomorrow: '',
+				weekDate: [],
+				weekN: ["一", "二", "三", "四", "五", "六", "日"],
+				activeClass: 0,
+				weekDate1: '',
+				courseList: [],
 				form: {
 					studentName: '',
 					headPhoto: ''
@@ -298,11 +318,86 @@
 			if(this.carhelp.getStudentId()) {
 				this.studentId = this.carhelp.getStudentId().studentId;
 				this.getStudentDetail();
+				this.getToday();
 			}
 			
 			this.getStudentList();
 		},
 		methods: {
+			chosenClick(item,index) {
+				this.chosenActive = index;
+			},
+			getCourseList() {
+				this.courseList = [];
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				classScheduleApi.loadMySchedule({
+					studentId: this.studentId,
+					startDate: this.date,
+					endDate: this.weekDate[6].day
+				}).then((response) => {
+					uni.hideLoading();
+					this.courseList =  response.data;
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
+			getToday() {
+				this.weekDate = [];
+				let date = new Date(); //当前日期
+				let year = date.getFullYear(); //当前年
+				let month = date.getMonth() + 1; //当前月
+				let day = date.getDate(); //当天
+				let mydate = new Date(year, month - 1, day);
+				let weekday = mydate.getDay();
+				this.weekDate1 = new Date(year, month - 1, day + 1 - weekday);
+				this.getWeekDate(true);
+			},
+			getWeekDate(bl) {
+				let weekDate2 = new Date(this.weekDate1.getTime());
+				for (var i = 0; i < 7; i++) {
+					for (var j = 0; j < this.weekN.length; j++) {
+						if (i == j) {
+							this.weekDate.push({
+								week: this.weekN[j],
+								day: this.getFormatDate(new Date(weekDate2.setDate(this.weekDate1.getDate() + i))),
+								isDotShow: false
+							})
+						}
+					}
+				}
+			
+				if (bl) {
+					let date = new Date(); //当前日期
+					date = this.getFormatDate(date);
+					for (var m = 0; m < this.weekDate.length; m++) {
+						if (date == this.weekDate[m].day) {
+							this.activeClass = m;
+							this.date = this.weekDate[m].day;
+							this.tomorrow = this.weekDate[m+1].day;
+						}
+					}
+					this.getCourseList();
+				}
+			},
+			getFormatDate(date) {
+				let myyear = date.getFullYear();
+				let mymonth = date.getMonth() + 1;
+				let myweekday = date.getDate();
+				if (mymonth < 10) {
+					mymonth = "0" + mymonth;
+				}
+				if (myweekday < 10) {
+					myweekday = "0" + myweekday;
+				}
+			
+				return (myyear + "-" + mymonth + "-" + myweekday);
+			},
 			getStudentDetail() {
 				uni.showLoading({
 					title: "加载中",

+ 1 - 1
pages/parents/mine/addChildInformation.vue

@@ -226,7 +226,7 @@
 						//非app端用前端组件剪裁头像,app端用内置的原生裁剪
 						let fileData = await new Promise((callback) => {
 							uni.navigateTo({
-								url: '/components/cropImage?path=' + filePath +
+								url: '/pages/components/cropImage?path=' + filePath +
 									`&options=${JSON.stringify(crop)}`,
 								animationType: "fade-in",
 								events: {

+ 1 - 1
pages/parents/mine/editProfile.vue

@@ -116,7 +116,7 @@
 						//非app端用前端组件剪裁头像,app端用内置的原生裁剪
 						let fileData = await new Promise((callback) => {
 							uni.navigateTo({
-								url: '/components/cropImage?path=' + filePath +
+								url: '/pages/components/cropImage?path=' + filePath +
 									`&options=${JSON.stringify(crop)}`,
 								animationType: "fade-in",
 								events: {

+ 1 - 1
pages/parents/mine/mine.vue

@@ -28,7 +28,7 @@
 			</view>
 
 
-			<view class="children">
+			<view class="children" v-if="studentList.length != 0">
 				<view class="check-box" v-for="(item,index) in studentList" :key="item.studentId">
 					<view class="photo" @click="toAddChildInformation(item)">
 						<u-avatar v-if="item.headPhoto != null" class="avatar"

+ 1 - 1
pages/teacher/editProfile/editProfile.vue

@@ -118,7 +118,7 @@
 						//非app端用前端组件剪裁头像,app端用内置的原生裁剪
 						let fileData = await new Promise((callback) => {
 							uni.navigateTo({
-								url: '/components/cropImage?path=' + filePath +
+								url: '/pages/components/cropImage?path=' + filePath +
 									`&options=${JSON.stringify(crop)}`,
 								animationType: "fade-in",
 								events: {

+ 26 - 1
pages/teacher/mine/mine.vue

@@ -85,6 +85,7 @@
 </template>
 
 <script>
+	import * as loginApi from '@/apis/login.js'
 	import Tabbar from '@/components/Tabbar.vue'
 	
 	export default {
@@ -94,10 +95,34 @@
 		},
 		data() {
 			return {
-				
+				form: {
+					headImg: '',
+					nickName: ''
+				},
 			}
 		},
+		onShow() {
+			this.getParentsInfo();
+		},
 		methods: {
+			getParentsInfo() {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				loginApi.findByOpenId({
+					openId: this.carhelp.getOpenId()
+				}).then((response) => {
+					uni.hideLoading();
+					this.form.headImg = response.data.regUser.headImg;
+					this.form.nickName = response.data.regUser.nickName;
+				}).catch(error => {
+					uni.showToast({
+						title: error,
+						icon: "none"
+					})
+				})
+			},
 			toEditProfile() {
 				uni.navigateTo({
 					url: '/pages/teacher/editProfile/editProfile'

+ 105 - 78
pages/teacher/myCourse/myCourse.vue

@@ -1,97 +1,35 @@
 <template>
 	<view>
-		<u-navbar back-text="我的课表"></u-navbar>
+		<u-navbar title="我的课表">
+			<view class="slot-wrap" @click="getToday()">
+				今天
+			</view>
+		</u-navbar>
 	<!-- 日期 -->	
 		<view class="date-picker">
-			<view class="check">
+			<view class="check" @click="beforeWeek">
 				<u-icon name="arrow-left" size="32"></u-icon>前一周
 			</view>
 			<view class="date">
-				2023-01-03
+				{{date}}
 			</view>
-			<view class="check">
+			<view class="check" @click="afterWeek">
 				后一周<u-icon name="arrow-right" size="32" ></u-icon>
 			</view>
 		</view>
 		<view class="date-item">
-			<view class="item checked">
-				<view class="dot dot-checked">
-					
+			<view class="item" v-for="(item,index) in weekDate" :key="index"
+				:class="activeClass == index ? 'checked' : ''" @click="activeClassClick(item,index)">
+				<view :class="item.isDotShow ? 'dot' : ''" :style="activeClass == index ? 'background-color: #fff;' : ''">
+		
 				</view>
 				<view class="week ">
-					
+					{{item.week}}
 				</view>
 				<view class="day ">
-					3
-				</view>
-			</view>
-			<view class="item">
-				<view class="dot">
-					
-				</view>
-				<view class="week">
-					二
-				</view>
-				<view class="day">
-					4
-				</view>
-			</view>
-			<view class="item">
-				<view class="dot">
-					
-				</view>
-				<view class="week">
-					三
-				</view>
-				<view class="day">
-					5
+					{{parseInt(item.day.slice(8))}}
 				</view>
 			</view>
-			<view class="item">
-				<view class="dot">
-					
-				</view>
-				<view class="week">
-					四
-				</view>
-				<view class="day">
-					6
-				</view>
-			</view>
-			<view class="item">
-				<view class="dot">
-					
-				</view>
-				<view class="week">
-					五
-				</view>
-				<view class="day">
-					7
-				</view>
-			</view>
-			<view class="item">
-				<view class="dot">
-					
-				</view>
-				<view class="week">
-					六
-				</view>
-				<view class="day">
-					8
-				</view>
-			</view>
-			<view class="item">
-				<view class="dot">
-					
-				</view>
-				<view class="week">
-					日
-				</view>
-				<view class="day">
-					9
-				</view>
-			</view>
-		
 		</view>
 	<!-- 课表信息 -->
 	   <view class="class-infos">
@@ -139,11 +77,100 @@
 	export default {
 		data() {
 			return {
-
+				date: '',
+				weekDate: [],
+				weekN: ["一", "二", "三", "四", "五", "六", "日"],
+				activeClass: 0,
+				weekDate1: '',
+				courseList: [],
+				studentId: ''
 			}
 		},
+		onReady() {
+			this.getToday();
+		},
 		methods: {
-
+			getToday() {
+				this.weekDate = [];
+				let date = new Date(); //当前日期
+				let year = date.getFullYear(); //当前年
+				let month = date.getMonth() + 1; //当前月
+				let day = date.getDate(); //当天
+				let mydate = new Date(year, month - 1, day);
+				let weekday = mydate.getDay();
+				this.weekDate1 = new Date(year, month - 1, day + 1 - weekday);
+				this.getWeekDate(true);
+			},
+			getWeekDate(bl) {
+				let weekDate2 = new Date(this.weekDate1.getTime());
+				for (var i = 0; i < 7; i++) {
+					for (var j = 0; j < this.weekN.length; j++) {
+						if (i == j) {
+							this.weekDate.push({
+								week: this.weekN[j],
+								day: this.getFormatDate(new Date(weekDate2.setDate(this.weekDate1.getDate() + i))),
+								isDotShow: false
+							})
+						}
+					}
+				}
+			
+				if (bl) {
+					let date = new Date(); //当前日期
+					date = this.getFormatDate(date);
+					for (var m = 0; m < this.weekDate.length; m++) {
+						if (date == this.weekDate[m].day) {
+							this.activeClass = m;
+							this.date = this.weekDate[m].day;
+						}
+					}
+					// this.getCourseList();
+				}
+			},
+			getFormatDate(date) {
+				let myyear = date.getFullYear();
+				let mymonth = date.getMonth() + 1;
+				let myweekday = date.getDate();
+				if (mymonth < 10) {
+					mymonth = "0" + mymonth;
+				}
+				if (myweekday < 10) {
+					myweekday = "0" + myweekday;
+				}
+			
+				return (myyear + "-" + mymonth + "-" + myweekday);
+			},
+			beforeWeek() {
+				this.weekDate = [];
+				this.weekDate1 = new Date(this.weekDate1.setDate(this.weekDate1.getDate() - 7));
+				this.getWeekDate();
+				for (var m = 0; m < this.weekDate.length; m++) {
+					if (this.activeClass == m) {
+						this.date = this.weekDate[m].day;
+					}
+				}
+				// this.getCourseList();
+			},
+			afterWeek() {
+				this.weekDate = [];
+				this.weekDate1 = new Date(this.weekDate1.setDate(this.weekDate1.getDate() + 7));
+				this.getWeekDate();
+				for (var m = 0; m < this.weekDate.length; m++) {
+					if (this.activeClass == m) {
+						this.date = this.weekDate[m].day;
+					}
+				}
+				// this.getCourseList();
+			},
+			activeClassClick(item, index) {
+				this.activeClass = index;
+				for (var m = 0; m < this.weekDate.length; m++) {
+					if (index == m) {
+						this.date = this.weekDate[m].day;
+					}
+				}
+				// this.getCourseList();
+			},
 		}
 	}
 </script>