UNPKG

goldpankit

Version:

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

2 lines (1 loc) 2.76 kB
import{M as y,V as $,S as I,a as T,p as F}from"./index-af31ed44.js";import{z as V,_ as S,C as k,Q as q,Z as C,r as o,o as u,c,a as s,t as n,g as R,w as a,i as w,b as r,F as h,e as i}from"./index-dd2ed0b0.js";import{C as B}from"./CompilerSelect-caaf8496.js";import"./service-3f3b4b89.js";function N(e){return V.post("/usr/plugin/create",e,{baseURL:"/remote-api"})}const L={components:{FormTip:k,FormItemTip:q,MainServiceSelect:y,VersionSelect:$,ServiceTypeSelect:I,CompilerSelect:B,SpaceSelect:T,I18nInput:C},data(){return{space:null,service:null,form:{name:"",label:""}}},methods:{getRules(){return{name:[{required:!0,message:this.$t("form.isRequired",{value:this.$t("plugin.name")})}],label:[{required:!0,message:this.$t("form.isRequired",{value:this.$t("plugin.label")})}]}},handleLabelInput(e){this.form.name=F(e,{toneType:"none",type:"array"}).map(t=>t.substr(0,1)).join("")},create(){this.$refs.form.validate(e=>{e&&N({space:this.space,service:this.service,...this.form}).then(()=>{this.$router.push({name:"PluginSettings",query:{space:this.space,service:this.service,plugin:this.form.name}})}).catch(t=>{this.$tip.apiFailed(t)})})}},created(){this.space=this.$route.query.space,this.service=this.$route.query.service,this.$nextTick(()=>{setTimeout(()=>{this.$refs.labelInput.focus()},100)})}},U={class:"form"},z={class:"wrap"},M={class:"opera"};function j(e,t,D,E,l,p){const b=o("FormTip"),d=o("el-input"),f=o("FormItemTip"),_=o("el-form-item"),g=o("el-form"),v=o("el-button");return u(),c("div",U,[s("div",z,[s("h2",null,n(e.$t("plugin.create")),1),l.service!=null?(u(),R(b,{key:0},{default:a(()=>[e.$i18n.locale==="en"?(u(),c(h,{key:0},[i(n(e.$t("plugin.createFor")),1),s("em",null,n(l.service),1),i(". ")],64)):(u(),c(h,{key:1},[i(n(e.$t("plugin.createFor1")),1),s("em",null,n(l.service),1),i(n(e.$t("plugin.createFor2"))+"。 ",1)],64))]),_:1})):w("",!0),r(g,{ref:"form",model:l.form,rules:p.getRules()},{default:a(()=>[r(_,{label:e.$t("plugin.label"),prop:"label",required:""},{default:a(()=>[r(d,{ref:"labelInput",modelValue:l.form.label,"onUpdate:modelValue":t[0]||(t[0]=m=>l.form.label=m),onInput:p.handleLabelInput},null,8,["modelValue","onInput"]),r(f,{content:e.$t("plugin.labelTip")},null,8,["content"])]),_:1},8,["label"]),r(_,{label:e.$t("plugin.name"),prop:"name",required:""},{default:a(()=>[r(d,{class:"follow-input",modelValue:l.form.name,"onUpdate:modelValue":t[1]||(t[1]=m=>l.form.name=m)},null,8,["modelValue"]),r(f,{content:e.$t("plugin.nameTip")},null,8,["content"])]),_:1},8,["label"])]),_:1},8,["model","rules"]),s("div",M,[r(v,{type:"primary",size:"large",onClick:p.create},{default:a(()=>[i(n(e.$t("plugin.create")),1)]),_:1},8,["onClick"])])])])}const G=S(L,[["render",j],["__scopeId","data-v-b5d3eeb9"]]);export{G as default};