ソースを参照

修改注册、添加实名认证

lihongxiao 1 年間 前
コミット
462934894b

+ 84 - 57
components/modules/index/index-nav.vue

@@ -144,7 +144,6 @@
 			event(item) {},
 			//分类跳转
 			async tapEvent(e) {
-				
 				this.form.name = "";
 				this.form.identifyNumber = "";
 				this.form.identifyValidDate = "";
@@ -160,60 +159,13 @@
 					})
 				}
 				if (this.userInfo.sysUser.status == '2') {
-					let res = await this.$http.get('/apps/getApplicationStatus?jobNumber=' + this.userInfo.sysUser.id);
-					if (res.code == 200) {
-						this.getApplicationStatus = res.data;
-						if (this.getApplicationStatus == '0') {
-							if (!e.src || e.src == '#' || e.src == '') {
-								uni.showToast({
-									icon: "none",
-									title: '正在开发中...',
-									duration: 1500
-								})
-							} else {
-								uni.showToast({
-									icon: "none",
-									title: '实名认证等待审核中',
-									duration: 1500
-								})
-							}
-						} else if (this.getApplicationStatus == '3') {
-							if (!e.src || e.src == '#' || e.src == '') {
-								uni.showToast({
-									icon: "none",
-									title: '正在开发中...',
-									duration: 1500
-								})
-							} else {
-								uni.showToast({
-									icon: "none",
-									title: '实名认证不通过,请修改后提交',
-									duration: 1500
-								})
-								setTimeout(() => {
-									uni.navigateTo({
-										url: '/pages/user/certification'
-									})
-								}, 1000)
-							}
-						}
-					} else {
-						if (!e.src || e.src == '#' || e.src == '') {
-							uni.showToast({
-								icon: "none",
-								title: '正在开发中...',
-								duration: 1500
-							})
-						} else {
-							this.show();
-							setTimeout(() => {
-								uni.navigateTo({
-									url: '/pages/user/infoInput'
-								})
-							}, 1000)
-						}
-					}
-				} else if (this.userInfo.sysUser.status == '1') {
+					uni.showToast({
+						icon: "none",
+						title: '请先通过实名认证',
+						duration: 1500
+					})
+				}
+				 else if (this.userInfo.sysUser.status == '1') {
 					if (!e.src || e.src == '#' || e.src == '') {
 						uni.showToast({
 							icon: "none",
@@ -225,9 +177,84 @@
 								url: e.src
 							}, "navigateTo", true)
 					}
-				} else {
-					this.show1 = false;
 				}
