import Api from "../../model/api"; import {getEventParam, isMobile, throttle, toast} from "../../utils/utils"; import Config from "../../model/config"; // README WISEWOODS Component({ properties: { phone: String, }, data: { time: Config.CD_TIME, isCd: false, codeText: '获取验证码', timeData: {} }, methods: { getCode:throttle(async function(e) { if (this.data.isCd) { return; } if (!isMobile(this.data.phone)) { toast('请输入正确的手机号') return; } await Api.sendCode(this.data.phone, true); this.setData({ isCd: true }) }), finished() { this.setData({ isCd: false, codeText: '重新获取' }) }, onChange(e) { this.setData({ timeData: getEventParam(e), }); }, } });