UNPKG

goldpankit

Version:

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

2 lines (1 loc) 3.8 kB
import{_ as k,n as y,q as C,u as U,v as I,r as f,o as $,c as b,a as u,t as g,b as l,w as c,i as x,x as D,e as w}from"./index-99dec0ae.js";/*! js-cookie v3.0.5 | MIT */function h(e){for(var n=1;n<arguments.length;n++){var i=arguments[n];for(var d in i)e[d]=i[d]}return e}var R={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function v(e,n){function i(r,t,o){if(!(typeof document>"u")){o=h({},n,o),typeof o.expires=="number"&&(o.expires=new Date(Date.now()+o.expires*864e5)),o.expires&&(o.expires=o.expires.toUTCString()),r=encodeURIComponent(r).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var a in o)o[a]&&(s+="; "+a,o[a]!==!0&&(s+="="+o[a].split(";")[0]));return document.cookie=r+"="+e.write(t,r)+s}}function d(r){if(!(typeof document>"u"||arguments.length&&!r)){for(var t=document.cookie?document.cookie.split("; "):[],o={},s=0;s<t.length;s++){var a=t[s].split("="),_=a.slice(1).join("=");try{var p=decodeURIComponent(a[0]);if(o[p]=e.read(_,p),r===p)break}catch{}}return r?o[r]:o}}return Object.create({set:i,get:d,remove:function(r,t){i(r,"",h({},t,{expires:-1}))},withAttributes:function(r){return v(this.converter,h({},this.attributes,r))},withConverter:function(r){return v(h({},this.converter,r),this.attributes)}},{attributes:{value:Object.freeze(n)},converter:{value:Object.freeze(e)}})}var V=v(R,{path:"/"});const q={data(){return{form:{username:"",password:""},loginData:{isWorking:!1}}},methods:{...y(["setUserInfo"]),getRules(){return{username:[{required:!0,message:this.$t("form.isRequired",{value:this.$t("user.username")})}],password:[{required:!0,message:this.$t("form.isRequired",{value:this.$t("user.password")})}]}},login(){this.$refs.form.validate().then(()=>{this.loginData.isWorking||(this.loginData.isWorking=!0,C({...this.form,username:this.form.username.trim()}).then(e=>(V.set("x-kit-token",e),U(e))).then(()=>I()).then(e=>{this.setUserInfo(e);const n=this.$route.query.redirect_uri;if(n!=null&&n!=="")this.$router.push(n);else{const i=this.$router.options.history.state.back;i==null||i==="/signup"?this.$router.push({name:"Desktop"}):this.$router.back()}}).catch(e=>{this.$tip.apiFailed(e)}).finally(()=>{this.loginData.isWorking=!1}))}).catch(()=>{})}}},B={class:"signup"},j={class:"wrap"},W={class:"login-box"},z={class:"create-account"};function A(e,n,i,d,r,t){const o=f("el-input"),s=f("el-form-item"),a=f("el-form"),_=f("el-button"),p=f("router-link");return $(),b("div",B,[u("div",j,[u("h2",null,g(e.$t("common.signIn")),1),l(a,{ref:"form",model:r.form,rules:t.getRules(),onSubmit:n[2]||(n[2]=x(()=>{},["stop"]))},{default:c(()=>[l(s,{label:e.$t("user.username"),prop:"username",required:""},{default:c(()=>[l(o,{modelValue:r.form.username,"onUpdate:modelValue":n[0]||(n[0]=m=>r.form.username=m),type:"text",size:"large"},null,8,["modelValue"])]),_:1},8,["label"]),l(s,{class:"password-item",label:e.$t("user.password"),prop:"password",required:""},{label:c(()=>[u("label",null,g(e.$t("user.password")),1)]),default:c(()=>[l(o,{modelValue:r.form.password,"onUpdate:modelValue":n[1]||(n[1]=m=>r.form.password=m),"show-password":"",type:"password",size:"large",onKeypress:D(t.login,["enter","native"])},null,8,["modelValue","onKeypress"])]),_:1},8,["label"])]),_:1},8,["model","rules"]),u("div",W,[u("div",null,[l(_,{type:"important",disabled:r.loginData.isWorking,onClick:t.login},{default:c(()=>[w(g(e.$t("common.signIn")),1)]),_:1},8,["disabled","onClick"])])])]),u("div",z,[l(p,{to:{name:"SignUp"}},{default:c(()=>[w(g(e.$t("user.createAccount")),1)]),_:1})])])}const S=k(q,[["render",A],["__scopeId","data-v-efdc3398"]]);export{S as default};