Bläddra i källkod

学生信息完善

dedsudiyu 2 månader sedan
förälder
incheckning
d50fba967b
2 ändrade filer med 135 tillägg och 52 borttagningar
  1. 8 0
      pages_basics/api/index.js
  2. 127 52
      pages_basics/views/completeInformation/completeInformation.vue

+ 8 - 0
pages_basics/api/index.js

@@ -234,6 +234,14 @@ export const systemUserSelectByPage  = (data) => {
 				data: { ...data }
     })
 };
+//查询导师列表-老师/非本科学生
+export const systemUserSelectUserNotBenKeByPage  = (data) => {
+    return apiResquest({
+        url: `/system/user/selectUserNotBenKeByPage`,
+        method: 'POST',
+				data: { ...data }
+    })
+};
 //完善用户信息-提交
 export const systemUserEditUserAndPhone  = (data) => {
     return apiResquest({

+ 127 - 52
pages_basics/views/completeInformation/completeInformation.vue

@@ -61,6 +61,24 @@
 					</view>
 				</view>
 			</view>
+			<!-- 学生类型 -->
+			<view class="button-max-box" v-if="newData.userType == 2 && !newData.education">
+				<view class="button-top-box">
+					<view>*</view>
+					<view>学生类型</view>
+				</view>
+				<picker @change="educationChange" :value="educationIndex" :range="educationList" :range-key="'label'">
+					<view class="button-bottom-p" :class="educationIndex?'':'button-bottom-p-null'">{{educationIndex?educationList[educationIndex].label:'请选择学生类型'}}</view>
+				</picker>
+			</view>
+			<view class="text-max-box" v-if="newData.userType == 2 && newData.education">
+				<view class="text-top-box">
+					<view>*</view>
+					<view>学生类型</view>
+				</view>
+				<view class="text-bottom-p">{{newData.educationName}}</view>
+			</view>
+			<!-- 导师 -->
 			<view class="button-max-box" v-if="newData.userType == 2 && !newData.tutorUserName">
 				<view class="button-top-box">
 					<view>*</view>
@@ -112,9 +130,13 @@
 	import {
 		systemUserDetail,
 		systemUserSelectByPage,
+		systemUserSelectUserNotBenKeByPage,
 		systemUserEditUserAndPhone,
 		authNumCaptchaNotRegistered,
 	} from '@/pages_basics/api/index.js'
+	import {
+		getDicts
+	} from '@/api/index.js'
 	export default {
 		data() {
 			return {
@@ -129,6 +151,7 @@
 					mobile:"",
 					supervisorName:"",
 					supervisorId:"",
+					education:"",
 				},
 				userShowType:false,
 				checkUserUserId:null,
@@ -141,6 +164,9 @@
 				},
 				getDataType: false,
 				total: 0,
+				//学生类别列表
+				educationList:[],
+				educationIndex:0,
 				//教师查询列表
 				dataList:[],
 				//定时器
@@ -153,17 +179,43 @@
 			
 		},
 		onShow() {
-			this.systemUserDetail();
+			this.getDicts();
 		},
 		methods: {
+			//学生类型列表
+			async getDicts(){
+				//学生类别查询
+				const { data } = await getDicts('education')
+				if (data.code == 200) {
+					this.$set(this,'educationList',data.data);
+					this.systemUserDetail();
+				}
+			},
+			//选中学生类型
+			educationChange(val){
+				this.$set(this,'educationIndex',val.detail.value);
+				this.$set(this.form,'education',this.educationList[val.detail.value].value);
+				this.$set(this.form,'supervisorName','');
+				this.$set(this.form,'supervisorId','');
+				this.$set(this,'checkUserUserId','');
+				this.$set(this, 'getDataType', false);
+				this.$set(this, 'dataList', []);
+				this.$set(this, 'total', 0);
+				this.$set(this.getData, 'page', 1);
+			},
+			//信息详情
 			async systemUserDetail(){
+				let self = this;
 				const { data } = await systemUserDetail({userId:uni.getStorageSync('userId')});
 				if (data.code == 200) {
+					for(let i=0;i<self.educationList.length;i++){
+						if(data.data.education == self.educationList[i].value){
+							data.data.educationName = self.educationList[i].label;
+						}
+					}
 					this.$set(this,'newData',data.data);
-					this.systemUserSelectByPage();
 				}
 			},
-			
 			//获取验证码
 			getCode() {
 				let self = this;
@@ -248,7 +300,7 @@
 						return
 					} 
 				}else if(this.newData.userType == 2){
-					if(!this.newData.mobile && !this.newData.tutorUserName){
+					if(!this.newData.mobile){
 						if(!this.form.mobile){
 							uni.showToast({
 								title: '请输入手机号码',
@@ -270,15 +322,19 @@
 								duration: 3000
 							});
 							return
-						} else if(!this.checkUserUserId){
+						}
+					}
+					if(!this.newData.education){
+						if(!this.form.education){
 							uni.showToast({
-								title: '请选择导师',
+								title: '请选择学生类型',
 								icon: "none",
 								duration: 3000
 							});
 							return
 						}
-					}else if(this.newData.mobile){
+					}
+					if(!this.newData.tutorUserName){
 						if(!this.checkUserUserId){
 							uni.showToast({
 								title: '请选择导师',
@@ -287,29 +343,6 @@
 							});
 							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({
@@ -336,15 +369,15 @@
 					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;
+					if(!this.newData.mobile){
 						obj.mobile = this.form.mobile;
 						obj.captcha = this.form.captcha;
-					}else if(this.newData.mobile){
+					}
+					if(!this.newData.tutorUserName){
 						obj.tutorUserId = this.checkUserUserId;
-					}else{
-						obj.mobile = this.form.mobile;
-						obj.captcha = this.form.captcha;
+					}
+					if(!this.newData.education){
+						obj.education = this.form.education;
 					}
 				}
 				const { data } = await systemUserEditUserAndPhone(obj);
@@ -381,7 +414,23 @@
 			},
 			//教师弹窗开关啊
 			userButton(type){
-				this.$set(this,'userShowType',!this.userShowType);
+				if(!this.userShowType){
+					//开启时
+					if(this.newData.education||this.form.education){
+						this.systemUserSelectByPage();
+						this.$set(this,'userShowType',true);
+					}else{
+						uni.showToast({
+							title: '请先选择学生类型',
+							icon: "none",
+							duration: 3000
+						});
+						return
+					}
+				}else{
+					//关闭时
+					this.$set(this,'userShowType',false);
+				}
 			},
 			//选中教师
 			checkUser(item){
@@ -402,7 +451,7 @@
 					})
 				}
 			},
-			//获取实验室
+			//获取导师信息
 			async systemUserSelectByPage() {
 				let self = this;
 				let obj = {
@@ -410,25 +459,47 @@
 					page:this.getData.page,
 					pageSize:this.getData.pageSize,
 					userName:this.getData.userName,
+					searchValue:this.getData.userName,
 				};
 				if(!obj.userName){
 					obj.deptId = this.newData.deptId
 				}
-				const {
-					data
-				} = await systemUserSelectByPage(obj);
-				if (data.code == 200) {
-					if (self.getData.page == 1) {
-						this.dataList = data.data.records;
-						this.total = data.data.total;
-						if (data.data.total / self.getData.pageSize <= self.getData.page) {
-							this.$set(this, 'getDataType', true);
+				if(this.newData.education == 'dazhuan'||this.form.education == 'dazhuan'||this.newData.education == 'benke'||this.form.education == 'benke'){
+					const {
+						data
+					} = await systemUserSelectUserNotBenKeByPage(obj);
+					if (data.code == 200) {
+						if (self.getData.page == 1) {
+							this.dataList = data.data.records;
+							this.total = data.data.total;
+							if (data.data.total / self.getData.pageSize <= self.getData.page) {
+								this.$set(this, 'getDataType', true);
+							}
+						} else {
+							this.dataList = [...this.dataList, ...data.data.records]
+							this.total = data.data.total;
+							if (data.data.total / self.getData.pageSize <= self.getData.page) {
+								this.$set(this, 'getDataType', true);
+							}
 						}
-					} else {
-						this.dataList = [...this.dataList, ...data.data.records]
-						this.total = data.data.total;
-						if (data.data.total / self.getData.pageSize <= self.getData.page) {
-							this.$set(this, 'getDataType', true);
+					}
+				}else if(this.newData.education == 'yanjiusheng'||this.form.education == 'yanjiusheng'||this.newData.education == 'boshi'||this.form.education == 'boshi'){
+					const {
+						data
+					} = await systemUserSelectByPage(obj);
+					if (data.code == 200) {
+						if (self.getData.page == 1) {
+							this.dataList = data.data.records;
+							this.total = data.data.total;
+							if (data.data.total / self.getData.pageSize <= self.getData.page) {
+								this.$set(this, 'getDataType', true);
+							}
+						} else {
+							this.dataList = [...this.dataList, ...data.data.records]
+							this.total = data.data.total;
+							if (data.data.total / self.getData.pageSize <= self.getData.page) {
+								this.$set(this, 'getDataType', true);
+							}
 						}
 					}
 				}
@@ -585,6 +656,10 @@
 					padding:0 30rpx;
 					border-radius: 10rpx 10rpx 10rpx 10rpx;
 					border: 1rpx solid #E0E0E0;
+					line-height: 100rpx;
+				}
+				.button-bottom-p-null{
+					color:#777;
 				}
 			}
 			.bottom-button-p{