+				
+				// if (this.userInfo.sysUser.status == '2') {
+				// 	let res = await this.$http.get('/apps/getApplicationStatus?jobNumber=' + this.userInfo.sysUser.id);
+				// 	if (res.code == 200) {
+				// 		this.getApplicationStatus = res.data;
+				// 		if (this.getApplicationStatus == '0') {
+				// 			if (!e.src || e.src == '#' || e.src == '') {
+				// 				uni.showToast({
+				// 					icon: "none",
+				// 					title: '正在开发中...',
+				// 					duration: 1500
+				// 				})
+				// 			} else {
+				// 				uni.showToast({
+				// 					icon: "none",
+				// 					title: '该账户已删除',
+				// 					duration: 1500
+				// 				})
+				// 			}
+				// 		} else if (this.getApplicationStatus == '3') {
+				// 			if (!e.src || e.src == '#' || e.src == '') {
+				// 				uni.showToast({
+				// 					icon: "none",
+				// 					title: '正在开发中...',
+				// 					duration: 1500
+				// 				})
+				// 			} else {
+				// 				uni.showToast({
+				// 					icon: "none",
+				// 					title: '实名认证不通过,请修改后提交',
+				// 					duration: 1500
+				// 				})
+				// 				setTimeout(() => {
+				// 					uni.navigateTo({
+				// 						url: '/pages/user/certification'
+				// 					})
+				// 				}, 1000)
+				// 			}
+				// 		}
+				// 		else if (this.getApplicationStatus == '2') {
+				// 			uni.showToast({
+				// 				icon: "none",
+				// 				title: '请先通过实名认证',
+				// 				duration: 1500
+				// 			})
+				// 		}
+				// 	} else {
+				// 		if (!e.src || e.src == '#' || e.src == '') {
+				// 			uni.showToast({
+				// 				icon: "none",
+				// 				title: '正在开发中...',
+				// 				duration: 1500
+				// 			})
+				// 		} else {
+				// 			this.show();
+				// 			setTimeout(() => {
+				// 				uni.navigateTo({
+				// 					url: '/pages/user/infoInput'
+				// 				})
+				// 			}, 1000)
+				// 		}
+				// 	}
+				// } else if (this.userInfo.sysUser.status == '1') {
+				// 	if (!e.src || e.src == '#' || e.src == '') {
+				// 		uni.showToast({
+				// 			icon: "none",
+				// 			title: '正在开发中...',
+				// 			duration: 1500
+				// 		})
+				// 	} else {
+				// 			this.navigate({
+				// 				url: e.src
+				// 			}, "navigateTo", true)
+				// 	}
+				// } else {
+				// 	this.show1 = false;
+				// }
 			},
 			xueliConfirm(e) {
 				this.form.xueli = e[0].value;

+ 2 - 2
config/baseUrl.js

@@ -3,8 +3,8 @@ let h5BaseUrl = "";
 let socketUrl = "";
 if (process.env.NODE_ENV === 'development') {
 	// 开发环境
-	baseUrl = "http://39.98.239.48/web-api"; //测试
-       // baseUrl = 'http://192.168.0.111:8080'
+	// baseUrl = "http://39.98.239.48/web-api"; //测试
+       baseUrl = 'http://192.168.0.111:8080'
 	h5BaseUrl = "http://39.98.239.48/h5";
 	// baseUrl = "http://sxzgkj.baoxianzhanggui.com/web-api";//正式
 	// h5BaseUrl = "http://sxzgkj.baoxianzhanggui.com/h5";

+ 34 - 47
config/login.js

@@ -222,58 +222,45 @@ async function getLoginUserInfo(token,userId) {
 		title: 'avatar',
 		data: avatar
 	})
-	let loginStatus = await getStaffStatus(userId);
-	if (loginStatus) {
-		return true;
-	} else {
-		return false;
-	}
+	return true;
+	// let loginStatus = await getStaffStatus(userId);
+	// if (loginStatus) {
+	// 	return true;
+	// } else {
+	// 	return false;
+	// }
 }
 // 查询人员状态status,1为审核通过 2为新注册人员(新注册人员又分为5个状态 1:未认证 2:认证中 3:驳回认证 4:退回修改 5正常)
 async function getStaffStatus(userId) {
-	//查询登录人的状态信息
+	// 人员状态:1正常  0删除  2新注册  3审批不通过
+	
+ 	//查询登录人的状态信息
 	let res = await $http.get('/user/findByName?name=' + userId)
 	//默认人员状态是未认证状态
-	var status = '1';
-	if (res.data.status == '1') {
-		//正式人员
-		status = '5'; //审核通过
-		let userInfoRes = await $http.get('/user/loginUser'); //用户信息
-		store.commit('setUserModules', {
-			title: 'userInfo',
-			data: {
-				sysUser:{...userInfoRes.data}
-			}
-		})
-	} else {
-		let userInfoRes = await $http.get('/user/loginUser'); //用户信息
-		store.commit('setUserModules', {
-			title: 'userInfo',
-			data: {
-				sysUser:{...userInfoRes.data}
-			}
-		})
-		//注册人员
-		let res1 = await $http.get('/esmUserInternalcheck/findById?checkid=' + userId);
-		store.commit('setUserModules', {
-			title: 'userCheckInfo',
-			data: res1.data
-		})
-		//判断人员审核状态
-		// if ((!res1.data.esmUserInternal.identity) && (res1.data.esmUserInternal.status == '0')) {
-		// 	console.log(1)
-		// 	status = '1'; //未认证
-		// } else if ((!!res1.data.esmUserInternal.identity) && (res1.data.esmUserInternal.status == '0')) {
-		// 	console.log(1)
-		// 	status = '2'; //认证中
-		// } else if (res1.data.esmUserInternal.status == '2') {
-		// 	console.log(1)
-		// 	status = '3'; //审核驳回
-		// } else if (res1.data.esmUserInternal.status == '3') {
-		// 	console.log(1)
-		// 	status = '4'; //退回修改
-		// }
-	}
+	// var status = '1';
+	// if (res.data.status == '1') {
+	// 	status = '5'; 
+	// 	let userInfoRes = await $http.get('/user/loginUser'); //用户信息
+	// 	store.commit('setUserModules', {
+	// 		title: 'userInfo',
+	// 		data: {
+	// 			sysUser:{...userInfoRes.data}
+	// 		}
+	// 	})
+	// } else {
+	// 	let userInfoRes = await $http.get('/user/loginUser'); //用户信息
+	// 	store.commit('setUserModules', {
+	// 		title: 'userInfo',
+	// 		data: {
+	// 			sysUser:{...userInfoRes.data}
+	// 		}
+	// 	})
+	// 	let res1 = await $http.get('/esmUserInternalcheck/findById?checkid=' + userId);
+	// 	store.commit('setUserModules', {
+	// 		title: 'userCheckInfo',
+	// 		data: res1.data
+	// 	})
+	// }
 	store.commit('setUserModules', {
 		title: 'userStatus',
 		data: status

+ 7 - 0
pages.json

@@ -707,6 +707,13 @@
 				"enablePullDownRefresh": false
 			}
 
+		},{
+			"path": "pages/realname/realname",
+			"style": {
+				"navigationBarTitleText": "实名认证",
+				"enablePullDownRefresh": false
+			}
+
 		}
 	],
 	"globalStyle": {

+ 33 - 19
pages/index/index.vue

@@ -1,13 +1,15 @@
 <template>
 	<view>
-		<u-notice-bar :autoplay="autoplay" :playState="playState" :speed="speed" :mode="mode" @click="click"
+		<!-- <u-notice-bar :autoplay="autoplay" :playState="playState" :speed="speed" :mode="mode" @click="click"
 			:show="show" :type="type" :list="list" :moreIcon="moreIcon" :volumeIcon="volumeIcon" :duration="duration"
 			bgColor="" padding="8rpx 24rpx" :isCircular="isCircular"
-			style="position: absolute;top: 12%;z-index: 9;width: 100%;"></u-notice-bar>
+			style="position: absolute;top: 12%;z-index: 9;width: 100%;"></u-notice-bar> -->
+			
 		<!-- 更新组件 force 是否强制更新   tabbar:页面是否有原生tabbar组件-->
 		<app-update ref="app_update" :tabbar="false"></app-update>
 		<!-- 状态栏 -->
 		<view class="status" :style="{position:headerPosition,backgroundColor:bgColor}"></view>
+		
 		<!-- 漂浮头部 -->
 		<view class="header" :style="{position:headerPosition,backgroundColor:bgColor}">
 			<view class="scan">
@@ -18,14 +20,21 @@
 				<input disabled placeholder="车险" @tap="toSearch()" />
 			</view>
 			<view class="menu">
-				<image mode="aspectFill" :src="avatar"></image>
+				<image mode="aspectFill" :src="avatar" 	@click='isShow?navigate({url:"/pages/realname/realname"},"navigateTo",true):""'></image>
 			</view>
 		</view>
 		<!-- 公共组件-每个页面必须引入 -->
 		<public-module></public-module>
 		<!-- 占位 -->
 		<view class="place" :style="{backgroundColor:'#fff'}"></view>
-
+		<!-- 实名认证提示 -->
+		<u-notice-bar
+		:list="list" 
+		v-show="isShow"
+		 type="error"
+		 padding="8rpx 24rpx"
+		  @click='navigate({url:"/pages/realname/realname"},"navigateTo",true)'
+		></u-notice-bar>
 		<!-- 轮播图 -->
 		<swiper-image :resdata="swiperList" @changeEvent="swiperChange"></swiper-image>
 
@@ -116,7 +125,7 @@
 				contentSlot: true,
 				showTitle: false,
 				asyncClose: false,
-				show: false,
+				isShow: false,
 				autoplay: true,
 				type: 'warning',
 				list: ['欢迎登录晋掌柜,请点击此处文字进行实名验证,方可使用所有功能。'],
@@ -195,7 +204,6 @@
 					}
 				],
 
