import{l as o,f as i,a as n,i as l}from"./index.f5168bf8.js";import{n as u,v as p}from"./package.3367ca0a.js";import{n as c}from"./vueComponentNormalizer.9ef17bb1.js";var m=function(){var t=this,a=t.$createElement,e=t._self._c||a;return e("div",{staticClass:"_login copyright",attrs:{"data-version":t.version}},[e("img",{staticClass:"login_top",attrs:{src:"/imgs/login-top.png"}}),e("img",{staticClass:"login_draw",attrs:{src:"/imgs/login-draw.png",width:"800"}}),e("img",{staticClass:"login_bottom",attrs:{src:"/imgs/login-bottom.png"}}),e("h1",{staticClass:"_login_title i-logo",staticStyle:{"font-size":"32px"}},[t._v(" "+t._s(t.name))]),e("div",{staticClass:"_login_panel",attrs:{"data-title":"\u6B22\u8FCE\u4F7F\u7528"}},[e("label",{staticClass:"i-user"},[e("input",{directives:[{name:"model",rawName:"v-model",value:t.username,expression:"username"}],attrs:{type:"text",placeholder:"\u8BF7\u8F93\u5165\u767B\u5F55\u540D",maxlength:"12"},domProps:{value:t.username},on:{keyup:function(s){return!s.type.indexOf("key")&&t._k(s.keyCode,"enter",13,s.key,"Enter")?null:t.login.apply(null,arguments)},input:function(s){s.target.composing||(t.username=s.target.value)}}})]),e("label",{staticClass:"i-lock"},[e("input",{directives:[{name:"model",rawName:"v-model",value:t.password,expression:"password"}],attrs:{type:"password",placeholder:"\u8BF7\u8F93\u5165\u5BC6\u7801",maxlength:"12"},domProps:{value:t.password},on:{keyup:function(s){return!s.type.indexOf("key")&&t._k(s.keyCode,"enter",13,s.key,"Enter")?null:t.login.apply(null,arguments)},input:function(s){s.target.composing||(t.password=s.target.value)}}})]),e("input",{staticClass:"btn",attrs:{type:"button",value:"\u767B\u5F55"},on:{click:t.login}})])])},d=[];const g={data:()=>({username:"",password:"",name:u,version:p}),methods:{async login(){const t=this.username.trim(),a=this.password.trim();if(!t)return this.$message.error("\u8BF7\u8F93\u5165\u7528\u6237\u540D");if(!/[a-zA-Z0-9]{6,12}$/.test(a))return this.$message.error("\u5BC6\u7801\u8F93\u5165\u4E0D\u5408\u6CD5");const{data:{user:e,token:s}}=await o(t,a);this.$store.setUser(e),this.$store.setToken(s),await this.findRoleFeature(),e.baseRole===2?this.$router.push("/entry"):this.$router.push("/")},async findRoleFeature(){const{data:t}=await i(),a={1:[],2:[]};for(const e of t)a[e.type].push(e.name);n.save("module",a[1]),n.save("feature",a[2]),l()}}},r={};var _=c(g,m,d,!1,f,null,null,null);function f(t){for(let a in r)this[a]=r[a]}const w=function(){return _.exports}();export{w as default};
