Просмотр исходного кода

Merge branch 'master' of https://gitee.com/he2802/saas_applet

Tang 3 лет назад
Родитель
Сommit
0bc838adfe

+ 1 - 1
common/request.js

@@ -4,7 +4,7 @@ import store from '@/store/index.js'
 import api from './api.js'
 var num = 1
 
-export const BASE_URL = 'http://192.168.1.222:5055' //接口api  http://42.192.164.187:19005 http://192.168.1.222:5055
+export const BASE_URL = 'http://42.192.164.187:19005' //接口api  http://42.192.164.187:19005 http://192.168.1.222:5055
 
 
 export const BASE_IMG_URL = 'https://file-dev.xyyxt.net/' //图片上传api  'https://file.xyyxt.net/

+ 2 - 2
pages.json

@@ -356,7 +356,7 @@
 			{
 				"path": "bank/questionBankExplain",
 				"style": {
-					"navigationBarTitleText": "试卷",
+					"navigationBarTitleText": "解析",
 					"app-plus": {
 						"titleNView": false, //禁用原生导航栏 
 						"bounce": "none"
@@ -387,7 +387,7 @@
 			{
 				"path": "bank/questionBankContinue",
 				"style": {
-					"navigationBarTitleText": "试卷",
+					"navigationBarTitleText": "试卷题目",
 					"navigationStyle": "custom", // 隐藏系统导航栏
 					"app-plus": {
 						"titleNView": false, //禁用原生导航栏 

+ 1 - 1
pages/index/index.vue

@@ -5,7 +5,7 @@
 				<image  src="/static/logo2.png"></image>
 			</view>
 		</u-navbar>
-		<u-swiper :list="list" @change="e => current = e.current" :autoplay="false"></u-swiper>
+		<!-- <u-swiper :list="list" @change="e => current = e.current" :autoplay="false"></u-swiper> -->
 		<view class="content">
 			<view class="notice" v-if="infoNums">
 				<image src="/static/icon/msg_icon1.png" class="icon"></image>

+ 138 - 75
pages/login/login.vue

@@ -7,14 +7,14 @@
 				<u-subsection @change="sectionChange" :list="list" :current="current" active-color="#007AFF" inactive-color="#ffffff" bg-color="rgba(255,255,255,0.52)"></u-subsection>
 			</view>
 			<view class="login_box">
-				<u-form :model="form" ref="uForm" v-if="current==0">
-					<u-form-item ><u-input type="idcard" v-model="form.account" placeholder="手机号/学员身份证"/></u-form-item>
-					<u-form-item ><u-input v-model="form.pwd" type="password" placeholder="登录密码"/></u-form-item>
+				<u-form :model="form" ref="uForm1" v-show="current==0">
+					<u-form-item prop="account" ><u-input type="idcard" v-model="form.account" placeholder-style="color:#999999" placeholder="手机号/学员身份证"/></u-form-item>
+					<u-form-item prop="pwd" ><u-input class="password" v-model="form.pwd" placeholder-style="color:#999999" type="password" placeholder="登录密码"/></u-form-item>
 				</u-form>
-				<u-form :model="form" ref="uForm" v-if="current==1">
-					<u-form-item ><u-input type="number" maxlength="11"  v-model="form.tel" placeholder="手机号"/></u-form-item>
-					<u-form-item >
-						<u-input v-model="form.code" type="number"  placeholder="验证码"/>
+				<u-form :model="form" ref="uForm2" v-show="current==1">
+					<u-form-item  prop="tel" ref="tel"><u-input type="number" maxlength="11" placeholder-style="color:#999999"  v-model="form.tel" placeholder="手机号"/></u-form-item>
+					<u-form-item prop="code" >
+						<u-input v-model="form.code" type="number" placeholder-style="color:#999999"  placeholder="验证码"/>
 						<u-button slot="right"  size="mini" @click="getCode">{{codeTips}}</u-button>
 					</u-form-item>
 				</u-form>
@@ -61,6 +61,50 @@ export default {
 					name: '短信登录'
 				}
 			],
+			rules: {
+				tel: [
+					{ 
+						required: true, 
+						message: '请输入手机号', 
+						// 可以单个或者同时写两个触发验证方式 
+						trigger: ['change','blur'],
+					},
+					{
+						validator: (rule, value, callback) => {
+							// 上面有说,返回true表示校验通过,返回false表示不通过
+							// this.$u.test.mobile()就是返回true或者false的
+							return this.$u.test.mobile(value);
+						},
+						message: '手机号码格式不正确',
+						// 触发器可以同时用blur和change
+						trigger: ['change','blur'],
+					}
+				],
+				account: [
+					{ 
+						required: true, 
+						message: '请输入手机号/学员身份证', 
+						// 可以单个或者同时写两个触发验证方式 
+						trigger: ['change','blur'],
+					}
+				],
+				pwd: [
+					{ 
+						required: true, 
+						message: '请输入密码', 
+						// 可以单个或者同时写两个触发验证方式 
+						trigger: ['change','blur'],
+					}
+				],
+				code: [
+					{ 
+						required: true, 
+						message: '请输入验证码', 
+						// 可以单个或者同时写两个触发验证方式 
+						trigger: ['change','blur'],
+					}
+				],
+			},
 			current: 0,
 			codeTips: '',
 			isUse:false,
@@ -68,6 +112,8 @@ export default {
 		};
 	},
 	onLoad(option) {
+		this.$refs.uForm1.setRules(this.rules)
+		this.$refs.uForm2.setRules(this.rules)
 		if(option.isBack){
 			this.isBack = option.isBack;
 		}
@@ -96,57 +142,62 @@ export default {
 			}
 		},
 		sms_login(){
-			let that = this
-			if(!this.form.tel){
-				this.$u.toast('请输入手机号码');
-				return 
-			}
-			if(!this.form.code){
-				this.$u.toast('请输入验证码');
-				return 
-			}
-			that.isUse = true
-			let datas = {
-				tel:this.form.tel,
-				code:this.form.code
-			}
-			that.$api.smsLogin(datas).then(
-				res => {
-					that.isUse = false
-					if (res.data.code == 200) {
-						if(res.data.data.full_info){
-							//信息完善,直接进入页面
-							uni.setStorageSync('user_account', res.data.data.user_account);
-							uni.setStorageSync('token', res.data.data.token);
-							that.$api.getInfo().then(resdata => {
-								if(resdata.data.code == 200){
-									that.$store.state.userInfo = resdata.data.data;
-									
-									if(!that.isBack){
-										uni.reLaunch({
-											url:'/pages/index/index'
-										})
-									}else{
-										uni.navigateBack();
-									}
-								}
-								
-							});
-							
-						}else{
-							//未完善信息,存为临时信息
-							uni.setStorageSync('user_account_temp', res.data.data.user_account);
-							uni.setStorageSync('token_temp', res.data.data.token);
-							that.$navTo.togo('/pages2/register/bind');
-						}	
-					} else {
-						that.$u.toast(res.data.msg);
+			this.$refs.uForm2.validate(valid => {
+				if(valid) {
+					let that = this
+					if(!this.form.tel){
+						this.$u.toast('请输入手机号码');
+						return 
 					}
-				},
-				err => {
-					that.isUse = false
+					if(!this.form.code){
+						this.$u.toast('请输入验证码');
+						return 
+					}
+					that.isUse = true
+					let datas = {
+						tel:this.form.tel,
+						code:this.form.code
+					}
+					that.$api.smsLogin(datas).then(
+						res => {
+							that.isUse = false
+							if (res.data.code == 200) {
+								if(res.data.data.full_info){
+									//信息完善,直接进入页面
+									uni.setStorageSync('user_account', res.data.data.user_account);
+									uni.setStorageSync('token', res.data.data.token);
+									that.$api.getInfo().then(resdata => {
+										if(resdata.data.code == 200){
+											that.$store.state.userInfo = resdata.data.data;
+											
+											if(!that.isBack){
+												uni.reLaunch({
+													url:'/pages/index/index'
+												})
+											}else{
+												uni.navigateBack();
+											}
+										}
+										
+									});
+									
+								}else{
+									//未完善信息,存为临时信息
+									uni.setStorageSync('user_account_temp', res.data.data.user_account);
+									uni.setStorageSync('token_temp', res.data.data.token);
+									that.$navTo.togo('/pages2/register/bind');
+								}	
+							} else {
+								that.$u.toast(res.data.msg);
+							}
+						},
+						err => {
+							that.isUse = false
+						}
+					);
 				}
-			);
+			})
+			
 		},
 		fakeLogin(){
 			uni.setStorageSync('user_account', '123');
@@ -211,26 +262,28 @@ export default {
 		// 获取验证码
 		getCode() {
 			let that = this
-			if(that.$refs.uCode.canGetCode) {
-				if(!this.form.tel){
-					this.$u.toast('请输入手机号码');
-					return 
-				}
-				let datas = {tel:this.form.tel}
-				that.$api.loginSms(datas).then(
-					res => {
-						if (res.data.code == 200) {
-							that.$u.toast('验证码已发送');
-							// 通知验证码组件内部开始倒计时
-							that.$refs.uCode.start();
-						} else {
-							that.$u.toast(res.data.msg);
+			if(that.$refs.uCode.canGetCode) { 
+				if(that.$refs.tel.validateState == 'success') {
+					let datas = {tel:this.form.tel}
+					that.$api.loginSms(datas).then(
+						res => {
+							if (res.data.code == 200) {
+								that.$u.toast('验证码已发送');
+								// 通知验证码组件内部开始倒计时
+								that.$refs.uCode.start();
+							} else {
+								that.$u.toast(res.data.msg);
+							}
+						},
+						err => {
+							console.log(err);
 						}
-					},
-					err => {
-						console.log(err);
-					}
-			);}
+					);
+				} else {
+					this.$refs.tel.onFieldBlur()
+				}
+			}
+			
 		},
 		sectionChange(index) {
 			this.current = index;
@@ -347,6 +400,16 @@ export default {
 		border-radius: 24rpx;
 		margin-top: 30rpx;
 		padding:40rpx 35rpx;
+		
+		
+		.password {
+			/deep/.uicon-eye-fill {
+				&::before{
+					color:#007AFF;
+					content:"\e613";
+				}
+			}
+		}
 	}
 	/deep/ .u-item-bg{
 		border-radius: 32px !important;

+ 64 - 29
pages/wd/index.vue

@@ -2,8 +2,8 @@
 	<view>
 		<image mode="widthFix" :src="isLogin ? '/static/wd_bg_login.jpg' : '/static/wd_bg.jpg'" :class="isLogin ? 'login_full_img' : 'full_img'"></image>
 
-		<view style="text-align: center;margin-top: 60rpx;" v-if="!isLogin">
-			<view style="color: #007AFF ;font-size: 36rpx;font-weight: bold;">您还没有登录哦~</view>
+		<view class="login_wrap" v-if="!isLogin">
+			<view class="login_text">您还没有登录哦~</view>
 			<view class="loginBtn" @click="jumpLogin">立即登录/注册</view>
 		</view>
 		<view v-if="isLogin" class="loginBox">
@@ -18,13 +18,13 @@
 			</view>
 			<view style="top: 195px;position: relative;padding-bottom: 30rpx;">
 				<navigator  hover-class="none" url="/pages2/plan/index" class="menu_box">
-					<view style="display: flex;align-items: center;">
+					<view class="box_left">
 						<image src="/static/icon/my_icon1.png" class="my_icon"></image>
 						<view>学习计划</view>
 					</view>
-					<view>
+					<view class="box_right">
 						今天有
-						<text style="color: #007AFF;margin: 0 5rpx;">{{ userNums.planSum }}</text>
+						<text>{{ userNums.planSum }}</text>
 						个学习任务
 					</view>
 				</navigator>
@@ -39,53 +39,53 @@
 					</navigator>
 				</view>
 				<navigator  hover-class="none" url="/pages2/learn/my_learn" class="menu_box">
-					<view style="display: flex;align-items: center;">
+					<view class="box_left">
 						<image src="/static/icon/my_icon2.png" class="my_icon"></image>
 						<view>我的学时</view>
 					</view>
-					<view>
+					<view class="box_right">
 						累计
-						<text style="color: #007AFF;margin: 0 5rpx;">{{ userNums.periodSum }}</text>
+						<text>{{ userNums.periodSum }}</text>
 						学时未通过
 					</view>
 				</navigator>
 				<navigator  hover-class="none" url="/pages2/exam/index" class="menu_box">
-					<view style="display: flex;align-items: center;">
+					<view class="box_left">
 						<image src="/static/icon/my_icon10.png" class="my_icon"></image>
 						<view>我的考试</view>
 					</view>
-					<view>
-						<text style="color: #007AFF;margin: 0 5rpx;">{{ userNums.subscribeSum }}</text>
+					<view class="box_right">
+						<text>{{ userNums.subscribeSum }}</text>
 						考试预约
 					</view>
 				</navigator>
 				<navigator  hover-class="none" url="/pages2/order/index" class="menu_box">
-					<view style="display: flex;align-items: center;">
+					<view class="box_left">
 						<image src="/static/icon/my_icon7.png" class="my_icon"></image>
 						<view>我的订单</view>
 					</view>
-					<view>
-						<text style="color: #007AFF;margin: 0 5rpx;">{{ userNums.orderSum }}</text>
+					<view class="box_right">
+						<text>{{ userNums.orderSum }}</text>
 						笔待支付
 					</view>
 				</navigator>
 				<navigator  hover-class="none" url="/pages2/msg/index" class="menu_box">
-					<view style="display: flex;align-items: center;">
+					<view class="box_left">
 						<image src="/static/icon/my_icon8.png" class="my_icon"></image>
 						<view>我的消息</view>
 					</view>
-					<view>
-						<text style="color: #007AFF;margin: 0 5rpx;">{{ userNums.informSum }}</text>
+					<view class="box_right">
+						<text>{{ userNums.informSum }}</text>
 						条未读
 					</view>
 				</navigator>
 				<navigator  hover-class="none" url="/pages2/wd/info" class="menu_box">
-					<view style="display: flex;align-items: center;">
+					<view class="box_left">
 						<image src="/static/icon/my_icon9.png" class="my_icon"></image>
 						<view>我的资料</view>
 					</view>
 				</navigator>
-				<view style="color: #999999;text-align: center;font-size: 32rpx;margin-top: 50rpx;" @click="logout">退出</view>
+				<view class="logout" @click="logout">退出</view>
 			</view>
 		</view>
 
@@ -151,7 +151,30 @@ page {
 	background-color: #f0f1f5;
 }
 </style>
-<style scoped>
+<style scoped lang="scss">
+.login_wrap {
+	text-align: center;
+	margin-top: 60rpx;
+	
+	.login_text {
+		color: #007AFF ;
+		font-size: 36rpx;
+		font-weight: bold;
+	}
+	
+	
+	.loginBtn {
+		width: 526rpx;
+		height: 80rpx;
+		background: linear-gradient(90deg, #015eea, #00c0fa);
+		box-shadow: 0rpx 10rpx 16rpx 4rpx rgba(1, 99, 235, 0.04);
+		border-radius: 40rpx;
+		color: #ffffff;
+		line-height: 80rpx;
+		margin: 0 auto;
+		margin-top: 50rpx;
+	}
+}
 .avatar {
 	height: 70rpx;
 	width: 70rpx;
@@ -168,6 +191,8 @@ page {
 	margin-top: 30rpx;
 }
 .two_menu {
+	font-size: 32rpx;
+	color:#666;
 	display: flex;
 	justify-content: space-between;
 }
@@ -187,6 +212,20 @@ page {
 	justify-content: space-between;
 	color: #666666;
 	font-size: 32rpx;
+	
+	.box_left {
+		display: flex;
+		align-items: center;
+	}
+	
+	.box_right {
+		font-size: 32rpx;
+		
+		text {
+			color: #007AFF;
+			margin: 0 5rpx;
+		}
+	}
 }
 .loginBox {
 	position: relative;
@@ -211,15 +250,11 @@ page {
 	z-index: -999;
 	top: 0;
 }
-.loginBtn {
-	width: 526rpx;
-	height: 80rpx;
-	background: linear-gradient(90deg, #015eea, #00c0fa);
-	box-shadow: 0rpx 10rpx 16rpx 4rpx rgba(1, 99, 235, 0.04);
-	border-radius: 40rpx;
-	color: #ffffff;
-	line-height: 80rpx;
-	margin: 0 auto;
+
+.logout {
+	color: #999999;
+	text-align: center;
+	font-size: 32rpx;
 	margin-top: 50rpx;
 }
 </style>

+ 54 - 8
pages2/bank/questionBank.vue

@@ -301,7 +301,7 @@
 												</view>
 											</view>
 										</view>
-										<view class="ans_submit answerInfos" v-if="bank.ques[ansIndex] || bank.ques[ansIndex].imageList.length || bank.ques[ansIndex].text">
+										<view class="ans_submit answerInfos" v-if="bank.ques[ansIndex] && (bank.ques[ansIndex].imageList.length || bank.ques[ansIndex].text)">
 											<view class="answerTitle">我的答案</view>
 											{{ bank.ques[ansIndex].text || ''}}
 											<view class="imgs">
@@ -424,6 +424,8 @@
 							? `您还有${lastCount}道题未作答, 现在继续作答,还是下次继续?`
 							: cgType === 6
 							? `您还有${lastCount}道题未作答, 您确定要交卷吗?`
+							: cgType == 9
+							? `您已完成所有题目,快去交卷吧!?` 
 							: ''
 					}}
 				</view>
@@ -432,13 +434,17 @@
 					<view class="btnsty btns2" @click="showpopups = false">继续做题</view>
 				</view>
 				<view class="classFootsty" v-if="cgType === 7">
-					<view class="btnsty btns1" @click="showpopups = false">下次继续</view>
-					<view class="btnsty btns2" @click="backPages">结束做题</view>
+					<view class="btnsty btns1" @click="backPages">下次继续</view>
+					<view class="btnsty btns2" @click="submit">结束做题</view>
 				</view>
 				<view class="classFootsty" v-if="cgType === 8">
 					<view class="btnsty btns1" @click="backPages()">下次继续</view>
 					<view class="btnsty btns2" @click="showpopups = false">继续作答</view>
 				</view>
+				<view class="classFootsty" v-if="cgType === 9">
+					<view class="btnsty btns1" @click="showpopups = false">暂不交卷</view>
+					<view class="btnsty btns2" @click="submit">立即交卷</view>
+				</view>
 			</view>
 		</u-popup>
 	</view>
@@ -515,7 +521,7 @@ export default {
 					uni.showToast({
 						icon:'none',
 						mask:true,
-						title:'考试时间到,自动交卷',
+						title:'考试时间到,系统将自动交卷',
 						duration:10000
 					})
 
@@ -637,7 +643,8 @@ export default {
 									return false;
 								}
 							} else if (jsonItem.type == 5) {
-								if (item.ques[indexs] && (item.ques[indexs].text.length || item.ques[indexs].imageList.length)) {
+								if (item.ques[indexs] && (item.ques[indexs].text || item.ques[indexs].imageList.length)) {
+									console.log('chil')
 									return true;
 								} else {
 									return false;
@@ -654,7 +661,8 @@ export default {
 					//简答题
 					if(hasSpecail) {
 						
-						if (item.ansText && (item.ansText.text.length || item.ansText.imageList.length)) {
+						if (item.ques && (item.ques.text || item.ques.imageList.length)) {
+							console.log(5,item)
 							count++;
 						}
 					}
@@ -663,6 +671,16 @@ export default {
 
 			return count;
 		},
+		/**
+		 * 是否做完所有题目
+		 */
+		isDoOver() {
+			let questionOverNum = this.questionOverNum(true); //获取已经回答的题目数(包括简答和案例)
+			if(this.questionList.length == questionOverNum) { //全部做完弹窗
+				this.cgType = 9;
+				this.showpopups = true;
+			}
+		},
 		/**
 		 * 暂不交卷
 		 */
@@ -1050,7 +1068,7 @@ export default {
 								uni.showToast({
 									icon:'none',
 									mask:true,
-									title:'考试时间到,自动交卷',
+									title:'考试时间到,系统将自动交卷',
 									duration:10000
 								})
 
@@ -1109,7 +1127,7 @@ export default {
 										ansArr[index] = json.answerQuestion;
 									} else if (json.type == 5) {
 										ansArr[index] = {
-											text: '',
+											text: json.answerQuestion,
 											imageList: []
 										};
 										json.ansText = {
@@ -1139,6 +1157,7 @@ export default {
 		radioSelect(optionsId, bindex) {
 			if (this.questionList[bindex].ques) return;
 			this.$set(this.questionList[bindex], 'ques', optionsId);
+			this.isDoOver();
 
 			// 回答错误
 			if (this.questionList[bindex].ques != this.questionList[bindex].ans) {
@@ -1171,6 +1190,7 @@ export default {
 		radioSelectChild(optionsId, ansIndex, bindex) {
 			if (this.questionList[bindex].ques[ansIndex]) return;
 			this.$set(this.questionList[bindex].ques, ansIndex, optionsId);
+			this.isDoOver();
 		},
 
 		/**
@@ -1200,6 +1220,7 @@ export default {
 			});
 
 			this.$set(this.questionList[bindex], 'ques', arr);
+			this.isDoOver();
 
 			let isWrong = this.questionList[bindex].ques.some((quesItem, quesIndex) => {
 				return this.questionList[bindex].ques[quesIndex] != this.questionList[bindex].ans[quesIndex];
@@ -1242,6 +1263,7 @@ export default {
 			});
 
 			this.$set(this.questionList[bindex].ques, ansIndex, arr);
+			this.isDoOver();
 		},
 
 		/**
@@ -1252,6 +1274,7 @@ export default {
 		judgeSelect(index, bindex) {
 			if (this.questionList[bindex].ques) return;
 			this.$set(this.questionList[bindex], 'ques', index + '');
+			this.isDoOver();
 			// 回答错误
 			if (this.questionList[bindex].ques != this.questionList[bindex].ans) {
 				this.$api
@@ -1286,6 +1309,7 @@ export default {
 		judgeSelectChild(ansindex, childindex, bindex) {
 			if (this.questionList[bindex].ques[ansindex]) return;
 			this.$set(this.questionList[bindex].ques, ansindex, childindex + '');
+			this.isDoOver();
 		},
 
 		openFooterTab() {
@@ -1330,6 +1354,26 @@ export default {
 					return;
 				}
 			// } 
+			
+				if(this.bankType == 2) {
+					if(this.lastTime > 0) {
+						let lastTime = this.countdown(this.lastTime)
+						uni.showModal({
+							title:'提示',
+							content:`时间还剩余${lastTime},确定交卷吗?`,
+							confirmText:'交卷',
+							cancelText:'继续答题',
+							success:(res) => {
+								if(res.confirm) { //确定
+									this.submit();
+								} else {  //取消
+									
+								}
+							}
+						})
+						return;
+					}
+				}
 			this.submit();
 		},
 		/**
@@ -1732,6 +1776,7 @@ export default {
 				imageList: this.questionList[bankindex].ansText.imageList || [],
 				text: this.questionList[bankindex].ansText.text || ''
 			});
+			this.isDoOver()
 		},
 
 		/**
@@ -1753,6 +1798,7 @@ export default {
 				imageList: this.questionList[bankindex].jsonStr[ansindex].ansText.imageList || [],
 				text: this.questionList[bankindex].jsonStr[ansindex].ansText.text || ''
 			});
+			this.isDoOver()
 		},
 
 		isRight(item, index) {

+ 28 - 4
pages2/bank/questionBankContinue.vue

@@ -275,7 +275,7 @@
 												</view>
 											</view>
 										</view>
-										<view class="ans_submit answerInfos" v-if="bank.ques[ansIndex] || bank.ques[ansIndex].text || bank.ques[ansIndex].imageList.length">
+										<view class="ans_submit answerInfos" v-if="bank.ques[ansIndex] && (bank.ques[ansIndex].text || bank.ques[ansIndex].imageList.length)">
 											<view class="answerTitle">我的答案</view>
 											{{bank.ques[ansIndex].text || ''}}
 											<view class="imgs" v-if="bank.ques[ansIndex] && bank.ques[ansIndex].imageList.length">
@@ -361,6 +361,8 @@
 							? `您还有${lastCount}道题未作答, 现在继续作答,还是下次继续?`
 							: cgType === 6
 							? `您还有${lastCount}道题未作答, 您确定要交卷吗?`
+							: cgType == 9
+							? `您已完成所有题目,快去交卷吧!?` 
 							: ''
 					}}
 				</view>
@@ -369,13 +371,17 @@
 					<view class="btnsty btns2" @click="showpopups = false">继续做题</view>
 				</view>
 				<view class="classFootsty" v-if="cgType === 7">
-					<view class="btnsty btns1" @click="showpopups = false">下次继续</view>
-					<view class="btnsty btns2" @click="backPages">结束做题</view>
+					<view class="btnsty btns1" @click="backPages">下次继续</view>
+					<view class="btnsty btns2" @click="submit">结束做题</view>
 				</view>
 				<view class="classFootsty" v-if="cgType === 8">
 					<view class="btnsty btns1" @click="backPages()">下次继续</view>
 					<view class="btnsty btns2" @click="showpopups = false">继续作答</view>
 				</view>
+				<view class="classFootsty" v-if="cgType === 9">
+					<view class="btnsty btns1" @click="showpopups = false">暂不交卷</view>
+					<view class="btnsty btns2" @click="submit">立即交卷</view>
+				</view>
 			</view>
 		</u-popup>
 	</view>
@@ -533,7 +539,7 @@ export default {
 					//简答题
 					if(hasSpecail) {
 						
-						if (item.ansText && (item.ansText.text.length || item.ansText.imageList.length)) {
+						if (item.ques && (item.ques.text.length || item.ques.imageList.length)) {
 							count++;
 						}
 					}
@@ -550,6 +556,16 @@ export default {
 				delta: 1
 			});
 		},
+		/**
+		 * 是否做完所有题目
+		 */
+		isDoOver() {
+			let questionOverNum = this.questionOverNum(true); //获取已经回答的题目数(包括简答和案例)
+			if(this.questionList.length == questionOverNum) { //全部做完弹窗
+				this.cgType = 9;
+				this.showpopups = true;
+			}
+		},
 		pdsubmit() {
 			// if (this.bankType == 1) {
 				let ansCount = this.questionOverNum(true); //已答题数
@@ -602,6 +618,7 @@ export default {
 			
 			if(this.questionList[bindex].ques) return;
 			this.$set(this.questionList[bindex],'ques',optionsId)
+			this.isDoOver()
 			
 		},
 		examRecordEdit() {
@@ -672,6 +689,7 @@ export default {
 			
 			if(this.questionList[bindex].ques[ansIndex]) return;
 			this.$set(this.questionList[bindex].ques,ansIndex,optionsId)
+			this.isDoOver()
 			
 		},
 		
@@ -868,6 +886,7 @@ export default {
 			})
 			
 			this.$set(this.questionList[bindex],'ques',arr)
+			this.isDoOver()
 			
 		},
 		
@@ -885,12 +904,14 @@ export default {
 			})
 			
 			this.$set(this.questionList[bindex].ques,ansIndex,arr)
+			this.isDoOver()
 		},
 		
 		judgeSelect(index,bindex) {
 			
 			if(this.questionList[bindex].ques) return;
 			this.$set(this.questionList[bindex],'ques',index+'')
+			this.isDoOver()
 			
 		},
 		
@@ -898,6 +919,7 @@ export default {
 			
 			if(this.questionList[bindex].ques[ansindex]) return;
 			this.$set(this.questionList[bindex].ques,ansindex,childindex+'')
+			this.isDoOver()
 		},
 		
 		/**
@@ -1241,6 +1263,7 @@ export default {
 				imageList:this.questionList[bankindex].ansText.imageList,
 				text:this.questionList[bankindex].ansText.text,
 			})
+			this.isDoOver()
 			
 		},
 		
@@ -1259,6 +1282,7 @@ export default {
 				imageList:this.questionList[bankindex].jsonStr[ansindex].ansText.imageList,
 				text:this.questionList[bankindex].jsonStr[ansindex].ansText.text,
 			})
+			this.isDoOver()
 			
 		},
 		

+ 90 - 38
pages2/class/questionBank.vue

@@ -412,6 +412,8 @@
 							? `您还有${lastCount}道题未作答, 现在继续作答,还是下次继续?`
 							: cgType === 6
 							? `您还有${lastCount}道题未作答, 您确定要交卷吗?`
+							: cgType == 9
+							? `您已完成所有题目,快去交卷吧!?` 
 							: ''
 					}}
 				</view>
@@ -427,6 +429,10 @@
 					<view class="btnsty btns1" @click="leaveNow()">下次继续</view>
 					<view class="btnsty btns2" @click="showpopups = false">继续作答</view>
 				</view>
+				<view class="classFootsty" v-if="cgType === 9">
+					<view class="btnsty btns1" @click="showpopups = false">暂不交卷</view>
+					<view class="btnsty btns2" @click="submit">立即交卷</view>
+				</view>
 			</view>
 		</u-popup>
 		<u-mask :show="photoPopup" >
@@ -490,6 +496,7 @@ export default {
 			avatarUrl:'',
 			ossAvatarUrl: '',
 			goodsDetail:{},
+			isTakePhoto:false,
 			needPhoto:false //是否需要拍照
 		};
 	},
@@ -511,7 +518,8 @@ export default {
 			this.showDialog = true;
 			uni.setStorageSync('showDialog','1');
 		}
-
+		
+		//考试时候用手势或者返回键 被迫返回做题
 		if (isBack) {
 			console.log(getApp());
 			let app = getApp();
@@ -520,22 +528,29 @@ export default {
 			for (var k in globalData.bankData) {
 				this[k] = globalData.bankData[k];
 			}
-
-			this.timer = setInterval(() => {
-				if (this.lastTime <= 0) {
-					clearInterval(this.timer);
-					uni.showToast({
-						icon:'none',
-						mask:true,
-						title:'考试时间到,自动交卷',
-						duration:10000
-					})
-
-					this.submit();
-					return;
+			
+			//需要拍没拍过直接弹出摄像头
+			if(this.needPhoto && !this.isTakePhoto) {
+				this.photoPopup = true;
+			} else { //不需要拍照
+				if(this.lastTime) {
+					this.timer = setInterval(() => {
+						if (this.lastTime <= 0) {
+							clearInterval(this.timer);
+							uni.showToast({
+								icon:'none',
+								mask:true,
+								title:'考试时间已到,系统将自动交卷',
+								duration:10000
+							})
+					
+							this.submit();
+							return;
+						}
+						this.lastTime--;
+					}, 1000);
 				}
-				this.lastTime--;
-			}, 1000);
+			}
 		} else {
 			this.goodsQuestionList();
 			this.bankExam();
@@ -553,7 +568,7 @@ export default {
 			app.globalData.bankData = this.$data;
 			clearInterval(this.timer);
 			uni.navigateTo({
-				url: '/pages2/bank/questionBank?id=' + this.id + '&goodsid=' + this.goodsId + '&isback=true'
+				url: '/pages2/class/questionBank?id=' + this.id + '&goodsid=' + this.goodsId + '&isback=true'
 			});
 		} else {
 			//点击返回按钮确认允许退出,交卷
@@ -569,7 +584,7 @@ export default {
 				if (self.goodsDetail.goodsPhotoExamConfig) {
 					let goodsPhotoExamConfig = JSON.parse(self.goodsDetail.goodsPhotoExamConfig);
 					if (goodsPhotoExamConfig.photograph > 0) {
-						self.needPhoto = true;
+						// self.needPhoto = true;
 					}
 				}
 				
@@ -583,6 +598,25 @@ export default {
 			};
 			this.$api.studyExamPhotoRecord(data).then(res => {
 				self.ossAvatarUrl = ''
+				self.isTakePhoto = true;
+				//拍照
+				if(this.lastTime) {
+					this.timer = setInterval(() => {
+						if (this.lastTime <= 0) {
+							clearInterval(this.timer);
+							uni.showToast({
+								icon:'none',
+								mask:true,
+								title:'考试时间已到,系统将自动交卷',
+								duration:10000
+							})
+					
+							this.submit();
+							return;
+						}
+						this.lastTime--;
+					}, 1000);
+				}
 			});
 		},
 		uploadFile(options, int) {
@@ -789,7 +823,7 @@ export default {
 					//简答题
 					if(hasSpecail) {
 						
-						if (item.ansText && (item.ansText.text.length || item.ansText.imageList.length)) {
+						if (item.ques && (item.ques.text.length || item.ques.imageList.length)) {
 							count++;
 						}
 					}
@@ -798,6 +832,16 @@ export default {
 
 			return count;
 		},
+		/**
+		 * 是否做完所有题目
+		 */
+		isDoOver() {
+			let questionOverNum = this.questionOverNum(true); //获取已经回答的题目数(包括简答和案例)
+			if(this.questionList.length == questionOverNum) { //全部做完弹窗
+				this.cgType = 9;
+				this.showpopups = true;
+			}
+		},
 		/**
 		 * 暂不交卷
 		 */
@@ -1090,25 +1134,7 @@ export default {
 					}
 					this.allTimes = res.data.data[0].answerTime * 60;
 					this.lastTime = res.data.data[0].answerTime && res.data.data[0].answerTime * 60;
-					//考试时间到了自动交卷
-					if (this.lastTime) {
-						this.timer = setInterval(() => {
-							if (this.lastTime <= 0) {
-								clearInterval(this.timer);
-								uni.showToast({
-									icon:'none',
-									mask:true,
-									title:'考试时间到,自动交卷',
-									duration:10000
-								})
-
-								this.submit();
-								return;
-							}
-							this.lastTime--;
-						}, 1000);
-					} else {
-					}
+					
 					res.data.data.forEach((item, index) => {
 						if (typeof item.jsonStr == 'string') {
 							item.jsonStr = JSON.parse(item.jsonStr);
@@ -1210,6 +1236,24 @@ export default {
 					this.recordId = res.data.data;
 					if(self.needPhoto){
 						self.photoPopup = true; //拍照
+					} else {
+						if(this.lastTime) {
+							this.timer = setInterval(() => {
+								if (this.lastTime <= 0) {
+									clearInterval(this.timer);
+									uni.showToast({
+										icon:'none',
+										mask:true,
+										title:'考试时间已到,系统将自动交卷',
+										duration:10000
+									})
+							
+									this.submit();
+									return;
+								}
+								this.lastTime--;
+							}, 1000);
+						}
 					}
 					
 				});
@@ -1221,6 +1265,7 @@ export default {
 		radioSelect(optionsId, bindex) {
 			if (this.questionList[bindex].ques) return;
 			this.$set(this.questionList[bindex], 'ques', optionsId);
+			this.isDoOver()
 		},
 
 		/**
@@ -1229,6 +1274,7 @@ export default {
 		radioSelectChild(optionsId, ansIndex, bindex) {
 			if (this.questionList[bindex].ques[ansIndex]) return;
 			this.$set(this.questionList[bindex].ques, ansIndex, optionsId);
+			this.isDoOver()
 		},
 
 		/**
@@ -1258,6 +1304,7 @@ export default {
 			});
 
 			this.$set(this.questionList[bindex], 'ques', arr);
+			this.isDoOver()
 
 			let isWrong = this.questionList[bindex].ques.some((quesItem, quesIndex) => {
 				return this.questionList[bindex].ques[quesIndex] != this.questionList[bindex].ans[quesIndex];
@@ -1277,6 +1324,7 @@ export default {
 			});
 
 			this.$set(this.questionList[bindex].ques, ansIndex, arr);
+			this.isDoOver()
 		},
 
 		/**
@@ -1287,6 +1335,7 @@ export default {
 		judgeSelect(index, bindex) {
 			if (this.questionList[bindex].ques) return;
 			this.$set(this.questionList[bindex], 'ques', index + '');
+			this.isDoOver()
 		},
 
 		/**
@@ -1298,6 +1347,7 @@ export default {
 		judgeSelectChild(ansindex, childindex, bindex) {
 			if (this.questionList[bindex].ques[ansindex]) return;
 			this.$set(this.questionList[bindex].ques, ansindex, childindex + '');
+			this.isDoOver()
 		},
 
 		openFooterTab() {
@@ -1679,6 +1729,7 @@ export default {
 				imageList: this.questionList[bankindex].ansText.imageList,
 				text: this.questionList[bankindex].ansText.text
 			});
+			this.isDoOver()
 		},
 
 		/**
@@ -1700,6 +1751,7 @@ export default {
 				imageList: this.questionList[bankindex].jsonStr[ansindex].ansText.imageList,
 				text: this.questionList[bankindex].jsonStr[ansindex].ansText.text
 			});
+			this.isDoOver()
 		},
 
 		isRight(item, index) {

+ 78 - 23
pages2/register/forget.vue

@@ -5,13 +5,13 @@
 		<view style="padding: 30rpx;">
 			<view class="login_box">
 				<u-form :model="form" ref="uForm" >
-					<u-form-item ><u-input  v-model="form.tel" type="number" maxlength="11" placeholder="手机号"/></u-form-item>
-					<u-form-item >
-						<u-input v-model="form.code" type="number"  placeholder="验证码"/>
+					<u-form-item prop="tel" ref="tel"><u-input  v-model="form.tel" type="number" maxlength="11" placeholder-style="color:#999999" placeholder="手机号"/></u-form-item>
+					<u-form-item prop="code">
+						<u-input v-model="form.code" type="number" placeholder-style="color:#999999"  placeholder="验证码"/>
 						<u-button slot="right"  size="mini" @click="getCode">{{codeTips}}</u-button>
 					</u-form-item>
-					<u-form-item ><u-input v-model="form.pwd" type="password" placeholder="请输入新密码"/></u-form-item>
-					<u-form-item ><u-input v-model="form.pwdAgain" type="password" placeholder="再次输入新密码"/></u-form-item>
+					<u-form-item prop="pwd"><u-input class="password" placeholder-style="color:#999999" v-model="form.pwd" type="password" placeholder="请输入新密码"/></u-form-item>
+					<u-form-item prop="pwdAgain"><u-input class="password" placeholder-style="color:#999999" v-model="form.pwdAgain" type="password" placeholder="再次输入新密码"/></u-form-item>
 				</u-form>
 			</view>
 			
@@ -35,6 +35,50 @@ export default {
 				pwd:'',
 				pwdAgain:''
 			},
+			rules: {
+				tel: [
+					{ 
+						required: true, 
+						message: '请输入手机号', 
+						// 可以单个或者同时写两个触发验证方式 
+						trigger: ['change','blur'],
+					},
+					{
+						validator: (rule, value, callback) => {
+							// 上面有说,返回true表示校验通过,返回false表示不通过
+							// this.$u.test.mobile()就是返回true或者false的
+							return this.$u.test.mobile(value);
+						},
+						message: '手机号码格式不正确',
+						// 触发器可以同时用blur和change
+						trigger: ['change','blur'],
+					}
+				],
+				pwd: [
+					{ 
+						required: true, 
+						message: '请输入密码', 
+						// 可以单个或者同时写两个触发验证方式 
+						trigger: ['change','blur'],
+					}
+				],
+				pwdAgain: [
+					{ 
+						required: true, 
+						message: '请输入密码', 
+						// 可以单个或者同时写两个触发验证方式 
+						trigger: ['change','blur'],
+					}
+				],
+				code: [
+					{ 
+						required: true, 
+						message: '请输入验证码', 
+						// 可以单个或者同时写两个触发验证方式 
+						trigger: ['change','blur'],
+					}
+				],
+			},
 			codeTips: '',
 			read:'',
 			isUse:false
@@ -108,25 +152,26 @@ export default {
 		getCode() {
 			let that = this
 			if(that.$refs.uCode.canGetCode) {
-				if(!this.form.tel){
-					this.$u.toast('请输入手机号码');
-					return 
+				if(that.$refs.tel.validateState == 'success') {
+					let datas = {tel:this.form.tel}
+					that.$api.forgetSms(datas).then(
+						res => {
+							if (res.data.code == 200) {
+								that.$u.toast('验证码已发送');
+								// 通知验证码组件内部开始倒计时
+								that.$refs.uCode.start();
+							} else {
+								that.$u.toast(res.data.msg);
+							}
+						},
+						err => {
+							console.log(err);
+						});
+				} else {
+					this.$refs.tel.onFieldBlur()
 				}
-				let datas = {tel:this.form.tel}
-				that.$api.forgetSms(datas).then(
-					res => {
-						if (res.data.code == 200) {
-							that.$u.toast('验证码已发送');
-							// 通知验证码组件内部开始倒计时
-							that.$refs.uCode.start();
-						} else {
-							that.$u.toast(res.data.msg);
-						}
-					},
-					err => {
-						console.log(err);
-					}
-			);}
+			}
+				
 		},
 		sectionChange(index) {
 			this.current = index;
@@ -191,6 +236,7 @@ export default {
 		}
 	},
 	onLoad(option) {
+		this.$refs.uForm.setRules(this.rules)
 		let that = this;
 		this.from = option.from;
 		uni.login({
@@ -252,6 +298,15 @@ export default {
 		border-radius: 24rpx;
 		margin-top: 30rpx;
 		padding:40rpx 35rpx;
+		
+		.password {
+			/deep/.uicon-eye-fill {
+				&::before{
+					color:#007AFF;
+					content:"\e613";
+				}
+			}
+		}
 	}
 	/deep/ .u-item-bg{
 		border-radius: 32px !important;

+ 112 - 67
pages2/register/register.vue

@@ -5,12 +5,12 @@
 		<view style="padding: 30rpx;">
 			<view class="login_box">
 				<u-form :model="form" ref="uForm" >
-					<u-form-item ><u-input  v-model="form.tel" type="number" maxlength="11" placeholder="手机号"/></u-form-item>
-					<u-form-item >
-						<u-input v-model="form.code"  type="number" placeholder="验证码"/>
+					<u-form-item prop="tel" ref="tel"><u-input  v-model="form.tel" type="number" maxlength="11" placeholder-style="color:#999999" placeholder="手机号"/></u-form-item>
+					<u-form-item prop="code">
+						<u-input v-model="form.code"  type="number" placeholder-style="color:#999999" placeholder="验证码"/>
 						<u-button slot="right"  size="mini" @click="getCode">{{codeTips}}</u-button>
 					</u-form-item>
-					<u-form-item ><u-input v-model="form.pwd" type="password" placeholder="请输入登录密码"/></u-form-item>
+					<u-form-item prop="pwd"><u-input v-model="form.pwd" type="password" placeholder-style="color:#999999" placeholder="请输入登录密码"/></u-form-item>
 				</u-form>
 			</view>
 			<view style="margin: 30rpx 0;">
@@ -23,9 +23,7 @@
 			<button :disabled="isUse" class="loginBtn" :class="{able:canRegister()}" @click="submit">
 				确定
 			</button>
-			
-			
-			
+		
 		</view>
 		<u-verification-code seconds="60" ref="uCode" @change="codeChange"></u-verification-code>
 	</view>
@@ -42,6 +40,42 @@ export default {
 			},
 			codeTips: '',
 			read:false,
+			rules: {
+				tel: [
+					{ 
+						required: true, 
+						message: '请输入手机号', 
+						// 可以单个或者同时写两个触发验证方式 
+						trigger: ['change','blur'],
+					},
+					{
+						validator: (rule, value, callback) => {
+							// 上面有说,返回true表示校验通过,返回false表示不通过
+							// this.$u.test.mobile()就是返回true或者false的
+							return this.$u.test.mobile(value);
+						},
+						message: '手机号码格式不正确',
+						// 触发器可以同时用blur和change
+						trigger: ['change','blur'],
+					}
+				],
+				pwd: [
+					{ 
+						required: true, 
+						message: '请输入密码', 
+						// 可以单个或者同时写两个触发验证方式 
+						trigger: ['change','blur'],
+					}
+				],
+				code: [
+					{ 
+						required: true, 
+						message: '请输入验证码', 
+						// 可以单个或者同时写两个触发验证方式 
+						trigger: ['change','blur'],
+					}
+				],
+			},
 			isUse:false
 		};
 	},
@@ -55,49 +89,58 @@ export default {
 		},
 		submit(){
 			let that = this
-			if(!this.form.tel){
-				this.$u.toast('请输入手机号码');
-				return 
-			}
-			if(!this.form.code){
-				this.$u.toast('请输入验证码');
-				return 
-			}
-			if(!this.form.pwd){
-				this.$u.toast('请输入注册密码');
-				return 
-			}
-			if(!this.read){
-				this.$u.toast('请勾选服务协议');
-				return 
-			}
-			that.isUse = true
-			let datas = {
-				tel:this.form.tel,
-				code:this.form.code,
-				pwd:this.form.pwd
-				}
-			that.$api.registerUser(datas).then(
-				res => {
-					that.isUse = false
-					if (res.data.code == 200) {
-						uni.showModal({
-							title: '提示',
-							content: '注册成功',
-							showCancel:false,
-							success: function(resst) {
-								uni.navigateBack()
-							}
-						});
-					} else {
-						that.$u.toast(res.data.msg);
+			// if(!this.form.tel){
+			// 	this.$u.toast('请输入手机号码');
+			// 	return 
+			// }
+			// if(!this.form.code){
+			// 	this.$u.toast('请输入验证码');
+			// 	return 
+			// }
+			// if(!this.form.pwd){
+			// 	this.$u.toast('请输入注册密码');
+			// 	return 
+			// }
+			// if(!this.read){
+			// 	this.$u.toast('请勾选服务协议');
+			// 	return 
+			// }
+			this.$refs.uForm.validate(valid => {
+				if(valid) {
+					if(!this.read){
+						this.$u.toast('请勾选服务协议');
+						return 
 					}
-				},
-				err => {
-					that.isUse = false
-					console.log(err);
+					that.isUse = true
+					let datas = {
+						tel:this.form.tel,
+						code:this.form.code,
+						pwd:this.form.pwd
+						}
+					that.$api.registerUser(datas).then(
+						res => {
+							that.isUse = false
+							if (res.data.code == 200) {
+								uni.showModal({
+									title: '提示',
+									content: '注册成功',
+									showCancel:false,
+									success: function(resst) {
+										uni.navigateBack()
+									}
+								});
+							} else {
+								that.$u.toast(res.data.msg);
+							}
+						},
+						err => {
+							that.isUse = false
+							console.log(err);
+						}
+					);
 				}
-			);
+			})
+			
 		},
 		radioGroupChange(e) {
 			 console.log(e);
@@ -109,25 +152,26 @@ export default {
 		getCode() {
 			let that = this
 			if(that.$refs.uCode.canGetCode) {
-				if(!this.form.tel){
-					this.$u.toast('请输入手机号码');
-					return 
-				}
-				let datas = {tel:this.form.tel}
-				that.$api.registerSms(datas).then(
-					res => {
-						if (res.data.code == 200) {
-							that.$u.toast('验证码已发送');
-							// 通知验证码组件内部开始倒计时
-							that.$refs.uCode.start();
-						} else {
-							that.$u.toast(res.data.msg);
+				if(that.$refs.tel.validateState == 'success') {
+					let datas = {tel:this.form.tel}
+					that.$api.registerSms(datas).then(
+						res => {
+							if (res.data.code == 200) {
+								that.$u.toast('验证码已发送');
+								// 通知验证码组件内部开始倒计时
+								that.$refs.uCode.start();
+							} else {
+								that.$u.toast(res.data.msg);
+							}
+						},
+						err => {
+							console.log(err);
 						}
-					},
-					err => {
-						console.log(err);
-					}
-			);}
+					);	
+				} else {
+					this.$refs.tel.onFieldBlur()
+				}
+			}
 
 		},
 		sectionChange(index) {
@@ -194,6 +238,7 @@ export default {
 	},
 	onLoad(option) {
 		let that = this;
+		this.$refs.uForm.setRules(this.rules)
 		this.from = option.from;
 		uni.login({
 			provider: 'weixin',
@@ -248,7 +293,7 @@ export default {
 	}
 	.login_box{
 		width: 100%;
-		height: 463rpx;
+		height: 500rpx;
 		background: #FFFFFF;
 		box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(1, 99, 235, 0.1);
 		border-radius: 24rpx;