finishregister.vue 2.5 KB
<template>
	<view class="content">
		<view  class="loginbox loginboxmima">
			<view class="bangdingmima">设置密码之后你就可以使用账号密码登录了</view>
			<view class="setpassword flexone">
				<view class="setpasswordleft">密码</view>
				<view class="setpasswordright">
					<input  placeholder="6-16个字符以内,区分大小写" @input="enterfirst" type="password">
				</view>
			</view>
			<view class="setpassword flexone">
				<view class="setpasswordleft">确认密码</view>
				<view class="setpasswordright">
					<input  placeholder="请再次输入" @input="entersecond" type="password">
				</view>
			</view>
		</view>
		
		<view class="loginbtn finish" @click="finish">确认注册</view>
	</view>
</template>

<script>
	import app from "../../App.vue";
	    export default {
	        data() {
	            return {
	               firscode:'',
				   secondcode:'',
				   phone:''
	            }
	        },
	        onLoad(options) {
				this.phone=options.phone
	        },
	        methods: {
	           // 输入密码
			   enterfirst(e){
				   this.firscode=e.detail.value
			   },
			   // 
			   entersecond(e){
				   this.secondcode=e.detail.value
			   },
			   // 完成注册
			   finish(){
				   let that = this;
				   if(that.firscode==''){
					   uni.showToast({
						   title:'请输入密码',
						   icon:"none"
					   })
					   return false
				   }
				   
				   if(that.secondcode==''){
					   uni.showToast({
					   	title:"请输入确认密码",
						icon:"none"
					   })
					   return false
				   }
				   if(that.firscode!=that.secondcode){
					   uni.showToast({
					   	title:'两次输入密码不一致',
						icon:"none"
					   })
					   return  false
				   }
				   
				   let url = "user/register2";
				   let param = {
				   	mobile: that.phone,
					password:that.firscode,
					affirm_password:that.secondcode,
					third_id: uni.getStorageSync("third_id")==undefined?''
: uni.getStorageSync("third_id")	,
					
				   };
				   console.log('8888', param)
				   app.post(url, param, 'get').then(r => {
				   	console.log(r)
				   	uni.showToast({
				   		title:'注册成功',
						icon:'none'
				   	})
					setTimeout(function(){
						uni.reLaunch({
							url:'/pages/login/loginindex'
						})
					},1500)
				   
				   }).catch(err => {
				   	console.log(err)
					uni.showToast({
						title:err.msg,
						icon:'none'
					})
				   })
			   }
	      
	        }
	
	    }
</script>

<style>
	@import url('../../base/login');
	page{
		overflow-y: hidden;
	}
</style>