|
|
@@ -191,7 +191,7 @@
|
|
|
<van-button
|
|
|
size="small"
|
|
|
type="primary"
|
|
|
- @click="sendCode(item)"
|
|
|
+ @click="sendCode(item, index)"
|
|
|
:disabled="time != null"
|
|
|
>发送验证码<span v-if="time">({{ timeNum }})</span>
|
|
|
</van-button>
|
|
|
@@ -214,6 +214,7 @@
|
|
|
v-model="item.answerValue"
|
|
|
:placeholder="item.text"
|
|
|
type="number"
|
|
|
+ @blur="verification(item, collectionItemList)"
|
|
|
@input="numberFn(item, index, 'A')"></van-field>
|
|
|
<p
|
|
|
style="color: red; font-size: 14px; margin: 0; padding: 10px 0; text-align: right"
|
|
|
@@ -568,7 +569,7 @@
|
|
|
<van-button
|
|
|
size="small"
|
|
|
type="primary"
|
|
|
- @click="sendCode(childitem)"
|
|
|
+ @click="sendCode(childitem, index)"
|
|
|
:disabled="time != null"
|
|
|
>发送验证码<span v-if="time">({{ timeNum }})</span>
|
|
|
</van-button>
|
|
|
@@ -597,6 +598,7 @@
|
|
|
v-model="childitem.collectionOptionList[0].answerValue"
|
|
|
:placeholder="item.text"
|
|
|
type="number"
|
|
|
+ @blur="verification(childitem, child.collectionItems)"
|
|
|
@input="numberFn(childitem, index)"></van-field>
|
|
|
<p
|
|
|
style="
|
|
|
@@ -2897,6 +2899,7 @@ import {
|
|
|
editDwellTime,
|
|
|
deleteTaskAnswer,
|
|
|
getCollectionShowHistory,
|
|
|
+ sendAndCheckVerCode,
|
|
|
} from '@/api/index';
|
|
|
import zRadio from '@/components/zRadio';
|
|
|
import zCheckbox from '@/components/zCheckbox';
|
|
|
@@ -5043,16 +5046,77 @@ export default {
|
|
|
},
|
|
|
// 发送验证码
|
|
|
sendCode(val) {
|
|
|
- if (!/^1[3456789]\d{9}$/.test(val.answerValue) || val.answerValue == '') {
|
|
|
+ let answerValue = '';
|
|
|
+ if (val.collectionOptionList && val.collectionOptionList.length) {
|
|
|
+ answerValue = val.collectionOptionList[0].answerValue;
|
|
|
+ } else {
|
|
|
+ answerValue = val.answerValue;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!/^1[3456789]\d{9}$/.test(answerValue) || answerValue == '') {
|
|
|
this.$toast(val.collectionName + '格式错误');
|
|
|
return;
|
|
|
}
|
|
|
if (this.time) return;
|
|
|
this.timeNum = 0;
|
|
|
- this.time = setInterval(() => {
|
|
|
- this.timeNum++;
|
|
|
- if (this.timeNum == 60) this.time = null;
|
|
|
- }, 1000);
|
|
|
+ this.sendCodeFun(
|
|
|
+ {
|
|
|
+ type: '1', //String 调用类型:1:发送验证码 2:校验验证码
|
|
|
+ phone: answerValue, //String 手机号
|
|
|
+ verification: '', //String 手机号验证码
|
|
|
+ },
|
|
|
+ () => {
|
|
|
+ this.time = setInterval(() => {
|
|
|
+ this.timeNum++;
|
|
|
+ if (this.timeNum == 60) this.time = null;
|
|
|
+ }, 1000);
|
|
|
+ this.$toast('发送成功');
|
|
|
+ }
|
|
|
+ );
|
|
|
+ },
|
|
|
+ verification(item, collectionItems) {
|
|
|
+ let answerValue = '';
|
|
|
+ if (item.collectionOptionList && item.collectionOptionList.length) {
|
|
|
+ answerValue = item.collectionOptionList[0].answerValue;
|
|
|
+ } else {
|
|
|
+ answerValue = item.answerValue;
|
|
|
+ }
|
|
|
+ // 验证码
|
|
|
+ if (answerValue == '') {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ let telSendCode = collectionItems.find((res) => {
|
|
|
+ if (res.answerType == 'tel_send_code') {
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 手机号
|
|
|
+ let sendPhone = '';
|
|
|
+ if (telSendCode.collectionOptionList && telSendCode.collectionOptionList.length) {
|
|
|
+ sendPhone = telSendCode.collectionOptionList[0].answerValue;
|
|
|
+ } else {
|
|
|
+ sendPhone = telSendCode.answerValue;
|
|
|
+ }
|
|
|
+ if (sendPhone == '') {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.sendCodeFun(
|
|
|
+ {
|
|
|
+ type: '2', //String 调用类型:1:发送验证码 2:校验验证码
|
|
|
+ phone: sendPhone, //String 手机号
|
|
|
+ verification: answerValue, //String 手机号验证码
|
|
|
+ },
|
|
|
+ (res) => {
|
|
|
+ this.$toast(res.data ? '验证成功' : '验证码错误');
|
|
|
+ }
|
|
|
+ );
|
|
|
+ },
|
|
|
+ sendCodeFun(params, callback) {
|
|
|
+ sendAndCheckVerCode(params).then((res) => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ callback && callback(res);
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
onClickLeft() {
|
|
|
this.$router.go(-1);
|