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
2 years ago
|
import{_ as we}from"./main-nav.vue_vue_type_style_index_0_lang-455f4f57.js";import{d as ye,r as d,D as J,j as ke,c as g,L as t,Y as s,K as b,O as _,o as r,a as m,U as u,e as c,M as S,z as be,v as Ce,P as q,Z as N,a4 as Ie,a5 as $e}from"./@vue-f70ab1bd.js";import{u as Pe}from"./vuex-cc1858c6.js";import{L as X,M as Ue,N as Re,O as Se,P as qe,Q as Ne,R as ze,_ as Ae}from"./index-1063388e.js";import{s as Be}from"./@vicons-fc06a0bb.js";import{f as Ke,m as De,c as xe,z as Fe,_ as Oe,N as Le,Q as Me,Y as Te,H as Ve,Z as je,$ as Ee,b as Qe}from"./naive-ui-9980ffcb.js";import"./vue-router-29025daf.js";import"./vooks-dfdd6eef.js";import"./evtd-b614532e.js";import"./axios-707ed124.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-804c4158.js";import"./@css-render-66126308.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 O=z=>(Ie("data-v-a681720e"),z=z(),$e(),z),We={class:"base-line avatar"},Ye={class:"base-line"},Ze=O(()=>m("span",{class:"base-label"},"昵称",-1)),Ge={key:0},He={class:"base-line"},Je=O(()=>m("span",{class:"base-label"},"用户名",-1)),Xe={key:0},et={key:1},tt=O(()=>m("br",null,null,-1)),at={key:2,class:"phone-bind-wrap"},st={class:"captcha-img-wrap"},nt={class:"captcha-img"},ot=["src"],lt={class:"form-submit-wrap"},rt={key:0},it={key:1},ut=O(()=>m("br",null,null,-1)),dt={key:2,class:"phone-bind-wrap"},ct={class:"captcha-img-wrap"},pt={class:"captcha-img"},_t=["src"],mt={class:"form-submit-wrap"},vt={key:1,class:"phone-bind-wrap"},ft={class:"form-submit-wrap"},gt=ye({__name:"Setting",setup(z){const ee="/v1/attachment",te="Bearer "+localStorage.getItem("PAOPAO_TOKEN"),A=d("public/avatar"),$="true".toLowerCase()==="true",ae="false".toLowerCase()==="true",o=Pe(),P=d(!1),B=d(!1),K=d(!1),E=d(),Q=d(),C=d(!1),D=d(!1),U=d(!1),R=d(!1),I=d(60),y=d(!1),k=d(!1),W=d(),Y=d(),Z=d(),G=d(),a=J({id:"",b64s:"",imgCaptcha:"",phone:"",phone_captcha:"",password:"",old_password:"",reenteredPassword:""}),i=J({id:"",b64s:"",imgCaptcha:"",activate_code:""}),se=async n=>{var e,v;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"&&((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&&A.value==="public/avatar"&&Ue({avatar:f.data.content}).then(p=>{var x;window.$message.success("头像更新成功"),(x=E.value)==null||x.clear(),o.commit("updateUserinfo",{...o.state.userInfo,avatar:f.data.content})}).catch(p=>{console.log(p)})}catch{window.$message.error("上传失败")}},oe=(n,e)=>!!a.password&&a.password.startsWith(e)&&a.password.length>=e.length,le=(n,e)=>e===a.password,re=()=>{var n;a.reenteredPassword&&((n=G.value)==null||n.validate({trigger:"password-input"}))},ie=n=>{var e;n.preventDefault(),(e=Z.value)==null||e.validate(v=>{v||(D.value=!0,Re({password:a.password,old_password:a.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=W.value)==null||e.validate(v=>{v||(B.value=!0,Se({phone:a.phone,captcha:a.phone_captcha}).then(f=>{B.value=!1,y.value=!1,window.$message.success("绑定成功"),o.commit("updateUserinfo",{...o.state.userInfo,phone:a.phone}),a.id="",a.b64s="",a.imgCaptcha="",a.phone="",a.phone_captcha=""}).catch(f=>{B.value=!1}))})},de=n=>{var e;n.preventDefault(),(e=Y.value)==null||e.validate(v=>{if(i.imgCaptcha===""){window.$message.warning("请输入图片验证码");return}P.value=!0,v||(K.value=!0,qe({activate_code:i.activate_code,captcha_id:i.id,imgCaptcha:i.imgCaptcha}).then(f=>{K.value=!1,k.value=
|