yurong/.svn/pristine/85/85a86557956867dc3fa62576daf...

167 lines
5.3 KiB
Plaintext

<template>
<view class="pl-30 pr-30">
<view class="pdBtm10 pdlft30 pdRit30">
<view class="pdlft10 pdRit10">
<view class=" pdlft20 pdRit20" style="border-radius: 8rpx;margin-top: 50rpx; border-bottom: 2rpx solid #f1f1f1;">
<view class="fs28 col333 bold">手机号</view>
<input v-model="phone" maxlength="11" type="number" class="fs28 col333" style="width: 500rpx;height: 80rpx;" placeholder-class="fs28 col333" placeholder="请输入手机号"/>
</view>
<view class="pdlft20 pdRit20 relative" style="border-radius: 8rpx;margin-top: 50rpx; border-bottom: 2rpx solid #f1f1f1;">
<view class="fs28 col333 bold">验证码</view>
<input v-model="code" maxlength="11" type="number" class="fs28 col333" style="width: 500rpx;height: 80rpx;" placeholder-class="fs28 col333" placeholder="请输入验证码"/>
<view @click="verificationes()" class="get_corasd tct fs24 colfff">
{{verifications?`倒计时${times}s` : '获取验证码' }}
</view>
</view>
<view class="pdlft20 pdRit20" style="border-radius: 8rpx;margin-top: 50rpx; border-bottom: 2rpx solid #f1f1f1;">
<view class="fs28 col333 bold">原密码</view>
<input v-model="oldPassword" type="text" class="fs28 col333" style="width: 500rpx;height: 80rpx;" placeholder-class="fs28 col333" placeholder="请输入密码"/>
</view>
<view class="pdlft20 pdRit20" style="border-radius: 8rpx;margin-top: 50rpx; border-bottom: 2rpx solid #f1f1f1;">
<view class="fs28 col333 bold">新密码</view>
<input v-model="password" type="text" class="fs28 col333" style="width: 500rpx;height: 80rpx;" placeholder-class="fs28 col333" placeholder="请输入密码"/>
</view>
<view class="pdlft20 pdRit20" style="border-radius: 8rpx;margin-top: 50rpx; border-bottom: 2rpx solid #f1f1f1;">
<view class="fs28 col333 bold">确认密码</view>
<input v-model="passwords" type="text" class="fs28 col333" style="width: 500rpx;height: 80rpx;" placeholder-class="fs28 col333" placeholder="请再次输入密码"/>
</view>
<view @click="isSubmit" class="w-690 h-94 br-47 rowsc rowsm fs-36 colfff mt-150" style="background-image: linear-gradient(#5cddd7,#018285);">
提交
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
timerInsad:null,//定时器
name:'',//昵称
phone:'',//手机号
oldPassword: '',//原密码
password:'',//密码
passwords:'',//确认密码
code:'',//验证码
times:199,//倒计时的时间
verifications:false,//显示的那个倒计时
}
},
onReady() {
this.heigha = uni.getSystemInfoSync().windowHeight;//获取设备高
},
onShow() {
},
methods: {
verificationes() {// 获取验证码的事件
if(this.verifications) {
this.$tools.showtt('您已获取验证码')
} else {
if(!(/^1[3456789]\d{9}$/.test(this.phone))) {
this.$tools.showtt('手机号格式不正确','none')
return false
} else {
let obj = {
mobile:this.phone,//手机号
flag:'1',
}
this.$tools.axios('POST','sms/send',obj).then(zifan => {
if(zifan.code == 0) {
this.$tools.showtt(zifan.msg+'')
this.verifications = true
this.timerInsad = setInterval( res => {
if(this.times <= 0) {
this.verifications = false
this.times = 199
this.code = ''
clearInterval(this.timerInsad)
} else {
this.times--
}
},1000)
} else {
this.$tools.showtt(zifan.msg+'')
}
})
}
}
},
loginOne() {//按钮
let obj = {
phone:this.phone,//手机号
password:this.password,//密码
code:this.code,//验证码
}
this.$tools.axios('POST','updatePassword',obj,'修改中').then(one => {
clearInterval(this.timerInsad)
this.$tools.showtt(one.msg)
this.verifications = false
this.times = 199
if(one.code == '0') {
setTimeout(two => {
this.$tools.goBack(1)
},600)
} else {
this.name = '';
this.oldPassword = '';
this.passwords = '';
this.code = '';
}
})
},
isSubmit() {//做的飞空验证
if (!(/^1[3456789]\d{9}$/.test(this.phone))) {
this.$tools.showtt('手机号格式不正确')
return false
}
if(!this.oldPassword) {
this.$tools.showtt('请输入原密码')
return false
}
if(!this.password) {
this.$tools.showtt('请输入密码')
return false
}
if(this.password != this.passwords) {
this.$tools.showtt('两次密码输入不一致')
return false
}
if(!this.code) {
this.$tools.showtt('请输入验证码')
return false
}
this.loginOne();//注册
},
}
}
</script>
<style scoped>
.container {
width: 750rpx;
}
.logis_dsfg {
height: 100rpx;
line-height: 100rpx;
background-color: #3DCA9A;
border-radius: 100rpx;
margin-top: 100rpx;
}
.get_corasd {
position: absolute;
bottom: 15rpx;
right: 0rpx;
width: 180rpx;
height: 50rpx;
background-image: linear-gradient(#afe8e5,#4cb9bc);
border-radius: 100rpx;
line-height: 50rpx;
}
</style>