"use strict";const e=require("../../../common/vendor.js"),i=require("../../../request/api.js"),t=require("../../../common/assets.js"),o=getApp(),n={data:()=>({contentTop:"",mobile:"",code:"",isAgree:!1,countdown:0,getCode:!1,timer:null}),onLoad(){this.contentTop=e.inject("navHeight")+230/750*e.inject("windowWidth")},methods:{clickGetCode(){let t=this.mobile;if(!t)return void e.index.showToast({title:"请输入手机号",icon:"none"});if(!o.globalData.mobileReg.test(t))return void e.index.showToast({title:"请输入正确格式的手机号",icon:"none"});if(this.isSubmiting)return;if(this.countdown>0)return;this.isSubmiting=!0;let n={phone:this.mobile,isJson:1},s=this;i.sendSMS(n).then((i=>{e.index.showToast({title:i.message,icon:"none"});let t=60;this.timer=setInterval((()=>{s.isSubmiting=!1,t--,0==t&&clearInterval(s.timer),s.getCode=!0,s.countdown=t}),1e3)})).catch((e=>{this.isSubmiting=!1}))},clickLoginAtOnce(){if(!this.mobile)return void e.index.showToast({title:"请输入手机号",icon:"none"});if(!this.code)return void e.index.showToast({title:"请输入验证码",icon:"none"});if(!this.isAgree)return void e.index.showToast({title:"请阅读并同意我们的《用户服务协议》和《隐私政策》",icon:"none"});let t={phone:this.mobile,code:this.code,isJson:1};i.loginByPhone(t).then((i=>{0==i.code?(e.index.showToast({title:i.message}),e.index.setStorageSync("token",i.token),setTimeout((function(){e.index.switchTab({url:"/pages/index/index"})}),1e3)):e.index.showToast({title:i.message,icon:"none"})})).catch((e=>{}))},clickOneClickLogin(){e.index.navigateBack()},clickAgree(){this.isAgree=!this.isAgree},clickProtocol(i){e.index.navigateTo({url:"/pages/mine/web/web?type="+i})}}};if(!Array){e.resolveComponent("navBar")()}Math;const s=e._export_sfc(n,[["render",function(i,o,n,s,c,r){return e.e({a:e.p({leftText:"登录",hideNavBg:!0,backBlack:!0}),b:e.s("margin-top:"+c.contentTop+"px;"),c:t._imports_0$1,d:t._imports_1$7,e:c.mobile,f:e.o((e=>c.mobile=e.detail.value)),g:t._imports_2$6,h:c.code,i:e.o((e=>c.code=e.detail.value)),j:e.t(c.getCode?c.countdown>0?c.countdown+"s":"重新获取验证码":"获取验证码"),k:e.o((e=>r.clickGetCode())),l:e.o((e=>r.clickLoginAtOnce())),m:e.o((e=>r.clickOneClickLogin())),n:c.isAgree},c.isAgree?{o:t._imports_3$5}:{p:t._imports_4$6},{q:e.o((e=>r.clickAgree()))})}]]);wx.createPage(s);
