webpackJsonp([9],{237:function(e,t,r){r(257),r(258);var s=r(1)(r(259),r(260),null,null);e.exports=s.exports},257:function(e,t){},258:function(e,t){},259:function(e,t,r){"use strict";function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(6),a=s(o),n=r(14);s(n);t.default={data:function(){return{message:"",form:{userName:"",password:""},rules:{userName:[{required:!0,message:"账号不能为空",trigger:"blur"}],password:[{required:!0,message:"密码不能为空",trigger:"blur"}]}}},methods:{handleSubmit:function(){var e=this;this.$refs.loginForm.validate(function(t){t&&e.axios.post("login",{name:e.form.userName,password:e.form.password}).then(function(t){if(0===t.data.status){a.default.set("user",e.form.userName),a.default.set("token",t.data.token);var r=1,s="home_index";switch(t.data.role){case"admin":r=1,s="order_housekeeper";break;case"tongyong":r=2,s="order_housekeeper";break;case"yuesao":s="order_matron",r=3;break;case"muying":r=4,s="order_product"}a.default.set("access",r),e.axios.defaults.headers.common.Authorization="Bearer "+t.data.token,e.$router.push({name:s})}else e.message=t.data.message})})}}}},260:function(e,t){e.exports={render:function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"login",on:{keydown:function(t){return"button"in t||!e._k(t.keyCode,"enter",13,t.key,"Enter")?e.handleSubmit(t):null}}},[r("div",{staticClass:"login-con"},[r("Card",{attrs:{bordered:!1}},[r("p",{attrs:{slot:"title"},slot:"title"},[r("Icon",{attrs:{type:"log-in"}}),e._v("\n                欢迎登录\n            ")],1),e._v(" "),r("div",{staticClass:"form-con"},[r("Form",{ref:"loginForm",attrs:{model:e.form,rules:e.rules}},[r("FormItem",{attrs:{prop:"userName"}},[r("Input",{attrs:{placeholder:"请输入用户名"},model:{value:e.form.userName,callback:function(t){e.$set(e.form,"userName",t)},expression:"form.userName"}},[r("span",{attrs:{slot:"prepend"},slot:"prepend"},[r("Icon",{attrs:{size:16,type:"person"}})],1)])],1),e._v(" "),r("FormItem",{attrs:{prop:"password"}},[r("Input",{attrs:{type:"password",placeholder:"请输入密码"},model:{value:e.form.password,callback:function(t){e.$set(e.form,"password",t)},expression:"form.password"}},[r("span",{attrs:{slot:"prepend"},slot:"prepend"},[r("Icon",{attrs:{size:14,type:"locked"}})],1)])],1),e._v(" "),r("FormItem",[r("Button",{attrs:{type:"primary",long:""},on:{click:e.handleSubmit}},[e._v("登录")]),e._v(" "),r("p",{staticStyle:{color:"#f00","text-align":"center"}},[e._v(e._s(e.message))])],1)],1)],1)])],1)])},staticRenderFns:[]}}});