"use strict";(self["webpackChunkerp"]=self["webpackChunkerp"]||[]).push([[200],{7240:function(t,e,r){r.r(e),r.d(e,{default:function(){return p}});var n=function(){var t=this,e=t._self._c;return e("div",{staticClass:"backimg"},[e("div",{staticClass:"sign"},[e("span",{staticClass:"title"},[t._v("Hi 欢迎使用")]),t._m(0),e("p",{staticClass:"title-1"},[t._v("登录")]),e("div",{staticClass:"row"},[e("el-input",{attrs:{placeholder:"请输入用户名",size:"large"},model:{value:t.form.name,callback:function(e){t.$set(t.form,"name",e)},expression:"form.name"}})],1),e("div",{staticClass:"row"},[e("el-input",{attrs:{"show-password":"",placeholder:"请输入密码",size:"large"},model:{value:t.form.password,callback:function(e){t.$set(t.form,"password",e)},expression:"form.password"}})],1),e("el-checkbox",{model:{value:t.checked,callback:function(e){t.checked=e},expression:"checked"}},[t._v("记住密码")]),e("br"),e("el-button",{attrs:{type:"primary",loading:t.loading},on:{click:function(e){return t.Login()},keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.Login()}}},[t._v("登 录")])],1)])},o=[function(){var t=this,e=t._self._c;return e("p",{staticClass:"manage"},[e("img",{attrs:{src:r(5108),alt:""}}),e("span",[t._v("ERP管理系统")])])}],i=(r(560),r(9669)),a=r.n(i),s=r(730),u={data(){return{loading:!1,checked:!1,form:{name:"",password:""}}},mounted(){this.getCookie(),window.addEventListener("keydown",this.keyDown)},methods:{Login(){!0===this.checked?this.setCookie(this.form.name,this.form.password,!0,7):this.clearCookie(),""===this.form.name||""===this.form.password?this.$message({message:"账号或密码不能为空",type:"error"}):(this.loading=!0,a().post("/api/auth/login",this.form).then((t=>{let e=t.data;e.error&&(this.$message({message:"账号或密码错误,请重新输入",type:"error"}),this.form.name="",this.form.password="",this.checked=!1,this.loading=!1),e.token&&(localStorage.setItem("userName",this.form.name),this.form={},localStorage.setItem("token",e.token),(0,s.Xt)().then((t=>{console.log(t.data.roles),t.data.roles&&t.data.roles[0]&&(localStorage.setItem("roleName",t.data.roles[0].name),localStorage.setItem("userId",t.data.id),this.$message({message:"成功登录,欢迎来到后台管理系统",type:"success"}),this.$router.push("/GOODS_LIST")),this.loading=!1})).catch((()=>{this.loading=!1})))})))},setCookie(t,e,r,n){const o=new Date;o.setTime(o.getTime()+864e5*n),window.document.cookie="name="+t+";path=/;expires="+o.toGMTString(),window.document.cookie="password="+e+";path=/;expires="+o.toGMTString(),window.document.cookie="state="+r+";path=/;expires="+o.toGMTString()},getCookie(){if(document.cookie.length>0){const t=document.cookie.split("; ");for(let e=0;ef)if(s=u[f++],s!==s)return!0}else for(;c>f;f++)if((t||f in u)&&u[f]===r)return t||f||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},5649:function(t,e,r){var n=r(7697),o=r(2297),i=TypeError,a=Object.getOwnPropertyDescriptor,s=n&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}();t.exports=s?function(t,e){if(o(t)&&!a(t,"length").writable)throw new i("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e}},8758:function(t,e,r){var n=r(6812),o=r(9152),i=r(2474),a=r(2560);t.exports=function(t,e,r){for(var s=o(e),u=a.f,c=i.f,f=0;fr)throw e("Maximum allowed index exceeded");return t}},2739:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},9989:function(t,e,r){var n=r(9037),o=r(2474).f,i=r(5773),a=r(1880),s=r(5014),u=r(8758),c=r(5266);t.exports=function(t,e){var r,f,l,p,h,d,m=t.target,g=t.global,v=t.stat;if(f=g?n:v?n[m]||s(m,{}):n[m]&&n[m].prototype,f)for(l in e){if(h=e[l],t.dontCallGetSet?(d=o(f,l),p=d&&d.value):p=f[l],r=c(g?l:m+(v?".":"#")+l,t.forced),!r&&void 0!==p){if(typeof h==typeof p)continue;u(h,p)}(t.sham||p&&p.sham)&&i(h,"sham",!0),a(f,l,h,t)}}},4413:function(t,e,r){var n=r(8844),o=r(3689),i=r(6648),a=Object,s=n("".split);t.exports=o((function(){return!a("z").propertyIsEnumerable(0)}))?function(t){return"String"===i(t)?s(t,""):a(t)}:a},2297:function(t,e,r){var n=r(6648);t.exports=Array.isArray||function(t){return"Array"===n(t)}},5266:function(t,e,r){var n=r(3689),o=r(9985),i=/#|\.prototype\./,a=function(t,e){var r=u[s(t)];return r===f||r!==c&&(o(e)?n(e):!!e)},s=a.normalize=function(t){return String(t).replace(i,".").toLowerCase()},u=a.data={},c=a.NATIVE="N",f=a.POLYFILL="P";t.exports=a},6310:function(t,e,r){var n=r(3126);t.exports=function(t){return n(t.length)}},8828:function(t){var e=Math.ceil,r=Math.floor;t.exports=Math.trunc||function(t){var n=+t;return(n>0?r:e)(n)}},2474:function(t,e,r){var n=r(7697),o=r(2615),i=r(9556),a=r(5684),s=r(5290),u=r(8360),c=r(6812),f=r(8506),l=Object.getOwnPropertyDescriptor;e.f=n?l:function(t,e){if(t=s(t),e=u(e),f)try{return l(t,e)}catch(r){}if(c(t,e))return a(!o(i.f,t,e),t[e])}},2741:function(t,e,r){var n=r(4948),o=r(2739),i=o.concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return n(t,i)}},7518:function(t,e){e.f=Object.getOwnPropertySymbols},4948:function(t,e,r){var n=r(8844),o=r(6812),i=r(5290),a=r(4328).indexOf,s=r(7248),u=n([].push);t.exports=function(t,e){var r,n=i(t),c=0,f=[];for(r in n)!o(s,r)&&o(n,r)&&u(f,r);while(e.length>c)o(n,r=e[c++])&&(~a(f,r)||u(f,r));return f}},9556:function(t,e){var r={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,o=n&&!r.call({1:2},1);e.f=o?function(t){var e=n(this,t);return!!e&&e.enumerable}:r},9152:function(t,e,r){var n=r(6058),o=r(8844),i=r(2741),a=r(7518),s=r(5027),u=o([].concat);t.exports=n("Reflect","ownKeys")||function(t){var e=i.f(s(t)),r=a.f;return r?u(e,r(t)):e}},7578:function(t,e,r){var n=r(8700),o=Math.max,i=Math.min;t.exports=function(t,e){var r=n(t);return r<0?o(r+e,0):i(r,e)}},5290:function(t,e,r){var n=r(4413),o=r(4684);t.exports=function(t){return n(o(t))}},8700:function(t,e,r){var n=r(8828);t.exports=function(t){var e=+t;return e!==e||0===e?0:n(e)}},3126:function(t,e,r){var n=r(8700),o=Math.min;t.exports=function(t){var e=n(t);return e>0?o(e,9007199254740991):0}},560:function(t,e,r){var n=r(9989),o=r(690),i=r(6310),a=r(5649),s=r(5565),u=r(3689),c=u((function(){return 4294967297!==[].push.call({length:4294967296},1)})),f=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(t){return t instanceof TypeError}},l=c||!f();n({target:"Array",proto:!0,arity:1,forced:l},{push:function(t){var e=o(this),r=i(e),n=arguments.length;s(r+n);for(var u=0;u