"use strict";const e=require("../../common/vendor.js"),i=require("../../components/request.js"),n=require("../../components/postFile.js"),a=require("../../components/generateFileName.js"),t={inject:["$global"],data:()=>({userinfo:"",name:"",id:"",info:{},userSig:""}),onLoad(i){e.index.getStorage({key:"userinfo",success:e=>{this.id=e.data.id,this.name=e.data.nickName,this.userinfo=e.data.headerIcon}}),e.index.getStorage({key:"userSig",success:e=>{this.userSig=e.data}})},methods:{cancel(){e.index.navigateBack({delta:1})},inputName(e){this.name=e.detail.value},async Userinfo(e){const{avatarUrl:i}=e.detail;this.userinfo=i},wxLogin(t){e.index.showLoading({title:"修改中...",mask:!0}),n.uploadFile({path:this.userinfo,name:a.generateFileName()}).then((n=>{i.request({url:"user/updateUserInfo",method:"POST",data:{id:this.id,headerIcon:n.split("/").pop(),nickName:this.name,usersig:this.userSig.userSig},userInfo:!0}).then((i=>{200===i.code?(e.index.showToast({title:"修改成功",icon:"success"}),e.index.setStorageSync("userinfo",i.data.info),e.index.hideLoading(),e.index.navigateBack({delta:1})):e.index.showToast({title:"修改失败",icon:"none"})}))})).catch((e=>{console.log(e)}))}}};const s=e._export_sfc(t,[["render",function(i,n,a,t,s,o){return{a:s.userinfo,b:e.o$1(((...e)=>o.Userinfo&&o.Userinfo(...e))),c:e.o$1(((...e)=>o.inputName&&o.inputName(...e))),d:s.name,e:e.o$1((e=>s.name=e.detail.value)),f:e.o$1(((...e)=>o.wxLogin&&o.wxLogin(...e))),g:e.o$1(((...e)=>o.cancel&&o.cancel(...e)))}}],["__scopeId","data-v-4ace481a"]]);wx.createPage(s);
