import{d as i}from"./vendor-39c32a1b.js";import{S as r,n}from"./index-8fa791df.js";import{g as l}from"./dingtalkHooks-6afc1548.js";const a=i({name:"LoginView",data(){return{login_ing:!1,ruleForm:{username:"",password:""},rules:{username:[{required:!0,message:"\u8BF7\u8F93\u5165\u767B\u5F55\u8D26\u53F7",trigger:"blur"},{min:4,max:50,message:"\u957F\u5EA6\u5728 4 \u5230 20 \u4E2A\u5B57\u7B26",trigger:"blur"}],password:[{required:!0,message:"\u8BF7\u8F93\u5165\u767B\u5F55\u5BC6\u7801",trigger:"blur"},{min:4,max:20,message:"\u957F\u5EA6\u5728 4 \u5230 20 \u4E2A\u5B57\u7B26",trigger:"blur"}]}}},computed:{isLocalhost:function(){return r.isLocalhost||location.href.indexOf("localhost")>-1}},mounted(){r.isDD?l():this.getWWAuthCode()},methods:{getWWAuthCode(t=!0){try{const e=location.href.split("?")[1].split("&")[0].split("=")[1];e&&t&&this.handleWWAuthLogin(e)}catch(e){}},handleWWAuthLogin(t){this.login_ing=!0,this.$store.dispatch("wwAuthLogin",t).then(()=>{this.$message.success("\u767B\u5F55\u6210\u529F"),this.$router.push("/")}).catch(e=>{this.$message.error(e.msg)}).finally(()=>{setTimeout(()=>this.login_ing=!1,500)})},submitForm(t){this.$refs[t].validate(e=>{if(e)this.handleLogin();else return!1})},resetForm(t){this.$refs[t].resetFields()},handleLogin(){this.login_ing=!0,this.$store.dispatch("login",this.ruleForm).then(t=>{this.$message.success("\u767B\u5F55\u6210\u529F"),this.$router.push("/")}).catch(t=>{this.$message.error(t.data.msg)}).finally(()=>{setTimeout(()=>this.login_ing=!1,500)})},handleLoginOut(){this.exit_loading=!0,this.$store.dispatch("loginOut").then(()=>{this.$message.info("\u9000\u51FA\u6210\u529F"),this.exit_loading=!1})}}});var u=function(){var e=this,s=e._self._c;return s("div",{staticClass:"login-page",class:{"is-localhost":e.isLocalhost}},[e._m(0),e.isLocalhost?s("el-form",{ref:"ruleForm",staticClass:"demo-ruleForm",attrs:{model:e.ruleForm,rules:e.rules,"label-width":"100px"}},[s("el-form-item",{attrs:{label:"\u767B\u5F55\u8D26\u53F7",prop:"username"}},[s("el-input",{attrs:{type:"username"},model:{value:e.ruleForm.username,callback:function(o){e.$set(e.ruleForm,"username",o)},expression:"ruleForm.username"}},[s("i",{staticClass:"el-icon-s-custom",attrs:{slot:"prefix"},slot:"prefix"})])],1),s("el-form-item",{attrs:{label:"\u767B\u5F55\u5BC6\u7801",prop:"password"}},[s("el-input",{attrs:{type:"password",autocomplete:"off","show-password":""},model:{value:e.ruleForm.password,callback:function(o){e.$set(e.ruleForm,"password",o)},expression:"ruleForm.password"}},[s("i",{staticClass:"el-icon-connection",attrs:{slot:"prefix"},slot:"prefix"})])],1),s("el-form-item",{staticClass:"login-buts"},[s("el-button",{staticClass:"submit-but",attrs:{icon:"el-icon-s-promotion",loading:e.login_ing,type:"primary",round:""},on:{click:function(o){return e.submitForm("ruleForm")}}},[e._v("\u63D0\u4EA4 ")]),s("el-button",{attrs:{icon:"el-icon-refresh",type:"danger",round:""},on:{click:function(o){return e.resetForm("ruleForm")}}},[e._v("\u91CD\u7F6E ")]),s("el-button",{attrs:{icon:"el-icon-refresh",type:"primary",round:""},on:{click:function(o){return e.getWWAuthCode(!0)}}},[e._v("\u624B\u52A8\u6D4B\u8BD5\u6388\u6743\u767B\u5F55 ")])],1)],1):e._e()],1)},c=[function(){var t=this,e=t._self._c;return e("h1",{staticClass:"com-online-code-login-loading"},[e("i",{staticClass:"el-icon-loading"}),e("h1",{staticClass:"com-title"},[t._v("\u4E5D\u53F7\u540C\u4E8B")])])}],m=n(a,u,c,!1,null,null,null,null);const p=m.exports;export{p as default};
