| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648 | <template>	<view class="yezhu_body">		<view class="user_info">			<view class="user_line">							</view>			<view class="user_item">				<text class="item_name" :style="{color:titleColor}">姓名</text>				<view class="item_right">					<input placeholder-class="item_right_name_placeholder" :style="{color:titleColor}" class="item_right_name" type="text" v-model="name" maxlength="20" @input="onKeyYHKNameInput" placeholder="请输入姓名" @blur='inputName' @confirm='inputName'/>					<image class="icon_right" src="../../static/icons/icon_right_yezhu.png" mode=""></image>				</view>			</view>			<view class="user_line">							</view>			<view class="user_item">				<text class="item_name" :style="{color:titleColor}">性别</text>				<view class="item_right" @click="showGender">					<input placeholder-class="item_right_name_placeholder" :style="{color:titleColor}" class="item_right_name" type="text" :value="genderStr" placeholder="请选择" disabled/>				<image class="icon_right" src="../../static/icons/icon_right_yezhu.png" mode=""></image>				</view>			</view>			<view class="user_line">							</view>			<view class="user_item">				<text class="item_name" :style="{color:titleColor}">手机号</text>				<view class="item_right">					<input v-if="mobileOld"  placeholder-class="item_right_name_placeholder" type='number' maxlength="11"  class="item_right_name" style="color: #b1b1b1;" :value="mobileOld" disabled/>					<input v-else placeholder-class="item_right_name_placeholder" type='number' maxlength="11" style="width: calc(100% - 150rpx);" :style="{color:titleColor}" class="item_right_name" :value="mobile" placeholder="请输入" @blur='inputMobile' @confirm='inputMobile'/>					<view class="veritify" @click="getVeritify" v-if="!mobileOld"  :style="{color:color1}">						{{veritifyTxt}}					</view>					<image v-if="mobileOld" class="icon_right" src="../../static/icons/icon_right_yezhu.png" mode=""></image>				</view>			</view>						<view class="user_item" v-if="!mobileOld&&showInputVerifity">				<text class="item_name" :style="{color:titleColor}">验证码</text>				<view class="item_right">					<input placeholder-class="item_right_name_placeholder" :style="{color:titleColor}" class="item_right_name" type="text" :value="verifity" placeholder="请输入" @blur='inputVerifity' @confirm='inputVerifity'/>					<image class="icon_right" src="../../static/icons/icon_right_yezhu.png" mode=""></image>				</view>			</view>		</view>		<view class="project_ino">			<view class="user_line">							</view>			<view class="user_item">				<text class="item_name" :style="{color:titleColor}">认证项目</text>				<view class="item_right" @click="chooseHouse">					<input placeholder-class="item_right_name_placeholder"  :style="{color:titleColor}" class="item_right_name" type="text" :value="houseName" placeholder="请选择" disabled/>					<image class="icon_right" src="../../static/icons/icon_right_yezhu.png" mode=""></image>				</view>			</view>			<view class="user_line">							</view>			<view class="user_item">				<text class="item_name" :style="{color:titleColor}">证件类型</text>				<view class="item_right" @click="chooseCertificateType">					<input placeholder-class="item_right_name_placeholder" :style="{color:titleColor}" class="item_right_name" type="text" :value="certificateTypeStr" placeholder="请选择" disabled/>				<image class="icon_right" src="../../static/icons/icon_right_yezhu.png" mode=""></image>				</view>			</view>			<view class="user_line">							</view>			<view class="user_item">				<text class="item_name" :style="{color:titleColor}">证件号</text>				<view class="item_right">					<input placeholder-class="item_right_name_placeholder" :style="{color:titleColor}" class="item_right_name" type="text"  v-model ="certificateNo" placeholder="请输入" @input="idInput"  @blur='inputId' @confirm='inputId'/>					<image class="icon_right" src="../../static/icons/icon_right_yezhu.png" mode=""></image>				</view>			</view>			<view class="user_line">							</view>			<view class="user_item">				<text class="item_name" :style="{color:titleColor}">填写房号</text>				<view class="item_right">					<input placeholder-class="item_right_name_placeholder" :style="{color:titleColor}" class="item_right_name" type="text" :value="roomNo" placeholder="请输入" @blur='inputRoomNo' @confirm='inputRoomNo'/>					<image class="icon_right" src="../../static/icons/icon_right_yezhu.png" mode=""></image>				</view>			</view>		</view>	    <view class="xieyi" >	    	<image class="icon_selected" @click="agreeXieyi" v-if="agree" src="../../static/icons/icon_yezhu_selected.png" mode=""></image>			<image class="icon_selected" @click="agreeXieyi" v-else src="../../static/icons/icon_yezhu_unselected.png" mode=""></image>			<text class="tongyi">我已阅读并同意</text>			<text class="xieyi_text" :style="{color:color1}" @click="showXieyi">《入驻协议》</text>	    </view>		<view class="btn_next" @click="toRegist" :style="{background:color1}">			下一步		</view>		<dmAgreeement ref='agreement' @agree='agreeXieyi' :url='proviceUrl'></dmAgreeement>		<dmPickerView ref="genderPicker" :options="genderList" :value="gender" @confirm="confirm" title="性别"></dmPickerView>	    <dmPickerView ref="housePicker" :options="houseList" :value="houseId" @confirm="houseConfirm" title="认证项目"></dmPickerView>	    <dmPickerView ref="certificateTypePicker" :options="certificateTypeList" :value="certificateType" @confirm="certificateTypeConfirm" title="证件类型"></dmPickerView>	    <login-notice></login-notice>	    <login></login>	</view></template><script>	import dmAgreeement from "../../components/subComponents/dmAgreement.vue";	import dmPickerView from "../../components/subComponents/dmPickerView.vue";	let app = getApp();	export default {		data() {			return {				agree:false,				veritifyTxt:"获取验证码",				genderList:[					{						title:"男",						value:"1"					},					{						title:"女",						value:"0"					}				],				gender:"",				genderStr:"",				houseId:"",				houseName:"",				houseList:[],				certificateType:"1",				certificateTypeStr:"",				certificateTypeList:[{					title:"中国居民大陆身份证",					value:"1"				},{					title:"香港居民身份证",					value:"2"				},{					title:"护照",					value:"3"				}],				mobileOld:"",				mobile:"",				verifity:"",				name:"",				certificateNo:"",				roomNo:"",				timer:null,				countdownTimes:120,				showInputVerifity:true,				proviceUrl:"",				color1:"",				titleColor:""			};		},		onLoad(param) {			this.mobileOld = param.mobile;			this.color1 = getApp().globalData.color1;			this.titleColor = getApp().globalData.titleColor;			wx.hideMenuItems({			  menuList: ['menuItem:share:qq','menuItem:share:QZone','menuItem:favorite','menuItem:originPage','menuItem:copyUrl','menuItem:openWithSafari','menuItem:openWithQQBrowser'] // 要隐藏的菜单项,只能隐藏“传播类”和“保护类”按钮,所有menu项见附录3			});		},		created() {			this.queryProjectBox();			this.queryProtocolConfigView();		},		methods:{			async queryProtocolConfigView(){				let res = await this.$myRequest({					url: "/project/queryProtocolConfigView",					data: {},				})				if(res.data.success){					const curryUrl = this.curry("/hybrid/html/web/viewer.html?file=");					this.proviceUrl = curryUrl(res.data.single.ownerRegistProtocol)				}			},			curry(baseUrl) {				return function(url) {					let index = url.lastIndexOf('.');					if (url.substring(index + 1).indexOf('pdf') > -1) {						return baseUrl + url;					} else {						return url;					}				}			},			onKeyYHKNameInput(event){				let value = event.target.value;				let patt = /.*[0-9]{1,}.*/i;				var pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?%]");				let _str=""				for(let i=0,len=value.length;i<len;i++){					_str+=value[i].replace(pattern,'').replace(patt,'')				}				this.$nextTick(function(){					this.name = _str;				})			},			idInput(event){				let value = event.target.value;				let patt = /^[\u4e00-\u9fa5]+$/;				var pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?% ]");				let _str=""				for(let i=0,len=value.length;i<len;i++){					_str+=value[i].replace(pattern,'').replace(patt,'')				}				this.$nextTick(function(){					this.certificateNo = _str;				})							},			agreeXieyi(){				this.agree = !this.agree			},			showXieyi(){				uni.navigateTo({					url:"../webviewPage/webviewPage?type=3"				})			},			showGender(){				this.$refs.genderPicker.show();			},			confirm(e){				this.genderStr = e.selItem.title;				this.gender = e.selItem.value;			},			chooseCertificateType(){				this.$refs.certificateTypePicker.show();			},			certificateTypeConfirm(e){				this.certificateTypeStr = e.selItem.title;				this.certificateType = e.selItem.value;			},			async queryProjectBox() {				let ret = await this.$myRequest({					url: "/project/queryProjectBox",					data: {						"onlineStatus": "1",					}				})				this.houseList = [];				if (ret.data.success) {					let houseList = ret.data.list || [];					let count = 0;					while (count<houseList.length){						this.houseList.push({							title:houseList[count].name,							value:houseList[count].id,						})						count++;					}				}			},			async getVeritify(){				if(!this.mobile){					uni.showToast({						icon:"none",						title:"请输入手机号"					})					return 				}				var phone = /^[1][3,4,5,6,7,8,9][0-9]{9}$/				if (!phone.test(this.mobile)) {					uni.showToast({						icon:"none",						title:"请输入正确的手机号"					})					return 				}				this.showInputVerifity = true;				if(this.timer&&this.countdownTimes>=0){					return				}				let ret = await this.$myRequest({					url: "/sms/sendSmsVerifyCode",					data: {						"phone": this.mobile,					},					method:"GET"				})				if (ret.data.success) {					this.countdown();				}			},			chooseHouse(){				this.$refs.housePicker.show();			},			houseConfirm(e){				this.houseId = e.selItem.value;				this.houseName = e.selItem.title			},			countdown(){				this.timer = setInterval(()=>{					this.countdownTimes--;					this.veritifyTxt = this.countdownTimes+"s"					if(this.countdownTimes<=0){						clearInterval(this.timer);						this.timer = null;						this.veritifyTxt = '获取验证码';						this.countdownTimes = 120;					}				},1000)			},			inputName(e){				this.name = e.detail.value			},			inputMobile(e){				this.mobile = e.detail.value			},			inputVerifity(e){				this.verifity = e.detail.value			},			inputId(e){				this.certificateNo = e.detail.value			},			inputRoomNo(e){				this.roomNo = e.detail.value			},			toRegist(){				if(this.mobileOld){					this.addOrUpdate();				}else{					this.toLogin();				}			},			async toLogin(){				if(!this.mobile){					uni.showToast({						icon:"none",						title:"请输入手机号"					})					return				}								if(!this.verifity){					uni.showToast({						icon:"none",						title:"请输入验证码"					})					return				}								let ret = await this.$myRequest({					url: "/authorizedPhone",					data: {						"code": this.verifity,						"phone": this.mobile,						"userId": getApp().globalData.userId,						"projectId": getApp().globalData.projectId||"",						"shareToken": getApp().globalData.shareToken||"",					}				});			    				if(ret.data.success){					let token = ret.data.single;					getApp().globalData.token = token;					uni.$emit('request');					this.addOrUpdate();				}else{					uni.showToast({						icon:"none",						title:ret.data.message					});				}			},						async addOrUpdate() {				if(!this.name){					uni.showToast({						icon:"none",						title:"请输入姓名"					})					return				}				if(!this.gender){					uni.showToast({						icon:"none",						title:"请选择性别"					})					return				}												if(!this.houseId){					uni.showToast({						icon:"none",						title:"请选择认证项目"					})					return				}				if(!this.certificateType){					uni.showToast({						icon:"none",						title:"请选择证件类型"					})					return				}				if(!this.certificateNo){					uni.showToast({						icon:"none",						title:"请输入证件号"					})					return				}else{					if(this.certificateType==1){						if(this.certificateNo.length!=18){							uni.showToast({								icon:"none",								title:"请输入正确的身份证号"							})							return						}					}				}								if(!this.roomNo){					uni.showToast({						icon:"none",						title:"请输入房号"					})					return				}				if(!this.agree){					uni.showToast({						icon:"none",						title:"请阅读并同意《入住协议》"					})					return				}				let ret = await this.$myRequest({					url: "/user/regist/addOrUpdate",					data: {						"agreeState": this.agree?1:0,						"captcha":this.verifity,						"certificateNo": this.certificateNo,						"certificateType": this.certificateType,						"phone": this.mobileOld?this.mobileOld:this.mobile,						"projectId": this.houseId,						"roomNo": this.roomNo,						"sex": this.gender,						"sign": this.sign,						"userId": app.globalData.userId,						"username": this.name,						"phoneFrom":this.mobileOld?1:2					}				})				if (ret.data.success) {					uni.redirectTo({						url:'../certificationResultPage/certificationResultPage'					})				}else{					uni.showToast({						icon:"none",						title:ret.data.message					})				}			},		},		destroyed() {			if(null!=this.timer){				clearInterval(this.timer);				this.timer = null;			}		},		components:{			dmAgreeement,			dmPickerView		}	}</script><style lang="scss">.yezhu_body{	width: 100%;	height: 100vh;	position: relative;	.user_info{		background: #ffffff;		.user_item{			margin-left: 40rpx;			margin-right: 40rpx;			height: 98rpx;			display: flex;			justify-content: space-between;			align-items: center;			.item_name{				width: 20%;				font-size: 28rpx;				font-family: Verdana, Verdana-Regular;				font-weight: 400;				text-align: left;				color: #262626;			}			.item_right{				width: 80%;				font-size: 26rpx;				font-family: Verdana, Verdana-Regular;				font-weight: 400;				text-align: right;				color: #262626;				display: flex;				align-items: center;								.item_right_name{					width: 100%;				}				.item_right_name_placeholder{					font-size: 26rpx;					font-family: Verdana, Verdana-Regular;					font-weight: 400;					color: #b1b1b1;				}				.icon_right{					width: 10rpx;					height: 22rpx;					margin-left: 19rpx;				}								.veritify{					width: 140rpx;					height: 50rpx;					margin-left: 10rpx;					line-height: 50rpx;					background: #ffffff;					border: 2rpx solid #f07423;					border-radius: 8rpx;					font-size: 20rpx;					font-family: Verdana, Verdana-Regular;					font-weight: 400;					text-align: center;					color: #f07423;				}			}		}				.user_line{			margin-left: 40rpx;			margin-right: 40rpx;			height: 2px;			background: #f8f8f8;		}	}		.project_ino{		background: #ffffff;		margin-top: 20rpx;		.user_item{			margin-left: 40rpx;			margin-right: 40rpx;			height: 98rpx;			display: flex;			justify-content: space-between;			align-items: center;			.item_name{				width: 20%;				font-size: 28rpx;				font-family: Verdana, Verdana-Regular;				font-weight: 400;				text-align: left;				color: #262626;			}			.item_right{				width: 80%;				font-size: 26rpx;				font-family: Verdana, Verdana-Regular;				font-weight: 400;				text-align: right;				color: #262626;				display: flex;				align-items: center;								.item_right_name{					width: 100%;				}				.item_right_name_placeholder{					font-size: 26rpx;					font-family: Verdana, Verdana-Regular;					font-weight: 400;					color: #b1b1b1;				}				.icon_right{					width: 10rpx;					height: 22rpx;					margin-left: 19rpx;				}			}		}				.user_line{			margin-left: 40rpx;			margin-right: 40rpx;			height: 2px;			background: #f8f8f8;		}	}    	.xieyi{		display: flex;		width: 100%;		justify-content: center;		position: absolute;		bottom: 162rpx;		left: 0;		align-items: center;				.icon_selected{			width: 24rpx;			height: 24rpx;			margin-right: 20rpx;		}		.tongyi{			font-size: 24rpx;			font-family: Verdana, Verdana-Regular;			font-weight: 400;			color: #999999;			display: inline-block;		}		.xieyi_text{			font-size: 24rpx;			font-family: Verdana, Verdana-Regular;			font-weight: 400;			color: #f07423;			display: inline-block;		}	}	.btn_next{		width: calc(100% - 80rpx);		box-sizing: border-box;	    margin-left: 40rpx;		margin-right: 40rpx;		height: 72rpx;		line-height: 72rpx;		background: #f07423;		border-radius: 12rpx;		font-size: 32rpx;		font-family: Verdana, Verdana-Regular;		font-weight: 400;		text-align: center;		color: #ffffff;		position: absolute;		bottom: 60rpx;		left: 0;	}}</style>
 |