"use strict";const e=require("../../common/vendor.js"),i=require("../../components/request.js"),t=require("../../components/postFile.js"),n=require("../../components/generateFileName.js"),o=require("../../stores/counter.js"),s=require("../../components/goEasyTool/tool.js"),a=o.useCounterStore(),r={inject:["$global"],data:()=>({userinfo:"",name:"",id:"",info:{},userSig:"",lastPage:"",picture:"",Filename:n.generateFileName()}),onLoad(i){e.index.getStorage({key:"userinfo",success:e=>{this.id=e.data.id}}),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"})},inputName(e){this.name=e.detail.value},async Userinfo(e){const{avatarUrl:i}=e.detail;this.userinfo=i},async wxLogin(n){if(""!==this.name&&""!==this.userinfo){e.index.showLoading({title:"登录中...",mask:!0});const{code:n}=await e.index.login({provider:"weixin",onlyAuthorize:!0});t.uploadFile({path:this.userinfo,name:this.Filename}).then((t=>{this.picture=t.split("/").pop(),i.request({url:"user/inputUserInfo",method:"POST",data:{id:this.id,headerIcon:this.Filename,nickName:this.name,code:n},userInfo:!1}).then((i=>{200===i.code?(e.index.showToast({title:"登录成功",icon:"success"}),e.index.setStorageSync("userinfo",i.data.info),s.goEasylogin(this.$goeasy,String(i.data.info.id),this.picture,this.name),a.$patch({myitem:i.data.info}),e.index.hideLoading(),e.index.reLaunch({url:this.lastPage})):e.index.showToast({title:i.msg,icon:"none"})}))})).catch((e=>{console.log(e)}))}else e.index.showToast({title:"请填写头像昵称",icon:"success",duration:3e3})}}};const c=e._export_sfc(r,[["render",function(i,t,n,o,s,a){return{a:e.o(((...e)=>a.Return&&a.Return(...e))),b:s.userinfo,c:e.o(((...e)=>a.Userinfo&&a.Userinfo(...e))),d:e.o(((...e)=>a.inputName&&a.inputName(...e))),e:e.o(((...e)=>a.wxLogin&&a.wxLogin(...e)))}}],["__scopeId","data-v-cf0dffc1"]]);wx.createPage(c);
