|
|
@@ -35,8 +35,8 @@
|
|
|
<mt-field :state="state.mobile"
|
|
|
placeholder="手机号码"
|
|
|
v-model="mobile"
|
|
|
- type="tel"
|
|
|
- @blur.native.capture="codeMobile"></mt-field>
|
|
|
+ @blur.native.capture="codeMobile"
|
|
|
+ type="tel"></mt-field>
|
|
|
</div>
|
|
|
<div class="page-part">
|
|
|
<mt-field :state="state.token"
|
|
|
@@ -44,7 +44,8 @@
|
|
|
v-model="token"
|
|
|
@blur.native.capture="codeToken"
|
|
|
auto-complete="off">
|
|
|
- <span class="token" v-text="tokenText" @click="getCheckCode">获取验证码</span>
|
|
|
+ <span class="token" v-text="tokenText" @click="getCheckCode" v-if="state.mobile === 'success'">获取验证码</span>
|
|
|
+ <span class="token-no" v-text="tokenText" v-if="state.mobile !== 'success'">获取验证码</span>
|
|
|
</mt-field>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -204,40 +205,42 @@
|
|
|
}
|
|
|
},
|
|
|
// 获取验证码
|
|
|
+ loadCheckCode () {
|
|
|
+ if (this.state.mobile === 'success') {
|
|
|
+ this.$indicator.open('获取中...')
|
|
|
+ let _this = this
|
|
|
+ this.$http.get('/sso/personal/register/checkCode', {params: {mobile: this.mobile}})
|
|
|
+ .then(response => {
|
|
|
+ this.$indicator.close()
|
|
|
+ if (response.data) {
|
|
|
+ this.tokenCode = response.data.token
|
|
|
+ this.$toast({
|
|
|
+ message: '验证码已经发送到您的手机,请注意查收',
|
|
|
+ iconClass: 'el-icon-success'
|
|
|
+ })
|
|
|
+ this.tokenText = '已发送(' + this.tokenTime + 'S)'
|
|
|
+ let setTime = setInterval(() => {
|
|
|
+ _this.tokenTime--
|
|
|
+ this.tokenText = '已发送(' + this.tokenTime + 'S)'
|
|
|
+ if (this.tokenTime <= 0) {
|
|
|
+ clearInterval(setTime)
|
|
|
+ _this.tokenText = '获取验证码'
|
|
|
+ _this.tokenTime = 60
|
|
|
+ }
|
|
|
+ }, 1000)
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ this.$indicator.close()
|
|
|
+ this.downToast('请检查网络是否正常或联系服务商')
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 验证码发送请求
|
|
|
getCheckCode () {
|
|
|
if (this.tokenTime > 0 && this.tokenTime < 60) {
|
|
|
this.downToast('请稍后再点击,我在倒计时')
|
|
|
} else {
|
|
|
- if (this.state.mobile !== 'success') {
|
|
|
- this.downToast('请先输入正确的手机号')
|
|
|
- } else {
|
|
|
- this.$indicator.open('获取中...')
|
|
|
- let _this = this
|
|
|
- this.$http.get('/sso/personal/register/checkCode', {params: {mobile: this.mobile}})
|
|
|
- .then(response => {
|
|
|
- this.$indicator.close()
|
|
|
- if (response.data) {
|
|
|
- this.tokenCode = response.data.token
|
|
|
- this.$toast({
|
|
|
- message: '验证码已经发送到您的手机,请注意查收',
|
|
|
- iconClass: 'el-icon-success'
|
|
|
- })
|
|
|
- this.tokenText = '已发送(' + this.tokenTime + 'S)'
|
|
|
- let setTime = setInterval(() => {
|
|
|
- _this.tokenTime--
|
|
|
- this.tokenText = '已发送(' + this.tokenTime + 'S)'
|
|
|
- if (this.tokenTime <= 0) {
|
|
|
- clearInterval(setTime)
|
|
|
- _this.tokenText = '获取验证码'
|
|
|
- _this.tokenTime = 60
|
|
|
- }
|
|
|
- }, 1000)
|
|
|
- }
|
|
|
- }).catch(() => {
|
|
|
- this.$indicator.close()
|
|
|
- this.downToast('请检查网络是否正常或联系服务商')
|
|
|
- })
|
|
|
- }
|
|
|
+ this.loadCheckCode()
|
|
|
}
|
|
|
},
|
|
|
// 表单提交
|