"use strict";var e=(e,t,o)=>new Promise(((s,n)=>{var a=e=>{try{i(o.next(e))}catch(t){n(t)}},u=e=>{try{i(o.throw(e))}catch(t){n(t)}},i=e=>e.done?s(e.value):Promise.resolve(e.value).then(a,u);i((o=o.apply(e,t)).next())}));const t=require("../../../common/vendor.js"),o=require("../../../store/config.js");require("../../../store/index.js");const s=require("../../../utils/http.js"),n=require("../../../utils/commUtils.js"),a=require("../../../service/fileservice.js"),u=require("../../../service/userService.js"),i=require("../../../store/user.js");if(!Array){(t.resolveComponent("wd-img")+t.resolveComponent("wd-picker")+t.resolveComponent("wd-icon")+t.resolveComponent("wd-popup")+t.resolveComponent("layout-default-uni"))()}Math||((()=>"../../../node-modules/wot-design-uni/components/wd-img/wd-img.js")+(()=>"../../../node-modules/wot-design-uni/components/wd-picker/wd-picker.js")+(()=>"../../../node-modules/wot-design-uni/components/wd-icon/wd-icon.js")+(()=>"../../../node-modules/wot-design-uni/components/wd-popup/wd-popup.js")+l)();const l=()=>"../../../components/LoadingAnimation.js",r={__name:"index",setup(l){const r=o.useConfigStore(),d=i.useUserStore(),c=r.languages,v=t.ref(c["zh-Hans"]),m=t.ref({}),p=t.ref(!1),g=t.ref(""),h=t.ref(!1),f=t.computed((()=>Object.entries(c).map((([e,t])=>({value:e,label:t}))))),w=({value:e})=>{r.changeLanguage(v.value)},y=()=>{t.index.navigateTo({url:"/modules/pet/permission/bind-phone"})},j=()=>e(this,null,(function*(){const e=yield s.httpGet("/setting/info");try{200===e.code?m.value=e.data:n.toast(e.message)}catch(t){}})),x=()=>e(this,null,(function*(){if(!g.value)return void n.toast("用户名不能为空");const e=yield s.httpPost("/setting/updateUserName",{},{userName:g.value});200===e.code?(m.value.userName=g.value,n.toast("用户名修改成功"),p.value=!1,yield j(),yield u.getUserInfo()):n.toast(e.message)})),A=()=>e(this,null,(function*(){try{const e=yield a.chooseImage();if(!e||""==e)return void n.toast("图片上传失败,请检查你的网络情况!");const t=yield s.httpPost("/setting/updateUserAvatar",{},{userAvatar:e});200==t.code&&t.data&&(n.toast("头像更新成功"),yield j(),yield u.getUserInfo())}catch(e){n.toast("头像更新失败")}})),q=()=>e(this,null,(function*(){const e=yield s.httpGet("/user/logout");200==e.code?t.index.showToast({title:"退出成功",icon:"none"}):t.index.showToast({title:e.msg,icon:"none"}),d.clearUserInfo(),t.index.reLaunch({url:"/modules/pet/login/index"})}));return t.onLoad((()=>e(this,null,(function*(){h.value=!0,yield j(),h.value=!1})))),(e,o)=>t.e({a:null!=m.value.userAvatar},null!=m.value.userAvatar?{b:t.p({width:100,height:100,round:!0,mode:"aspectFill",src:m.value.userAvatar?t.unref(n.imgUrl)(m.value.userAvatar):t.unref(n.imgUrl)("")})}:{},{c:t.o(A),d:t.o(w),e:t.o((e=>v.value=e)),f:t.p({columns:f.value,label:"选择语言",modelValue:v.value}),g:t.t(m.value.userName),h:t.p({name:"right",size:"16"}),i:t.o((e=>p.value=!0)),j:t.t(m.value.mobile),k:t.p({name:"right",size:"16"}),l:t.o(y),m:m.value.isAuth},(m.value.isAuth,{}),{n:t.p({name:"right",size:"16"}),o:t.o((e=>m.value.isAuth?t.unref(n.toast)("你已经实名了"):void t.index.navigateTo({url:"/modules/pet/permission/real-name-auth"}))),p:g.value,q:t.o((e=>g.value=e.detail.value)),r:t.o(x),s:t.o((e=>p.value=!1)),t:t.o((e=>p.value=e)),v:t.p({position:"center","custom-style":"padding: 20px;",modelValue:p.value}),w:t.o(q),x:t.o((e=>h.value=e)),y:t.p({modelValue:h.value})})}},d=t._export_sfc(r,[["__scopeId","data-v-95f20a45"]]);wx.createPage(d);