123456 |
- /*!
- * build: Hopaheal
- * copyright: Mead
- * time: 2022-7-23 18:51:45
- */
- (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-f306698e"],{"161f":function(e,t,s){},"2d82":function(e,t,s){"use strict";s("161f")},"9ed6":function(e,t,s){"use strict";s.r(t);var i=function(){var e=this,t=e._self._c;return t("div",{staticClass:"login-container"},[t("div",{staticClass:"title1"},[t("div",{staticClass:"h1"},[e._v(e._s(e.title))]),e.secondLineTitle?t("div",{staticClass:"h1"},[e._v(e._s(e.secondLineTitle))]):e._e()]),t("el-row",[t("el-col",{attrs:{lg:7,md:6,sm:24,xl:8,xs:24}},[t("div",{staticStyle:{color:"transparent"}},[e._v("占位符")])]),t("el-col",{attrs:{lg:10,md:12,sm:24,xl:8,xs:24}},[t("el-form",{ref:"form",staticClass:"login-form",attrs:{"label-position":"left",model:e.form,rules:e.rules}},[t("div",{staticClass:"title"},[e._v("登录")]),t("el-form-item",{staticStyle:{"margin-top":"40px"},attrs:{prop:"username"}},[t("el-input",{directives:[{name:"focus",rawName:"v-focus"}],attrs:{placeholder:"请输入用户名",tabindex:"1",type:"text"},scopedSlots:e._u([{key:"prefix",fn:function(){return[t("vab-icon",{staticClass:"icon",attrs:{icon:"user-line"}})]},proxy:!0}]),model:{value:e.form.username,callback:function(t){e.$set(e.form,"username","string"===typeof t?t.trim():t)},expression:"form.username"}})],1),t("el-form-item",{attrs:{prop:"password"}},[t("el-input",{key:e.passwordType,ref:"password",attrs:{placeholder:"请输入密码",tabindex:"2",type:e.passwordType},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.handleLogin.apply(null,arguments)}},scopedSlots:e._u([{key:"prefix",fn:function(){return[t("vab-icon",{staticClass:"icon",attrs:{icon:"lock-line"}})]},proxy:!0},"password"===e.passwordType?{key:"suffix",fn:function(){return[t("vab-icon",{staticClass:"show-password icon",attrs:{icon:"eye-off-line"},on:{click:e.handlePassword}})]},proxy:!0}:{key:"suffix",fn:function(){return[t("vab-icon",{staticClass:"show-password icon",attrs:{icon:"eye-line"},on:{click:e.handlePassword}})]},proxy:!0}],null,!0),model:{value:e.form.password,callback:function(t){e.$set(e.form,"password","string"===typeof t?t.trim():t)},expression:"form.password"}})],1),t("el-button",{staticClass:"login-btn",attrs:{loading:e.loading,type:"primary"},on:{click:e.handleLogin}},[e._v(" 登录 ")]),t("div",{staticClass:"tip_1"},[t("span"),t("vab-icon",{attrs:{icon:"question-line"}}),e._v(" 忘记账号密码或其他问题,请联系管理员 ")],1)],1)],1),t("el-col",{attrs:{lg:7,md:6,sm:24,xl:8,xs:24}},[t("div",{staticStyle:{color:"transparent"}},[e._v("占位符")])])],1)],1)},r=[],o=(s("d9e2"),s("2f62")),a=s("61f7"),n=s("2400"),l={name:"Login",directives:{focus:{inserted(e){e.querySelector("input").focus()}}},beforeRouteLeave(e,t,s){clearInterval(this.timer),s()},data(){const e=(e,t,s)=>{""===t?s(new Error("用户名不能为空")):s()},t=(e,t,s)=>{Object(a["isPassword"])(t)?s():s(new Error("密码不能少于6位"))};return{form:{username:"",password:""},rules:{username:[{required:!0,trigger:"blur",validator:e}],password:[{required:!0,trigger:"blur",validator:t}]},loading:!1,passwordType:"password",redirect:void 0,timer:0,codeUrl:"https://www.oschina.net/action/user/captcha",previewText:""}},computed:{...Object(o["c"])({title:"settings/title",secondLineTitle:"settings/secondLineTitle"})},watch:{$route:{handler(e){this.redirect=e.query&&e.query.redirect||"/admin/index"},immediate:!0}},mounted(){this.form.username="",this.form.password=""},methods:{...Object(o["b"])({login:"user/login",setAvatar:"user/setAvatar",setRole_id:"user/setRole_id"}),handlePassword(){"password"===this.passwordType?this.passwordType="":this.passwordType="password",this.$nextTick(()=>{this.$refs.password.focus()})},handleRoute(){return console.log(this.redirect,"this.redirect"),"/404"===this.redirect||this.redirect,"/admin/index"},handleLogin(){this.$refs.form.validate(async e=>{if(e)try{this.loading=!0,await this.login(this.form),await this.getUser(),console.log(this.$store.state.user.role_id,"this.redirect")}finally{this.loading=!1}})},async getUser(){this.listLoading=!0;const{data:e}=await Object(n["getUser"])();console.log(e),await this.$router.push(this.handleRoute())},changeCode(){this.codeUrl="https://www.oschina.net/action/user/captcha?timestamp="+(new Date).getTime()}}},c=l,d=(s("2d82"),s("2877")),p=Object(d["a"])(c,i,r,!1,null,"adad913c",null);t["default"]=p.exports}}]);
|