/*! * build: Hopaheal * copyright: Mead * time: 2022-11-24 14:44:56 */ (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-34295b50"],{"905b":function(t,e,s){},aace:function(t,e,s){"use strict";s("905b")},c1d1:function(t,e,s){"use strict";s.r(e);var r=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"login-container"},[s("el-row",[s("el-col",{attrs:{lg:8,md:6,sm:24,xl:8,xs:24}},[s("div",{staticStyle:{color:"transparent"}},[t._v("占位符")])]),s("el-col",{attrs:{lg:8,md:12,sm:24,xl:9,xs:24}},[s("el-form",{ref:"form",staticClass:"login-form",attrs:{"label-position":"left",model:t.form,rules:t.rules}},[s("div",{staticClass:"title"},[t._v(t._s(t.translateTitle("登录")))]),s("el-form-item",{staticStyle:{"margin-top":"40px"},attrs:{prop:"username"}},[s("el-input",{directives:[{name:"focus",rawName:"v-focus"}],attrs:{placeholder:t.translateTitle("请输入用户名"),tabindex:"1",type:"text"},scopedSlots:t._u([{key:"prefix",fn:function(){return[s("vab-icon",{staticClass:"icon",attrs:{icon:"user-line"}})]},proxy:!0}]),model:{value:t.form.username,callback:function(e){t.$set(t.form,"username","string"===typeof e?e.trim():e)},expression:"form.username"}})],1),s("el-form-item",{attrs:{prop:"password"}},[s("el-input",{key:t.passwordType,ref:"password",attrs:{placeholder:t.translateTitle("请输入密码"),tabindex:"2",type:t.passwordType},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.handleLogin(e)}},scopedSlots:t._u([{key:"prefix",fn:function(){return[s("vab-icon",{staticClass:"icon",attrs:{icon:"lock-line"}})]},proxy:!0},"password"===t.passwordType?{key:"suffix",fn:function(){return[s("vab-icon",{staticClass:"show-password icon",attrs:{icon:"eye-off-line"},on:{click:t.handlePassword}})]},proxy:!0}:{key:"suffix",fn:function(){return[s("vab-icon",{staticClass:"show-password icon",attrs:{icon:"eye-line"},on:{click:t.handlePassword}})]},proxy:!0}],null,!0),model:{value:t.form.password,callback:function(e){t.$set(t.form,"password","string"===typeof e?e.trim():e)},expression:"form.password"}})],1),s("el-button",{staticClass:"login-btn",attrs:{loading:t.loading,type:"primary"},on:{click:t.handleLogin}},[t._v(" "+t._s(t.translateTitle("登录"))+" ")]),s("div",{staticClass:"tip_1"},[s("span"),s("vab-icon",{attrs:{icon:"question-line"}}),t._v(" "+t._s(t.translateTitle("忘记账号密码或其他问题,请联系管理员"))+" ")],1),s("div",{staticClass:"tips"},[s("div",[t._v("如有需要请联系我们:17638192817(李经理)")])])],1)],1),s("el-col",{attrs:{lg:8,md:6,sm:24,xl:8,xs:24}},[s("div",{staticStyle:{color:"transparent"}},[t._v("占位符")])])],1)],1)},i=[],a=(s("67e1"),s("388d"),s("7736")),o=s("61f7"),n=s("79fa"),l=s("2400"),c={name:"Login",directives:{focus:{inserted(t){t.querySelector("input").focus()}}},beforeRouteLeave(t,e,s){clearInterval(this.timer),s()},data(){const t=(t,e,s)=>{""===e?s(new Error("用户名不能为空")):s()},e=(t,e,s)=>{Object(o["isPassword"])(e)?s():s(new Error("密码不能少于6位"))};return{form:{username:"",password:""},rules:{username:[{required:!0,trigger:"blur",validator:t}],password:[{required:!0,trigger:"blur",validator:e}]},loading:!1,passwordType:"password",redirect:void 0,timer:0,codeUrl:"https://www.oschina.net/action/user/captcha",previewText:""}},computed:{...Object(a["c"])({title:"settings/title",secondLineTitle:"settings/secondLineTitle"})},watch:{$route:{handler(){this.redirect="/"},immediate:!0}},mounted(){this.form.username="",this.form.password=""},methods:{translateTitle:n["translateTitle"],...Object(a["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.$store.state.user.role_id,"this.redirect"),"/404"===this.redirect||"/403"===this.redirect?"/":this.redirect},handleLogin(){this.$refs.form.validate(async t=>{if(t)try{this.loading=!0,await this.login(this.form),await this.getUser(),await this.$router.push("/"),console.log(this.$store.state.user.role_id,"this.redirect")}finally{this.loading=!1}})},async getUser(){this.listLoading=!0;const{data:t}=await Object(l["getUser"])();2!=t.role_id?await this.$router.push(this.handleRoute()):this.$router.push("/project/expertList")},changeCode(){this.codeUrl="https://www.oschina.net/action/user/captcha?timestamp="+(new Date).getTime()}}},d=c,p=(s("aace"),s("0b56")),u=Object(p["a"])(d,r,i,!1,null,"10dd1994",null);e["default"]=u.exports}}]);