快捷登陆
This commit is contained in:
@@ -1,16 +1,80 @@
|
||||
export default {
|
||||
methods: {
|
||||
checkPhoneNum (phone) {
|
||||
alert("1111111111111")
|
||||
}
|
||||
}
|
||||
}
|
||||
var sendPhoneCode = new Vue({
|
||||
el:'#sendPhoneCode',
|
||||
methods:{
|
||||
sendCode:function(){
|
||||
alert("222222222")
|
||||
checkPhoneNum("1352222222")
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
function sendCode(){
|
||||
var mobile = $("#input_phoneNumber").val();
|
||||
if(checkPhoneNum(mobile)){
|
||||
timer.start();
|
||||
axios.post("/rest/user/sendMobileCode", {mobile: mobile})
|
||||
.then(function (response) {
|
||||
var data = response.data
|
||||
if(data.code==200){
|
||||
$.toast("短信验证码发送成功,请注意查收!")
|
||||
}else{
|
||||
$.toast("验证码发送失败")
|
||||
timer.cancel()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
function checkPhoneNum(phone){
|
||||
var reg=11&& /^((13|14|15|17|18)[0-9]{1}\d{8})$/;
|
||||
if(phone==''){
|
||||
$.toast("请输入手机号码");
|
||||
return false;
|
||||
}else if(!reg.test(phone)){
|
||||
$.toast("手机格式不正确");
|
||||
return false;
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//验证码倒计时
|
||||
timer = {
|
||||
countdown:60,
|
||||
start:function(){
|
||||
countdown = 60
|
||||
$(".sendCode").hide()
|
||||
$(".waiting").empty().append(countdown + " s").show()
|
||||
timer.down()
|
||||
},
|
||||
down:function(){
|
||||
countdown --
|
||||
$(".waiting").empty().append(countdown + " s")
|
||||
if(countdown <= 0){
|
||||
$(".sendCode").show()
|
||||
$(".waiting").hide()
|
||||
}else{
|
||||
setTimeout(timer.down, 1000)
|
||||
}
|
||||
},
|
||||
cancel:function(){
|
||||
countdown = 0
|
||||
}
|
||||
}
|
||||
|
||||
/* 错误提示-快捷登录 */
|
||||
$("#login_btn").on("click", function () {
|
||||
var phoneNum = $("#input_phoneNumber").val();
|
||||
var code = $("#input_codeSms").val();
|
||||
var protocal = $(".check").find(".checkImg").css("display");
|
||||
if(phoneNum == ""){
|
||||
$.toast("请输入手机号码");
|
||||
return false;
|
||||
}
|
||||
if(code == ""){
|
||||
$.toast("请输入验证码");
|
||||
return false;
|
||||
}
|
||||
if(protocal != "block"){
|
||||
$.toast("请同意服务协议");
|
||||
return false;
|
||||
}
|
||||
axios.post("/rest/user/sendMobileCode", {mobile: mobile})
|
||||
.then(function (response) {
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user