chunk-2c0a4c9e.e33823dc.js 6.3 KB

1
  1. (window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-2c0a4c9e"],{"1b69":function(e,t,n){var o=n("c7eb"),r=n("1da1"),s=(n("d3b7"),n("a18c"),n("5daa")),a=n("5f87"),i={};window.ajaxTimeout=2e4,t.a=Object(r.a)(Object(o.a)().mark((function e(){var t,n,c,u,l,p,d,f=arguments;return Object(o.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=0<f.length&&void 0!==f[0]?f[0]:"",n=1<f.length&&void 0!==f[1]?f[1]:{},c=2<f.length&&void 0!==f[2]?f[2]:"GET",u=3<f.length&&void 0!==f[3]?f[3]:{},l=4<f.length&&void 0!==f[4]?f[4]:i,p=5<f.length?f[5]:void 0,c=c.toLowerCase(),d={method:c,baseURL:"",url:s.a.baseURL+t,data:n,params:u,processData:!0,timeout:window.ajaxTimeout,headers:l,onUploadProgress:p},p&&"function"==typeof p&&(d.onUploadProgress=p),axios.interceptors.request.use((function(e){return e.data.token||(e.data.token=Object(a.e)()),e}),(function(e){return Promise.reject(new Error("服务器异常,请联系管理员!"))})),axios.interceptors.response.use((()=>{var e=Object(r.a)(Object(o.a)().mark((function e(t){var n;return Object(o.a)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return 200===t.status&&100<=(n=t.data.code)&&n<=104&&(Object(a.i)(),Object(a.g)(),Object(a.f)()),e.abrupt("return",t);case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}})(),(function(e){return Promise.reject(e.response.data)})),e.abrupt("return",new Promise((function(e,t){axios(d).then((function(t){e(t.data)})).catch((function(e){e.response&&e.response.data?t(e.response.data):t(e)}))})));case 12:case"end":return e.stop()}}),e)})))},"1d95":function(e,t,n){},"99b8":function(e,t,n){n("1d95")},"9ed6":function(e,t,n){n.r(t);var o=n("ade3"),r=n("c7eb"),s=n("1da1"),a=(n("13d5"),n("b64b"),n("d3b7"),n("1b69")),i=function(e,t){return Object(a.a)("admin/version",e,"post",t)},c={name:"Login",mixins:[n("9f53").a],data:function(){return{ver:"",show:!1,loginForm:{username:"",password:""},loginRules:{username:[{required:!0,trigger:"blur",validator:function(e,t,n){""===t?n(new Error("账号不能为空!")):n()}}],password:[{required:!0,trigger:"blur",validator:function(e,t,n){n(),""===t?n(new Error("密码不能为空!")):n()}}]},passwordType:"password",capsTooltip:!1,loading:!1,showDialog:!1,redirect:void 0,otherQuery:{}}},watch:{$route:{handler:function(e){e=e.query,e&&(this.redirect=e.redirect,this.otherQuery=this.getOtherQuery(e))},immediate:!0}},created:function(){},mounted:function(){""===this.loginForm.username?this.$refs.username.focus():""===this.loginForm.password&&this.$refs.password.focus()},methods:{getversion:function(){var e=this;return Object(s.a)(Object(r.a)().mark((function t(){var n,o;return Object(r.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,i({});case 2:(n=t.sent)&&0===n.code?(o=n.data,e.ver=o.version,t.next=11):t.next=8;break;case 8:if(n&&100<=n.code&&n.code<=104)return t.next=11,e.logout();t.next=11;break;case 11:case"end":return t.stop()}}),t)})))()},setVisible:function(e){this.show=e},handleClick:function(){this.show=!0},handleSuccess:function(){this.show=!1,this.handleLogin()},checkCapslock:function(e){e=e.key,this.capsTooltip=e&&1===e.length&&"A"<=e&&e<="Z"},showPwd:function(){var e=this;"password"===this.passwordType?this.passwordType="":this.passwordType="password",this.$nextTick((function(){e.$refs.password.focus()}))},handleLogin:function(){var e=this;this.$refs.loginForm.validate((function(t){if(!t)return!1;e.loading=!0,e.$store.dispatch("user/login",e.loginForm).then((function(t){0===t.code?e.getMenu():(e.$message.warning(t.msg),e.loading=!1)})).catch((function(t){e.loading=!1}))}))},getMenu:function(){var e=this;this.$store.dispatch("user/getMenuList",this).then((function(t){window.vm.$router.push({path:"/welcome",query:e.otherQuery}),e.loading=!1})).catch((function(t){e.loading=!1}))},getOtherQuery:function(e){return Object.keys(e).reduce((function(t,n){return"redirect"!==n&&(t[n]=e[n]),t}),{})}}};n("99b8"),n=n("2877"),n=Object(n.a)(c,(function(){var e=this,t=e._self._c;return t("div",{staticClass:"login-container"},[t("div",{staticClass:"login-form-main"},[t("el-form",{ref:"loginForm",staticClass:"login-form",attrs:{model:e.loginForm,rules:e.loginRules,autocomplete:"on","label-position":"left"}},[t("div",{staticClass:"title-container"},[t("h3",{staticClass:"title"},[e._v(" 五常稻田"),t("span",[e._v(e._s(e.ver))])])]),t("el-form-item",{attrs:{prop:"username"}},[t("el-input",{ref:"username",attrs:{placeholder:"账号",name:"username",type:"text",tabindex:"1",autocomplete:"on"},model:{value:e.loginForm.username,callback:function(t){e.$set(e.loginForm,"username",t)},expression:"loginForm.username"}},[t("i",{staticClass:"el-icon-user-solid",attrs:{slot:"prefix"},slot:"prefix"})])],1),t("el-tooltip",{attrs:{content:"Caps lock is On",placement:"right",manual:""},model:{value:e.capsTooltip,callback:function(t){e.capsTooltip=t},expression:"capsTooltip"}},[t("el-form-item",{attrs:{prop:"password"}},[t("el-input",{key:e.passwordType,ref:"password",attrs:{type:e.passwordType,placeholder:"密码",name:"password",tabindex:"2",autocomplete:"on"},on:{blur:function(t){e.capsTooltip=!1}},nativeOn:{keyup:[function(t){return e.checkCapslock.apply(null,arguments)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.handleLogin.apply(null,arguments)}]},model:{value:e.loginForm.password,callback:function(t){e.$set(e.loginForm,"password",t)},expression:"loginForm.password"}},[t("i",{staticClass:"el-icon-warning",attrs:{slot:"prefix"},slot:"prefix"}),t("i",{class:Object(o.a)({"el-input__icon":"password"===e.passwordType},"el-input__icon","password"!==e.passwordType),attrs:{slot:"suffix"},nativeOn:{click:function(t){return e.showPwd.apply(null,arguments)}},slot:"suffix"})])],1)],1),t("el-button",{staticStyle:{width:"100%","margin-top":"5px"},attrs:{loading:e.loading,disabled:e.loading,type:"primary"},nativeOn:{click:function(t){return t.preventDefault(),e.handleLogin()}}},[e._v("登    录")])],1)],1)])}),[],!1,null,"068269f0",null);t.default=n.exports},"9f53":function(e,t,n){var o=n("c7eb"),r=n("1da1");t.a={methods:{logout:function(){var e=this;return Object(r.a)(Object(o.a)().mark((function t(){return Object(o.a)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("/login"!==e.$route.path)return t.next=3,e.$store.dispatch("user/logout");t.next=4;break;case 3:e.$router.push("/login");case 4:case"end":return t.stop()}}),t)})))()}}}}}]);