dedsudiyu 2 miesięcy temu
rodzic
commit
7672830d38

+ 2 - 2
api/request/config.js

@@ -1,12 +1,12 @@
 const config = {
 	// base_url: 'http://192.168.1.43/api', //43服务器
-	base_url: 'http://192.168.1.8/api',//1.8服务器
+	// base_url: 'http://192.168.1.8/api',//1.8服务器
 	// base_url: 'http://192.168.1.9:8080',//柴
 	// base_url: 'http://192.168.1.24:8080',//林总
 	// base_url: 'http://192.168.1.7:8080',//刘波
 	// base_url: 'http://192.168.1.17:8080',//小飞
 	// base_url: 'http://192.168.1.43/api',//小飞
-	// base_url: 'http://192.168.1.20:8080',//志伟
+	base_url: 'http://192.168.1.20:8080',//志伟
 	// base_url: 'http://192.168.1.39:8080',//高升
 	// base_url: 'http://192.168.1.29:8080',//何成
 	// base_url: 'https://demo.zjznai.com/xzgd/',

+ 7 - 0
pages/api/index.js

@@ -490,4 +490,11 @@ export const laboratoryClassLevelGetList = (data) => {
 		method: 'POST',
 		data: { ...data }
 	})
+};
+//查询用户信息-(初始密码/手机号/导师/身份)
+export const systemUserPersonalData  = (data) => {
+    return apiResquest({
+        url: `/system/user/personalData`,
+        method: 'get',
+    })
 };

+ 34 - 5
pages/views/home/home.vue

@@ -5,6 +5,9 @@
 	</view>
 </template>
 <script>
+	import {
+		systemUserPersonalData,
+	} from '@/pages/api/index.js'
 	import {
 		teacherHome
 	} from '@/pages/views/teacherPage/teacherHome'
@@ -28,9 +31,8 @@
 		onShow() {
 			uni.removeStorageSync('planSensorList');
 			if (uni.getStorageSync('token') && uni.getStorageSync('userId') && uni.getStorageSync('userType')) {
-				this.userType = uni.getStorageSync('userType')
-				console.log('检查用户个人信息/初始密码');
-				this.passwrodTips();
+				this.systemUserPersonalData();
+				//写入用户
 			} else {
 				uni.removeStorageSync('token');
 				uni.removeStorageSync('userId');
@@ -41,6 +43,33 @@
 			}
 		},
 		methods: {
+			async systemUserPersonalData(){
+				const {
+					data
+				} = await systemUserPersonalData();
+				if (data.code == 200) {
+					// isInitPwd 初始密码 true 是
+					// isTutorExist 导师 true 有
+					// isPhoneExist 电话 true 有
+					// userType 1教职工 2学生
+					if(data.data.userType == 1 && !data.data.isPhoneExist){
+						//教职工
+						uni.redirectTo({
+							url: '/pages_basics/views/completeInformation/completeInformation',
+						});
+					}else if(data.data.userType == 2 &&(!data.data.isTutorExist || !data.data.isPhoneExist)){
+						//学生
+						uni.redirectTo({
+							url: '/pages_basics/views/completeInformation/completeInformation',
+						});
+					}else if(data.data.isInitPwd){
+						this.userType = uni.getStorageSync('userType')
+						this.passwrodTips();
+					}else{
+						this.userType = uni.getStorageSync('userType')
+					}
+				}
+			},
 			//初始密码修改提示
 			passwrodTips(){
 				uni.showModal({
@@ -52,12 +81,12 @@
 					confirmText:'修改密码',
 					success(res) {
 						if (res.confirm) {
-							console.log('确定')
+							// console.log('确定')
 							uni.navigateTo({
 								url: '/pages_basics/views/editPassword/editPassword',
 							});
 						} else if (res.cancel) {
-							console.log('取消')
+							// console.log('取消')
 						}
 					}
 				})

+ 55 - 0
pages_basics/api/index.js

@@ -179,3 +179,58 @@ export const gradingControlDetail  = (data) => {
         //data: data,
     })
 };
+//通过手机号码-获取数字验证码(需要手机号已存在)
+export const authNumCaptcha  = (data) => {
+    return apiResquest({
+        url: `/auth/numCaptcha`,
+        method: 'get',
+        data: {...data}
+    })
+};
+//通过手机号码-获取数字验证码(需要手机号不存在)
+export const authNumCaptchaNotRegistered  = (data) => {
+    return apiResquest({
+        url: `/auth/numCaptchaNotRegistered`,
+        method: 'get',
+        data: {...data}
+    })
+};
+//忘记密码/修改密码-提交
+export const authForgetPassword  = (data) => {
+    return apiResquest({
+        url: `/auth/forgetPassword`,
+        method: 'POST',
+        data: {...data}
+    })
+};
+//查询用户信息-(初始密码/手机号/导师/身份)
+export const systemUserPersonalData  = (data) => {
+    return apiResquest({
+        url: `/system/user/personalData`,
+        method: 'get',
+    })
+};
+//根据用户id查询用户详情
+export const systemUserDetail  = (data) => {
+    return apiResquest({
+        url: `/system/user/detail`,
+        method: 'get',
+				data: { ...data }
+    })
+};
+//查询导师列表
+export const systemUserSelectByPage  = (data) => {
+    return apiResquest({
+        url: `/system/user/selectByPage`,
+        method: 'POST',
+				data: { ...data }
+    })
+};
+//完善用户信息-提交
+export const systemUserEditUser  = (data) => {
+    return apiResquest({
+        url: `/system/user/editUser`,
+        method: 'POST',
+				data: { ...data }
+    })
+};

