profile-_l3t0fu9.js 13 KB

1
  1. import{d as Y,a2 as Z,ag as x,a as P,r as ee,o as oe,K as m,aq as ae,e as p,f as I,j as n,L as r,t as d,i as w,u as t,m as c,y as g,am as T,ac as q,C as v,n as D}from"./vue-A59npLRR.js";import{F as f}from"./index-r6iTpmP6.js";import{h as le,j as ie,b as te,ae as ne,o as re,n as j,p as E,af as de,ag as se,ah as ue,_ as pe}from"./index-EwE51S_X.js";import{b as u}from"./validate-_EUdkMt3.js";import{U as ce}from"./userProfile-ncSGlwdV.js";import{c as O}from"./index-AhShc7A-.js";import"./index-K8IR974I.js";import"./baTable-MdxYOkAk.js";import"./index-XALue448.js";import"./echarts-cxb9vJr1.js";import"./wechat_mp-zANTKHXk.js";import"./oauth-flw5HISP.js";const fe={class:"user-views"},me={class:"card-header"},ge={class:"user-profile"},be={key:0},ye={key:1},we=Y({__name:"profile",setup(ve){let B;const{t:a}=Z(),z=x(),b=le(),G=ie(),V=P(),h=P(),C=P(),e=ee({formSubmitLoading:!1,form:b.$state,rules:{username:[u({name:"required",title:a("user.account.profile.User name")}),u({name:"account"})],nickname:[u({name:"required",title:a("user.account.profile.nickname")})]},accountVerificationType:[],dialog:{type:"email",submitLoading:!1,sendCaptchaLoading:!1,codeSendCountdown:0,captchaId:te(),verification:{show:!1,rules:{password:[u({name:"required",title:a("user.account.profile.password")}),u({name:"password"})],captcha:[u({name:"required",title:a("user.account.profile.Verification Code")})]},form:{password:"",captcha:""},accountVerificationToken:""},bind:{show:!1,rules:{password:[u({name:"required",title:a("user.account.profile.password")}),u({name:"password"})],email:[u({name:"required",title:a("user.account.profile.email")}),u({name:"email",title:a("user.account.profile.email")})],mobile:[u({name:"required",title:a("user.account.profile.mobile")}),u({name:"mobile",title:a("user.account.profile.mobile")})],captcha:[u({name:"required",title:a("user.account.profile.Verification Code")})]},form:{password:"",email:"",mobile:"",captcha:""}}}}),F=l=>{e.dialog.codeSendCountdown=l,B=window.setInterval(()=>{e.dialog.codeSendCountdown--,e.dialog.codeSendCountdown<=0&&S()},1e3)},S=()=>{e.dialog.codeSendCountdown=0,clearInterval(B)},M=l=>{l=="email"&&b.email||l=="mobile"&&b.mobile?e.dialog.verification.show=!0:e.dialog.bind.show=!0,e.dialog.type=l},H=()=>{e.dialog.codeSendCountdown>0||C.value.validateField("password").then(l=>{l&&O(e.dialog.captchaId,o=>J(o))})},J=l=>{e.dialog.sendCaptchaLoading=!0,(e.dialog.type=="email"?j:E)(b[e.dialog.type],`user_${e.dialog.type}_verify`,{password:e.dialog.verification.form.password,captchaId:e.dialog.captchaId,captchaInfo:l}).then(s=>{s.code==1&&F(60)}).finally(()=>{e.dialog.sendCaptchaLoading=!1})},Q=()=>{e.dialog.codeSendCountdown>0||h.value.validateField(e.dialog.type).then(l=>{l&&O(e.dialog.captchaId,o=>W(o))})},W=l=>{e.dialog.sendCaptchaLoading=!0,(e.dialog.type=="email"?j:E)(e.dialog.bind.form[e.dialog.type],`user_change_${e.dialog.type}`,{captchaId:e.dialog.captchaId,captchaInfo:l}).then(s=>{s.code==1&&F(60)}).finally(()=>{e.dialog.sendCaptchaLoading=!1})},R=()=>{C.value&&C.value.validate(l=>{l&&(e.dialog.submitLoading=!0,de({type:e.dialog.type,captcha:e.dialog.verification.form.captcha}).then(o=>{S(),e.dialog.bind.show=!0,e.dialog.type=o.data.type,e.dialog.verification.show=!1,e.dialog.verification.accountVerificationToken=o.data.accountVerificationToken}).finally(()=>{e.dialog.submitLoading=!1}))})},N=()=>{h.value&&h.value.validate(l=>{l&&(e.dialog.submitLoading=!0,se({type:e.dialog.type,accountVerificationToken:e.dialog.verification.accountVerificationToken,...e.dialog.bind.form}).then(()=>{S(),e.dialog.bind.show=!1,b[e.dialog.type]=e.dialog.bind.form[e.dialog.type]}).finally(()=>{e.dialog.submitLoading=!1}))})},_=()=>{V.value&&V.value.validate(l=>{l&&(e.formSubmitLoading=!0,ue(e.form).then(()=>{e.formSubmitLoading=!1}).catch(()=>{e.formSubmitLoading=!1}))})};return oe(()=>{ne().then(l=>{e.accountVerificationType=l.data.accountVerificationType})}),(l,o)=>{const s=m("el-button"),k=m("el-input"),y=m("el-form-item"),U=m("el-form"),X=m("el-card"),$=m("el-col"),K=m("el-row"),A=m("el-dialog"),L=ae("blur");return p(),I("div",fe,[n(X,{class:"user-views-card",shadow:"hover"},{header:r(()=>[w("div",me,[w("span",null,d(l.$t("user.account.profile.personal data")),1),T((p(),g(s,{onClick:o[0]||(o[0]=i=>t(z).push({name:"account/changePassword"})),type:"info",plain:""},{default:r(()=>[c(d(l.$t("user.account.profile.Change Password")),1)]),_:1})),[[L]])])]),default:r(()=>[w("div",ge,[n(U,{"label-position":t(G).state.shrink?"top":"right",model:e.form,rules:e.rules,"label-width":100,ref_key:"formRef",ref:V,onKeyup:o[13]||(o[13]=q(i=>_(),["enter"]))},{default:r(()=>[n(f,{label:l.$t("user.account.profile.head portrait"),"input-attr":{"hide-select-file":!0},type:"image",modelValue:e.form.avatar,"onUpdate:modelValue":o[1]||(o[1]=i=>e.form.avatar=i),prop:"avatar"},null,8,["label","modelValue"]),n(f,{label:l.$t("user.account.profile.User name"),type:"string",modelValue:e.form.username,"onUpdate:modelValue":o[2]||(o[2]=i=>e.form.username=i),placeholder:l.$t("Please input field",{field:l.$t("user.account.profile.User name")}),prop:"username"},null,8,["label","modelValue","placeholder"]),n(f,{label:l.$t("user.account.profile.User nickname"),type:"string",modelValue:e.form.nickname,"onUpdate:modelValue":o[3]||(o[3]=i=>e.form.nickname=i),placeholder:l.$t("Please input field",{field:l.$t("user.account.profile.User nickname")}),prop:"nickname"},null,8,["label","modelValue","placeholder"]),e.accountVerificationType.includes("email")?(p(),g(y,{key:0,label:t(a)("user.account.profile.email")},{default:r(()=>[n(k,{modelValue:e.form.email,"onUpdate:modelValue":o[5]||(o[5]=i=>e.form.email=i),readonly:"",placeholder:t(a)("user.account.profile.Operation via right button")},{append:r(()=>[n(s,{type:"primary",onClick:o[4]||(o[4]=i=>M("email"))},{default:r(()=>[c(d(e.form.email?t(a)("user.account.profile.Click Modify"):t(a)("user.account.profile.bind")),1)]),_:1})]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):v("",!0),e.accountVerificationType.includes("mobile")?(p(),g(y,{key:1,label:t(a)("user.account.profile.mobile")},{default:r(()=>[n(k,{modelValue:e.form.mobile,"onUpdate:modelValue":o[7]||(o[7]=i=>e.form.mobile=i),readonly:"",placeholder:t(a)("user.account.profile.Operation via right button")},{append:r(()=>[n(s,{type:"primary",onClick:o[6]||(o[6]=i=>M("mobile"))},{default:r(()=>[c(d(e.form.mobile?t(a)("user.account.profile.Click Modify"):t(a)("user.account.profile.bind")),1)]),_:1})]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):v("",!0),n(f,{label:l.$t("user.account.profile.Gender"),type:"radio",modelValue:e.form.gender,"onUpdate:modelValue":o[8]||(o[8]=i=>e.form.gender=i),data:{childrenAttr:{border:!0},content:{0:l.$t("user.account.profile.secrecy"),1:l.$t("user.account.profile.male"),2:l.$t("user.account.profile.female")}}},null,8,["label","modelValue","data"]),n(f,{label:l.$t("user.account.profile.birthday"),type:"date",modelValue:e.form.birthday,"onUpdate:modelValue":o[9]||(o[9]=i=>e.form.birthday=i)},null,8,["label","modelValue"]),n(f,{label:l.$t("user.account.profile.Personal signature"),type:"textarea",placeholder:l.$t("Please input field",{field:l.$t("user.account.profile.Personal signature")}),modelValue:e.form.motto,"onUpdate:modelValue":o[10]||(o[10]=i=>e.form.motto=i),"input-attr":{"show-word-limit":!0,rows:3}},null,8,["label","placeholder","modelValue"]),n(ce),n(y,{class:"submit-buttons"},{default:r(()=>[n(s,{onClick:o[11]||(o[11]=i=>t(re)(V.value))},{default:r(()=>[c(d(l.$t("Reset")),1)]),_:1}),n(s,{type:"primary",loading:e.formSubmitLoading,onClick:o[12]||(o[12]=i=>_())},{default:r(()=>[c(d(l.$t("Save")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["label-position","model","rules"])])]),_:1}),n(A,{title:t(a)("user.account.profile.Account verification"),modelValue:e.dialog.verification.show,"onUpdate:modelValue":o[19]||(o[19]=i=>e.dialog.verification.show=i),class:"ba-change-bind-dialog ba-verification-dialog","destroy-on-close":!0,"close-on-click-modal":!1,width:"30%"},{footer:r(()=>[w("div",{style:D("width: calc(100% - 20px)")},[n(s,{onClick:o[17]||(o[17]=i=>e.dialog.verification.show=!1)},{default:r(()=>[c(d(t(a)("Cancel")),1)]),_:1}),T((p(),g(s,{loading:e.dialog.submitLoading,onClick:o[18]||(o[18]=i=>R()),type:"primary"},{default:r(()=>[c(d(t(a)("user.account.profile.next step")),1)]),_:1},8,["loading"])),[[L]])],4)]),default:r(()=>[n(U,{model:e.dialog.verification.form,rules:e.dialog.verification.rules,"label-position":"top",ref_key:"verificationFormRef",ref:C,onKeyup:o[16]||(o[16]=q(i=>R(),["enter"]))},{default:r(()=>[n(f,{label:t(a)("user.account.profile.Account password verification"),type:"password",modelValue:e.dialog.verification.form.password,"onUpdate:modelValue":o[14]||(o[14]=i=>e.dialog.verification.form.password=i),prop:"password","input-attr":{"show-password":!0},placeholder:l.$t("Please input field",{field:l.$t("user.account.profile.password")})},null,8,["label","modelValue","placeholder"]),n(y,{prop:"captcha"},{label:r(()=>[e.dialog.type=="email"?(p(),I("span",be,d(t(a)("user.account.profile.Mail verification"))+" ("+d(t(a)("user.account.profile.accept")+t(a)("user.account.profile.mail")+":"+t(b).email)+") ",1)):(p(),I("span",ye,d(t(a)("user.account.profile.SMS verification"))+" ("+d(t(a)("user.account.profile.accept")+t(a)("user.account.profile.mobile")+":"+t(b).mobile)+") ",1))]),default:r(()=>[n(K,{class:"w100",gutter:10},{default:r(()=>[n($,{span:18},{default:r(()=>[n(k,{modelValue:e.dialog.verification.form.captcha,"onUpdate:modelValue":o[15]||(o[15]=i=>e.dialog.verification.form.captcha=i),placeholder:t(a)("Please input field",{field:t(a)("user.account.profile.Verification Code")}),autocomplete:"off"},null,8,["modelValue","placeholder"])]),_:1}),n($,{class:"captcha-box",span:6},{default:r(()=>[n(s,{onClick:H,loading:e.dialog.sendCaptchaLoading,disabled:!(e.dialog.codeSendCountdown<=0),type:"primary"},{default:r(()=>[c(d(e.dialog.codeSendCountdown<=0?t(a)("user.account.profile.send"):e.dialog.codeSendCountdown+t(a)("user.account.profile.seconds")),1)]),_:1},8,["loading","disabled"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title","modelValue"]),n(A,{title:t(a)("user.account.profile.bind")+t(a)("user.account.profile."+e.dialog.type),modelValue:e.dialog.bind.show,"onUpdate:modelValue":o[27]||(o[27]=i=>e.dialog.bind.show=i),class:"ba-change-bind-dialog ba-bind-dialog","destroy-on-close":!0,"close-on-click-modal":!1,width:"30%"},{footer:r(()=>[w("div",{style:D("width: calc(100% - 20px)")},[n(s,{onClick:o[25]||(o[25]=i=>e.dialog.bind.show=!1)},{default:r(()=>[c(d(t(a)("Cancel")),1)]),_:1}),T((p(),g(s,{loading:e.dialog.submitLoading,onClick:o[26]||(o[26]=i=>N()),type:"primary"},{default:r(()=>[c(d(t(a)("user.account.profile.bind")),1)]),_:1},8,["loading"])),[[L]])],4)]),default:r(()=>[n(U,{model:e.dialog.bind.form,rules:e.dialog.bind.rules,"label-position":"top",ref_key:"bindFormRef",ref:h,onKeyup:o[24]||(o[24]=q(i=>N(),["enter"]))},{default:r(()=>[e.dialog.verification.accountVerificationToken?v("",!0):(p(),g(f,{key:0,label:t(a)("user.account.profile.Account password verification"),type:"password",modelValue:e.dialog.bind.form.password,"onUpdate:modelValue":o[20]||(o[20]=i=>e.dialog.bind.form.password=i),prop:"password","input-attr":{"show-password":!0},placeholder:l.$t("Please input field",{field:l.$t("user.account.profile.password")})},null,8,["label","modelValue","placeholder"])),e.dialog.type=="email"?(p(),g(f,{key:1,label:t(a)("user.account.profile.New "+e.dialog.type),type:"string",modelValue:e.dialog.bind.form.email,"onUpdate:modelValue":o[21]||(o[21]=i=>e.dialog.bind.form.email=i),prop:"email",placeholder:l.$t("Please input field",{field:t(a)("user.account.profile.New "+e.dialog.type)})},null,8,["label","modelValue","placeholder"])):v("",!0),e.dialog.type=="mobile"?(p(),g(f,{key:2,label:t(a)("user.account.profile.New "+e.dialog.type),type:"string",modelValue:e.dialog.bind.form.mobile,"onUpdate:modelValue":o[22]||(o[22]=i=>e.dialog.bind.form.mobile=i),prop:"mobile",placeholder:l.$t("Please input field",{field:t(a)("user.account.profile.New "+e.dialog.type)})},null,8,["label","modelValue","placeholder"])):v("",!0),n(y,{label:e.dialog.type=="email"?t(a)("user.account.profile.Mail verification"):t(a)("user.account.profile.SMS verification"),prop:"captcha"},{default:r(()=>[n(K,{class:"w100",gutter:10},{default:r(()=>[n($,{span:18},{default:r(()=>[n(k,{modelValue:e.dialog.bind.form.captcha,"onUpdate:modelValue":o[23]||(o[23]=i=>e.dialog.bind.form.captcha=i),placeholder:t(a)("Please input field",{field:t(a)("user.account.profile.Verification Code")}),autocomplete:"off"},null,8,["modelValue","placeholder"])]),_:1}),n($,{class:"captcha-box",span:6},{default:r(()=>[n(s,{onClick:Q,loading:e.dialog.sendCaptchaLoading,disabled:!(e.dialog.codeSendCountdown<=0),type:"primary"},{default:r(()=>[c(d(e.dialog.codeSendCountdown<=0?t(a)("user.account.profile.send"):e.dialog.codeSendCountdown+t(a)("user.account.profile.seconds")),1)]),_:1},8,["loading","disabled"])]),_:1})]),_:1})]),_:1},8,["label"])]),_:1},8,["model","rules"])]),_:1},8,["title","modelValue"])])}}}),Be=pe(we,[["__scopeId","data-v-f0abc081"]]);export{Be as default};