"use strict";var e=require("../common/vendor.js"),t=require("../api/user.js");require("../common/request.js");const a={data:()=>({user:{avatar:null,phone:""}}),onLoad(){this.getUserInfo()},methods:{bindblur(e){this.user.nickName=e.detail.value},bindinput(e){this.user.nickName=e.detail.value},onChooseAvatar(t){let{avatarUrl:a}=t.detail;e.index.uploadFile({url:e.index.getStorageSync("requestPath")+"/app/common/uploadOSS",filePath:a,name:"file",formData:{user:"test"},success:e=>{this.user.avatar=JSON.parse(e.data).url}})},submit(){this.user.isWeixinAuth=1,t.editUser(this.user).then((t=>{200==t.code?(e.index.setStorageSync("avatar",this.avatar),e.index.setStorageSync("nickName",this.nickName),e.index.showToast({icon:"success",title:"修改成功"}),this.getUserInfo()):e.index.showToast({icon:"none",title:"请求失败"})}),(e=>{}))},getUserInfo(){t.getUserInfo().then((t=>{200==t.code?null!=t.user?this.user=t.user:this.utils.loginOut():e.index.showToast({icon:"none",title:"请求失败"})}),(e=>{}))}}};var s=e._export_sfc(a,[["render",function(t,a,s,n,r,i){return e.e({a:null==r.user.avatar?"https://fs-1319721001.cos.ap-chongqing.myqcloud.com/fs/20240229/22cb9518a55040dea74d8f730551a7a2.jpg":r.user.avatar,b:e.o(((...e)=>i.onChooseAvatar&&i.onChooseAvatar(...e))),c:e.o(((...e)=>i.bindblur&&i.bindblur(...e))),d:e.o([e=>r.user.nickName=e.detail.value,(...e)=>i.bindinput&&i.bindinput(...e)]),e:r.user.nickName,f:null!=r.user},null!=r.user?{g:e.t(t.$parsePhone(r.user.phone))}:{},{h:e.o((e=>i.submit()))})}],["__scopeId","data-v-131016a0"]]);wx.createPage(s);
