import{r as d,b as _,a as f}from"./index.7d05c6dc.js";import{d as v,i as w,f as e,l as r,z as S,A as m,r as l,B as g}from"./vendor.a31584f5.js";const F="_loginContainer_10mj0_4",I="_loginInput_10mj0_11",C="_loginBtn_10mj0_16",B="_disabled_10mj0_27",y="_remberBox_10mj0_46",j="_dotWrap_10mj0_56",b="_checked_10mj0_65",T="_loginForm_10mj0_105",E="_tips_10mj0_111",U="_svgContainer_10mj0_119",k="_icon_10mj0_125",x="_titleContainer_10mj0_132",P="_showPwd_10mj0_152",R="_loginHeader_10mj0_167",q="_logo_10mj0_177",A="_line_10mj0_180",L="_footer_10mj0_187",$="_loginSection_10mj0_194",H="_formBg_10mj0_205";var o={loginContainer:F,loginInput:I,loginBtn:C,disabled:B,remberBox:y,dotWrap:j,checked:b,loginForm:T,tips:E,svgContainer:U,icon:k,titleContainer:x,showPwd:P,loginHeader:R,logo:q,line:A,footer:L,loginSection:$,formBg:H},V="./assets/logo.1cbb4412.png",M="./assets/from-bg.1957537a.png",Y=v({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,n,a)=>{n.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 n=await d("/api-auth/user/queryClient",{params:{phone:s.username}});console.log(n);const a=n.data;let i="SYSTEM";a.includes("SYSTEM")?i="SYSTEM":a.includes("TEACHER")&&(i="TEACHER");const t=await d.post("/api-auth/usernameLogin",{data:{username:s.username,password:s.password,clientId:i,clientSecret:i}});let u=(t==null?void 0:t.data.authentication.token_type)+" "+(t==null?void 0:t.data.authentication.access_token);_(u);const p=sessionStorage.getItem("roomUid"),h=await d.get("/api-web/imLiveBroadcastRoom/queryRoom",{params:{roomUid:p}});sessionStorage.setItem("details",JSON.stringify(h.data)),w.success("\u767B\u5F55\u6210\u529F"),this.$router.push(this.redirect||"/")}catch{f()}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(m,{prop:"username",class:o.logitem},{default:()=>[e("span",{class:o.svgContainer},[e(l("SvgIcon"),{class:o.icon,name:"svg-user",color:"#fff"},null)]),e(g,{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(m,{prop:"password",class:o.logitem},{default:()=>[e("span",{class:o.svgContainer},[e(l("SvgIcon"),{class:o.icon,name:"svg-password",color:"#fff"},null)]),e(g,{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},[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};
