"use strict";const e=require("../../common/vendor.js");require("../../common/libraries/request.js");const o=require("../../common/store/useWeAppAuthStore.js");require("../../common/store/useWorkStore.js");const a=require("../../common/libraries/apiLoading.js"),r=require("../../common/libraries/naviHelper.js"),s=require("./model.js"),i=require("../../gen/Apis.js"),t=require("../../common/libraries/upload.js"),l=o.useWeAppAuthStore(),u={init(){var e;s.useModel.formData.value=JSON.parse(JSON.stringify((null==(e=null==l?void 0:l.data)?void 0:e.user)||{}))},handleChooseAvatar:async e=>{var o,a;if(console.log(e,"eeeee"),null==(o=null==e?void 0:e.detail)?void 0:o.avatarUrl){let o=await t.avatarUpload(null==(a=null==e?void 0:e.detail)?void 0:a.avatarUrl);s.useModel.formData.value.avatar=o,console.log(o,"filePath")}},handleConfirm(){a.getApiLoading(i.Apis.Login.Auth.ChangeName,s.useModel.formData.value).then((o=>{e.index.showToast({icon:"success",title:"编辑成功！",duration:1e3,success:()=>{setTimeout((()=>{l.data.user={...l.data.user,...s.useModel.formData.value}}),1e3)}}),console.log(o)}))},handleLogout(){a.getApiLoading(i.Apis.Login.Auth.Logout,{}).then((e=>{r.showToastBack("退出成功！",1,!0),setTimeout((()=>{l.data={user:void 0,selected_house:void 0,config:void 0}}),1e3),console.log(e)}))}};exports.method=u;
