var vm=new Vue({el:"#app",data:{passLoginForm:{nameOrQQOrMobilePhone:"",password:"",code:"",rememberMe:!0,returnUrl:returnUrl,UnionId:unionId,NickName:nickName},phoneLoginForm:{mobilePhone:"",messageCode:"",validateCode:"",rememberMe:!0,returnUrl:returnUrl,UnionId:unionId,NickName:nickName},activeName:"first",content:"获取短信验证码",totalTime:60,canClick:!0,loginType:!0,showWxLogin:!1&&unionId==""},methods:{getSMSValidateCode:function(){vm.canClick&&this.validateMobilePhone(function(){axios.post("/Common/SendSMSValidateCode",{mobilePhone:vm.phoneLoginForm.mobilePhone,imgCode:vm.phoneLoginForm.validateCode}).then(function(n){if(n.data.IsSuccess){vm.canClick=!1;vm.content=vm.totalTime+"s后重新发送";var t=setInterval(function(){vm.totalTime--;vm.content=vm.totalTime+"s后重新发送";vm.totalTime<0&&(clearInterval(t),vm.content="重新发送验证码",vm.totalTime=60,vm.canClick=!0)},1e3);vm.$message({message:"短信验证码已成功发送至手机号"+vm.phoneLoginForm.mobilePhone+",请注意查收",type:"success"})}else vm.$message({message:n.data.Message,type:"error"}),vm.getImgValidateCode()}).catch(function(){vm.$message({message:"系统延时,请您稍后重试",type:"error"})})})},validateMobilePhone:function(n,t){if(!(this.phoneLoginForm.mobilePhone&&/^1[0-9]{10}$/.test(this.phoneLoginForm.mobilePhone))){vm.$message({message:"手机号未填写或者格式不正确",type:"error"});return}if(!vm.phoneLoginForm.validateCode){vm.$message({message:"图形验证码必须填写",type:"error"});return}if(t&&!this.phoneLoginForm.messageCode){vm.$message({message:"短信验证码必须填写",type:"error"});return}axios.post("/Register/IsExistsCustomerByMobilePhone",{mobilePhone:this.phoneLoginForm.mobilePhone}).then(function(t){t.data.IsSuccess?n():axios.post("/Register/IsExistsSubMobilePhone",{mobilePhone:vm.phoneLoginForm.mobilePhone}).then(function(t){if(t.data.IsSuccess)n();else{vm.$alert("系统中不存在此手机号!","温馨提示",{dangerouslyUseHTMLString:!0});return}})}).catch(function(){vm.$message({message:"系统延时,请您稍后重试",type:"error"})})},getImgValidateCode:function(){var n="/Common/GetValidateCode?v="+(new Date).getTime();vm.$refs.passImgValidateCode.src=n;vm.$refs.imgValidateCode.src=n},submitPassLoginForm:function(){if(!this.passLoginForm.nameOrQQOrMobilePhone){vm.$message({message:"手机号或QQ或公司名称必填",type:"error"});return}if(!this.passLoginForm.password){vm.$message({message:"密码必须填写",type:"error"});return}if(!this.passLoginForm.code){vm.$message({message:"图形验证码必须填写",type:"error"});return}axios.post("/Login/LoginByNameOrQQOrMobilePhone",vm.passLoginForm).then(function(n){n.data.IsSuccess?window.location.href=n.data.Message:n.data.Message.indexOf("不安全")!=-1?vm.$alert("当前登录密码为初始密码,为了您的信息安全请点击 "+resetPasswordUrl+" 去修改密码","温馨提示",{dangerouslyUseHTMLString:!0}):vm.$message({message:n.data.Message,type:"error"})}).catch(function(){vm.$message({message:"系统延时,请您稍后重试",type:"error"})})},submitPhoneLoginForm:function(){this.validateMobilePhone(function(){axios.post("/Login/LoginByMobilePhone",vm.phoneLoginForm).then(function(n){n.data.IsSuccess?window.location.href=n.data.Message:vm.$message({message:n.data.Message,type:"error"})}).catch(function(){vm.$message({message:"系统延时,请您稍后重试",type:"error"})})},!0)},keyup:function(n,t){t===1&&n.keyCode===13?this.submitPassLoginForm():t===2&&n.keyCode===13&&this.submitPhoneLoginForm()}}})