!function(){function e(e,t,i,n,o,d,s){try{var a=e[d](s),l=a.value}catch(r){return void i(r)}a.done?t(l):Promise.resolve(l).then(n,o)}function t(t){return function(){var i=this,n=arguments;return new Promise((function(o,d){var s=t.apply(i,n);function a(t){e(s,o,d,a,l,"next",t)}function l(t){e(s,o,d,a,l,"throw",t)}a(void 0)}))}}System.register(["./index-legacy-1cbe5d00.js","./index-legacy-048aac54.js","./index-legacy-4bfe3a0d.js","./index-legacy-dbc3358b.js"],(function(e,i){"use strict";var n,o,d,s,a,l,r,c,u,m,p;return{setters:[e=>{n=e.d,o=e.D,d=e.N,s=e.a,a=e.U,l=e.A,r=e.L},e=>{c=e.R,u=e.C},e=>{m=e.F},e=>{p=e.I}],execute:function(){var i=document.createElement("style");i.textContent="._imgCode_14iw3_1{padding:.42667rem}._imgCode_14iw3_1 ._codeTitle_14iw3_4{text-align:center;font-size:.42667rem;color:#4f4f4f;margin:0;padding-bottom:.42667rem}._imgCode_14iw3_1 ._img_14iw3_1{display:flex;align-items:center;justify-content:center}._imgCode_14iw3_1 ._imgChange_14iw3_16{display:block;color:#aaa;font-size:.32rem;text-align:center;padding-top:.13333rem}._imgCode_14iw3_1 ._field_14iw3_23{background:#f4f4f4;padding:.26667rem .32rem!important}._imgCodePopup_14iw3_27{width:90%;max-width:8.53333rem;border-radius:.13333rem;overflow:initial}._imgCodePopup_14iw3_27 .van-popup__close-icon{top:-.98667rem!important;right:0!important;font-size:.66667rem;color:#fff}\n",document.head.appendChild(i);const f="_imgCode_14iw3_1",g="_codeTitle_14iw3_4",_="_img_14iw3_1",h="_imgChange_14iw3_16",y="_field_14iw3_23",C="_imgCodePopup_14iw3_27";e("M",n({name:"o-img-code",props:{value:Boolean,phone:[String,Number],type:{type:String,default:"LOGIN"},clientId:{type:String,default:"cooleshow-student"},zIndex:{type:Number,default:2001},showTips:{type:Boolean,default:!0}},emits:["close","sendCode"],data:()=>({isSuffix:"/edu-app",showStatus:!1,identifyingCode:null,code:""}),mounted(){this.showStatus=this.value,this.sendImgCode()},watch:{value(e){this.showStatus=e},code(e){var i=this;return t((function*(){e.length>=4&&(yield i.checkVerifyLoginImage())}))()}},methods:{sendImgCode(){var e=this;return t((function*(){const{data:t}=yield o.get(e.isSuffix+"/open/sendImgCode",{requestType:"form",hideLoading:!0,params:{phone:e.phone}});e.identifyingCode=t}))()},updateIdentifyingCode(){var e=this;return t((function*(){e.sendImgCode()}))()},checkVerifyLoginImage(){var e=this;return t((function*(){try{if(e.code.length<4)return;yield o.post("/edu-app/open/sendSmsVerify",{requestType:"form",hideLoading:!0,data:{code:e.code,clientId:e.clientId,type:e.type,mobile:e.phone}}),setTimeout((()=>{e.showTips&&d("验证码已发送")}),100),e.$emit("close"),e.$emit("sendCode")}catch(t){e.code="",setTimeout((()=>{e.updateIdentifyingCode()}),2e3)}}))()}},render(){return s(a,{show:this.showStatus,zIndex:this.zIndex,class:C,closeOnClickOverlay:!1,onClose:()=>{this.$emit("close")},closeable:!0,closeIcon:"close"},{default:()=>[s("div",{class:f},[s("p",{class:g},[l("输入图形验证码")]),s(c,null,{default:()=>[s(u,{span:"14"},{default:()=>[s(m,{placeholder:"请输入验证码",modelValue:this.code,"onUpdate:modelValue":e=>this.code=e,class:y,autocomplete:"off",maxlength:4},null)]}),s(u,{span:"10",class:_},{default:()=>[s(p,{src:this.identifyingCode,onClick:()=>this.updateIdentifyingCode()},{loading:()=>s(r,{type:"spinner",size:"20"},null)})]})]}),s(c,{style:{display:"flex",justifyContent:"end"}},{default:()=>[s(u,{span:"10"},{default:()=>[s("span",{class:h,onClick:()=>this.updateIdentifyingCode()},[l("看不清？换一换")])]})]})])]})}}))}}}))}();
