"use strict";const e=require("../../common/vendor.js"),o=require("../../request/api.js"),i=require("../../common/assets.js"),n={data:()=>({contentTop:"",isAgree:!1,isBindPhone:!0}),onLoad(){this.contentTop=e.inject("navHeight")+230/750*e.inject("windowWidth"),this.getIsBindPhoneData()},methods:{getPhoneNumData(i){console.log(i),"getPhoneNumber:ok"==i.detail.errMsg&&e.index.login({provider:"weixin",success(n){console.log(n.code);let t={code:n.code,isJson:1};o.loginByWx(t).then((n=>{if(200==n.code){let t=n.data.token;e.index.setStorageSync("token",t);let s={code:i.detail.code};o.wxBindPhone(s).then((o=>{200==o.code?(e.index.showToast({title:o.message}),setTimeout((function(){e.index.switchTab({url:"/pages/index/index"})}),1e3)):e.index.showToast({title:o.message,icon:"none"})})).catch((e=>{}))}else e.index.showToast({title:n.message,icon:"none"})})).catch((e=>{}))},fail(){}})},clickOneClickLogin(){this.isAgree?e.index.login({provider:"weixin",success(i){console.log(i.code);let n={code:i.code,isJson:1};o.loginByWx(n).then((o=>{if(200==o.code){let i=o.data.token;e.index.setStorageSync("token",i),setTimeout((function(){e.index.switchTab({url:"/pages/index/index"})}),1e3)}else e.index.showToast({title:o.message,icon:"none"})})).catch((e=>{}))},fail(){}}):e.index.showToast({title:"请阅读并同意我们的《用户服务协议》和《隐私政策》",icon:"none"})},clickCodeLogin(){e.index.navigateTo({url:"/pages/login/codeLogin/codeLogin"})},clickAgree(){this.isAgree=!this.isAgree},clickProtocol(o){e.index.navigateTo({url:"/pages/mine/web/web?type="+o})},getIsBindPhoneData(){let i=this;e.index.login({provider:"weixin",success(n){console.log(n.code);let t={code:n.code,isJson:1};o.loginByWx(t).then((o=>{200==o.code?i.isBindPhone=!!o.data.user.phone:e.index.showToast({title:o.message,icon:"none"})})).catch((e=>{}))},fail(){}})}}};if(!Array){e.resolveComponent("navBar")()}Math;const t=e._export_sfc(n,[["render",function(o,n,t,s,c,a){return e.e({a:e.p({leftText:"登录",hideNavBg:!0,backBlack:!0}),b:e.s("margin-top:"+c.contentTop+"px;"),c:i._imports_0$1,d:!c.isBindPhone},c.isBindPhone?{}:{e:e.o(((...e)=>a.getPhoneNumData&&a.getPhoneNumData(...e)))},{f:e.o((e=>c.isBindPhone?a.clickOneClickLogin():"")),g:e.o((e=>a.clickCodeLogin())),h:c.isAgree},c.isAgree?{i:i._imports_3$5}:{j:i._imports_4$6},{k:e.o((e=>a.clickAgree())),l:e.o((e=>a.clickProtocol(2))),m:e.o((e=>a.clickProtocol(3)))})}]]);wx.createPage(t);