-
 				//推荐商品 3个
 				pickList: [{
 						goods_id: 0,
@@ -319,6 +327,7 @@
 		},
 		async onLoad() {
 			// uni.startPullDownRefresh(); 
+			this.isShow=this.userInfo.sysUser.status=='2'?true:false
 			let res = await this.$http.get('/apps/getApplicationStatus?jobNumber=' + this.userInfo.sysUser.id);
 			if (res.code == 200) {
 				if (res.data == '0') {
@@ -337,16 +346,19 @@
 		// },
 		//下拉刷新,需要自己在page.json文件中配置开启页面下拉刷新 "enablePullDownRefresh": true
 		async onPullDownRefresh() {
-			let userInfoRes = await this.$http.get('/esmUserInternal/findById?id=' + this.userInfo.sysUser.id, {}, {});
+			let userInfoRes = await this.$http.get('/user/loginUser')
+			// let userInfoRes = await this.$http.get('/esmUserInternal/findById?id=' + this.userInfo.sysUser.id, {}, {});
 			uni.stopPullDownRefresh();
 			store.commit('setUserModules', {
 				title: 'userInfo',
-				data: userInfoRes.data
+				data: {
+					sysUser:{...userInfoRes.data}
+				}
 			})
-			if (userInfoRes.data.sysUser.status == 2) {
-				this.show = true;
+			if (userInfoRes.data.status == 2) {
+				this.isShow = true; 
 			} else {
-				this.show = false;
+				this.isShow = false;
 			}
 
 		},
@@ -381,15 +393,17 @@
 			}, 1000)
 		},
 
-		 async onShow() {
-			if (this.userInfo.sysUser.status == '2') {
-				this.show = true;
-			} else {
-				this.show = false;
-			}
-			
-		},
+		//  async onShow() {
+		// 	if (this.userInfo.sysUser.status == '2') {
+		// 		this.show = true;
+		// 	} else {
+		// 		this.show = false;
+		// 	}
+		// },
 		methods: {
+			nameClick(){
+				this.navigate({url:"/pages/realname/realname"},"navigateTo",true)
+			},
 			async chooseImage() {
 				var _this = this;
 				uni.chooseImage({

+ 195 - 0
pages/realname/realname.vue

@@ -0,0 +1,195 @@
+<template>
+	<view>
+		<!-- 公共组件-每个页面必须引入 -->
+		<public-module></public-module>
+		<u-form  :model="form" ref="uForm" class="addStaffManage" >
+			<u-form-item label="姓名" prop="name"><u-input v-model="form.name" /></u-form-item>
+			<!-- <u-form-item label="性别">
+				<u-input type="select" :select-open="showSex" v-model="form.sex"
+						placeholder="请选择性别" @click="showSex = true"
+						placeholder-style="color:#808080"></u-input>
+				<u-select v-model="showSex" mode="single-column" :list="actions"
+				 @confirm="sexSelect"></u-select>
+					
+			</u-form-item> -->
+			<u-form-item label="身份证号" prop="identity"><u-input v-model="form.identity"  /></u-form-item>
+			 <u-button hover-class="none" :custom-style="submitBtnStyle" type="success" @click="submit">提交</u-button>
+		</u-form>
+		
+		
+	</view>
+</template>
+
+<script>
+	import {
+		mapState
+	} from "vuex"
+	export default {
+		data() {
+			//身份证验证
+			function validateSfz(rule, value, callback) {
+			  if (!value) {
+			    return callback(new Error('身份证号码不能为空'));
+			  }
+			  function validataCredentials(num) {
+			    var msg, boo; //  msg身份证验证友情提示,boo返回值
+			    var num = num.toUpperCase(); // 身份证为末尾可能是X
+			    //   身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,
+			    //   最后一位是校验位,可能为数字或字符X。
+			    const arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
+			    const arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
+			    var nTemp = 0,
+			      i;
+			    if (!(/(^\d{15}$)|(^\d{17}([0-9]|X)$)/.test(num))) {
+			      //  输入的身份证号长度不对,或者号码不符合规定;
+			      return [boo = false, msg = "身份证号码不符合规定"];
+			    }
+			    //   校验位按照ISO 7064:1983.MOD 11-2的规定生成,X可以认为是数字10。
+			    //   下面分别分析出生日期和校验位
+			    var len, re;
+			    len = num.length;
+			    if (len == 15) {
+			      re = new RegExp(/^(\d{6})(\d{2})(\d{2})(\d{2})(\d{3})$/);
+			      var arrSplit = num.match(re);
+			      //   检查生日日期是否正确
+			      var dtmBirth = new Date('19' + arrSplit[2] + '/' + arrSplit[3] + '/' + arrSplit[4]);
+			      var bGoodDay;
+			      bGoodDay = (dtmBirth.getYear() == Number(arrSplit[2])) && ((dtmBirth.getMonth() + 1) == Number(arrSplit[3])) && (dtmBirth.getDate() == Number(arrSplit[4]));
+			      if (!bGoodDay) {
+			        //   输入的身份证号里出生日期不对!
+			        return [boo = false, msg = "输入的身份证号里出生日期不对!"];
+			
+			      } else {
+			        //   将15位身份证转成18位
+			        //   校验位按照ISO 7064:1983.MOD 11-2的规定生成,X可以认为是数字10。   
+			        num = num.substr(0, 6) + '19' + num.substr(6, num.length - 6);
+			        for (i = 0; i < 17; i++) {
+			          nTemp += num.substr(i, 1) * arrInt[i];
+			        }
+			        num += arrCh[nTemp % 11];
+			        return [boo = true, msg = num];
+			      }
+			    }
+			    if (len == 18) {
+			      re = new RegExp(/^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/);
+			      var arrSplit = num.match(re);
+			      //  检查生日日期是否正确
+			      var dtmBirth = new Date(arrSplit[2] + "/" + arrSplit[3] + "/" + arrSplit[4]);
+			      var bGoodDay;
+			      bGoodDay = (dtmBirth.getFullYear() == Number(arrSplit[2])) && ((dtmBirth.getMonth() + 1) == Number(arrSplit[3])) && (dtmBirth.getDate() == Number(arrSplit[4]));
+			      if (!bGoodDay) {
+			        //  输入的身份证号里出生日期不对! 
+			
+			        return [boo = false, msg = " 输入的身份证号里出生日期不对"];
+			      } else {
+			        //  检验18位身份证的校验码是否正确。
+			        //  校验位按照ISO 7064:1983.MOD 11-2的规定生成,X可以认为是数字10。
+			        var valnum;
+			        for (i = 0; i < 17; i++) {
+			          nTemp += num.substr(i, 1) * arrInt[i];
+			        }
+			        valnum = arrCh[nTemp % 11];
+			        if (valnum != num.substr(17, 1)) {
+			          //  18位身份证的校验码不正确!
+			          return [boo = false, msg = "身份证的校验码不正确!"];
+			        }
+			        return [boo = true, msg = "验证成功"]
+			      }
+			    }
+			    return [boo = false, msg = "身份证的长度不正确!"];
+			  }
+			  setTimeout(() => {
+			    var res = validataCredentials(value);
+			    if (!res[0]) {
+			      callback(new Error(res[1]));
+			    } else {
+			      callback();
+			    }
+			  }, 200);
+			}
+			return {
+				showSex:false,
+				 submitBtnStyle: {
+					margin: "30rpx 0rpx 0rpx",
+					color: "#ffffff",
+					fontWeight: "550",
+					letterSpacing: "10rpx",
+					backgroundColor: "#ea552d",
+				},
+				form: {
+					name: '',
+					identity: '',
+				},
+				actions: [{
+						value: '1',
+						label: '男'
+					},
+					{
+						value: '2',
+						label: '女'
+					},
+					{
+						value: '3',
+						label: '未知'
+					}
+							],
+					rules: {
+						name: [
+							{
+								required: true,
+								message: '请输入姓名',
+								trigger: ['blur', 'change']
+							}
+						],
+						identity: [
+							// {
+							// 	required: true,
+							// 	message: '请输入身份证号',
+							// 	trigger: ['blur', 'change']
+							// }
+							{ required: true, message: "请填写身份证号" },
+						   { validator: validateSfz }
+						]
+					}
+			}
+		},
+		computed: {
+			...mapState(['userInfo'])
+		},
+		
+		methods: {
+			sexSelect(e) {
+				this.form.sex = e[0].label
+			},
+			async submit(){
+				this.$refs.uForm.validate(valid => {
+					if (valid) {
+						console.log('验证通过');
+						console.log(this.userInfo.sysUser,11111111)
+					} else {
+						console.log('验证失败');
+					}
+				});
+				// let res = await this.$http.post('/user/updateUserInfo/' + this.userInfo.sysUser.id,
+				// {
+				// 	sysUser:{name:this.form.name,identity:this.form.identity,status:'1',
+				// 	mobile:this.userInfo.sysUser.mobile,deptId:this.userInfo.sysUser.deptId,
+				// 	deptName:this.userInfo.sysUser.deptName,
+				// 	},
+				// 	sysUserInfo:{},
+				// });
+				// console.log(res,11111111)
+			}
+		},
+		onReady() {
+			this.$refs.uForm.setRules(this.rules);
+		}
+	}
+</script>
+
+<style>
+	.addStaffManage{
+		height: 220upx;
+		margin: 0 40upx;
+	}
+</style>

+ 29 - 25
pages/register/register.vue

@@ -73,7 +73,7 @@
 			// // #ifdef H5
 			// document.getElementsByTagName('uni-page-head')[0].style.display = 'none'
 			// // #endif
-			if(!!params.id){
+			if(params.id){
 				this.recommenderid = params.id;
 				// 查询推荐人信息
 				let res = await this.$http.get('/user/findById?id='+params.id);
@@ -81,28 +81,31 @@
 					this.recommendername = res.data.name;
 					this.showRecommend = true;
 				}else{
-					if(this.$base.baseUrl.indexOf("test")>-1){
-						this.recommenderid="99140109M01D01001";
-						this.recommendername = "耿陈杰";
+					    uni.showToast({ title:res.msg , icon:"success",duration:2000 });
 						this.showRecommend = false;
-					}else{
-						this.recommenderid="99140109M03D01001";
-						this.recommendername = "掌柜老王";
-						this.showRecommend = false;
-					}
+					// if(this.$base.baseUrl.indexOf("test")>-1){
+					// 	this.recommenderid="99140109M01D01001";
+					// 	this.recommendername = "耿陈杰";
+					// 	this.showRecommend = false;
+					// }else{
+					// 	this.recommenderid="99140109M03D01001";
+					// 	this.recommendername = "掌柜老王";
+					// 	this.showRecommend = false;
+					// }
 					
 				}
-			}else{
-				if(this.$base.baseUrl.indexOf("test")>-1){
-					this.recommenderid="99140109M01D01001";
-					this.recommendername = "耿陈杰";
-					this.showRecommend = false;
-				}else{
-					this.recommenderid="99140109M03D01001";
-					this.recommendername = "掌柜老王";
-					this.showRecommend = false;
-				}
 			}
+			// else{
+			// 	if(this.$base.baseUrl.indexOf("test")>-1){
+			// 		this.recommenderid="99140109M01D01001";
+			// 		this.recommendername = "耿陈杰";
+			// 		this.showRecommend = false;
+			// 	}else{
+			// 		this.recommenderid="99140109M03D01001";
+			// 		this.recommendername = "掌柜老王";
+			// 		this.showRecommend = false;
+			// 	}
+			// }
 		},
 		watch:{
 			name(){
@@ -192,7 +195,7 @@
 				// this.phone="";
 				// this.code="";
 				// this.name="";
-				if((res.code==200) && (!!res.data)){
+				if((res.code==200) && (!!res.data)){	
 					// #ifndef H5
 					this.setUserModules({title:"userLoginId",data:res.data})
 					uni.showToast({ title: '注册成功', icon:"success",duration:2000 });
@@ -209,12 +212,13 @@
 					}, 2000);
 					// #endif
 				}
-				else if(res.code==500){
-					uni.showToast({ title:res.msg , icon:"success",duration:2000 });
-				}
-				else{
-					uni.showToast({ title: '已注册,重复注册', icon:"success",duration:2000 });
+				else {
+					uni.showToast({ 
+						title:res.msg , icon:"success",duration:2000 });
 				}
+				// else{
+				// 	uni.showToast({ title: '已注册,重复注册', icon:"success",duration:2000 });
+				// }
 			}
 			
 		}