You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
paopao-ce/web/dist/assets/Setting-fc8840df.js

2 lines
12 KiB

import{_ as ye}from"./main-nav.vue_vue_type_style_index_0_lang-d6b3b6a4.js";import{d as te,W as r,Y as f,Z as d,r as c,be as ee,a2 as ke,a4 as a,a5 as s,a6 as b,a7 as v,$ as be,ch as ae,bP as Ce,a3 as u,a9 as p,aa as q,bw as Ie,bo as $e,by as x,ci as Pe,cj as Ue,ck as Se,cl as Re,cm as qe,cn as xe,ae as Be,K as Ae,_ as Ne,af as ze,co as Ke,cp as De,cq as Fe,cr as Me,a8 as B,aB as je,aC as Ee,al as Te}from"./index-c17d3913.js";import{c as Ve}from"./Upload-f8f7ade2.js";import{_ as Le}from"./Alert-e0e350bb.js";import{_ as Oe}from"./InputGroup-97df1a51.js";const We={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",viewBox:"0 0 24 24"},Ge=d("g",{fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[d("path",{d:"M9 7H6a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-3"}),d("path",{d:"M9 15h3l8.5-8.5a1.5 1.5 0 0 0-3-3L9 12v3"}),d("path",{d:"M16 5l3 3"})],-1),He=[Ge],Je=te({name:"Edit",render:function(O,W){return r(),f("svg",We,He)}}),M=$=>(je("data-v-3f84f089"),$=$(),Ee(),$),Ye={class:"base-line avatar"},Ze={class:"base-line"},Qe=M(()=>d("span",{class:"base-label"},"昵称",-1)),Xe={key:0},ea={class:"base-line"},aa=M(()=>d("span",{class:"base-label"},"用户名",-1)),ta={key:0},sa={key:1},na=M(()=>d("br",null,null,-1)),oa={key:2,class:"phone-bind-wrap"},la={class:"captcha-img-wrap"},ra={class:"captcha-img"},ia=["src"],ua={class:"form-submit-wrap"},da={key:0},ca={key:1},pa=M(()=>d("br",null,null,-1)),_a={key:2,class:"phone-bind-wrap"},va={class:"captcha-img-wrap"},fa={class:"captcha-img"},ma=["src"],ha={class:"form-submit-wrap"},ga={key:1,class:"phone-bind-wrap"},wa={class:"form-submit-wrap"},ya=te({__name:"Setting",setup($){const O="/v1/attachment",W="Bearer "+localStorage.getItem("PAOPAO_TOKEN"),A=c("public/avatar"),P="true".toLowerCase()==="true",se="false".toLowerCase()==="true",o=be(),U=c(!1),N=c(!1),z=c(!1),G=c(),H=c(),C=c(!1),K=c(!1),S=c(!1),R=c(!1),I=c(60),y=c(!1),k=c(!1),J=c(),Y=c(),Z=c(),Q=c(),t=ee({id:"",b64s:"",imgCaptcha:"",phone:"",phone_captcha:"",password:"",old_password:"",reenteredPassword:""}),i=ee({id:"",b64s:"",imgCaptcha:"",activate_code:""}),ne=async n=>{var e,m;return A.value==="public/avatar"&&!["image/png","image/jpg","image/jpeg"].includes((e=n.file.file)==null?void 0:e.type)?(window.$message.warning("头像仅允许 png/jpg 格式"),!1):A.value==="image"&&((m=n.file.file)==null?void 0:m.size)>1048576?(window.$message.warning("头像大小不能超过1MB"),!1):!0},oe=({file:n,event:e})=>{var m;try{let h=JSON.parse((m=e.target)==null?void 0:m.response);h.code===0&&A.value==="public/avatar"&&Pe({avatar:h.data.content}).then(_=>{var D;window.$message.success("头像更新成功"),(D=G.value)==null||D.clear(),o.commit("updateUserinfo",{...o.state.userInfo,avatar:h.data.content})}).catch(_=>{console.log(_)})}catch{window.$message.error("上传失败")}},le=(n,e)=>!!t.password&&t.password.startsWith(e)&&t.password.length>=e.length,re=(n,e)=>e===t.password,ie=()=>{var n;t.reenteredPassword&&((n=Q.value)==null||n.validate({trigger:"password-input"}))},ue=n=>{var e;n.preventDefault(),(e=Z.value)==null||e.validate(m=>{m||(K.value=!0,Ue({password:t.password,old_password:t.old_password}).then(h=>{K.value=!1,S.value=!1,window.$message.success("密码重置成功"),o.commit("userLogout"),o.commit("triggerAuth",!0),o.commit("triggerAuthKey","signin")}).catch(h=>{K.value=!1}))})},de=n=>{var e;n.preventDefault(),(e=J.value)==null||e.validate(m=>{m||(N.value=!0,Se({phone:t.phone,captcha:t.phone_captcha}).then(h=>{N.value=!1,y.value=!1,window.$message.success("绑定成功"),o.commit("updateUserinfo",{...o.state.userInfo,phone:t.phone}),t.id="",t.b64s="",t.imgCaptcha="",t.phone="",t.phone_captcha=""}).catch(h=>{N.value=!1}))})},ce=n=>{var e;n.preventDefault(),(e=Y.value)==null||e.validate(m=>{if(i.imgCaptcha===""){window.$message.warning("请输入图片验证码");return}U.value=!0,m||(z.value=!0,Re({activate_code:i.activate_code,captcha_id:i.id,imgCaptcha:i.imgCaptcha}).then(h=>{z.value=!1,k.value=!1,window.$message.success("