| 1 |
- import{c as R,a as t,d as _,n as F,r as N,u as J,p as $,L as X,m as M,b as O,t as p,e as j,w as H,f as Y,g as Z,v as ee,h as te,i as oe,s as se,T as ne,j as ae,H as re,k as U,B as le,l as ie,o as ue,q as ce,x as de,y as he,z as me,I as ge,A,C as k,F as fe,D as C,E as x,G as V,J as K,K as W,M as E,N as L,O as ye}from"./index-c96ba1f0.js";import{O as Ae}from"./index-e3ae19f8.js";import{C as q}from"./index-13f38947.js";import{F as z}from"./index-5d1699f1.js";import"./index-6ac764ea.js";const[pe,S]=R("key"),we=t("svg",{class:S("collapse-icon"),viewBox:"0 0 30 24"},[t("path",{d:"M26 13h-2v2h2v-2zm-8-3h2V8h-2v2zm2-4h2V4h-2v2zm2 4h4V4h-2v4h-2v2zm-7 14 3-3h-6l3 3zM6 13H4v2h2v-2zm16 0H8v2h14v-2zm-12-3h2V8h-2v2zM28 0l1 1 1 1v15l-1 2H1l-1-2V2l1-1 1-1zm0 2H2v15h26V2zM6 4v2H4V4zm10 2h2V4h-2v2zM8 9v1H4V8zm8 0v1h-2V8zm-6-5v2H8V4zm4 0v2h-2V4z",fill:"currentColor"},null)]),ve=t("svg",{class:S("delete-icon"),viewBox:"0 0 32 22"},[t("path",{d:"M28 0a4 4 0 0 1 4 4v14a4 4 0 0 1-4 4H10.4a2 2 0 0 1-1.4-.6L1 13.1c-.6-.5-.9-1.3-.9-2 0-1 .3-1.7.9-2.2L9 .6a2 2 0 0 1 1.4-.6zm0 2H10.4l-8.2 8.3a1 1 0 0 0-.3.7c0 .3.1.5.3.7l8.2 8.4H28a2 2 0 0 0 2-2V4c0-1.1-.9-2-2-2zm-5 4a1 1 0 0 1 .7.3 1 1 0 0 1 0 1.4L20.4 11l3.3 3.3c.2.2.3.5.3.7 0 .3-.1.5-.3.7a1 1 0 0 1-.7.3 1 1 0 0 1-.7-.3L19 12.4l-3.4 3.3a1 1 0 0 1-.6.3 1 1 0 0 1-.7-.3 1 1 0 0 1-.3-.7c0-.2.1-.5.3-.7l3.3-3.3-3.3-3.3A1 1 0 0 1 14 7c0-.3.1-.5.3-.7A1 1 0 0 1 15 6a1 1 0 0 1 .6.3L19 9.6l3.3-3.3A1 1 0 0 1 23 6z",fill:"currentColor"},null)]);var D=_({name:pe,props:{type:String,text:F,color:String,wider:Boolean,large:Boolean,loading:Boolean},emits:["press"],setup(e,{emit:n,slots:o}){const d=N(!1),r=J(),g=u=>{r.start(u),d.value=!0},i=u=>{r.move(u),r.direction.value&&(d.value=!1)},h=u=>{d.value&&(o.default||$(u),d.value=!1,n("press",e.text,e.type))},y=()=>{if(e.loading)return t(X,{class:S("loading-icon")},null);const u=o.default?o.default():e.text;switch(e.type){case"delete":return u||ve;case"extra":return u||we;default:return u}};return()=>t("div",{class:S("wrapper",{wider:e.wider}),onTouchstartPassive:g,onTouchmovePassive:i,onTouchend:h,onTouchcancel:h},[t("div",{role:"button",tabindex:0,class:S([e.color,{large:e.large,active:d.value,delete:e.type==="delete"}])},[y()])])}});const[Ce,f]=R("number-keyboard"),Se={show:Boolean,title:String,theme:M("default"),zIndex:F,teleport:[String,Object],maxlength:O(1/0),modelValue:M(""),transition:p,blurOnClose:p,showDeleteKey:p,randomKeyOrder:Boolean,closeButtonText:String,deleteButtonText:String,closeButtonLoading:Boolean,hideOnClickOutside:p,safeAreaInsetBottom:p,extraKey:{type:[String,Array],default:""}};function _e(e){for(let n=e.length-1;n>0;n--){const o=Math.floor(Math.random()*(n+1)),d=e[n];e[n]=e[o],e[o]=d}return e}var Te=_({name:Ce,inheritAttrs:!1,props:Se,emits:["show","hide","blur","input","close","delete","update:modelValue"],setup(e,{emit:n,slots:o,attrs:d}){const r=N(),g=()=>{const s=Array(9).fill("").map((l,c)=>({text:c+1}));return e.randomKeyOrder&&_e(s),s},i=()=>[...g(),{text:e.extraKey,type:"extra"},{text:0},{text:e.showDeleteKey?e.deleteButtonText:"",type:e.showDeleteKey?"delete":""}],h=()=>{const s=g(),{extraKey:l}=e,c=Array.isArray(l)?l:[l];return c.length===1?s.push({text:0,wider:!0},{text:c[0],type:"extra"}):c.length===2&&s.push({text:c[0],type:"extra"},{text:0},{text:c[1],type:"extra"}),s},y=j(()=>e.theme==="custom"?h():i()),u=()=>{e.show&&n("blur")},m=()=>{n("close"),e.blurOnClose&&u()},T=()=>n(e.show?"show":"hide"),w=(s,l)=>{if(s===""){l==="extra"&&u();return}const c=e.modelValue;l==="delete"?(n("delete"),n("update:modelValue",c.slice(0,c.length-1))):l==="close"?m():c.length<+e.maxlength&&(n("input",s),n("update:modelValue",c+s))},b=()=>{const{title:s,theme:l,closeButtonText:c}=e,P=o["title-left"],I=c&&l==="default";if(s||I||P)return t("div",{class:f("header")},[P&&t("span",{class:f("title-left")},[P()]),s&&t("h2",{class:f("title")},[s]),I&&t("button",{type:"button",class:[f("close"),re],onClick:m},[c])])},B=()=>y.value.map(s=>{const l={};return s.type==="delete"&&(l.default=o.delete),s.type==="extra"&&(l.default=o["extra-key"]),t(D,{key:s.text,text:s.text,type:s.type,wider:s.wider,color:s.color,onPress:w},l)}),Q=()=>{if(e.theme==="custom")return t("div",{class:f("sidebar")},[e.showDeleteKey&&t(D,{large:!0,text:e.deleteButtonText,type:"delete",onPress:w},{delete:o.delete}),t(D,{large:!0,text:e.closeButtonText,type:"close",color:"blue",loading:e.closeButtonLoading,onPress:w},null)])};return H(()=>e.show,s=>{e.transition||n(s?"show":"hide")}),e.hideOnClickOutside&&Y(r,u,{eventName:"touchstart"}),()=>{const s=b(),l=t(ne,{name:e.transition?"van-slide-up":""},{default:()=>[Z(t("div",te({ref:r,style:oe(e.zIndex),class:f({unfit:!e.safeAreaInsetBottom,"with-title":!!s}),onAnimationend:T,onTouchstartPassive:se},d),[s,t("div",{class:f("body")},[t("div",{class:f("keys")},[B()]),Q()])]),[[ee,e.show]])]});return e.teleport?t(ae,{to:e.teleport},{default:()=>[l]}):l}}});const be=U(Te),[Be,v]=R("password-input"),xe={info:String,mask:p,value:M(""),gutter:F,length:O(6),focused:Boolean,errorInfo:String};var Pe=_({name:Be,props:xe,emits:["focus"],setup(e,{emit:n}){const o=r=>{r.stopPropagation(),n("focus",r)},d=()=>{const r=[],{mask:g,value:i,gutter:h,focused:y}=e,u=+e.length;for(let m=0;m<u;m++){const T=i[m],w=m!==0&&!h,b=y&&m===i.length;let B;m!==0&&h&&(B={marginLeft:ue(h)}),r.push(t("li",{class:[{[ie]:w},v("item",{focus:b})],style:B},[g?t("i",{style:{visibility:T?"visible":"hidden"}},null):T,b&&t("div",{class:v("cursor")},null)]))}return r};return()=>{const r=e.errorInfo||e.info;return t("div",{class:v()},[t("ul",{class:[v("security"),{[le]:!e.gutter}],onTouchstartPassive:o},[d()]),r&&t("div",{class:v(e.errorInfo?"error-info":"info")},[r])])}}});const De=U(Pe),G=""+new URL("login-logo-11b6718f.png",import.meta.url).href,Me="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAMAAAC7IEhfAAAAPFBMVEUAAACnsMylrsymr8ymsMymrsymsMynsM2or8+ms8ynsM2nsM2mr8yosc6nr8ulscyissmkrcimr82mr8xoS1BYAAAAE3RSTlMAqlX5zaSca0wN5MK3cmNBIRyPF9bpcQAAAHRJREFUOMvt1LEOgCAMRVEriKiIKP//r4JlMIK+RCcT7kTDCRttan1H59Ry4yZ/bS6/57PEWoKdz9MlSHwnXThrwUP7AO0xGAxVPA8jhl4SUXAQchVW+AIKQzEJoU6TQnBIk0VwY+kkw0/fFS8AvFLwkvpXO7wRJHHiDd4WAAAAAElFTkSuQmCC",ke="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAMAAAC7IEhfAAAAZlBMVEUAAACmr82mr8ynsMyjssqnr8ymr8yksdKmr8ymr8ynsM2nr8ynsM2lr86qtc2msMyosc6nsc6msdOmsM2msM2nsM2nr82nsM2msMunsMynsc6or8ytrc6nsMymsMylsM2krcqmr8w5Qv39AAAAIXRSTlMArFWqIN6KBvv1oe+lShjWOzQL5bB5cmldWU1GD8SblDU92uELAAAAt0lEQVQ4y+3RyQ6DIBSFYVRAQUHrrLXDef+XbGp0I0NJXHTjv7oJX8gNkKs1Pbwkn9NfLOUZvrHY7+oH9jovTAC0o+pLAL47KyBbz1MJMM+eEuDbriWg3JABdBt7gLuhgNhHBUg3zJDv4x0ozsKa0gyCbo1AS7XNdQJmrDLcDGt5bT6hPWV+nr3YA8tnHgTFQqYgyAi5/Qk2hFRBENNSeKHRScgd8H2EurG6iBhpnkTHiiElVyF9ALhVMzsJy5oXAAAAAElFTkSuQmCC",Ve="_login_1id51_1",Ke="_arrowLeft_1id51_26",Re="_loginContainer_1id51_35",Fe="_container_1id51_40",Ie="_logo_1id51_48",Ee="_iconPhone_1id51_63",Le="_iconPassword_1id51_64",ze="_btnGroup_1id51_75",Ne="_primaryButton_1id51_78",Oe="_protocol_1id51_90",He="_iconChecked_1id51_99",Ue="_active_1id51_107",We="_codePhone_1id51_127",qe="_btnWrap_1id51_144",Ge="_btnSend_1id51_148",a={login:Ve,arrowLeft:Ke,loginContainer:Re,container:Fe,logo:Ie,"input-group":"_input-group_1id51_54",iconPhone:Ee,iconPassword:Le,btnGroup:ze,primaryButton:Ne,"login-change":"_login-change_1id51_79",protocol:Oe,iconChecked:He,active:Ue,"code-title":"_code-title_1id51_121",codePhone:We,btnWrap:qe,btnSend:Ge},Qe=_({name:"layout-code",props:{phone:{type:String,default:""},isRegister:{type:String,default:""}},emits:["close","confirm"],setup(e,{emit:n}){ce();const o=de({smsCode:"",showKeyboard:!1,countDownStatus:!0,countDownTime:120,countTimer:null}),d=async()=>{try{await C.post("/edu-app/open/sendSms",{requestType:"form",data:{clientId:"cooleshow-student",type:e.isRegister?"REGISTER":"LOGIN",mobile:e.phone}}),r(),setTimeout(()=>{x("验证码已发送")},100)}catch(i){o.countDownStatus=!0}},r=()=>{o.countDownStatus=!1,o.countTimer=setInterval(()=>{o.countDownTime>0?o.countDownTime--:(o.countDownStatus=!0,clearInterval(o.countTimer))},1e3)},g=async()=>{try{const i={username:e.phone,client_id:"cooleshow-student",client_secret:"cooleshow-student",password:o.smsCode,grant_type:"password",loginType:"SMS"},{data:h}=await C.post("/edu-app/userlogin",{requestType:"form",data:{...i}});V.set(K,h.token_type+" "+h.access_token);const y=await C.get("/edu-app/user/getUserInfo",{initRequest:!0});W(y.data),n("close",!0)}catch(i){}};return H(()=>o.smsCode,i=>{i&&i.length===6&&g()}),he(()=>{me(async()=>{await d(),o.showKeyboard=!0})}),()=>t("div",{class:[a.login]},[t(ge,{name:"arrow-left",class:a.arrowLeft,onClick:()=>n("close")},null),t("div",{class:a.loginContainer},[t("img",{src:G,class:a.logo},null),t(q,{class:a.container,border:!1},{default:()=>[t("h2",{class:a["code-title"]},[A("输入验证码")]),t("p",{class:a.codePhone},[A("已发送6位验证码至"),t("span",null,[e.phone])]),t(De,{value:o.smsCode,onFocus:()=>{o.showKeyboard=!0},focused:o.showKeyboard,length:6,gutter:12},null),t(be,{modelValue:o.smsCode,"onUpdate:modelValue":i=>o.smsCode=i,show:o.showKeyboard,maxlength:6,onBlur:()=>{o.showKeyboard=!1}},null),t("div",{class:a.btnWrap},[t(k,{type:"primary",round:!0,onClick:d,class:a.btnSend,disabled:!o.countDownStatus},{default:()=>[A("重新发送"),!o.countDownStatus&&t(fe,null,[A("("),o.countDownTime,A(")")])]})])]})])])}}),et=_({name:"layout-login",data(){const{isRegister:e}=this.$route.query;return{isRegister:e,loginType:"SMS",username:"",password:"",smsCode:"",countDownStatus:!0,countDownTime:1e3*120,imgCodeStatus:!1,isAgree:!0}},mounted(){V.remove(K),this.directNext()},methods:{directNext(){if(E.user.status==="login"||E.user.status==="error"){const{returnUrl:e,isRegister:n,...o}=this.$route.query;this.$router.replace({path:e,query:{...o}})}},async onLogin(){try{if(!L(this.username))return x("请输入正确的手机号码");const e={username:this.username,client_id:"cooleshow-student",client_secret:"cooleshow-student",password:this.loginType==="PWD"?this.password:this.smsCode,grant_type:"password",loginType:this.loginType==="PWD"?"PASSWORD":"SMS"},{data:n}=await C.post("/edu-app/userlogin",{requestType:"form",data:{...e}});V.set(K,n.token_type+" "+n.access_token);const o=await C.get("/edu-app/user/getUserInfo",{initRequest:!0});W(o.data),this.directNext()}catch(e){console.log(e)}},async onSendCode(){if(!this.isAgree)return x("请阅读并同意以下协议");if(!L(this.username))return x("请输入正确的手机号码");this.imgCodeStatus=!0},onChange(){this.loginType==="PWD"?this.loginType="SMS":this.loginType==="SMS"&&(this.loginType="PWD")}},render(){return t("div",{class:[a.login]},[t("div",{class:a.loginContainer},[t("img",{src:G,class:a.logo},null),t(q,{class:a.container,border:!1},{default:()=>[t(z,{modelValue:this.username,"onUpdate:modelValue":e=>this.username=e,name:"手机号",placeholder:"请输入您的手机号",type:"tel",class:a["input-group"],maxlength:11,autocomplete:"off",border:!1},{"left-icon":()=>t("img",{src:Me,class:a.iconPhone},null)}),this.loginType==="PWD"&&t(z,{modelValue:this.password,"onUpdate:modelValue":e=>this.password=e,type:"password",name:"密码",class:a["input-group"],placeholder:"请输入密码",autocomplete:"off",border:!1},{"left-icon":()=>t("img",{src:ke,class:a.iconPassword},null)}),t("div",{class:a.btnGroup},[t(k,{round:!0,block:!0,class:a.primaryButton,onClick:()=>{this.loginType==="PWD"?this.onLogin():this.onSendCode()}},{default:()=>[this.loginType==="PWD"?"登录":"获取短信验证码"]}),t(k,{round:!0,block:!0,type:"default",class:a["login-change"],onClick:this.onChange},{default:()=>[this.loginType==="PWD"?"短信登录":"密码登录"]})]),this.loginType==="SMS"&&t("div",{class:a.protocol,onClick:()=>this.isAgree=!this.isAgree},[t("i",{class:[a.iconChecked,this.isAgree?a.active:""]},null),A("我已阅读并同意"),t("span",{onClick:e=>{e.stopPropagation(),ye.push("/privacy-protocol")}},[A("《隐私政策》")])])]})]),t(Ae,{modelValue:this.imgCodeStatus,"onUpdate:modelValue":e=>this.imgCodeStatus=e},{default:()=>[t(Qe,{phone:this.username,isRegister:this.isRegister,onClose:e=>{this.imgCodeStatus=!1,e&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.directNext()})})},onConfirm:this.directNext},null)]})])}});export{et as default};
|