"use strict";const e=require("../../common/vendor.js"),n=require("../../components/request.js"),o=require("../../components/goEasyTool/tool.js"),t=require("../../stores/counter.js").useCounterStore(),i={inject:["$global"],data:()=>({userInfo:{},info:{},userSig:"",lastPage:"",myuserSig:""}),onLoad(){e.index.getUserInfo({provider:"weixin",success:e=>{this.userInfo=e.userInfo}}),e.index.getStorage({key:"lastPage",success:e=>{this.lastPage="/"+e.data},fail:()=>{this.lastPage="/pages/Home/Home"}})},methods:{Return(){e.index.reLaunch({url:"/pages/Home/Home"})},async getPhoneNumber(i){if(null==i.detail.code)return void e.index.showToast({title:"登录失败",icon:"none"});e.index.showLoading({title:"登录中...",mask:!0});const s=await n.request({url:"user/loginWithPhoneNumber",method:"POST",data:{code:i.detail.code},userInfo:!1});this.info=s,e.index.setStorageSync("userinfo",this.info.data.info);const a=Date.now();e.index.setStorageSync("last_clean_time",a),t.$patch({myitem:this.info.data.info}),200===this.info.code?this.info.data.newAccount?(e.index.reLaunch({url:"/pages/UserInformation/UserInformation"}),e.index.hideLoading()):(e.index.setStorageSync("userinfo",this.info.data.info),o.goEasylogin(this.$goeasy,String(this.info.data.info.id),this.info.data.info.headerIcon,this.info.data.info.nickName),e.index.hideLoading(),e.index.reLaunch({url:this.lastPage})):e.index.showToast({title:"登录失败",icon:"none"})}}};const s=e._export_sfc(i,[["render",function(n,o,t,i,s,a){return{a:e.o(((...e)=>a.Return&&a.Return(...e))),b:s.userInfo.avatarUrl,c:e.t(s.userInfo.nickName),d:e.o(((...e)=>a.getPhoneNumber&&a.getPhoneNumber(...e)))}}]]);wx.createPage(s);
