当前位置:网站首页>后台系统发送验证码功能
后台系统发送验证码功能
2022-07-05 15:26:00 【小蚂蚁hjk】
<div>
<p class="fl">
<input name="phone" type="number" placeholder="手机号" v-model="phone"/>
<button type="button" :disabled="disabled" @click="sendcode" class="btns">{ {btntxt}}</button>
</p>
<p class="fl" style="margin-left: 20px;">
<input type="text" placeholder="验证码"/>
</p>
</div>
<input type="button" value="查询" class="btns search" @click="query"/>
这里是script
里的内容
export default {
data: function () {
return {
disabled:false,
time:0,
btntxt:"获取验证码",
formMess:{
email:this.email,
phone:this.phone
}
}
},
mounted: function () {
},
methods:{
//验证手机号码部分
sendcode(){
var reg=11 && /^((13|14|15|17|18)[0-9]{1}\d{8})$/;
//var url="/nptOfficialWebsite/apply/sendSms?mobile="+this.ruleForm.phone;
if(this.phone==''){
alert("请输入手机号码");
}else if(!reg.test(this.phone)){
alert("手机格式不正确");
}else{
this.time=60;
this.disabled=true;
this.timer();
/*axios.post(url).then(
res=>{
this.phonedata=res.data;
})*/
}
},
timer() {
if (this.time > 0) {
this.time--;
this.btntxt=this.time+"s后重新获取";
setTimeout(this.timer, 1000);
} else{
this.time=0;
this.btntxt="获取验证码";
this.disabled=false;
}
},
query(){
var formMess=this.formMess
Axios.post(api+"/order/select/reception", formMess)
.then(function (res) {
if(res.data.code==200){
console.log(res.data.data);
this.productResult=res.data.data;
this.productResult.length=3;
}else if(res.data.code==400){
alert(res.data.message)
}
}.bind(this))
},
//邮箱验证
sendEmail(){
var regEmail=/^[A-Za-zd]+([-_.][A-Za-zd]+)*@([A-Za-zd]+[-.])+[A-Za-zd]{2,5}$/;
if(this.email==''){
alert("请输入邮箱");
}else if(!regEmail.test(this.email)){
alert("邮箱格式不正确");
}
}
}
}
边栏推荐
- Memo 00
- Temporary cramming before DFS examination
- 17. [stm32] use only three wires to drive LCD1602 LCD
- Database learning - Database Security
- MySQL table field adjustment
- 19.[STM32]HC_SR04超声波测距_定时器方式(OLED显示)
- F. Min cost string problem solving Report
- Data communication foundation - Ethernet port mirroring and link aggregation
- 【 note 】 résoudre l'erreur de code IDE golang
- Data communication foundation ACL access control list
猜你喜欢
随机推荐
The OBD deployment mode of oceanbase Community Edition is installed locally
Modify PyUnit_ Time makes it support the time text of 'xx~xx months'
Detailed explanation of C language branch statements
mapper. Comments in XML files
Temporary cramming before DFS examination
Nine hours, nine people, nine doors problem solving Report
vant popup+其他组件的组合使用,及避坑指南
2.3 learning content
基于OpenHarmony的智能金属探测器
I'm fat, huh
OSI 七层模型
Common MySQL interview questions (1) (written MySQL interview questions)
vulnhub-Root_ this_ box
Defining strict standards, Intel Evo 3.0 is accelerating the upgrading of the PC industry
RepLKNet:不是大卷积不好,而是卷积不够大,31x31卷积了解一下 | CVPR 2022
How difficult is it to pass the certification of Intel Evo 3.0? Yilian technology tells you
Coding devsecops helps financial enterprises run out of digital acceleration
Arduino控制微小的六足3D打印机器人
vlunhub- BoredHackerBlog Moriarty Corp
Data communication foundation ACL access control list