UNPKG

goldpankit

Version:

GoldPanKit是一款极速研发套件,可在套件中快速构建各类技术框架和项目。开源作者可发布自己的项目,并为其设定金额,实现开源项目的盈利。

2 lines (1 loc) 3.39 kB
import{_ as b,L as k,n as y,q as I,s as x,u as B,r as l,o as T,c as V,a as t,b as s,w as a,k as L,t as c,v as S,e as n,p as U,l as C}from"./index-feb3a4f9.js";import{a as W}from"./js.cookie-edb2da2a.js";const $={components:{Logo:k},data(){return{errorTip:"",isWorking:{login:!1},form:{username:"",password:""}}},computed:{disabledLoginButton(){return this.isWorking.login||this.form.username.trim()===""?!0:this.form.password.trim()===""}},methods:{...y(["setUserInfo"]),login(o=!0){this.disabledLoginButton||(this.errorTip="",this.isWorking.login=!0,I({username:this.form.username.trim(),password:this.form.password.trim(),force:o}).then(e=>(W.set("x-kit-token",e),x(e))).then(()=>B()).then(e=>{localStorage.setItem("login_username",this.form.username),this.setUserInfo(e);const u=this.$route.query.redirect_uri;if(u!=null&&u!=="")this.$router.push(u);else{const m=this.$router.options.history.state.back;m==null||m==="/signup"?this.$router.push({name:"Desktop"}):this.$router.back()}}).catch(e=>{if(e.code===6201){this.alert("当前账号已登录,继续登录后其它设备将自动离线,确认要继续登录吗?如果您对当前登录状态存在疑问,建议您登录后尽快修改密码!","重要提示",{showCancelButton:!0,cancelButtonText:"暂不登录",confirmButtonText:"继续登录"}).then(()=>{this.login(!0)});return}this.errorTip=e.message}).finally(()=>{this.isWorking.login=!1}))}},mounted(){const o=localStorage.getItem("login_username");o&&(this.form.username=o),this.$refs.username.focus()}},g=o=>(U("data-v-f21d7470"),o=o(),C(),o),K={class:"page-wrap"},M=g(()=>t("div",{class:"background-text"},[t("p",null,[n("我"),t("em",{style:{color:"#999"}},"无力"),n("创办一个"),t("em",null,"伟大"),n("的企业")]),t("p",null,[n("但我的"),t("em",null,"人生"),n("依然需要满意的"),t("em",null,"作品"),t("br")])],-1)),N={class:"wrap"},P=g(()=>t("h2",null,"登录KIT",-1)),q={class:"text-danger",style:{height:"40px"}},D={class:"footer-wrap"},E={class:"create-account"};function F(o,e,u,m,r,p){const h=l("Logo"),d=l("el-input"),f=l("el-form-item"),w=l("el-form"),v=l("el-button"),_=l("router-link");return T(),V("div",K,[M,t("div",N,[s(h,{"with-version":!1,"with-animation":!0}),P,s(w,{ref:"form",model:r.form,onSubmit:e[5]||(e[5]=L(()=>{},["stop"]))},{default:a(()=>[s(f,{label:"用户名或手机号码",prop:"username"},{default:a(()=>[s(d,{ref:"username",modelValue:r.form.username,"onUpdate:modelValue":e[0]||(e[0]=i=>r.form.username=i),type:"text",onInput:e[1]||(e[1]=i=>r.errorTip="")},null,8,["modelValue"])]),_:1}),s(f,{class:"password-item",label:"登录密码",prop:"password"},{default:a(()=>[s(d,{modelValue:r.form.password,"onUpdate:modelValue":e[2]||(e[2]=i=>r.form.password=i),"show-password":"",type:"password",onInput:e[3]||(e[3]=i=>r.errorTip=""),onKeypress:e[4]||(e[4]=S(i=>p.login(),["enter","native"]))},null,8,["modelValue"])]),_:1})]),_:1},8,["model"]),t("p",q,c(r.errorTip),1),t("div",D,[t("div",null,[s(v,{type:"important",disabled:p.disabledLoginButton,onClick:e[6]||(e[6]=i=>p.login())},{default:a(()=>[n(c(o.$t("common.signIn")),1)]),_:1},8,["disabled"])])]),t("div",E,[s(_,{to:{name:"SignUp"}},{default:a(()=>[n("创建新账号")]),_:1}),s(_,{to:{name:"FindPasswordByMobileOTP"}},{default:a(()=>[n("忘记密码了")]),_:1})])])])}const z=b($,[["render",F],["__scopeId","data-v-f21d7470"]]);export{z as default};