wkyy 1 سال پیش
والد
کامیت
6c459ef27d

+ 2 - 1
apis/utils/mixin.js

@@ -96,7 +96,8 @@ var app = {
 		uni.removeStorageSync(prefix + 'getElderModeClass');
 		//uni.removeStorageSync(prefix+'wx_openId');
 		uni.removeStorageSync(prefix + 'studentId');
-		uni.removeStorageSync(prefix + 'shoppingCartList');
+		uni.removeStorageSync(prefix + 'shoppingCartList');
+		uni.removeStorageSync(prefix + 'nsStudentId');
 	},
 
 	getToken : (options) => {

+ 1 - 14
pages/youth/course/paymentRecords.vue

@@ -193,10 +193,6 @@
 					title: "加载中",
 					mask: true,
 				})
-				// if (bl) {
-				// 	this.paymentList = [];
-				// 	this.pageNum = 1;
-				// }
 				courseApi.loadMyBuyLog({
 					studentId: this.studentId,
 					year: this.year,
@@ -205,16 +201,7 @@
 					pageSize: 1000
 				}).then((res) => {
 					uni.hideLoading();
-					// this.paymentList = [
-					// 	...this.paymentList,
-					// 	...res.data.data
-					// ];
-					// this.recordsTotal = res.data.recordsTotal;
-					var list = res.data.data;
-					for (var i = 0; i < list.length; i++) {
-						this.paymentList.push(list[i]);
-					}
-					// this.paymentList = res.data.data;
+					this.paymentList = res.data.data;
 				}).catch(error => {
 					uni.showToast({
 						title: error,

+ 2 - 1
pages/youth/homePage/homePage.vue

@@ -216,7 +216,7 @@
 				studentId: '',
 				list: [{
 					image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
-				}, ],
+				}, ]
 			}
 		},
 		onReady() {
@@ -245,6 +245,7 @@
 				}).then((response) => {
 					uni.hideLoading();
 					this.form = response.data.nsStudentInfo;
+					this.studentId = response.data.nsStudentInfo.id;
 					this.carhelp.setNsStudentId({studentId: response.data.nsStudentInfo.id});
 				}).catch(error => {
 					uni.showToast({

+ 43 - 6
pages/youth/login/login.vue

@@ -84,6 +84,7 @@
 	import {
 		checkPhone
 	} from '@/apis/utils'
+	import * as mineApi from '@/apis/youth/mine.js'
 	
 	export default {
 		data() {
@@ -107,6 +108,34 @@
 			this.findByOpenId();
 		},
 		methods: {
+			getLoadMyCourses(studentId) {
+				uni.showLoading({
+					title: "加载中",
+					mask: true,
+				})
+				mineApi.loadMyCourses({
+					studentId: studentId,
+					pageNum: 1,
+					pageSize: 100
+				}).then((res) => {
+					uni.hideLoading();
+					var list = res.data.data;
+					if(list.length == 0) {
+						uni.redirectTo({
+							url: '/pages/youth/course/course'
+						})
+					} else {
+						uni.redirectTo({
+							url: '/pages/youth/homePage/homePage'
+						})
+					}
+				}).catch(error => {
+					uni.hideLoading();
+					uni.redirectTo({
+						url: '/pages/youth/course/course'
+					})
+				})
+			},
 			findByOpenId() {
 			
 				var openId = this.carhelp.getOpenId()
@@ -139,9 +168,11 @@
 						this.carhelp.setPersonInfoPlus(res.data.data);
 						this.carhelp.setNsStudentId({studentId: res.data.data.nsStudentInfo.id});
 						
-						uni.redirectTo({
-							url: '/pages/youth/homePage/homePage'
-						})
+						// uni.redirectTo({
+						// 	url: '/pages/youth/homePage/homePage'
+						// })
+						var studentId = res.data.data.nsStudentInfo.id;
+						this.getLoadMyCourses(studentId);
 					} else {
 						this.carhelp.logoff()
 					}
@@ -253,9 +284,15 @@
 					var token = response ? response.data.token : '';
 					this.carhelp.setToken(token);
 					this.carhelp.setPersonInfo(response.data.regUser);
-					uni.redirectTo({
-						url: '/pages/youth/homePage/homePage'
-					})
+					
+					var nsStudentInfo = response.data.nsStudentInfo;
+					if(nsStudentInfo != null) {
+						this.getLoadMyCourses(nsStudentInfo.id);
+					} else {
+						uni.redirectTo({
+							url: '/pages/youth/homePage/homePage'
+						})
+					}
 				}).catch(error => {
 					uni.showToast({
 						title: error,

+ 3 - 0
pages/youth/search/searchResult.vue

@@ -42,6 +42,9 @@
 			</view>
 		</view>
 		
+		<u-divider v-if="reCoursesList.length == 1" style="margin-top: 10px">暂时只开了一个班
+		</u-divider>
+		
 		<u-toast ref="uToast" />
 	</view>
 </template>