"use strict";const e=require("../../common/vendor.js"),a=require("../../common/assets.js"),s=require("../../api/index.js"),n=require("../../utils/fun.js"),o=require("../../store/index.js"),t=require("../../uni_modules/wot-design-uni/components/wd-message-box/index.js");if(require("../../uni_modules/wot-design-uni/locale/index.js"),require("../../uni_modules/wot-design-uni/dayjs/index.js"),!Array){(e.resolveComponent("wd-navbar")+e.resolveComponent("wd-message-box"))()}Math||((()=>"../../uni_modules/wot-design-uni/components/wd-navbar/wd-navbar.js")+(()=>"../../uni_modules/wot-design-uni/components/wd-message-box/wd-message-box.js"))();const i={__name:"sett",setup(i){const r=t.useMessage(),u=o.Store(),l=()=>{e.index.navigateBack()},c=e.computed((()=>u.userInfo||{})),d=e.ref({avatar:"",nickname:"",mobile:"",sex:0});function m(){r.prompt({title:"请输入昵称",inputValue:d.value.nickname}).then((async e=>{await s.api.usersUpdate({nickname:e.value||"微信用户"}),await u.usersGetInfo()})).catch((e=>{console.log(e)}))}e.onShow((async()=>{await u.usersGetInfo()})),e.onLoad((async()=>{if(e.index.getStorageSync("userInfo")){const a=await getUser();e.index.setStorageSync("userInfo",a),d.value={...a}}})),e.ref("");const v=async e=>{try{if(e.detail.avatarUrl){const a=await n.uploadFiles(e.detail.avatarUrl);await s.api.usersUpdate({avatar:a,mobile:c.value.mobile,nickname:c.value.nickname||"微信用户"}),await u.usersGetInfo()}}catch(a){console.error("选择头像失败:",a)}},g=async()=>{e.index.showModal({title:"提示",content:"是否确认退出登录?",success:function(e){e.confirm?u.logoutUser():e.cancel&&console.log("用户点击取消")}})},p=()=>{e.index.navigateTo({url:"/pages/mine/mobile"})};return(s,n)=>e.e({a:e.o(l),b:e.p({bordered:!1,"left-arrow":!0,"custom-style":"background-color: transparent !important;",title:"个人信息",safeAreaInsetTop:!0}),c:a._imports_0$6,d:c.value.avatar},c.value.avatar?{e:c.value.avatar}:{f:a._imports_1$4},{g:e.o(v),h:e.t(c.value.nickname||"微信用户"),i:a._imports_0$1,j:e.o(m),k:e.t(c.value.mobile),l:a._imports_0$1,m:e.o(p),n:c.value.userRights},c.value.userRights?{o:e.t(c.value.userRights.rights.rightsName)}:{},{p:e.o(g)})}},r=e._export_sfc(i,[["__scopeId","data-v-2463a4f2"]]);wx.createPage(r);
