setmima.vue 3.1 KB
<template>
	<view class="content">
		<view class="loginbox loginboxmima">
			<view class="bangdingmima">重置密码后你就可以使用新密码登录了</view>
			<view class="setpassword flextwo">
				<view class="flexone inputk">
					<view class="setpasswordleft">密码</view>
					<view class="setpasswordright">
						<input type="password" placeholder="6-16个字符以内,区分大小写" @input="enterfirstcode" v-if="passtrue">
						<input type="text" placeholder="6-16个字符以内,区分大小写" @input="enterfirstcode" v-else>
					</view>
				</view>
				
				<view class="eye" @click="chosepassword">
				      <image src="../../static/closeeye.png" mode="" v-if="passtrue"></image>
				      <image src="../../static/openeye.png" mode="" v-else></image>
				</view>
				
				
			</view>
			<view class="setpassword flextwo">
				<view class="flexone inputk">
					<view class="setpasswordleft">确认密码</view>
					<view class="setpasswordright">
						<input type="password" placeholder="请再次输入" @input="entersecondcode" v-if="passtruek">
						<input type="text" placeholder="请再次输入" @input="entersecondcode" v-else>
					</view>
				</view>
				<view class="eye" @click="chosepasswordk">
				      <image src="../../static/closeeye.png" mode="" v-if="passtruek"></image>
				      <image src="../../static/openeye.png" mode="" v-else></image>
				</view>
				
			</view>
		</view>

		<view class="loginbtn finish" @click="finish">完成</view>
	</view>
</template>

<script>
	import app from "../../App.vue";
	export default {
		data() {
			return {
				firstcode: '',
				secondcode: '',
				phone: '',
				passtrue:true,
				passtruek:true
			}
		},
		onLoad(options) {
			this.phone = options.phone
		},
		methods: {
			chosepassword(){
				this.passtrue=!this.passtrue
			},
			chosepasswordk(){
				this.passtruek=!this.passtruek
			},
			enterfirstcode(e) {
				this.firstcode = e.detail.value
			},
			entersecondcode(e) {
				this.secondcode = e.detail.value
			},
			finish() {
				let that = this;
				if(that.firstcode==''){
					uni.showToast({
						title:'请输入密码',
						icon:"none"
					})
					return false
				}
				if(this.secondcode==''){
					uni.showToast({
						title:'请输入确认密码',
						icon:"none"
					})
					return false
				}
				
				if(this.firstcode!=this.secondcode){
					uni.showToast({
						title:'两次输入密码不一致',
						icon:'none'
					})
					return false
				}
				var url = 'user/setting_password';
				var params = {
					mobile: that.phone,
					password: that.firstcode,
					affirm_password: that.secondcode
				}
				console.log('988765',params)
				app.post(url, params).then((res) => {
					console.log(res);
					wx.showToast({
						title:"重置密码成功",
						icon:'none'
					})
					setTimeout(function(){
						uni.reLaunch({
							url:'/pages/login/accountpassword'
						})
					},1500)

				}).catch((err) => {
					uni.showToast({
						title:err.msg,
						icon:'none'
					})

				})
			}

		}

	}
</script>

<style>
	@import url('../../base/login');

	page {
		overflow-y: hidden;
	}
</style>