import{r as d,G as _,b as h}from"./index.9a53f83d.js";import{d as w,l as v,q as S,a as e,t as i,C as F,D as g,r as l,F as u}from"./vendor.163b9869.js";const I="_loginContainer_10mj0_4",C="_loginInput_10mj0_11",y="_loginBtn_10mj0_16",B="_disabled_10mj0_27",j="_remberBox_10mj0_46",b="_dotWrap_10mj0_56",T="_checked_10mj0_65",E="_loginForm_10mj0_105",U="_tips_10mj0_111",k="_svgContainer_10mj0_119",x="_icon_10mj0_125",q="_titleContainer_10mj0_132",P="_showPwd_10mj0_152",R="_loginHeader_10mj0_167",L="_logo_10mj0_177",A="_line_10mj0_180",H="_footer_10mj0_187",V="_loginSection_10mj0_194",$="_formBg_10mj0_205";var o={loginContainer:I,loginInput:C,loginBtn:y,disabled:B,remberBox:j,dotWrap:b,checked:T,loginForm:E,tips:U,svgContainer:k,icon:x,titleContainer:q,showPwd:P,loginHeader:R,logo:L,line:A,footer:H,loginSection:V,formBg:$},M="./assets/logo.1cbb4412.png",N="./assets/from-bg.1957537a.png",Y=w({data(){return{loginForm:{username:null,password:null},loginRules:{username:[{required:!0,message:"\u8BF7\u8F93\u5165\u624B\u673A\u53F7",trigger:"blur"},{pattern:/^1[3456789]\d{9}$/,message:"\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u624B\u673A\u53F7",trigger:"blur"}],password:[{required:!0,trigger:"blur",validator:(c,t,a)=>{t.length<6?a(new Error("\u5BC6\u7801\u5FC5\u987B\u5927\u4E8E\u516D\u4F4D")):a()}}]},passwordType:"password",redirect:void 0,isSaveUserInfo:!0}},mounted(){this.$route.query.redirect&&(this.redirect=this.$route.query.redirect),this.loginForm.username=localStorage.getItem("username"),this.loginForm.password=localStorage.getItem("password")},methods:{showPwd(){this.passwordType==="password"?this.passwordType="":this.passwordType="password",this.$nextTick(()=>{this.$refs.password.focus()})},handleLogin(){const s=this.loginForm;this.isSaveUserInfo?(localStorage.setItem("username",s.username),localStorage.setItem("password",s.password)):(localStorage.setItem("username",""),localStorage.setItem("password","")),this.$refs.loginForm.validate(async c=>{if(c)try{const t=await d("/api-auth/user/queryClient",{params:{phone:s.username}});console.log(t);const a=(t==null?void 0:t.data)||"";let r="SYSTEM";a.includes("SYSTEM")?r="SYSTEM":a.includes("TEACHER")&&(r="TEACHER");const n=await d.post("/api-auth/usernameLogin",{data:{username:s.username,password:s.password,clientId:r,clientSecret:r}});let p=(n==null?void 0:n.data.authentication.token_type)+" "+(n==null?void 0:n.data.authentication.access_token);_(p);const m=sessionStorage.getItem("roomUid"),f=await d.get("/api-web/imLiveBroadcastRoom/speakerJoinRoom",{params:{roomUid:m}});sessionStorage.setItem("details",JSON.stringify(f.data)),v.success("\u767B\u5F55\u6210\u529F"),window.location.href=window.location.origin+"/live/?"+S.stringify({roomUid:m,time:new Date().getTime()})}catch{h()}else return!1})},saveUserInfo(){this.isSaveUserInfo=!this.isSaveUserInfo}},render(){return e("div",{class:o.loginContainer},[e("div",{class:o.loginHeader},[e("div",{class:o.logo},[e("img",{src:M,alt:""},null)]),e("i",{class:o.line},null),e("div",{class:o.logoName},[i("\u4E50\u56E2\u7BA1\u7406\u7CFB\u7EDF")])]),e("div",null,[e("div",{class:o.loginSection},[e("div",{class:o.formBg},[e("img",{src:N,alt:""},null)]),e(F,{ref:"loginForm",model:this.loginForm,rules:this.loginRules,class:o.loginForm,"auto-complete":"on","label-position":"left"},{default:()=>[e("div",{class:o.titleContainer},[i("\u767B\u5F55")]),e(g,{prop:"username",class:o.logitem},{default:()=>[e("span",{class:o.svgContainer},[e(l("SvgIcon"),{class:o.icon,name:"svg-user",color:"#fff"},null)]),e(u,{ref:"username",class:o.loginInput,modelValue:this.loginForm.username,"onUpdate:modelValue":s=>this.loginForm.username=s,placeholder:"\u8BF7\u8F93\u5165\u624B\u673A\u53F7",maxlength:11,type:"tel",tabindex:"1","auto-complete":"off"},null)]}),e(g,{prop:"password",class:o.logitem},{default:()=>[e("span",{class:o.svgContainer},[e(l("SvgIcon"),{class:o.icon,name:"svg-password",color:"#fff"},null)]),e(u,{ref:"password",class:o.loginInput,modelValue:this.loginForm.password,"onUpdate:modelValue":s=>this.loginForm.password=s,type:this.passwordType,placeholder:"\u8BF7\u8F93\u5165\u5BC6\u7801",tabindex:"2","auto-complete":"off"},null),e("span",{class:o.showPwd,onClick:this.showPwd},[this.passwordType==="password"?e(l("SvgIcon"),{class:o.icon,name:"svg-eye",color:"#fff"},null):e(l("SvgIcon"),{class:o.icon,name:"svg-eye-open",color:"#fff"},null)])]}),e("div",{class:[!this.loginForm.username||!this.loginForm.password?o.disabled:"",o.loginBtn],onClick:this.handleLogin},[i("\u767B\u5F55")]),e("div",{class:o.remberBox,onClick:()=>{this.isSaveUserInfo=!this.isSaveUserInfo}},[e("div",{class:[this.isSaveUserInfo?o.checked:"",o.dotWrap]},null),i("\u8BB0\u4F4F\u5BC6\u7801")])]})]),e("div",{class:o.footer},[i("Copyright \xA9 2022 \u7BA1\u4E50\u8FF7, Inc.ALL Rights Reserved")])])])}});export{Y as default};
