| 1 |
- import{d as i}from"./vendor-ef68d560.js";import{n as l,s as r}from"./index-87faf287.js";import{g as n}from"./dingtalkHooks-88e0937f.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}},methods:{getWWAuthCode(s=!0){try{const e=location.href.split("?")[1].split("&")[0].split("=")[1];e&&s&&this.handleWWAuthLogin(e)}catch(e){}},handleWWAuthLogin(s){this.login_ing=!0,this.$store.dispatch("wwAuthLogin",s).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(s){this.$refs[s].validate(e=>{if(e)this.handleLogin();else return!1})},resetForm(s){this.$refs[s].resetFields()},handleLogin(){this.login_ing=!0,this.$store.dispatch("login",this.ruleForm).then(s=>{this.$message.success("\u767B\u5F55\u6210\u529F"),this.$router.push("/")}).catch(s=>{s.data&&this.$message.error(s.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})}},mounted(){if(r.isDD)try{n()}catch(s){}else this.getWWAuthCode(!0)}});var u=function(){var e=this,t=e._self._c;return e._self._setupProxy,t("div",{staticClass:"login-page",class:{"is-localhost":e.isLocalhost}},[e._m(0),e.isLocalhost?t("el-form",{ref:"ruleForm",staticClass:"demo-ruleForm",attrs:{model:e.ruleForm,rules:e.rules,"label-width":"100px"}},[t("el-form-item",{attrs:{label:"\u767B\u5F55\u8D26\u53F7",prop:"username"}},[t("el-input",{attrs:{type:"username"},model:{value:e.ruleForm.username,callback:function(o){e.$set(e.ruleForm,"username",o)},expression:"ruleForm.username"}},[t("i",{staticClass:"el-icon-s-custom",attrs:{slot:"prefix"},slot:"prefix"})])],1),t("el-form-item",{attrs:{label:"\u767B\u5F55\u5BC6\u7801",prop:"password"}},[t("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"}},[t("i",{staticClass:"el-icon-connection",attrs:{slot:"prefix"},slot:"prefix"})])],1),t("el-form-item",{staticClass:"login-buts"},[t("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 ")]),t("el-button",{attrs:{icon:"el-icon-refresh",type:"danger",round:""},on:{click:function(o){return e.resetForm("ruleForm")}}},[e._v("\u91CD\u7F6E ")]),t("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 s=this,e=s._self._c;return s._self._setupProxy,e("h1",{staticClass:"com-online-code-login-loading"},[e("i",{staticClass:"el-icon-loading"}),e("h1",{staticClass:"com-title"},[s._v("\u4E5D\u53F7\u540C\u4E8B")])])}],m=l(a,u,c,!1,null,null,null,null);const f=m.exports;export{f as default};
|