| 1 |
- import{c as F,a as t,d as S,n as I,r as U,u as $,p as X,L as j,m as D,b as H,t as A,e as Y,w as N,f as Z,g as ee,v as te,h as oe,i as se,s as ne,T as ae,j as O,H as re,k as W,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 as y,C as k,F as fe,D as B,E as V,G as K,J as q,K as E,M as L,N as P,O as ye}from"./index-77075710.js";import{O as Ae}from"./index-619b5391.js";import{M as pe}from"./index-6fcdef90.js";import{C as Q}from"./index-c58c02c6.js";import{F as z}from"./index-c3a1a9e3.js";import"./index-7614be42.js";import"./index-a8e9fbb2.js";import"./index-833bd9b9.js";const[Ce,v]=F("key"),we=t("svg",{class:v("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:v("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 M=S({name:Ce,props:{type:String,text:I,color:String,wider:Boolean,large:Boolean,loading:Boolean},emits:["press"],setup(e,{emit:n,slots:o}){const d=U(!1),r=$(),i=u=>{r.start(u),d.value=!0},m=u=>{r.move(u),r.direction.value&&(d.value=!1)},h=u=>{d.value&&(o.default||X(u),d.value=!1,n("press",e.text,e.type))},p=()=>{if(e.loading)return t(j,{class:v("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:v("wrapper",{wider:e.wider}),onTouchstartPassive:i,onTouchmovePassive:m,onTouchend:h,onTouchcancel:h},[t("div",{role:"button",tabindex:0,class:v([e.color,{large:e.large,active:d.value,delete:e.type==="delete"}])},[p()])])}});const[Se,f]=F("number-keyboard"),_e={show:Boolean,title:String,theme:D("default"),zIndex:I,teleport:[String,Object],maxlength:H(1/0),modelValue:D(""),transition:A,blurOnClose:A,showDeleteKey:A,randomKeyOrder:Boolean,closeButtonText:String,deleteButtonText:String,closeButtonLoading:Boolean,hideOnClickOutside:A,safeAreaInsetBottom:A,extraKey:{type:[String,Array],default:""}};function Te(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 be=S({name:Se,inheritAttrs:!1,props:_e,emits:["show","hide","blur","input","close","delete","update:modelValue"],setup(e,{emit:n,slots:o,attrs:d}){const r=U(),i=()=>{const s=Array(9).fill("").map((l,c)=>({text:c+1}));return e.randomKeyOrder&&Te(s),s},m=()=>[...i(),{text:e.extraKey,type:"extra"},{text:0},{text:e.showDeleteKey?e.deleteButtonText:"",type:e.showDeleteKey?"delete":""}],h=()=>{const s=i(),{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},p=Y(()=>e.theme==="custom"?h():m()),u=()=>{e.show&&n("blur")},g=()=>{n("close"),e.blurOnClose&&u()},_=()=>n(e.show?"show":"hide"),C=(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"?g():c.length<+e.maxlength&&(n("input",s),n("update:modelValue",c+s))},T=()=>{const{title:s,theme:l,closeButtonText:c}=e,x=o["title-left"],R=c&&l==="default";if(s||R||x)return t("div",{class:f("header")},[x&&t("span",{class:f("title-left")},[x()]),s&&t("h2",{class:f("title")},[s]),R&&t("button",{type:"button",class:[f("close"),re],onClick:g},[c])])},b=()=>p.value.map(s=>{const l={};return s.type==="delete"&&(l.default=o.delete),s.type==="extra"&&(l.default=o["extra-key"]),t(M,{key:s.text,text:s.text,type:s.type,wider:s.wider,color:s.color,onPress:C},l)}),J=()=>{if(e.theme==="custom")return t("div",{class:f("sidebar")},[e.showDeleteKey&&t(M,{large:!0,text:e.deleteButtonText,type:"delete",onPress:C},{delete:o.delete}),t(M,{large:!0,text:e.closeButtonText,type:"close",color:"blue",loading:e.closeButtonLoading,onPress:C},null)])};return N(()=>e.show,s=>{e.transition||n(s?"show":"hide")}),e.hideOnClickOutside&&Z(r,u,{eventName:"touchstart"}),()=>{const s=T(),l=t(ae,{name:e.transition?"van-slide-up":""},{default:()=>[ee(t("div",oe({ref:r,style:se(e.zIndex),class:f({unfit:!e.safeAreaInsetBottom,"with-title":!!s}),onAnimationend:_,onTouchstartPassive:ne},d),[s,t("div",{class:f("body")},[t("div",{class:f("keys")},[b()]),J()])]),[[te,e.show]])]});return e.teleport?t(O,{to:e.teleport},{default:()=>[l]}):l}}});const Be=W(be),[xe,w]=F("password-input"),Pe={info:String,mask:A,value:D(""),gutter:I,length:H(6),focused:Boolean,errorInfo:String};var Me=S({name:xe,props:Pe,emits:["focus"],setup(e,{emit:n}){const o=r=>{r.stopPropagation(),n("focus",r)},d=()=>{const r=[],{mask:i,value:m,gutter:h,focused:p}=e,u=+e.length;for(let g=0;g<u;g++){const _=m[g],C=g!==0&&!h,T=p&&g===m.length;let b;g!==0&&h&&(b={marginLeft:ue(h)}),r.push(t("li",{class:[{[ie]:C},w("item",{focus:T})],style:b},[i?t("i",{style:{visibility:_?"visible":"hidden"}},null):_,T&&t("div",{class:w("cursor")},null)]))}return r};return()=>{const r=e.errorInfo||e.info;return t("div",{class:w()},[t("ul",{class:[w("security"),{[le]:!e.gutter}],onTouchstartPassive:o},[d()]),r&&t("div",{class:w(e.errorInfo?"error-info":"info")},[r])])}}});const De=W(Me),G=""+new URL("login-logo-11b6718f.png",import.meta.url).href,ke="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAMAAAC7IEhfAAAAPFBMVEUAAACnsMylrsymr8ymsMymrsymsMynsM2or8+ms8ynsM2nsM2mr8yosc6nr8ulscyissmkrcimr82mr8xoS1BYAAAAE3RSTlMAqlX5zaSca0wN5MK3cmNBIRyPF9bpcQAAAHRJREFUOMvt1LEOgCAMRVEriKiIKP//r4JlMIK+RCcT7kTDCRttan1H59Ry4yZ/bS6/57PEWoKdz9MlSHwnXThrwUP7AO0xGAxVPA8jhl4SUXAQchVW+AIKQzEJoU6TQnBIk0VwY+kkw0/fFS8AvFLwkvpXO7wRJHHiDd4WAAAAAElFTkSuQmCC",Ve="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAMAAAC7IEhfAAAAZlBMVEUAAACmr82mr8ynsMyjssqnr8ymr8yksdKmr8ymr8ynsM2nr8ynsM2lr86qtc2msMyosc6nsc6msdOmsM2msM2nsM2nr82nsM2msMunsMynsc6or8ytrc6nsMymsMylsM2krcqmr8w5Qv39AAAAIXRSTlMArFWqIN6KBvv1oe+lShjWOzQL5bB5cmldWU1GD8SblDU92uELAAAAt0lEQVQ4y+3RyQ6DIBSFYVRAQUHrrLXDef+XbGp0I0NJXHTjv7oJX8gNkKs1Pbwkn9NfLOUZvrHY7+oH9jovTAC0o+pLAL47KyBbz1MJMM+eEuDbriWg3JABdBt7gLuhgNhHBUg3zJDv4x0ozsKa0gyCbo1AS7XNdQJmrDLcDGt5bT6hPWV+nr3YA8tnHgTFQqYgyAi5/Qk2hFRBENNSeKHRScgd8H2EurG6iBhpnkTHiiElVyF9ALhVMzsJy5oXAAAAAElFTkSuQmCC",Ke="_login_1id51_1",Fe="_arrowLeft_1id51_26",Ie="_loginContainer_1id51_35",Re="_container_1id51_40",Ee="_logo_1id51_48",Le="_iconPhone_1id51_63",ze="_iconPassword_1id51_64",Ue="_btnGroup_1id51_75",He="_primaryButton_1id51_78",Ne="_protocol_1id51_90",Oe="_iconChecked_1id51_99",We="_active_1id51_107",qe="_codePhone_1id51_127",Qe="_btnWrap_1id51_144",Ge="_btnSend_1id51_148",a={login:Ke,arrowLeft:Fe,loginContainer:Ie,container:Re,logo:Ee,"input-group":"_input-group_1id51_54",iconPhone:Le,iconPassword:ze,btnGroup:Ue,primaryButton:He,"login-change":"_login-change_1id51_79",protocol:Ne,iconChecked:Oe,active:We,"code-title":"_code-title_1id51_121",codePhone:qe,btnWrap:Qe,btnSend:Ge},Je=S({name:"layout-code",props:{phone:{type:String,default:""},isRegister:{type:String,default:""}},emits:["close","confirm"],setup(e,{emit:n}){ce();const o=de({imgCodeStatus:!1,smsCode:"",showKeyboard:!1,countDownStatus:!0,countDownTime:120,countTimer:null}),d=()=>{o.countDownStatus=!1,o.countTimer=setInterval(()=>{o.countDownTime>0?o.countDownTime--:(o.countDownStatus=!0,clearInterval(o.countTimer))},1e3),o.showKeyboard=!0},r=async()=>{try{const i={username:e.phone,client_id:"cooleshow-student",client_secret:"cooleshow-student",password:o.smsCode,grant_type:"password",loginType:"SMS"},{data:m}=await B.post("/edu-app/userlogin",{requestType:"form",data:{...i}});V.set(K,m.token_type+" "+m.access_token);const h=await B.get("/edu-app/user/getUserInfo",{initRequest:!0});q(h.data),n("close",!0)}catch(i){}};return N(()=>o.smsCode,i=>{i&&i.length===6&&r()}),he(()=>{me(async()=>{o.imgCodeStatus=!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"]},[y("输入验证码")]),t("p",{class:a.codePhone},[y("已发送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:()=>{o.imgCodeStatus=!0},class:a.btnSend,disabled:!o.countDownStatus},{default:()=>[y("重新发送"),!o.countDownStatus&&t(fe,null,[y("("),o.countDownTime,y(")")])]})])]})]),o.imgCodeStatus?t(O,{to:"body"},{default:()=>[t(pe,{zIndex:2100,value:o.imgCodeStatus,"onUpdate:value":i=>o.imgCodeStatus=i,phone:e.phone,type:"REGISTER",onClose:()=>{o.imgCodeStatus=!1},onSendCode:d},null)]}):null])}}),nt=S({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 P("请输入正确的手机号码");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 B.post("/edu-app/userlogin",{requestType:"form",data:{...e}});V.set(K,n.token_type+" "+n.access_token);const o=await B.get("/edu-app/user/getUserInfo",{initRequest:!0});q(o.data),this.directNext()}catch(e){console.log(e)}},async onSendCode(){if(!this.isAgree)return P("请阅读并同意以下协议");if(!L(this.username))return P("请输入正确的手机号码");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:ke,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:Ve,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),y("我已阅读并同意"),t("span",{onClick:e=>{e.stopPropagation(),ye.push("/privacy-protocol")}},[y("《隐私政策》")])])]})]),t(Ae,{modelValue:this.imgCodeStatus,"onUpdate:modelValue":e=>this.imgCodeStatus=e,destroy:!0},{default:()=>[t(Je,{phone:this.username,isRegister:this.isRegister,onClose:e=>{this.imgCodeStatus=!1,e&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.directNext()})})},onConfirm:this.directNext},null)]})])}});export{nt as default};
|