+ 305 - 64
pages_basics/views/completeInformation/completeInformation.vue

@@ -10,37 +10,56 @@
 					<view>*</view>
 					<view>姓名</view>
 				</view>
-				<view class="text-bottom-p">{{newData.data1}}</view>
+				<view class="text-bottom-p">{{newData.userName}}</view>
 			</view>
 			<view class="text-max-box">
 				<view class="text-top-box">
 					<view>*</view>
-					<view>学号</view>
+					<view>{{newData.userType==1?'工号':(newData.userType==2?'学号':'')}}</view>
 				</view>
-				<view class="text-bottom-p">{{newData.data2}}</view>
+				<view class="text-bottom-p">{{newData.account}}</view>
 			</view>
 			<view class="text-max-box">
 				<view class="text-top-box">
 					<view>*</view>
 					<view>所在学院</view>
 				</view>
-				<view class="text-bottom-p">{{newData.data3}}</view>
+				<view class="text-bottom-p">{{newData.deptName?newData.deptName:'-'}}</view>
 			</view>
-			<view class="text-max-box">
+			<view class="text-max-box" v-if="newData.userType == 2">
 				<view class="text-top-box">
 					<view>*</view>
 					<view>专业</view>
 				</view>
-				<view class="text-bottom-p">{{newData.data4}}</view>
+				<view class="text-bottom-p">{{newData.majorName?newData.majorName:'-'}}</view>
+			</view>
+			<view class="text-max-box" v-if="newData.mobile">
+				<view class="text-top-box">
+					<view>*</view>
+					<view>手机号</view>
+				</view>
+				<view class="text-bottom-p">{{newData.mobile}}</view>
 			</view>
-			<view class="input-max-box">
+			<view class="input-max-box" v-if="!newData.mobile">
 				<view class="input-top-box">
 					<view>*</view>
 					<view>手机号</view>
 				</view>
-				<input class="input-top-p" v-model="form.phone" maxlength="11" focus placeholder="请输入手机号码">
+				<input class="input-top-p" v-model="form.mobile" maxlength="11" focus placeholder="请输入手机号码">
+			</view>
+			<view class="input-button-max-box" v-if="!newData.mobile">
+				<view class="input-top-box">
+					<view>*</view>
+					<view>手机验证码</view>
+				</view>
+				<view class="input-button-box">
+					<input maxlength="6" v-model="form.captcha" focus placeholder="请输入手机验证码" />
+					<view @click="getCode()" :class="codeType?'checkButton':'noCheckButton'">
+						{{codeType?seconds+'秒后重试':'获取验证码'}}
+					</view>
+				</view>
 			</view>
-			<view class="button-max-box">
+			<view class="button-max-box" v-if="newData.userType == 2 && !newData.tutorUserName">
 				<view class="button-top-box">
 					<view>*</view>
 					<view>导师</view>
@@ -48,6 +67,13 @@
 				<input class="button-bottom-p" :disabled="true" v-model="form.supervisorName" 
 				maxlength="30" focus placeholder="请选择导师" @click="userButton()">
 			</view>
+			<view class="text-max-box" v-if="newData.userType == 2 && newData.tutorUserName">
+				<view class="text-top-box">
+					<view>*</view>
+					<view>导师</view>
+				</view>
+				<view class="text-bottom-p">{{newData.tutorUserName}}</view>
+			</view>
 			<view class="bottom-button-p" @click="submitButton()">确定</view>
 		</view>
 		<view class="shade-max-big-box" v-if="userShowType">
@@ -57,17 +83,17 @@
 					<view class="shade-top-left-box">
 						<uni-icons type="search" class="icon-view-left" size="20" color="#999999"></uni-icons>
 						<input class="input-top-p"  @confirm="searchButton()"
-						v-model="getData.searchValue" maxlength="10" focus placeholder="请输入导师">
-						<uni-icons v-if="getData.searchValue" @click="clearButton()"
+						v-model="getData.userName" maxlength="10" focus placeholder="请输入导师">
+						<uni-icons v-if="getData.userName" @click="clearButton()"
 						type="clear" class="icon-view-right" size="20" color="#999999"></uni-icons>
 					</view>
 					<view class="shade-top-right-button" @click="searchButton()">搜索</view>
 				</view>
 				<scroll-view scroll-y @scrolltolower="scrollGet" class="shade-bottom-box">
-					<view @click="checkUser(item,index)"
-					class="for-user-box" :class="checkUserIndex==index?'check-user':''"
+					<view @click="checkUser(item)"
+					class="for-user-box" :class="checkUserUserId==item.userId?'check-user':''"
 					v-for="(item,index) in dataList" :key="index">
-						<view>{{item.name}}{{item.num?'('+item.num+')':''}}</view>
+						<view>{{item.userName}}{{item.account?'('+item.account+')':''}}</view>
 						<view>{{item.deptName}}</view>
 					</view>
 					<view class="get-data-null-p" v-if="getDataType">- 没有更多数据 -</view>
