/*! * build: Hopaheal * copyright: Mead * time: 2023-9-18 16:18:17 */ (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-6883bf5c"],{6749:function(e,t,s){},"9d2f":function(e,t,s){"use strict";s("6749")},"9ed6":function(e,t,s){"use strict";s.r(t);var r=function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"login-container"},[s("div",{staticClass:"title1"},[e.title?s("div",{staticClass:"h1"},[e._v(e._s(e.title))]):e._e()]),s("el-row",[s("el-col",{attrs:{lg:7,md:6,sm:24,xl:8,xs:24}},[s("div",{staticStyle:{color:"transparent"}},[e._v("占位符")])]),s("el-col",{attrs:{lg:10,md:12,sm:24,xl:8,xs:24}},[s("el-form",{ref:"form",staticClass:"login-form",attrs:{"label-position":"left",model:e.form,rules:e.rules}},[s("div",{staticClass:"title"},[e._v("登录")]),s("el-form-item",{staticStyle:{"margin-top":"40px"},attrs:{prop:"username"}},[s("el-input",{directives:[{name:"focus",rawName:"v-focus"}],attrs:{placeholder:"请输入用户名",tabindex:"1",type:"text"},scopedSlots:e._u([{key:"prefix",fn:function(){return[s("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),s("el-form-item",{attrs:{prop:"password"}},[s("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(t)}},scopedSlots:e._u([{key:"prefix",fn:function(){return[s("vab-icon",{staticClass:"icon",attrs:{icon:"lock-line"}})]},proxy:!0},"password"===e.passwordType?{key:"suffix",fn:function(){return[s("vab-icon",{staticClass:"show-password icon",attrs:{icon:"eye-off-line"},on:{click:e.handlePassword}})]},proxy:!0}:{key:"suffix",fn:function(){return[s("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),s("el-button",{staticClass:"login-btn",attrs:{loading:e.loading,type:"primary"},on:{click:e.handleLogin}},[e._v(" 登录 ")]),s("div",{staticClass:"tip_1"},[s("span"),s("vab-icon",{attrs:{icon:"question-line"}}),e._v(" 忘记账号密码或其他问题,请联系管理员 ")],1),s("div",{staticClass:"tips"},[e._v(" 本系统为演示系统如有需要请联系我们:17638192817(李经理) ")])],1)],1),s("el-col",{attrs:{lg:7,md:6,sm:24,xl:8,xs:24}},[s("div",{staticStyle:{color:"transparent"}},[e._v("占位符")])])],1)],1)},i=[],o=(s("fd0d"),s("2760"),s("7736")),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||"/"},immediate:!0}},mounted(){},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.$store.state.user.role_id,"this.redirect"),"/404"===this.redirect||"/403"===this.redirect?"/":this.redirect},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"])();2!=e.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()}}},c=l,d=(s("9d2f"),s("0b56")),p=Object(d["a"])(c,r,i,!1,null,"4f4cf20c",null);t["default"]=p.exports}}]);