import{n as c,t as m,u as d}from"./index.13f93d3a.js";const _=""+new URL("logo-loop.68eb387d.png",import.meta.url).href;const f={name:"login",data(){return{errors:"",memory:!1,form:{data:{account:"",password:""},rules:{account:[{required:!0,trigger:"blur"}],password:[{required:!0,trigger:"blur"}]}}}},mounted(){const s=localStorage.getItem("conf_account"),t=localStorage.getItem("conf_password");s&&t&&(this.memory=!0,this.form.data.account=s,this.form.data.password=t)},methods:{doLogin(){const{account:s,password:t}=this.form.data,o=this.$t("common.failure");this.$refs.form.validate(e=>{e&&this.$axios.post("/api/auth/login",{account:s,password:t}).then(r=>{const{code:a,msg:l=o,data:i}=r.data;if(a==0){const{token:n}=i;sessionStorage.setItem("conf_token",n),this.memory?(localStorage.setItem("conf_account",s),localStorage.setItem("conf_password",t)):(localStorage.removeItem("conf_account"),localStorage.removeItem("conf_password")),this.$store.dispatch("syncUserinfo"),this.$router.push({path:"/"})}else this.errors=l}).catch(()=>{this.errors=o})})}}};var u=function(){var t=this,o=t._self._c;return o("div",{staticClass:"login"},[o("div",{staticClass:"login-content"},[o("div",{staticClass:"content"},[t._m(0),o("div",{staticClass:"tip"},[o("img",{attrs:{src:m,alt:"logo"}}),o("br"),t._v(" "+t._s(t.$t("login.index.loginTip"))+" ")]),o("div",{staticClass:"form"},[o("el-form",{ref:"form",attrs:{model:t.form.data,rules:t.form.rules}},[o("el-form-item",{staticClass:"account",attrs:{prop:"account"}},[o("el-input",{attrs:{placeholder:"Huabook ID",clearable:""},model:{value:t.form.data.account,callback:function(e){t.$set(t.form.data,"account",e)},expression:"form.data.account"}})],1),o("el-form-item",{staticClass:"password",attrs:{prop:"password"}},[o("el-input",{attrs:{type:"password",placeholder:"Password",clearable:""},model:{value:t.form.data.password,callback:function(e){t.$set(t.form.data,"password",e)},expression:"form.data.password"}})],1),t.errors?o("el-form-item",{staticClass:"error"},[o("span",{staticClass:"error-tip"},[t._v(t._s(t.errors))])]):t._e(),o("el-form-item",{staticClass:"memory"},[o("el-checkbox",{model:{value:t.memory,callback:function(e){t.memory=e},expression:"memory"}},[t._v(t._s(t.$t("login.index.form.memory")))])],1),o("el-form-item",{staticClass:"button"},[o("el-button",{attrs:{type:"primary",round:""},on:{click:t.doLogin}},[t._v(t._s(t.$t("login.common.button.login")))])],1)],1)],1),o("div",{staticClass:"footer"},[o("ul",[o("li",[o("router-link",{staticClass:"mr7",attrs:{to:"/findPwd"}},[t._v(" "+t._s(t.$t("login.index.footer.text1"))+" "+t._s(t.$t("login.index.footer.text2"))+" ")])],1),o("li",[t._v(" "+t._s(t.$t("login.index.footer.text3"))+" "),o("router-link",{staticClass:"ml7",attrs:{to:"/register"}},[t._v(t._s(t.$t("login.index.footer.text4")))])],1)])])])])])},p=[function(){var s=this,t=s._self._c;return t("div",{staticClass:"logo"},[t("img",{staticClass:"logo-img",attrs:{src:d,alt:"logo"}}),t("img",{staticClass:"logo-loop-img",attrs:{src:_,alt:"logo loop"}})])}],g=c(f,u,p,!1,null,"f2bdfe4d",null,null);const h=g.exports;export{h as default};
