2 lines
13 KiB
JavaScript
2 lines
13 KiB
JavaScript
import{C as p,D as C,B as Z,a0 as x,a8 as I,a as ee,o as oe,I as m,X as ae,H as n,P as r,G as w,a7 as T,u as t,O as g,V as c,U as s,W as v,_ as R}from"./vue-BqYd3Ike.js";import{F as f}from"./index-B30olC8P.js";import{_ as O,x as le,b as ie,a as te,y as ne,ai as re,G as de,H as A,I as E,aj as se,ak as ue,al as pe}from"./index-CP9YHUOF.js";import{b as u}from"./validate-CsIEl4-L.js";import{c as G}from"./index-DjftB1Z5.js";import"./index-Civcz3u4.js";import"./index-CCiV5UhK.js";const ce={};function fe(j,k){return p(),C("div")}const me=O(ce,[["render",fe]]),ge={class:"user-views"},be={class:"card-header"},ye={class:"user-profile"},we={key:0},ve={key:1},Ve={style:"width: calc(100% - 20px)"},he={style:"width: calc(100% - 20px)"},Ce=Z({__name:"profile",setup(j){let k;const{t:l}=le.useI18n(),H=x(),b=ie(),W=te(),$=I("formRef"),S=I("bindFormRef"),U=I("verificationFormRef"),e=ee({formSubmitLoading:!1,form:b.$state,rules:{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:ne(),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:""}}}}),F=a=>{e.dialog.codeSendCountdown=a,k=window.setInterval(()=>{e.dialog.codeSendCountdown--,e.dialog.codeSendCountdown<=0&&P()},1e3)},P=()=>{e.dialog.codeSendCountdown=0,clearInterval(k)},B=a=>{a=="email"&&b.email||a=="mobile"&&b.mobile?e.dialog.verification.show=!0:e.dialog.bind.show=!0,e.dialog.type=a},X=()=>{e.dialog.codeSendCountdown>0||U.value.validateField("password").then(a=>{a&&G(e.dialog.captchaId,o=>z(o))})},z=a=>{e.dialog.sendCaptchaLoading=!0,(e.dialog.type=="email"?A:E)(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&&F(60)}).finally(()=>{e.dialog.sendCaptchaLoading=!1})},J=()=>{e.dialog.codeSendCountdown>0||S.value.validateField(e.dialog.type).then(a=>{a&&G(e.dialog.captchaId,o=>Q(o))})},Q=a=>{e.dialog.sendCaptchaLoading=!0,(e.dialog.type=="email"?A:E)(e.dialog.bind.form[e.dialog.type],`user_change_${e.dialog.type}`,{captchaId:e.dialog.captchaId,captchaInfo:a}).then(d=>{d.code==1&&F(60)}).finally(()=>{e.dialog.sendCaptchaLoading=!1})},M=()=>{var a;(a=U.value)==null||a.validate(o=>{o&&(e.dialog.submitLoading=!0,se({type:e.dialog.type,captcha:e.dialog.verification.form.captcha}).then(d=>{P(),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}))})},q=()=>{var a;(a=S.value)==null||a.validate(o=>{o&&(e.dialog.submitLoading=!0,ue({type:e.dialog.type,accountVerificationToken:e.dialog.verification.accountVerificationToken,...e.dialog.bind.form}).then(()=>{P(),e.dialog.bind.show=!1,b[e.dialog.type]=e.dialog.bind.form[e.dialog.type]}).finally(()=>{e.dialog.submitLoading=!1}))})},N=()=>{var a;(a=$.value)==null||a.validate(o=>{o&&(e.formSubmitLoading=!0,pe(e.form).then(()=>{e.formSubmitLoading=!1}).catch(()=>{e.formSubmitLoading=!1}))})};return oe(()=>{re().then(a=>{e.accountVerificationType=a.data.accountVerificationType})}),(a,o)=>{const d=m("el-button"),V=m("el-input"),y=m("el-form-item"),L=m("el-form"),Y=m("el-card"),h=m("el-col"),D=m("el-row"),K=m("el-dialog"),_=ae("blur");return p(),C("div",ge,[n(Y,{class:"user-views-card",shadow:"hover"},{header:r(()=>[w("div",be,[w("span",null,s(a.$t("user.account.profile.profile")),1),R((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})),[[_]])])]),default:r(()=>[w("div",ye,[n(L,{"label-position":t(W).state.shrink?"top":"right",model:e.form,rules:e.rules,"label-width":100,ref_key:"formRef",ref:$,onKeyup:o[13]||(o[13]=T(i=>N(),["enter"]))},{default:r(()=>[n(f,{label:a.$t("user.account.profile.avatar"),"input-attr":{hideSelectFile:!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(V,{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=>B("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"])):v("",!0),e.accountVerificationType.includes("mobile")?(p(),g(y,{key:1,label:t(l)("user.account.profile.mobile")},{default:r(()=>[n(V,{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=>B("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"])):v("",!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),"input-attr":{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","input-attr"]),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":{showWordLimit:!0,maxlength:120,rows:3}},null,8,["label","placeholder","modelValue"]),n(me),n(y,{class:"submit-buttons"},{default:r(()=>[n(d,{onClick:o[11]||(o[11]=i=>t(de)(t($)))},{default:r(()=>[c(s(a.$t("Reset")),1)]),_:1}),n(d,{type:"primary",loading:e.formSubmitLoading,onClick:o[12]||(o[12]=i=>N())},{default:r(()=>[c(s(a.$t("Save")),1)]),_:1},8,["loading"])]),_:1})]),_:1},8,["label-position","model","rules"])])]),_:1}),n(K,{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(()=>[w("div",Ve,[n(d,{onClick:o[17]||(o[17]=i=>e.dialog.verification.show=!1)},{default:r(()=>[c(s(t(l)("Cancel")),1)]),_:1}),R((p(),g(d,{loading:e.dialog.submitLoading,onClick:o[18]||(o[18]=i=>M()),type:"primary"},{default:r(()=>[c(s(t(l)("user.account.profile.next step")),1)]),_:1},8,["loading"])),[[_]])])]),default:r(()=>[n(L,{model:e.dialog.verification.form,rules:e.dialog.verification.rules,"label-position":"top",ref_key:"verificationFormRef",ref:U,onKeyup:o[16]||(o[16]=T(i=>M(),["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":{showPassword:!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(),C("span",we,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(),C("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(D,{class:"w100",gutter:10},{default:r(()=>[n(h,{span:18},{default:r(()=>[n(V,{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(h,{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})]),_:1},8,["model","rules"])]),_:1},8,["title","modelValue"]),n(K,{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(()=>[w("div",he,[n(d,{onClick:o[25]||(o[25]=i=>e.dialog.bind.show=!1)},{default:r(()=>[c(s(t(l)("Cancel")),1)]),_:1}),R((p(),g(d,{loading:e.dialog.submitLoading,onClick:o[26]||(o[26]=i=>q()),type:"primary"},{default:r(()=>[c(s(t(l)("user.account.profile.bind")),1)]),_:1},8,["loading"])),[[_]])])]),default:r(()=>[n(L,{model:e.dialog.bind.form,rules:e.dialog.bind.rules,"label-position":"top",ref_key:"bindFormRef",ref:S,onKeyup:o[24]||(o[24]=T(i=>q(),["enter"]))},{default:r(()=>[e.dialog.verification.accountVerificationToken?v("",!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":{showPassword:!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"])):v("",!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"])):v("",!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(D,{class:"w100",gutter:10},{default:r(()=>[n(h,{span:18},{default:r(()=>[n(V,{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(h,{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},8,["label"])]),_:1},8,["model","rules"])]),_:1},8,["title","modelValue"])])}}}),Ie=O(Ce,[["__scopeId","data-v-340d1387"]]);export{Ie as default};
|