12 |
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-0669d765"],{"0c6d":function(t,e,r){"use strict";r.d(e,"b",(function(){return a})),r.d(e,"a",(function(){return i}));r("d3b7");var n=r("2b0e"),o=function(t){return new Promise((function(e,r){axios(t).then((function(t){return e(t)})).catch((function(t){return r(t)}))}))},s=function(t){return new Promise((function(e,r){var n=t.data.code;return 0==n?(e(JSON.parse(JSON.stringify(t.data))),!1):(r(t.data.msg),!1)}))},a=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={url:t,method:"POST",headers:{Authorization:sessionStorage.getItem("token")},data:JSON.parse(JSON.stringify(e))};return new Promise((function(t,e){o(r).then((function(t){return s(t)})).then((function(e){return t(e)})).catch((function(t){return n["default"].prototype.$message.error("温馨提示:".concat(t))}))}))},i=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r={url:t,method:"GET",headers:{Authorization:sessionStorage.getItem("token")},params:JSON.parse(JSON.stringify(e))};return new Promise((function(t,e){o(r).then((function(t){return s(t)})).then((function(e){return t(e)})).catch((function(t){return n["default"].prototype.$message.error("温馨提示:".concat(t))}))}))}},"202d":function(t,e,r){},bb37:function(t,e,r){"use strict";r("202d")},d50e:function(t,e,r){t.exports=r.p+"img/u18.e9bf1564.svg"},d9c9:function(t,e,r){"use strict";r.r(e);var n=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{ref:"login",staticClass:"login"},[n("div",{staticClass:"card"},[n("el-card",{attrs:{shadow:"hover"}},[n("div",{staticClass:"icon"},[n("img",{attrs:{src:r("d50e"),alt:""}}),n("p",[t._v("人员能力评估系统")])]),n("div",{staticClass:"form"},[n("el-form",{ref:"form",attrs:{model:t.form,rules:t.rules,"label-width":"60px"}},[n("el-form-item",{attrs:{prop:"username"}},[n("i",{staticClass:"iconfont icon-zhanghao",attrs:{slot:"label"},slot:"label"}),n("el-input",{model:{value:t.form.username,callback:function(e){t.$set(t.form,"username",e)},expression:"form.username"}})],1),n("el-form-item",{attrs:{prop:"password"}},[n("i",{staticClass:"iconfont icon-mima",attrs:{slot:"label"},slot:"label"}),n("el-input",{attrs:{type:"password"},model:{value:t.form.password,callback:function(e){t.$set(t.form,"password",e)},expression:"form.password"}})],1),n("el-form-item",{attrs:{"label-width":"0"}},[n("el-button",{attrs:{type:"primary"},on:{click:function(e){return t.Submit("form")}}},[t._v("登录")])],1)],1)],1)])],1)])},o=[],s=r("0c6d"),a={login:function(t){return Object(s["b"])("/staff/token/obtain/",t)}},i={data:function(){return{form:{username:"",password:""},rules:{username:[{required:!0,message:"请输入账号名称",trigger:"blur"}],password:[{required:!0,message:"请输入账号密码",trigger:"blur"}]}}},mounted:function(){var t=this;this.$refs["login"].addEventListener("keydown",(function(e){13==e.keyCode&&t.Submit("form")}))},methods:{Submit:function(t){var e=this,r=this;this.$refs[t].validate((function(t){t&&a.login(r.form).then((function(t){try{var n=t.data,o=n.token,s=n.user_id,a=n.username;sessionStorage.setItem("token","JWT ".concat(o)),sessionStorage.setItem("user_id",s),sessionStorage.setItem("username",a),r.$router.push({path:"/"})}catch(i){e.$message.error("数据处理:".concat(i))}}))}))}}},u=i,c=(r("bb37"),r("2877")),f=Object(c["a"])(u,n,o,!1,null,"e088c436",null);e["default"]=f.exports}}]);
- //# sourceMappingURL=chunk-0669d765.a16fb41b.js.map
|