| 1 |
- import{d as l,S as r,n as a}from"./index.9d8a3e8d.js";import{g as u}from"./dingtalkHooks.30ada91d.js";import"./composables.2846c723.js";const c=l({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?u():this.getWWAuthCode()},methods:{getWWAuthCode(t=!0){try{const e=location.href.split("?")[1].split("&")[0].split("=")[1];console.log("\u89E3\u6790 code:",e),e&&t&&this.handleWWAuthLogin(e)}catch(e){console.log("\u6CA1\u6709\u89E3\u6790\u5230code",e)}},handleWWAuthLogin(t){console.log("WWAuthCode:",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 console.log("error submit!!"),!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 i=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)},m=[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")])])}];i._withStripped=!0;var n=a(c,i,m,!1,null,null,null,null);n.options.__file="E:/\u5341\u4E8C\u79D1\u6280/\u9879\u76EE/\u4E5D\u53F7\u540C\u4E8B/salary-management-web/src/views/LoginView.vue";const p=n.exports;export{p as default};
|