import{r as l,b as f,a as h}from"./index.46ef5581.js";import{d as w,i as v,f as e,l as r,z as S,A as g,r as d,B as u}from"./vendor.a31584f5.js";const F="_loginContainer_10mj0_4",I="_loginInput_10mj0_11",B="_loginBtn_10mj0_16",C="_disabled_10mj0_27",y="_remberBox_10mj0_46",b="_dotWrap_10mj0_56",j="_checked_10mj0_65",T="_loginForm_10mj0_105",E="_tips_10mj0_111",U="_svgContainer_10mj0_119",k="_icon_10mj0_125",x="_titleContainer_10mj0_132",R="_showPwd_10mj0_152",L="_loginHeader_10mj0_167",P="_logo_10mj0_177",q="_line_10mj0_180",A="_footer_10mj0_187",$="_loginSection_10mj0_194",H="_formBg_10mj0_205";var o={loginContainer:F,loginInput:I,loginBtn:B,disabled:C,remberBox:y,dotWrap:b,checked:j,loginForm:T,tips:E,svgContainer:U,icon:k,titleContainer:x,showPwd:R,loginHeader:L,logo:P,line:q,footer:A,loginSection:$,formBg:H},V="./assets/logo.1cbb4412.png",M="./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,n)=>{t.length<6?n(new Error("\u5BC6\u7801\u5FC5\u987B\u5927\u4E8E\u516D\u4F4D")):n()}}]},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 l("/api-auth/user/queryClient",{params:{phone:s.username}});console.log(t);const n=(t==null?void 0:t.data)||"";let i="SYSTEM";n.includes("SYSTEM")?i="SYSTEM":n.includes("TEACHER")&&(i="TEACHER");const a=await l.post("/api-auth/usernameLogin",{data:{username:s.username,password:s.password,clientId:i,clientSecret:i}});let p=(a==null?void 0:a.data.authentication.token_type)+" "+(a==null?void 0:a.data.authentication.access_token);f(p);const m=sessionStorage.getItem("roomUid");await l.get("/api-web/imLiveBroadcastRoom/speakerJoinRoom",{params:{roomUid:m}});const _=await l.get("/api-web/imLiveBroadcastRoom/queryRoom",{params:{roomUid:m}});sessionStorage.setItem("details",JSON.stringify(_.data)),v.success("\u767B\u5F55\u6210\u529F"),this.$router.push(this.redirect||"/")}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:V,alt:""},null)]),e("i",{class:o.line},null),e("div",{class:o.logoName},[r("\u4E50\u56E2\u7BA1\u7406\u7CFB\u7EDF")])]),e("div",null,[e("div",{class:o.loginSection},[e("div",{class:o.formBg},[e("img",{src:M,alt:""},null)]),e(S,{ref:"loginForm",model:this.loginForm,rules:this.loginRules,class:o.loginForm,"auto-complete":"on","label-position":"left"},{default:()=>[e("div",{class:o.titleContainer},[r("\u767B\u5F55")]),e(g,{prop:"username",class:o.logitem},{default:()=>[e("span",{class:o.svgContainer},[e(d("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(d("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(d("SvgIcon"),{class:o.icon,name:"svg-eye",color:"#fff"},null):e(d("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},[r("\u767B\u5F55")]),e("div",{class:o.remberBox,onClick:()=>{this.isSaveUserInfo=!this.isSaveUserInfo}},[e("div",{class:[this.isSaveUserInfo?o.checked:"",o.dotWrap]},null),r("\u8BB0\u4F4F\u5BC6\u7801")])]})]),e("div",{class:o.footer},[r("Copyright \xA9 2022 \u7BA1\u4E50\u8FF7, Inc.ALL Rights Reserved")])])])}});export{Y as default};
