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
1 year ago
|
import{_ as he}from"./main-nav.vue_vue_type_style_index_0_lang-a20a8596.js";import{d as we,H as d,R as Z,b as ye,f as g,k as t,w as s,bf as r,q as k,Y as _,e as i,j as m,A as p,x as U,O as be,D as ke,Z as R,y as S,$ as Ce,a0 as Ie}from"./@vue-a481fc63.js";import{u as $e}from"./vuex-44de225f.js";import{a4 as Q,a5 as Pe,a6 as Be,a7 as Ue,a8 as Re,a9 as Se,aa as qe,_ as Ae}from"./index-15a0e03b.js";import{a2 as Ne}from"./@vicons-f0266f88.js";import{h as ze,o as xe,e as De,B as Ke,b as Fe,j as Te,T as je,$ as Oe,L as Ve,a0 as Ee,a1 as Le,d as Me}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 F=q=>(Ce("data-v-7bb19e7f"),q=q(),Ie(),q),We={class:"base-line avatar"},Ge={class:"base-line"},He=F(()=>m("span",{class:"base-label"},"昵称",-1)),Je={key:0},Ye={class:"base-line"},Ze=F(()=>m("span",{class:"base-label"},"用户名",-1)),Qe={key:0},Xe={key:1},et=F(()=>m("br",null,null,-1)),tt={key:2,class:"phone-bind-wrap"},at={class:"captcha-img-wrap"},st={class:"captcha-img"},nt=["src"],ot={class:"form-submit-wrap"},lt={key:0},rt={key:1},it=F(()=>m("br",null,null,-1)),ut={key:2,class:"phone-bind-wrap"},dt={class:"captcha-img-wrap"},pt={class:"captcha-img"},ct=["src"],_t={class:"form-submit-wrap"},mt={key:1,class:"phone-bind-wrap"},vt={class:"form-submit-wrap"},ft=we({__name:"Setting",setup(q){const X="/v1/attachment",ee="Bearer "+localStorage.getItem("PAOPAO_TOKEN"),A=d("public/avatar"),te="false".toLowerCase()==="true",o=$e(),$=d(!1),N=d(!1),z=d(!1),L=d(),M=d(),C=d(!1),x=d(!1),P=d(!1),B=d(!1),I=d(60),y=d(!1),b=d(!1),W=d(),G=d(),H=d(),J=d(),a=Z({id:"",b64s:"",imgCaptcha:"",phone:"",phone_captcha:"",password:"",old_password:"",reenteredPassword:""}),u=Z({id:"",b64s:"",imgCaptcha:"",activate_code:""}),ae=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"&&Pe({avatar:f.data.content}).then(c=>{var D;window.$message.success("头像更新成功"),(D=L.value)==null||D.clear(),o.commit("updateUserinfo",{...o.state.userInfo,avatar:f.data.content})}).catch(c=>{console.log(c)})}catch{window.$message.error("上传失败")}},ne=(n,e)=>!!a.password&&a.password.startsWith(e)&&a.password.length>=e.length,oe=(n,e)=>e===a.password,le=()=>{var n;a.reenteredPassword&&((n=J.value)==null||n.validate({trigger:"password-input"}))},re=n=>{var e;n.preventDefault(),(e=H.value)==null||e.validate(v=>{v||(x.value=!0,Be({password:a.password,old_password:a.old_password}).then(f=>{x.value=!1,P.value=!1,window.$message.success("密码重置成功"),o.commit("userLogout"),o.commit("triggerAuth",!0),o.commit("triggerAuthKey","signin")}).catch(f=>{x.value=!1}))})},ie=n=>{var e;n.preventDefault(),(e=W.value)==null||e.validate(v=>{v||(N.value=!0,Ue({phone:a.phone,captcha:a.phone_captcha}).then(f=>{N.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=>{N.value=!1}))})},ue=n=>{var e;n.preventDefault(),(e=G.value)==null||e.validate(v=>{if(u.imgCaptcha===""){window.$message.warning("请输入图片验证码");return}$.value=!0,v||(z.value=!0,Re({activate_code:u.activate_code,captcha_id:u.id,imgCaptcha:u.imgCaptcha}).then(f=>{z.value=!1,b.
|