import{r as M,o as d,g as u,d as l,e as a,u as t,b as i,w as n,F as w,c as b,f as o,h as c,a as s,t as _,ae as C}from"./app-DA7OTM4Q.js";import{i as x,c as I}from"./app-BT68AfZ-.js";import{_ as g}from"./app-DokSVapq.js";import{T as y}from"./app-up4gT9D9.js";import{_ as S}from"./app-DuUYZNNT.js";import{_ as V}from"./app-CKSEN_Rg.js";import{T as p}from"./app-Zes_jb7S.js";import{D as v}from"./app-DNL2FXPk.js";import"./app-D29bbm9n.js";import"./app-Dxa5h-uG.js";import"./app-B_5dka6q.js";import"./app-BqY8p2gl.js";import"./app-CQwVTjAx.js";import"./app-DSiZNBrr.js";function k(){const{utils:m,Tea:r}=x(this);this.mobileIsValid=!1,this.newMobile="",this.isSending=!1,this.isSent=!1,this.code="",this.codeIsValid=!1,this.changeMobile=function(){this.mobileIsValid=this.newMobile.match(/^1\d{10}$/)},this.beforeSend=function(){this.isSending=!0},this.doneSend=function(){this.isSending=!1},this.success=function(){this.isSent=!0;let e=this;m.success("已将验证码短信发送到你的手机中，请在"+this.smsLife+"内完成验证",function(){e.$refs.smsCodeRef.focus()})},this.changeCode=function(){this.codeIsValid=this.code.length==this.smsCodeLength&&this.code.match(/^\d+$/)},this.verifySuccess=function(){m.success("验证成功",function(){window.location=r.url("/settings/mobile-verify?viewOnly=1")})}}const B=s("div",{class:"margin"},null,-1),T={key:0},$=s("td",{class:"title"},"已绑定手机号码",-1),D={class:"title"},L={key:0},N={key:0,href:"/settings/profile",class:"link"},R=["value"],F=s("div",{class:"margin"},null,-1),U={class:"title"},z={key:0},E=s("a",{href:"/settings/mobile-verify"},[s("span",{class:"small"},"[修改]")],-1),O=s("td",null,"短信验证码",-1),j={class:"comment"},ie={__name:"index",setup(m){const r=M(),e=I(new k,{refs:{smsCodeRef:r}});return(q,f)=>(d(),u(w,null,[l(i(g,{action:"$",onBefore:t(e).beforeSend,onDone:t(e).doneSend,onSuccess:t(e).success},{default:n(()=>[t(e).canVerify?c("",!0):(d(),b(y,{key:0},{default:n(()=>[o("系统暂未开通绑定手机号码功能。")]),_:1})),t(e).canVerify&&t(e).forceVerify&&t(e).verifiedMobile.length==0?(d(),b(y,{key:1,error:""},{default:n(()=>[o("你尚未绑定手机号码，必须绑定手机号码后才能继续操作。")]),_:1})):c("",!0),l(s("div",null,[B,i(v,null,{default:n(()=>[s("tbody",null,[t(e).verifiedMobile.length>0?(d(),u("tr",T,[$,s("td",null,[s("span",null,_(t(e).verifiedMobile),1)])])):c("",!0),l(s("tr",null,[s("td",D,[t(e).verifiedMobile.length>0?(d(),u("span",L,"新")):c("",!0),o("绑定手机号码 *")]),s("td",null,[i(S,{name:"mobile",maxlength:"11",autofocus:"",style:{width:"11em"},modelValue:t(e).newMobile,"onUpdate:modelValue":f[0]||(f[0]=h=>t(e).newMobile=h),onInput:t(e).changeMobile},null,8,["modelValue","onInput"])])],512),[[a,t(e).isModifying]])])]),_:1}),l(s("div",null,[l(i(V,null,{default:n(()=>[o("发送短信验证")]),_:1},512),[[a,t(e).mobileIsValid]]),l(i(p,{secondary:"",disabled:"",type:"button"},{default:n(()=>[o("发送短信验证")]),_:1},512),[[a,!t(e).mobileIsValid]]),o("   "),t(e).verifiedMobile.length>0?(d(),u("a",N,"不修改")):c("",!0)],512),[[a,t(e).isModifying&&!t(e).isSending]]),l(s("div",null,[i(p,{disabled:"",type:"button"},{default:n(()=>[o("短信发送中...")]),_:1})],512),[[a,t(e).isSending]])],512),[[a,t(e).canVerify]])]),_:1},8,["onBefore","onDone","onSuccess"]),[[a,!t(e).isSent]]),l(i(g,{action:".verify",onSuccess:t(e).verifySuccess},{default:n(()=>[s("input",{type:"hidden",name:"mobile",value:t(e).newMobile},null,8,R),F,i(v,null,{default:n(()=>[s("tbody",null,[s("tr",null,[s("td",U,[t(e).verifiedMobile.length>0?(d(),u("span",z,"新")):c("",!0),o("绑定手机号码 *")]),s("td",null,[o(_(t(e).newMobile)+"   ",1),E])]),s("tr",null,[O,s("td",null,[i(S,{name:"code",modelValue:t(e).code,"onUpdate:modelValue":f[1]||(f[1]=h=>t(e).code=h),maxlength:t(e).smsCodeLength,style:C({width:t(e).smsCodeLength+"em"}),ref_key:"smsCodeRef",ref:r,onInput:t(e).changeCode},null,8,["modelValue","maxlength","style","onInput"]),s("p",j,"请输入短信中"+_(t(e).smsCodeLength)+"位数字验证码。",1)])])])]),_:1}),l(i(V,null,{default:n(()=>[o("提交验证")]),_:1},512),[[a,t(e).codeIsValid]]),l(i(p,{secondary:"",disabled:"",type:"button"},{default:n(()=>[o("提交验证")]),_:1},512),[[a,!t(e).codeIsValid]])]),_:1},8,["onSuccess"]),[[a,t(e).isSent]])],64))}};export{ie as default};
