1 |
- import{p,l as S,h as E,a5 as x,y as I,r as ee,B as oe,t as m,a7 as ae,q as n,N as r,o as v,V as s,a6 as T,M as g,k as t,W as c,a0 as q,a4 as w,m as K}from"./vue-a39e6937.js";import{F as f}from"./index-f0d8af94.js";import{_ as W,f as le,n as ie,g as te,ae as ne,t as re,af as de,ag as se,ah as ue,v as O,w as z}from"./index-ba596ae9.js";import{b as u}from"./validate-4ecec794.js";import{c as G}from"./index-60338ea3.js";import"./index-434d719f.js";import"./controllerUrls-941681c3.js";import"./index-7e56a0fa.js";const pe={};function ce(j,U){return p(),S("div")}const fe=W(pe,[["render",ce]]),me={class:"user-views"},ge={class:"card-header"},be={class:"user-profile"},ye={key:0},ve={key:1},we=E({__name:"profile",setup(j){let U;const{t:l}=le(),H=x(),b=ie(),V=I(),h=I(),C=I(),e=ee({formSubmitLoading:!1,form:b.$state,rules:{avatar:[u({name:"required",message:l("Please select field",{field:l("user.account.profile.head portrait")})})],username:[u({name:"required",title:l("user.account.profile.User name")}),u({name:"account"})],nickname:[u({name:"required",title:l("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:l("user.account.profile.password")}),u({name:"password"})],captcha:[u({name:"required",title:l("user.account.profile.Verification Code")})]},form:{password:"",captcha:""},accountVerificationToken:""},bind:{show:!1,rules:{password:[u({name:"required",title:l("user.account.profile.password")}),u({name:"password"})],email:[u({name:"required",title:l("user.account.profile.email")}),u({name:"email",title:l("user.account.profile.email")})],mobile:[u({name:"required",title:l("user.account.profile.mobile")}),u({name:"mobile",title:l("user.account.profile.mobile")})],captcha:[u({name:"required",title:l("user.account.profile.Verification Code")})]},form:{password:"",email:"",mobile:"",captcha:""}}}}),B=a=>{e.dialog.codeSendCountdown=a,U=window.setInterval(()=>{e.dialog.codeSendCountdown--,e.dialog.codeSendCountdown<=0&&_()},1e3)},_=()=>{e.dialog.codeSendCountdown=0,clearInterval(U)},F=a=>{a=="email"&&b.email||a=="mobile"&&b.mobile?e.dialog.verification.show=!0:e.dialog.bind.show=!0,e.dialog.type=a},J=()=>{e.dialog.codeSendCountdown>0||C.value.validateField("password").then(a=>{a&&G(e.dialog.captchaId,o=>Q(o))})},Q=a=>{e.dialog.sendCaptchaLoading=!0,(e.dialog.type=="email"?O:z)(b[e.dialog.type],`user_${e.dialog.type}_verify`,{password:e.dialog.verification.form.password,captchaId:e.dialog.captchaId,captchaInfo:a}).then(d=>{d.code==1&&B(60)}).finally(()=>{e.dialog.sendCaptchaLoading=!1})},X=()=>{e.dialog.codeSendCountdown>0||h.value.validateField(e.dialog.type).then(a=>{a&&G(e.dialog.captchaId,o=>Y(o))})},Y=a=>{e.dialog.sendCaptchaLoading=!0,(e.dialog.type=="email"?O:z)(e.dialog.bind.form[e.dialog.type],`user_change_${e.dialog.type}`,{captchaId:e.dialog.captchaId,captchaInfo:a}).then(d=>{d.code==1&&B(60)}).finally(()=>{e.dialog.sendCaptchaLoading=!1})},M=a=>{a&&a.validate(o=>{o&&(e.dialog.submitLoading=!0,de({type:e.dialog.type,captcha:e.dialog.verification.form.captcha}).then(d=>{_(),e.dialog.bind.show=!0,e.dialog.type=d.data.type,e.dialog.verification.show=!1,e.dialog.verification.accountVerificationToken=d.data.accountVerificationToken}).finally(()=>{e.dialog.submitLoading=!1}))})},N=a=>{a&&a.validate(o=>{o&&(e.dialog.submitLoading=!0,se({type:e.dialog.type,accountVerificationToken:e.dialog.verification.accountVerificationToken,...e.dialog.bind.form}).then(()=>{_(),e.dialog.bind.show=!1,b[e.dialog.type]=e.dialog.bind.form[e.dialog.type]}).finally(()=>{e.dialog.submitLoading=!1}))})},R=a=>{a&&a.validate(o=>{o&&(e.formSubmitLoading=!0,ue(e.form).then(()=>{e.formSubmitLoading=!1}).catch(()=>{e.formSubmitLoading=!1}))})};return oe(()=>{ne().then(a=>{e.accountVerificationType=a.data.accountVerificationType})}),(a,o)=>{const d=m("el-button"),k=m("el-input"),y=m("el-form-item"),L=m("el-form"),Z=m("el-card"),$=m("el-col"),A=m("el-row"),D=m("el-dialog"),P=ae("blur");return p(),S("div",me,[n(Z,{class:"user-views-card",shadow:"hover"},{header:r(()=>[v("div",ge,[v("span",null,s(a.$t("user.account.profile.personal data")),1),T((p(),g(d,{onClick:o[0]||(o[0]=i=>t(H).push({name:"account/changePassword"})),type:"info",plain:""},{default:r(()=>[c(s(a.$t("user.account.profile.Change Password")),1)]),_:1})),[[P]])])]),default:r(()=>[v("div",be,[n(L,{model:e.form,rules:e.rules,"label-width":100,ref_key:"formRef",ref:V,onKeyup:o[13]||(o[13]=q(i=>R(V.value),["enter"]))},{default:r(()=>[n(f,{label:a.$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:a.$t("user.account.profile.User name"),type:"string",modelValue:e.form.username,"onUpdate:modelValue":o[2]||(o[2]=i=>e.form.username=i),placeholder:a.$t("Please input field",{field:a.$t("user.account.profile.User name")}),prop:"username"},null,8,["label","modelValue","placeholder"]),n(f,{label:a.$t("user.account.profile.User nickname"),type:"string",modelValue:e.form.nickname,"onUpdate:modelValue":o[3]||(o[3]=i=>e.form.nickname=i),placeholder:a.$t("Please input field",{field:a.$t("user.account.profile.User nickname")}),prop:"nickname"},null,8,["label","modelValue","placeholder"]),e.accountVerificationType.includes("email")?(p(),g(y,{key:0,label:t(l)("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(l)("user.account.profile.Operation via right button")},{append:r(()=>[n(d,{type:"primary",onClick:o[4]||(o[4]=i=>F("email"))},{default:r(()=>[c(s(e.form.email?t(l)("user.account.profile.Click Modify"):t(l)("user.account.profile.bind")),1)]),_:1})]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):w("",!0),e.accountVerificationType.includes("mobile")?(p(),g(y,{key:1,label:t(l)("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(l)("user.account.profile.Operation via right button")},{append:r(()=>[n(d,{type:"primary",onClick:o[6]||(o[6]=i=>F("mobile"))},{default:r(()=>[c(s(e.form.mobile?t(l)("user.account.profile.Click Modify"):t(l)("user.account.profile.bind")),1)]),_:1})]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"])):w("",!0),n(f,{label:a.$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:a.$t("user.account.profile.secrecy"),1:a.$t("user.account.profile.male"),2:a.$t("user.account.profile.female")}}},null,8,["label","modelValue","data"]),n(f,{label:a.$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:a.$t("user.account.profile.Personal signature"),type:"textarea",placeholder:a.$t("Please input field",{field:a.$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(fe),n(y,{class:"submit-buttons"},{default:r(()=>[n(d,{onClick:o[11]||(o[11]=i=>t(re)(V.value))},{default:r(()=>[c(s(a.$t("Reset")),1)]),_:1}),n(d,{type:"primary",loading:e.formSubmitLoading,onClick:o[12]||(o[12]=i=>R(V.value))},{default:r(()=>[c(s(a.$t("Save")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["model","rules"])])]),_:1}),n(D,{title:t(l)("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(()=>[v("div",{style:K("width: calc(100% - 20px)")},[n(d,{onClick:o[17]||(o[17]=i=>e.dialog.verification.show=!1)},{default:r(()=>[c(s(t(l)("Cancel")),1)]),_:1}),T((p(),g(d,{loading:e.dialog.submitLoading,onClick:o[18]||(o[18]=i=>M(C.value)),type:"primary"},{default:r(()=>[c(s(t(l)("user.account.profile.next step")),1)]),_:1},8,["loading"])),[[P]])],4)]),default:r(()=>[n(L,{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=>M(C.value),["enter"]))},{default:r(()=>[n(f,{label:t(l)("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:a.$t("Please input field",{field:a.$t("user.account.profile.password")})},null,8,["label","modelValue","placeholder"]),n(y,{prop:"captcha"},{label:r(()=>[e.dialog.type=="email"?(p(),S("span",ye,s(t(l)("user.account.profile.Mail verification"))+" ("+s(t(l)("user.account.profile.accept")+t(l)("user.account.profile.mail")+":"+t(b).email)+") ",1)):(p(),S("span",ve,s(t(l)("user.account.profile.SMS verification"))+" ("+s(t(l)("user.account.profile.accept")+t(l)("user.account.profile.mobile")+":"+t(b).mobile)+") ",1))]),default:r(()=>[n(A,{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(l)("Please input field",{field:t(l)("user.account.profile.Verification Code")}),autocomplete:"off"},null,8,["modelValue","placeholder"])]),_:1}),n($,{class:"captcha-box",span:6},{default:r(()=>[n(d,{onClick:J,loading:e.dialog.sendCaptchaLoading,disabled:!(e.dialog.codeSendCountdown<=0),type:"primary"},{default:r(()=>[c(s(e.dialog.codeSendCountdown<=0?t(l)("user.account.profile.send"):e.dialog.codeSendCountdown+t(l)("user.account.profile.seconds")),1)]),_:1},8,["loading","disabled"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model","rules"])]),_:1},8,["title","modelValue"]),n(D,{title:t(l)("user.account.profile.bind")+t(l)("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(()=>[v("div",{style:K("width: calc(100% - 20px)")},[n(d,{onClick:o[25]||(o[25]=i=>e.dialog.bind.show=!1)},{default:r(()=>[c(s(t(l)("Cancel")),1)]),_:1}),T((p(),g(d,{loading:e.dialog.submitLoading,onClick:o[26]||(o[26]=i=>N(h.value)),type:"primary"},{default:r(()=>[c(s(t(l)("user.account.profile.bind")),1)]),_:1},8,["loading"])),[[P]])],4)]),default:r(()=>[n(L,{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(h.value),["enter"]))},{default:r(()=>[e.dialog.verification.accountVerificationToken?w("",!0):(p(),g(f,{key:0,label:t(l)("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:a.$t("Please input field",{field:a.$t("user.account.profile.password")})},null,8,["label","modelValue","placeholder"])),e.dialog.type=="email"?(p(),g(f,{key:1,label:t(l)("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:a.$t("Please input field",{field:t(l)("user.account.profile.New "+e.dialog.type)})},null,8,["label","modelValue","placeholder"])):w("",!0),e.dialog.type=="mobile"?(p(),g(f,{key:2,label:t(l)("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:a.$t("Please input field",{field:t(l)("user.account.profile.New "+e.dialog.type)})},null,8,["label","modelValue","placeholder"])):w("",!0),n(y,{label:e.dialog.type=="email"?t(l)("user.account.profile.Mail verification"):t(l)("user.account.profile.SMS verification"),prop:"captcha"},{default:r(()=>[n(A,{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(l)("Please input field",{field:t(l)("user.account.profile.Verification Code")}),autocomplete:"off"},null,8,["modelValue","placeholder"])]),_:1}),n($,{class:"captcha-box",span:6},{default:r(()=>[n(d,{onClick:X,loading:e.dialog.sendCaptchaLoading,disabled:!(e.dialog.codeSendCountdown<=0),type:"primary"},{default:r(()=>[c(s(e.dialog.codeSendCountdown<=0?t(l)("user.account.profile.send"):e.dialog.codeSendCountdown+t(l)("user.account.profile.seconds")),1)]),_:1},8,["loading","disabled"])]),_:1})]),_:1})]),_:1},8,["label"])]),_:1},8,["model","rules"])]),_:1},8,["title","modelValue"])])}}});const Le=W(we,[["__scopeId","data-v-7bd8be2a"]]);export{Le as default};
|