mirror of https://github.com/rocboss/paopao-ce
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.
2 lines
12 KiB
2 lines
12 KiB
1 year ago
|
import{_ as we}from"./main-nav.vue_vue_type_style_index_0_lang-b9156c1f.js";import{d as ye,H as d,R as Q,b as ke,f as g,k as a,w as s,q as b,Y as _,e as r,j as m,bf as u,A as p,x as S,O as be,D as Ce,Z as q,y as A,$ as Ie,a0 as $e}from"./@vue-a481fc63.js";import{u as Pe}from"./vuex-44de225f.js";import{a4 as X,a5 as Ue,a6 as Re,a7 as Se,a8 as qe,a9 as Ae,aa as Be,_ as Ne}from"./index-ff4002c7.js";import{a2 as ze}from"./@vicons-f0266f88.js";import{h as xe,o as De,e as Ke,B as Fe,b as Te,j as je,T as Oe,$ as Ve,L as Ee,a0 as Le,a1 as Me,d as We}from"./naive-ui-eecf2ec3.js";import"./vue-router-e5a2430e.js";import"./vooks-6d99783e.js";import"./evtd-b614532e.js";import"./axios-4a70c6fc.js";import"./moment-2ab8298d.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-7c8d4b48.js";import"./@css-render-7124a1a5.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";const T=B=>(Ie("data-v-a681720e"),B=B(),$e(),B),Ge={class:"base-line avatar"},He={class:"base-line"},Je=T(()=>m("span",{class:"base-label"},"昵称",-1)),Ye={key:0},Ze={class:"base-line"},Qe=T(()=>m("span",{class:"base-label"},"用户名",-1)),Xe={key:0},ea={key:1},aa=T(()=>m("br",null,null,-1)),ta={key:2,class:"phone-bind-wrap"},sa={class:"captcha-img-wrap"},na={class:"captcha-img"},oa=["src"],la={class:"form-submit-wrap"},ra={key:0},ia={key:1},ua=T(()=>m("br",null,null,-1)),da={key:2,class:"phone-bind-wrap"},pa={class:"captcha-img-wrap"},ca={class:"captcha-img"},_a=["src"],ma={class:"form-submit-wrap"},va={key:1,class:"phone-bind-wrap"},fa={class:"form-submit-wrap"},ga=ye({__name:"Setting",setup(B){const ee="/v1/attachment",ae="Bearer "+localStorage.getItem("PAOPAO_TOKEN"),N=d("public/avatar"),$="true".toLowerCase()==="true",te="false".toLowerCase()==="true",o=Pe(),P=d(!1),z=d(!1),x=d(!1),M=d(),W=d(),C=d(!1),D=d(!1),U=d(!1),R=d(!1),I=d(60),y=d(!1),k=d(!1),G=d(),H=d(),J=d(),Y=d(),t=Q({id:"",b64s:"",imgCaptcha:"",phone:"",phone_captcha:"",password:"",old_password:"",reenteredPassword:""}),i=Q({id:"",b64s:"",imgCaptcha:"",activate_code:""}),se=async n=>{var e,v;return N.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):N.value==="image"&&((v=n.file.file)==null?void 0:v.size)>1048576?(window.$message.warning("头像大小不能超过1MB"),!1):!0},ne=({file:n,event:e})=>{var v;try{let f=JSON.parse((v=e.target)==null?void 0:v.response);f.code===0&&N.value==="public/avatar"&&Ue({avatar:f.data.content}).then(c=>{var K;window.$message.success("头像更新成功"),(K=M.value)==null||K.clear(),o.commit("updateUserinfo",{...o.state.userInfo,avatar:f.data.content})}).catch(c=>{console.log(c)})}catch{window.$message.error("上传失败")}},oe=(n,e)=>!!t.password&&t.password.startsWith(e)&&t.password.length>=e.length,le=(n,e)=>e===t.password,re=()=>{var n;t.reenteredPassword&&((n=Y.value)==null||n.validate({trigger:"password-input"}))},ie=n=>{var e;n.preventDefault(),(e=J.value)==null||e.validate(v=>{v||(D.value=!0,Re({password:t.password,old_password:t.old_password}).then(f=>{D.value=!1,U.value=!1,window.$message.success("密码重置成功"),o.commit("userLogout"),o.commit("triggerAuth",!0),o.commit("triggerAuthKey","signin")}).catch(f=>{D.value=!1}))})},ue=n=>{var e;n.preventDefault(),(e=G.value)==null||e.validate(v=>{v||(z.value=!0,Se({phone:t.phone,captcha:t.phone_captcha}).then(f=>{z.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(f=>{z.value=!1}))})},de=n=>{var e;n.preventDefault(),(e=H.value)==null||e.validate(v=>{if(i.imgCaptcha===""){window.$message.warning("请输入图片验证码");return}P.value=!0,v||(x.value=!0,qe({activate_code:i.activate_code,captcha_id:i.id,imgCaptcha:i.im
|