|
|
@@ -1,7 +1,8 @@
|
|
|
// components/send-code/send-code.js
|
|
|
let setInter = null;
|
|
|
import {
|
|
|
- imgServerUrl
|
|
|
+ imgServerUrl,
|
|
|
+ captcha
|
|
|
} from '../../config/config.js'
|
|
|
Component({
|
|
|
/**
|
|
|
@@ -42,7 +43,7 @@ Component({
|
|
|
value: false,
|
|
|
observer(data) {
|
|
|
if (data === true) {
|
|
|
- this.send()
|
|
|
+ // this.toTCaptcha()
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -61,6 +62,18 @@ Component({
|
|
|
time: 60, // 倒计时时长
|
|
|
format_phone: '' //整理格式后的电话号码
|
|
|
},
|
|
|
+ pageLifetimes: {
|
|
|
+ show() {
|
|
|
+ const captchaResult = getApp().captchaResult;
|
|
|
+ getApp().captchaResult = null; // 验证码的票据为一次性票据,取完需要置空
|
|
|
+ if (captchaResult && captchaResult.ret === 0) {
|
|
|
+ // 将验证码的结果返回至服务端校验
|
|
|
+ const ticket = captchaResult.ticket;
|
|
|
+ const randstr = captchaResult.randstr;
|
|
|
+ this.send({ randstr, ticket })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
ready() {
|
|
|
// 初始化界面
|
|
|
this.init();
|
|
|
@@ -72,6 +85,15 @@ Component({
|
|
|
* 组件的方法列表
|
|
|
*/
|
|
|
methods: {
|
|
|
+ toTCaptcha: function () {
|
|
|
+ wx.navigateToMiniProgram({
|
|
|
+ appId: 'wx5a3a7366fd07e119',
|
|
|
+ path: '/pages/captcha/index',
|
|
|
+ extraData: {
|
|
|
+ appId: captcha//您申请的验证码的 appId
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
// 初始化方法 生成键盘布局数组
|
|
|
init(status) {
|
|
|
// 原始数组
|
|
|
@@ -124,14 +146,14 @@ Component({
|
|
|
})
|
|
|
},
|
|
|
// 发送验证码
|
|
|
- send() {
|
|
|
+ send(data) {
|
|
|
const time = this.data.time;
|
|
|
if (time === 60) {
|
|
|
this.countdown();
|
|
|
this.setData({
|
|
|
hidden: false
|
|
|
})
|
|
|
- this.triggerEvent('send')
|
|
|
+ this.triggerEvent('send', data)
|
|
|
}
|
|
|
},
|
|
|
// 取消按键 点击键盘收起
|