|
|
|
@ -1,5 +1,6 @@ |
|
|
|
<template> |
|
|
|
<view class="phone_code"> |
|
|
|
<view class="kbzone"></view> |
|
|
|
<text class="phone_code_label">验证码已发送至</text> |
|
|
|
<view class="phone_code_count"> |
|
|
|
<text class="phone_code_count_new">{{ newPhone }}</text> |
|
|
|
@ -24,98 +25,128 @@ |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
newPhone: "167****8898", // 当前显示电话 |
|
|
|
isReget: false, // 判断是否显示 ‘重新获取’按钮 |
|
|
|
timer: null, // 定时器 |
|
|
|
count: 60, // 时间 |
|
|
|
code:"", // 验证码 |
|
|
|
focus:true, // 焦点 |
|
|
|
isCode:true // ‘确定’按钮是否禁用 |
|
|
|
import store from '@/store' |
|
|
|
import * as LoginApi from '@/api/login' |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
newPhone: "13800138000", // 当前显示电话 |
|
|
|
isReget: false, // 判断是否显示 ‘重新获取’按钮 |
|
|
|
timer: null, // 定时器 |
|
|
|
count: 60, // 时间 |
|
|
|
code:"", // 验证码 |
|
|
|
focus:true, // 焦点 |
|
|
|
// 正在加载 |
|
|
|
isLoading: false, |
|
|
|
isCode:true // ‘确定’按钮是否禁用 |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(options) { |
|
|
|
// console.log(options) |
|
|
|
if(options.rt!=""){ |
|
|
|
this.newPhone = options.rt |
|
|
|
} |
|
|
|
this.getTimer() // 开启定时器 |
|
|
|
this.getCode() // 获取验证码 |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
count(val) { |
|
|
|
if (val == 0) { |
|
|
|
this.isReget = true |
|
|
|
clearInterval(this.timer) |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
/** |
|
|
|
* AUTHOR: 单乘风 |
|
|
|
* DESC: 定时器 |
|
|
|
* */ |
|
|
|
getTimer() { |
|
|
|
this.timer = setInterval(() => { |
|
|
|
if (this.count == 0) { |
|
|
|
clearInterval(this.timer) |
|
|
|
uni.navigateBack({ |
|
|
|
delta: 1 |
|
|
|
}) |
|
|
|
return |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(options) { |
|
|
|
console.log(options) |
|
|
|
this.getTimer() // 开启定时器 |
|
|
|
this.getCode() // 获取验证码 |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
count(val) { |
|
|
|
if (val == 0) { |
|
|
|
this.isReget = true |
|
|
|
clearInterval(this.timer) |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
/** |
|
|
|
* AUTHOR: 单乘风 |
|
|
|
* DESC: 定时器 |
|
|
|
* */ |
|
|
|
getTimer() { |
|
|
|
this.timer = setInterval(() => { |
|
|
|
if (this.count == 0) { |
|
|
|
clearInterval(this.timer) |
|
|
|
uni.navigateBack({ |
|
|
|
delta: 1 |
|
|
|
}) |
|
|
|
return |
|
|
|
} |
|
|
|
this.count-- |
|
|
|
}, 1000) |
|
|
|
}, |
|
|
|
this.count-- |
|
|
|
}, 1000) |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* AUTHOR: 单乘风 |
|
|
|
* DESC: 获取验证码 |
|
|
|
* */ |
|
|
|
getCode() { |
|
|
|
console.log("获取验证码", this.newPhone) |
|
|
|
if (this.count == 0) { |
|
|
|
this.count = 60 |
|
|
|
this.isReget = false |
|
|
|
this.getTimer() |
|
|
|
} |
|
|
|
}, |
|
|
|
/** |
|
|
|
* AUTHOR: 单乘风 |
|
|
|
* DESC: 输入框输入事件 |
|
|
|
* */ |
|
|
|
codeNumInputFun(e) { |
|
|
|
let val = e.detail.value |
|
|
|
this.code = val |
|
|
|
if (val.length == 6) this.isCode = false |
|
|
|
else this.isCode = true |
|
|
|
}, |
|
|
|
/** |
|
|
|
* AUTHOR: 单乘风 |
|
|
|
* DESC: 输入框失去焦点事件 |
|
|
|
* */ |
|
|
|
codeNumBlurFun(e) { |
|
|
|
let val = e.detail.value |
|
|
|
this.focus = false |
|
|
|
if (val.length == 6) this.isCode = false |
|
|
|
else this.isCode = true |
|
|
|
}, |
|
|
|
/** |
|
|
|
* AUTHOR: 单乘风 |
|
|
|
* DESC: 输入框点击事件 |
|
|
|
* @param {Number} index 当前点击框索引 |
|
|
|
* */ |
|
|
|
codefocusFun(index) { |
|
|
|
this.focus = true |
|
|
|
}, |
|
|
|
/** |
|
|
|
* AUTHOR: 单乘风 |
|
|
|
* DESC: 按钮点击事件 |
|
|
|
* */ |
|
|
|
submitFun() { |
|
|
|
console.log("确认更换手机号") |
|
|
|
}, |
|
|
|
/** |
|
|
|
* AUTHOR: 单乘风 |
|
|
|
* DESC: 获取验证码 |
|
|
|
* */ |
|
|
|
getCode() { |
|
|
|
// console.log("获取验证码", this.newPhone) |
|
|
|
if (this.count == 0) { |
|
|
|
this.count = 60 |
|
|
|
this.isReget = false |
|
|
|
this.getTimer() |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
/** |
|
|
|
* AUTHOR: 单乘风 |
|
|
|
* DESC: 输入框输入事件 |
|
|
|
* */ |
|
|
|
codeNumInputFun(e) { |
|
|
|
let val = e.detail.value |
|
|
|
this.code = val |
|
|
|
if (val.length == 6) this.isCode = false |
|
|
|
else this.isCode = true |
|
|
|
}, |
|
|
|
/** |
|
|
|
* AUTHOR: 单乘风 |
|
|
|
* DESC: 输入框失去焦点事件 |
|
|
|
* */ |
|
|
|
codeNumBlurFun(e) { |
|
|
|
let val = e.detail.value |
|
|
|
this.focus = false |
|
|
|
if (val.length == 6) this.isCode = false |
|
|
|
else this.isCode = true |
|
|
|
}, |
|
|
|
/** |
|
|
|
* AUTHOR: 单乘风 |
|
|
|
* DESC: 输入框点击事件 |
|
|
|
* @param {Number} index 当前点击框索引 |
|
|
|
* */ |
|
|
|
codefocusFun(index) { |
|
|
|
this.focus = true |
|
|
|
}, |
|
|
|
/** |
|
|
|
* AUTHOR: 单乘风 |
|
|
|
* DESC: 按钮点击事件 |
|
|
|
* */ |
|
|
|
submitFun() { |
|
|
|
const app = this |
|
|
|
app.isLoading = true |
|
|
|
store.dispatch('Login', { |
|
|
|
smsCode: app.smsCode, |
|
|
|
mobile: app.mobile, |
|
|
|
isParty: app.isParty, |
|
|
|
partyData: app.partyData |
|
|
|
}) |
|
|
|
.then(result => { |
|
|
|
// 显示登录成功 |
|
|
|
app.$toast(result.message) |
|
|
|
// 相应全局事件订阅: 刷新上级页面数据 |
|
|
|
uni.$emit('syncRefresh', true) |
|
|
|
// 跳转回原页面 |
|
|
|
setTimeout(() => app.onNavigateBack(1), 2000) |
|
|
|
}) |
|
|
|
.catch(err => { |
|
|
|
// 跳转回原页面 |
|
|
|
if (err.result.data.isBack) { |
|
|
|
setTimeout(() => app.onNavigateBack(1), 2000) |
|
|
|
} |
|
|
|
}) |
|
|
|
.finally(() => app.isLoading = false) |
|
|
|
//console.log("确认更换手机号") |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
|
@ -126,6 +157,11 @@ |
|
|
|
|
|
|
|
&_code { |
|
|
|
padding: 30rpx; |
|
|
|
|
|
|
|
.kbzone{ |
|
|
|
width: 100%; |
|
|
|
height: 32vh; |
|
|
|
} |
|
|
|
|
|
|
|
&_label { |
|
|
|
font-size: 30rpx; |
|
|
|
@ -160,6 +196,7 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 单独的数字 |
|
|
|
&_single { |
|
|
|
margin-top: 30rpx; |
|
|
|
|
|
|
|
@ -168,6 +205,7 @@ |
|
|
|
left: -100rpx; |
|
|
|
width: 50rpx; |
|
|
|
height: 50rpx; |
|
|
|
border-bottom: #313131 solid 2rpx; |
|
|
|
} |
|
|
|
|
|
|
|
&_codeinput { |
|
|
|
|