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
13 KiB
2 lines
13 KiB
11 months ago
|
import{_ as ge}from"./main-nav.vue_vue_type_style_index_0_lang-NlSSnAqR.js";import{d as we,H as d,S as Q,b as ye,f as h,k as a,w as s,bk as r,v as b,Z as m,e as i,j as _,A as p,t as U,P as ke,D as be,_ as S,y as R,a0 as Ce,a1 as Ie}from"./@vue-M2CzPUka.js";import{u as Pe}from"./vuex-k9agayot.js";import{a5 as X,a6 as $e,a7 as Be,a8 as Ue,a9 as Se,aa as Re,ab as qe,_ as Ae}from"./index-Ngk4ShPB.js";import{a2 as Ne}from"./@vicons-t7bPon9z.js";import{h as ze,o as De,e as Ke,B as xe,b as Fe,j as Te,T as je,$ as Ve,L as Ee,a0 as Oe,a1 as Le,d as Me}from"./naive-ui-CFtxauK_.js";import"./vue-router-iNEl8q3a.js";import"./vooks-RlHpQsWY.js";import"./evtd-9ZCiDXyn.js";import"./axios-zw96FDk0.js";import"./moment-jIwEdMgI.js";/* empty css */import"./seemly-hKSMrbh9.js";import"./vueuc-5-iSHcg-.js";import"./@css-render-nQ5vzMKz.js";import"./vdirs-gz97tqc5.js";import"./@juggle--NVrOerG.js";import"./css-render-Adblu2bf.js";import"./@emotion-vV6BesBt.js";import"./lodash-es-KEIJqYRD.js";import"./treemate-hmrDCADh.js";import"./async-validator-BHjhHa7C.js";import"./date-fns-E8ESfRGG.js";const F=q=>(Ce("data-v-7bb19e7f"),q=q(),Ie(),q),We={class:"base-line avatar"},Ge={class:"base-line"},He=F(()=>_("span",{class:"base-label"},"昵称",-1)),Je={key:0},Ze={class:"base-line"},Qe=F(()=>_("span",{class:"base-label"},"用户名",-1)),Xe={key:0},Ye={key:1},ea=F(()=>_("br",null,null,-1)),aa={key:2,class:"phone-bind-wrap"},ta={class:"captcha-img-wrap"},sa={class:"captcha-img"},na=["src"],oa={class:"form-submit-wrap"},la={key:0},ra={key:1},ia=F(()=>_("br",null,null,-1)),ua={key:2,class:"phone-bind-wrap"},da={class:"captcha-img-wrap"},pa={class:"captcha-img"},ca=["src"],ma={class:"form-submit-wrap"},_a={key:1,class:"phone-bind-wrap"},va={class:"form-submit-wrap"},fa=we({__name:"Setting",setup(q){const Y="/v1/attachment",ee="Bearer "+localStorage.getItem("PAOPAO_TOKEN"),A=d("public/avatar"),ae="false".toLowerCase()==="true",o=Pe(),P=d(!1),N=d(!1),z=d(!1),L=d(),M=d(),C=d(!1),D=d(!1),$=d(!1),B=d(!1),I=d(60),y=d(!1),k=d(!1),W=d(),G=d(),H=d(),J=d(),t=Q({id:"",b64s:"",imgCaptcha:"",phone:"",phone_captcha:"",password:"",old_password:"",reenteredPassword:""}),u=Q({id:"",b64s:"",imgCaptcha:"",activate_code:""}),te=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},se=({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"&&$e({avatar:f.data.content}).then(c=>{var K;window.$message.success("头像更新成功"),(K=L.value)==null||K.clear(),o.commit("updateUserinfo",{...o.state.userInfo,avatar:f.data.content})}).catch(c=>{console.log(c)})}catch{window.$message.error("上传失败")}},ne=(n,e)=>!!t.password&&t.password.startsWith(e)&&t.password.length>=e.length,oe=(n,e)=>e===t.password,le=()=>{var n;t.reenteredPassword&&((n=J.value)==null||n.validate({trigger:"password-input"}))},re=n=>{var e;n.preventDefault(),(e=H.value)==null||e.validate(v=>{v||(D.value=!0,Be({password:t.password,old_password:t.old_password}).then(f=>{D.value=!1,$.value=!1,window.$message.success("密码重置成功"),o.commit("userLogout"),o.commit("triggerAuth",!0),o.commit("triggerAuthKey","signin")}).catch(f=>{D.value=!1}))})},ie=n=>{var e;n.preventDefault(),(e=W.value)==null||e.validate(v=>{v||(N.value=!0,Ue({phone:t.phone,captcha:t.phone_captcha}).then(f=>{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(f=>{N.value=!1}))})},ue=n=>{var e;n.preventDefault(),(e=G.value)==null||e.validate(v=>{if(u.imgCaptcha===""){window.$message.warning("请输入图片验证码");return}P.value=!0,v||(z.value=!0,Se({activate_code:u.activate_code,captcha_id:u.id,imgCaptcha:u.imgCaptcha}).then(f=>{z.value=!1,k
|