@@ -80,71 +106,79 @@
 
 <script>
 	import {
-		systemSubjectGetAppSubject,
-	} from '@/pages_manage/api/index.js'
+		systemUserDetail,
+		systemUserSelectByPage,
+		systemUserEditUser,
+		authNumCaptchaNotRegistered,
+	} from '@/pages_basics/api/index.js'
 	export default {
 		data() {
 			return {
 				newData:{
-					data1:"刘晓明",
-					data2:"2024060236",
-					data3:"园艺学院",
-					data4:"茶艺",
+					userName:"",
+					account:"",
+					deptName:"",
+					majorName:"",
+					userType:0,
 				},
 				form:{
-					phone:"",
+					mobile:"",
 					supervisorName:"",
 					supervisorId:"",
 				},
 				userShowType:false,
-				checkUserIndex:null,
+				checkUserUserId:null,
 				//查询
 				getData: {
+					userType:1,
 					page: 1,
 					pageSize: 20,
-					searchValue: '',
+					userName: '',
 				},
 				getDataType: false,
 				total: 0,
 				//教师查询列表
-				dataList:[
-					{name:"一二三四五",num:"01234567890123456789",deptName:"学院名称五六七八九十",},
-					{name:"一二三四五",num:"01234567890123456789",deptName:"学院名称五六七八九十",},
-					{name:"一二三四五",num:"01234567890123456789",deptName:"学院名称五六七八九十",},
-					{name:"一二三四五",num:"01234567890123456789",deptName:"学院名称五六七八九十",},
-					{name:"一二三四五",num:"01234567890123456789",deptName:"学院名称五六七八九十",},
-					{name:"一二三四五",num:"01234567890123456789",deptName:"学院名称五六七八九十",},
-					{name:"一二三四五",num:"01234567890123456789",deptName:"学院名称五六七八九十",},
-					{name:"一二三四五",num:"01234567890123456789",deptName:"学院名称五六七八九十",},
-					{name:"一二三四五",num:"01234567890123456789",deptName:"学院名称五六七八九十",},
-					{name:"一二三四五",num:"01234567890123456789",deptName:"学院名称五六七八九十",},
-					{name:"一二三四五",num:"01234567890123456789",deptName:"学院名称五六七八九十",},
-					{name:"一二三四五",num:"01234567890123456789",deptName:"学院名称五六七八九十",},
-					{name:"一二三四五",num:"01234567890123456789",deptName:"学院名称五六七八九十",},
-					{name:"一二三四五",num:"01234567890123456789",deptName:"学院名称五六七八九十",},
-					{name:"一二三四五",num:"01234567890123456789",deptName:"学院名称五六七八九十",},
-					{name:"一二三四五",num:"01234567890123456789",deptName:"学院名称五六七八九十",},
-				],
+				dataList:[],
+				//定时器
+				codeType: false,
+				seconds: 0,
+				timer:null,
 			}
 		},
 		onLoad(option) {
 			
 		},
 		onShow() {
-			// this.systemSubjectGetAppSubject();
+			this.systemUserDetail();
 		},
 		methods: {
-			//提交
-			submitButton(){
+			async systemUserDetail(){
+				const { data } = await systemUserDetail({userId:uni.getStorageSync('userId')});
+				if (data.code == 200) {
+					this.$set(this,'newData',data.data);
+					this.systemUserSelectByPage();
+				}
+			},
+			
+			//获取验证码
+			getCode() {
+				let self = this;
 				const reg = /^1[3|4|5|7|8|9][0-9]\d{8}$/
-				if(!this.form.phone){
+				if (this.codeType) {
+					uni.showToast({
+						title: '请稍后再试',
+						icon: "none",
+						duration: 3000
+					});
+					return
+				} else if (!this.form.mobile) {
 					uni.showToast({
 						title: '请输入手机号码',
 						icon: "none",
 						duration: 3000
 					});
 					return
-				}else if (!reg.test(this.form.phone)) {
+				} else if (!reg.test(this.form.mobile)) {
 					uni.showToast({
 						title: '请输入正确的手机号码',
 						icon: "none",
@@ -152,13 +186,127 @@
 					});
 					return
 				}
-				if(!this.form.supervisorName){
+				this.authNumCaptchaNotRegistered();
+			},
+			async authNumCaptchaNotRegistered() {
+				let self = this;
+				const {
+					data
+				} = await authNumCaptchaNotRegistered({mobile:this.form.mobile});
+				if (data.code == 200) {
 					uni.showToast({
-						title: '请选择导师',
+						title: '发送成功',
 						icon: "none",
-						duration: 3000
+						mask: true,
+						duration: 2000
 					});
-					return
+					const TIME_COUNT = 60;
+					this.$set(this, 'codeType', true);
+					if (!this.timer) {
+						this.$set(this, 'seconds', TIME_COUNT);
+						this.timer = setInterval(() => {
+							if (this.seconds > 1 && this.seconds <= TIME_COUNT) {
+								this.seconds -= 1;
+							} else {
+								this.$set(this, 'codeType', false);
+								clearInterval(this.timer);
+								this.$set(this, 'timer', null);
+							}
+						}, 1000);
+					}
+				}
+			},
+			//提交
+			submitButton(){
+				let self = this;
+				const reg = /^1[3|4|5|7|8|9][0-9]\d{8}$/
+				if(this.newData.userType == 1){
+					if(!this.form.mobile){
+						uni.showToast({
+							title: '请输入手机号码',
+							icon: "none",
+							duration: 3000
+						});
+						return
+					}else if (!reg.test(this.form.mobile)) {
+						uni.showToast({
+							title: '请输入正确的手机号码',
+							icon: "none",
+							duration: 3000
+						});
+						return
+					} else if (!this.form.captcha) {
+						uni.showToast({
+							title: '请输入手机验证码',
+							icon: "none",
+							duration: 3000
+						});
+						return
+					} 
+				}else if(this.newData.userType == 2){
+					if(!this.newData.mobile && !this.newData.tutorUserName){
+						if(!this.form.mobile){
+							uni.showToast({
+								title: '请输入手机号码',
+								icon: "none",
+								duration: 3000
+							});
+							return
+						}else if (!reg.test(this.form.mobile)) {
+							uni.showToast({
+								title: '请输入正确的手机号码',
+								icon: "none",
+								duration: 3000
+							});
+							return
+						} else if (!this.form.captcha) {
+							uni.showToast({
+								title: '请输入手机验证码',
+								icon: "none",
+								duration: 3000
+							});
+							return
+						} else if(!this.checkUserUserId){
+							uni.showToast({
+								title: '请选择导师',
+								icon: "none",
+								duration: 3000
+							});
+							return
+						}
+					}else if(this.newData.mobile){
+						if(!this.checkUserUserId){
+							uni.showToast({
+								title: '请选择导师',
+								icon: "none",
+								duration: 3000
+							});
+							return
+						}
+					}else{
+						if(!this.form.mobile){
+							uni.showToast({
+								title: '请输入手机号码',
+								icon: "none",
+								duration: 3000
+							});
+							return
+						}else if (!reg.test(this.form.mobile)) {
+							uni.showToast({
+								title: '请输入正确的手机号码',
+								icon: "none",
+								duration: 3000
+							});
+							return
+						} else if (!this.form.captcha) {
+							uni.showToast({
+								title: '请输入手机验证码',
+								icon: "none",
+								duration: 3000
+							});
+							return
+						} 
+					}
 				}
 				uni.showModal({
 					title: '确认提交?',
@@ -167,21 +315,57 @@
 					content: '',
 					success(res) {
 						if (res.confirm) {
-							console.log('确定')
+							// console.log('确定')
+							self.systemUserEditUser();
 						} else if (res.cancel) {
-							console.log('取消')
+							// console.log('取消')
 						}
 					}
 				})
 			},
+			//完善用户信息-提交
+			async systemUserEditUser(){
+				let obj = {
+					userId:this.newData.userId,
+				}
+				if(this.newData.userType == 1){
+					obj.mobile = this.form.mobile;
+					obj.captcha = this.form.captcha;
+				} else if(this.newData.userType == 2){
+					if(!this.newData.mobile && !this.newData.tutorUserName){
+						obj.tutorUserId = this.checkUserUserId;
+						obj.mobile = this.form.mobile;
+						obj.captcha = this.form.captcha;
+					}else if(this.newData.mobile){
+						obj.tutorUserId = this.checkUserUserId;
+					}else{
+						obj.mobile = this.form.mobile;
+						obj.captcha = this.form.captcha;
+					}
+				}
+				const { data } = await systemUserEditUser(obj);
+				if (data.code == 200) {
+					uni.showToast({
+						title: '提交成功',
+						mask: true,
+						icon: "none",
+						duration: 2000
+					});
+					setTimeout(function(){
+						uni.redirectTo({
+							url: '/pages/views/home/home',
+						});
+					},2000);
+				}
+			},
 			//搜索按钮
 			clearButton(){
 				this.$set(this, 'getDataType', false);
 				this.$set(this, 'dataList', []);
 				this.$set(this, 'total', 0);
-				this.$set(this.getData, 'searchValue','');
+				this.$set(this.getData, 'userName','');
 				this.$set(this.getData, 'page', 1);
-				this.systemSubjectGetAppSubject();
+				this.systemUserSelectByPage();
 			},
 			//搜索按钮
 			searchButton(){
@@ -189,17 +373,17 @@
 				this.$set(this, 'dataList', []);
 				this.$set(this, 'total', 0);
 				this.$set(this.getData, 'page', 1);
-				this.systemSubjectGetAppSubject();
+				this.systemUserSelectByPage();
 			},
 			//教师弹窗开关啊
 			userButton(type){
 				this.$set(this,'userShowType',!this.userShowType);
 			},
 			//选中教师
-			checkUser(item,index){
-				this.$set(this.form,'supervisorName',item.name);
-				this.$set(this.form,'supervisorId',item.num);
-				this.$set(this,'checkUserIndex',index);
+			checkUser(item){
+				this.$set(this.form,'supervisorName',item.userName);
+				this.$set(this.form,'supervisorId',item.account);
+				this.$set(this,'checkUserUserId',item.userId);
 				this.$set(this,'userShowType',false);
 			},
 			//滚动加载事件
@@ -210,16 +394,25 @@
 				} else {
 					this.getData.page += 1;
 					this.$nextTick(() => {
-						this.systemSubjectGetAppSubject();
+						this.systemUserSelectByPage();
 					})
 				}
 			},
 			//获取实验室
-			async systemSubjectGetAppSubject() {
+			async systemUserSelectByPage() {
 				let self = this;
+				let obj = {
+					userType:this.getData.userType,
+					page:this.getData.page,
+					pageSize:this.getData.pageSize,
+					userName:this.getData.userName,
+				};
+				if(!obj.userName){
+					obj.deptId = this.newData.deptId
+				}
 				const {
 					data
-				} = await systemSubjectGetAppSubject(this.getData);
+				} = await systemUserSelectByPage(obj);
 				if (data.code == 200) {
 					if (self.getData.page == 1) {
 						this.dataList = data.data.records;
@@ -318,6 +511,54 @@
 					border: 1rpx solid #E0E0E0;
 				}
 			}
+			.input-button-max-box{
+				.input-top-box{
+					display: flex;
+					margin-left:32rpx;
+					view{
+						font-size:30rpx;
+						line-height: 100rpx;
+					}
+					view:nth-child(1){
+						color:#FF0000;
+					}
+					view:nth-child(2){
+						color:#333;
+					}
+				}
+				
+				.input-button-box {
+					display: flex;
+					margin-left:30rpx;
+					input {
+						width: 412rpx;
+						height: 100rpx;
+						line-height: 100rpx;
+						border-radius: 10rpx;
+						border: 1px solid #D8D8D8;
+						padding: 0 30rpx;
+						margin-right: 18rpx;
+					}
+				
+					view {
+						width: 200rpx;
+						line-height: 100rpx;
+						text-align: center;
+						font-size: 30rpx;
+						border-radius: 10rpx;
+					}
+				
+					.checkButton {
+						color: #333;
+						background-color: #E8E8E8;
+					}
+				
+					.noCheckButton {
+						color: #fff;
+						background-color: #0183FA;
+					}
+				}
+			}
 			.button-max-box{
 				.button-top-box{
 					display: flex;
@@ -357,7 +598,7 @@
 			height:100%;
 			width:100%;
 			background-color: rgba(0,0,0,0.5);
-			z-index:1;
+			z-index:100;
 			display: flex;
 			flex-direction: column;
 			overflow: hidden;
@@ -372,7 +613,7 @@
 				border-top-left-radius:20rpx;
 				border-top-right-radius:20rpx;
 				overflow: hidden;
-				z-index:10;
+				z-index:110;
 				.shade-top-box{
 					height:122rpx;
 					border-bottom:1px solid #dedede;

+ 87 - 39
pages_basics/views/editPassword/editPassword.vue

@@ -4,16 +4,12 @@
 		<view class="page-title">修改密码</view>
 		<view class="input-disabled-box">
 			<view>手机号</view>
-			<view>{{form.data1}}</view>
-		</view>
-		<view class="input-max-box">
-			<view>学/工号</view>
-			<input v-model="form.data2" maxlength="30" focus placeholder="请输入学/工号"/>
+			<view>{{form.mobile}}</view>
 		</view>
 		<view class="input-button-max-box">
 			<view>手机验证码</view>
 			<view class="input-button-box">
-				<input maxlength="6" v-model="form.data3" focus placeholder="请输入手机验证码"/>
+				<input maxlength="6" v-model="form.captcha" focus placeholder="请输入手机验证码"/>
 				<view @click="getCode()"
 				:class="codeType?'checkButton':'noCheckButton'">
 					{{codeType?seconds+'秒后重试':'获取验证码'}}
@@ -22,11 +18,11 @@
 		</view>
 		<view class="input-max-box">
 			<view>新密码</view>
-			<input type="password" maxlength="16" v-model="form.data4" focus placeholder="请输入新密码"/>
+			<input type="password" maxlength="16" v-model="form.newPassword" focus placeholder="请输入新密码"/>
 		</view>
 		<view class="input-max-box">
 			<view>确认新密码</view>
-			<input type="password" maxlength="16" v-model="form.data5" focus placeholder="请再次输入确认密码"/>
+			<input type="password" maxlength="16" v-model="form.confirmPassword" focus placeholder="请再次输入确认密码"/>
 		</view>
 		<view class="bottom-button-box">
 			<view @click="outButton()">稍后修改</view>
@@ -36,11 +32,20 @@
 </template>
 
 <script>
+	import md5 from '@/utils/md5.js'
+	import {
+		systemUserDetail,
+		authNumCaptcha,
+		authForgetPassword,
+	} from '@/pages_basics/api/index.js'
 	export default {
 		data() {
 			return {
 				form:{
-					data1:"13333333333",
+					mobile:"",
+					captcha:"",
+					newPassword:"",
+					confirmPassword:"",
 				},
 				codeType:false,
 				seconds:0,
@@ -52,9 +57,18 @@
 			
 		},
 		onShow() {
-			
+			this.systemUserDetail();
 		},
 		methods: {
+			//获取用户信息
+			async systemUserDetail(){
+				const {
+					data
+				} = await systemUserDetail({userId:uni.getStorageSync('userId')});
+				if (data.code == 200) {
+					this.$set(this.form,'mobile',data.data.mobile);
+				}
+			},
 			//返回上级页面
 			outButton(){
 				uni.navigateBack();
@@ -71,75 +85,85 @@
 					});
 					return
 				}
-				const TIME_COUNT = 60;
-				this.$set(this,'codeType',true);
-				if (!this.timer) {
-					this.$set(this,'seconds',TIME_COUNT);
-					this.timer = setInterval(() => {
-						if (this.seconds > 1 && this.seconds <= TIME_COUNT) {
-							this.seconds -= 1;
-						} else {
-							this.$set(this,'codeType',false);
-							clearInterval(this.timer);
-							this.$set(this,'timer',null);
-						}
-					}, 1000);
+				this.authNumCaptcha();
+			},
+			//获取验证码
+			async authNumCaptcha() {
+				let self = this;
+				const {
+					data
+				} = await authNumCaptcha({mobile:this.form.mobile});
+				if (data.code == 200) {
+					uni.showToast({
+						title: '发送成功',
+						mask: true,
+						icon: "none",
+						duration: 2000
+					});
+					const TIME_COUNT = 60;
+					this.$set(this, 'codeType', true);
+					if (!this.timer) {
+						this.$set(this, 'seconds', TIME_COUNT);
+						this.timer = setInterval(() => {
+							if (this.seconds > 1 && this.seconds <= TIME_COUNT) {
+								this.seconds -= 1;
+							} else {
+								this.$set(this, 'codeType', false);
+								clearInterval(this.timer);
+								this.$set(this, 'timer', null);
+							}
+						}, 1000);
+					}
 				}
 			},
 			//提交
 			submitButton(){
+				let self = this;
 				const reg = /^1[3|4|5|7|8|9][0-9]\d{8}$/
 				const password = /^(?=(?:.*[A-Z]){1})(?=(?:.*[a-z]){1})(?=(?:.*[0-9]){1})(?=(?:.*[!@#*?&]){1})(?!(.)\1)(.{10,16})$/
-				if(!this.form.data1){
+				if(!this.form.mobile){
 					uni.showToast({
 						title: '请输入手机号码',
 						icon: "none",
 						duration: 3000
 					});
 					return
-				}else if (!reg.test(this.form.data1)) {
+				}else if (!reg.test(this.form.mobile)) {
 					uni.showToast({
 						title: '请输入正确的手机号码',
 						icon: "none",
 						duration: 3000
 					});
 					return
-				}else if(!this.form.data2){
-					uni.showToast({
-						title: '请输入学/工号',
-						icon: "none",
-						duration: 3000
-					});
-					return
-				}else if(!this.form.data3){
+				}else if(!this.form.captcha){
 					uni.showToast({
 						title: '请输入手机验证码',
 						icon: "none",
 						duration: 3000
 					});
 					return
-				}else if(!this.form.data4){
+				}else if(!this.form.newPassword){
 					uni.showToast({
 						title: '请输入新密码',
 						icon: "none",
 						duration: 3000
 					});
 					return
-				}else if(!this.form.data5){
+				}else if(!this.form.confirmPassword){
 					uni.showToast({
 						title: '请再次输入确认密码',
 						icon: "none",
 						duration: 3000
 					});
 					return
-				}else if(this.form.data4!=this.form.data5){
+				}else if(this.form.newPassword!=this.form.confirmPassword){
 					uni.showToast({
 						title: '新密码与确认新密码不一致',
 						icon: "none",
 						duration: 3000
 					});
 					return
-				}else if(!password.test(this.form.data4)||!password.test(this.form.data5)){
+				}else if(!password.test(this.form.newPassword)||!password.test(this.form.confirmPassword)){
 					uni.showToast({
 						title: '密码长度最少10位 最多16位,必须同时包含一个大写字母、一个小写字母、一个数字和一个特殊字符!@#*?&',
 						icon: "none",
@@ -154,13 +178,37 @@
 					content: '',
 					success(res) {
 						if (res.confirm) {
-							console.log('确定')
+							// console.log('确定')
+							self.authForgetPassword();
 						} else if (res.cancel) {
-							console.log('取消')
+							// console.log('取消')
 						}
 					}
 				})
 			},
+			async authForgetPassword(){
+				let self = this;
+				let obj = {
+					mobile:this.form.mobile,
+					captcha:this.form.captcha,
+					newPassword:md5.hex_md5(this.form.newPassword),
+					confirmPassword:md5.hex_md5(this.form.confirmPassword),
+				};
+				const {
+					data
+				} = await authForgetPassword(obj);
+				if (data.code == 200) {
+					uni.showToast({
+						title: '操作成功',
+						icon: "none",
+						mask: true,
+						duration: 2000
+					});
+					setTimeout(function(){
+						uni.navigateBack();
+					},2000);
+				}
+			},
 		},
 
 	}

+ 158 - 105
pages_basics/views/forgotPassword/forgotPassword.vue

@@ -4,29 +4,24 @@
 		<view class="page-title">忘记密码</view>
 		<view class="input-max-box">
 			<view>手机号</view>
-			<input v-model="form.data1" maxlength="11" focus placeholder="请输入手机号码"/>
-		</view>
-		<view class="input-max-box">
-			<view>学/工号</view>
-			<input v-model="form.data2" maxlength="30" focus placeholder="请输入学/工号"/>
+			<input v-model="form.mobile" maxlength="11" focus placeholder="请输入手机号码" />
 		</view>
 		<view class="input-button-max-box">
 			<view>手机验证码</view>
 			<view class="input-button-box">
-				<input maxlength="6" v-model="form.data3" focus placeholder="请输入手机验证码"/>
-				<view @click="getCode()"
-				:class="codeType?'checkButton':'noCheckButton'">
+				<input maxlength="6" v-model="form.captcha" focus placeholder="请输入手机验证码" />
+				<view @click="getCode()" :class="codeType?'checkButton':'noCheckButton'">
 					{{codeType?seconds+'秒后重试':'获取验证码'}}
 				</view>
 			</view>
 		</view>
 		<view class="input-max-box">
 			<view>新密码</view>
-			<input type="password" maxlength="16" v-model="form.data4" focus placeholder="请输入新密码"/>
+			<input type="password" maxlength="16" v-model="form.newPassword" focus placeholder="请输入新密码" />
 		</view>
 		<view class="input-max-box">
 			<view>确认新密码</view>
-			<input type="password" maxlength="16" v-model="form.data5" focus placeholder="请再次输入确认密码"/>
+			<input type="password" maxlength="16" v-model="form.confirmPassword" focus placeholder="请再次输入确认密码" />
 		</view>
 		<view class="bottom-button-box">
 			<view @click="outButton()">稍后修改</view>
@@ -36,48 +31,56 @@
 </template>
 
 <script>
+	import md5 from '@/utils/md5.js'
+	import {
+		authNumCaptcha,
+		authForgetPassword,
+	} from '@/pages_basics/api/index.js'
 	export default {
 		data() {
 			return {
-				form:{
-					phone:"",
+				form: {
+					mobile:"",
+					captcha:"",
+					newPassword:"",
+					confirmPassword:"",
 				},
-				codeType:false,
-				seconds:0,
-				timer:null,
+				codeType: false,
+				seconds: 0,
+				timer: null,
 			}
 		},
 
 		onLoad(option) {
-			
+
 		},
 		onShow() {
-			
+
 		},
 		methods: {
 			//返回上级页面
-			outButton(){
+			outButton() {
 				uni.navigateBack();
 			},
 			//获取验证码
-			getCode(){
+			getCode() {
 				let self = this;
 				const reg = /^1[3|4|5|7|8|9][0-9]\d{8}$/
-				if(this.codeType){
+				if (this.codeType) {
 					uni.showToast({
 						title: '请稍后再试',
 						icon: "none",
 						duration: 3000
 					});
 					return
-				}else if(!this.form.data1){
+				} else if (!this.form.mobile) {
 					uni.showToast({
 						title: '请输入手机号码',
 						icon: "none",
 						duration: 3000
 					});
 					return
-				}else if (!reg.test(this.form.data1)) {
+				} else if (!reg.test(this.form.mobile)) {
 					uni.showToast({
 						title: '请输入正确的手机号码',
 						icon: "none",
@@ -85,75 +88,86 @@
 					});
 					return
 				}
-				const TIME_COUNT = 60;
-				this.$set(this,'codeType',true);
-				if (!this.timer) {
-					this.$set(this,'seconds',TIME_COUNT);
-					this.timer = setInterval(() => {
-						if (this.seconds > 1 && this.seconds <= TIME_COUNT) {
-							this.seconds -= 1;
-						} else {
-							this.$set(this,'codeType',false);
-							clearInterval(this.timer);
-							this.$set(this,'timer',null);
-						}
-					}, 1000);
+				this.authNumCaptcha();
+			},
+			//获取验证码
+			async authNumCaptcha() {
+				let self = this;
+				const {
+					data
+				} = await authNumCaptcha({mobile:this.form.mobile});
+				if (data.code == 200) {
+					uni.showToast({
+						title: '发送成功',
+						icon: "none",
+						mask: true,
+						duration: 2000
+					});
+					const TIME_COUNT = 60;
+					this.$set(this, 'codeType', true);
+					if (!this.timer) {
+						this.$set(this, 'seconds', TIME_COUNT);
+						this.timer = setInterval(() => {
+							if (this.seconds > 1 && this.seconds <= TIME_COUNT) {
+								this.seconds -= 1;
+							} else {
+								this.$set(this, 'codeType', false);
+								clearInterval(this.timer);
+								this.$set(this, 'timer', null);
+							}
+						}, 1000);
+					}
 				}
 			},
 			//提交
-			submitButton(){
+			submitButton() {
+				let self = this;
 				const reg = /^1[3|4|5|7|8|9][0-9]\d{8}$/
-				const password = /^(?=(?:.*[A-Z]){1})(?=(?:.*[a-z]){1})(?=(?:.*[0-9]){1})(?=(?:.*[!@#*?&]){1})(?!(.)\1)(.{10,16})$/
-				if(!this.form.data1){
+				const password =
+					/^(?=(?:.*[A-Z]){1})(?=(?:.*[a-z]){1})(?=(?:.*[0-9]){1})(?=(?:.*[!@#*?&]){1})(?!(.)\1)(.{10,16})$/
+				if (!this.form.mobile) {
 					uni.showToast({
 						title: '请输入手机号码',
 						icon: "none",
 						duration: 3000
 					});
 					return
-				}else if (!reg.test(this.form.data1)) {
+				} else if (!reg.test(this.form.mobile)) {
 					uni.showToast({
 						title: '请输入正确的手机号码',
 						icon: "none",
 						duration: 3000
 					});
 					return
-				}else if(!this.form.data2){
-					uni.showToast({
-						title: '请输入学/工号',
-						icon: "none",
-						duration: 3000
-					});
-					return
-				}else if(!this.form.data3){
+				} else if (!this.form.captcha) {
 					uni.showToast({
 						title: '请输入手机验证码',
 						icon: "none",
 						duration: 3000
 					});
 					return
-				}else if(!this.form.data4){
+				} else if (!this.form.newPassword) {
 					uni.showToast({
 						title: '请输入新密码',
 						icon: "none",
 						duration: 3000
 					});
 					return
-				}else if(!this.form.data5){
+				} else if (!this.form.confirmPassword) {
 					uni.showToast({
 						title: '请再次输入确认密码',
 						icon: "none",
 						duration: 3000
 					});
 					return
-				}else if(this.form.data4!=this.form.data5){
+				} else if (this.form.newPassword != this.form.confirmPassword) {
 					uni.showToast({
 						title: '新密码与确认新密码不一致',
 						icon: "none",
 						duration: 3000
 					});
 					return
-				}else if(!password.test(this.form.data4)||!password.test(this.form.data5)){
+				} else if (!password.test(this.form.newPassword) || !password.test(this.form.confirmPassword)) {
 					uni.showToast({
 						title: '密码长度最少10位 最多16位,必须同时包含一个大写字母、一个小写字母、一个数字和一个特殊字符!@#*?&',
 						icon: "none",
@@ -168,13 +182,37 @@
 					content: '',
 					success(res) {
 						if (res.confirm) {
-							console.log('确定')
+							// console.log('确定')
+							self.authForgetPassword();
 						} else if (res.cancel) {
-							console.log('取消')
+							// console.log('取消')
 						}
 					}
 				})
 			},
+			async authForgetPassword(){
+				let self = this;
+				let obj = {
+					mobile:this.form.mobile,
+					captcha:this.form.captcha,
+					newPassword:md5.hex_md5(this.form.newPassword),
+					confirmPassword:md5.hex_md5(this.form.confirmPassword),
+				};
+				const {
+					data
+				} = await authForgetPassword(obj);
+				if (data.code == 200) {
+					uni.showToast({
+						title: '操作成功',
+						icon: "none",
+						mask: true,
+						duration: 2000
+					});
+					setTimeout(function(){
+						uni.navigateBack();
+					},2000);
+				}
+			},
 		},
 
 	}
@@ -183,90 +221,105 @@
 
 <style lang="stylus" scoped>
 	#forgotPassword {
-		height:100%;
+		height: 100%;
 		display: flex;
 		flex-direction: column;
-		flex:1;
+		flex: 1;
 		background-color: #FFFFFF;
 		overflow-y: scroll;
 		overflow-x: hidden;
-		.page-title{
-			line-height:120rpx;
+
+		.page-title {
+			line-height: 120rpx;
 			font-weight: 700;
 			font-size: 34rpx;
-			margin-left:30rpx;
+			margin-left: 30rpx;
 		}
-		.input-max-box{
-			padding:0 30rpx;
-			view{
+
+		.input-max-box {
+			padding: 0 30rpx;
+
+			view {
 				line-height: 80rpx;
-				font-size:30rpx;
-				font-weight:700;
+				font-size: 30rpx;
+				font-weight: 700;
 			}
-			input{
-				width:630rpx;
-				height:100rpx;
-				line-height:100rpx;
-				border-radius:10rpx;
-				border:1px solid #D8D8D8;
-				padding:0 30rpx;
+
+			input {
+				width: 630rpx;
+				height: 100rpx;
+				line-height: 100rpx;
+				border-radius: 10rpx;
+				border: 1px solid #D8D8D8;
+				padding: 0 30rpx;
 			}
 		}
-		.input-button-max-box{
-			padding:0 30rpx;
-			view:nth-child(1){
+
+		.input-button-max-box {
+			padding: 0 30rpx;
+
+			view:nth-child(1) {
 				line-height: 80rpx;
-				font-size:30rpx;
-				font-weight:700;
+				font-size: 30rpx;
+				font-weight: 700;
 			}
-			.input-button-box{
+
+			.input-button-box {
 				display: flex;
-				input{
-					width:412rpx;
-					height:100rpx;
-					line-height:100rpx;
-					border-radius:10rpx;
-					border:1px solid #D8D8D8;
-					padding:0 30rpx;
-					margin-right:18rpx;
+
+				input {
+					width: 412rpx;
+					height: 100rpx;
+					line-height: 100rpx;
+					border-radius: 10rpx;
+					border: 1px solid #D8D8D8;
+					padding: 0 30rpx;
+					margin-right: 18rpx;
 				}
-				view{
-					width:200rpx;
-					line-height:100rpx;
+
+				view {
+					width: 200rpx;
+					line-height: 100rpx;
 					text-align: center;
-					font-size:30rpx;
-					border-radius:10rpx;
+					font-size: 30rpx;
+					border-radius: 10rpx;
 				}
-				.checkButton{
-					color:#333;
+
+				.checkButton {
+					color: #333;
 					background-color: #E8E8E8;
 				}
-				.noCheckButton{
-					color:#fff;
+
+				.noCheckButton {
+					color: #fff;
 					background-color: #0183FA;
 				}
 			}
 		}
-		.bottom-button-box{
+
+		.bottom-button-box {
 			display: flex;
-			margin:43rpx 0;
-			view{
-				font-size:30rpx;
-				line-height:100rpx;
+			margin: 43rpx 0;
+
+			view {
+				font-size: 30rpx;
+				line-height: 100rpx;
 				text-align: center;
 			}
-			view:nth-child(1){
-				width:220rpx;
-				margin:0 33rpx 0 30rpx;
+
+			view:nth-child(1) {
+				width: 220rpx;
+				margin: 0 33rpx 0 30rpx;
 				border-radius: 50rpx 50rpx 50rpx 50rpx;
 				border: 1rpx solid #E0E0E0;
 			}
-			view:nth-child(2){
-				width:437rpx;
-				color:#fff;
+
+			view:nth-child(2) {
+				width: 437rpx;
+				color: #fff;
 				background: #0183FA;
 				border-radius: 50rpx 50rpx 50rpx 50rpx;
 			}
 		}
 	}
-</style>
+</style>