goldpankit
Version:
GoldPanKit是一款极速研发套件,可在套件中快速构建各类技术框架和项目。开源作者可发布自己的项目,并为其设定金额,实现开源项目的盈利。
2 lines (1 loc) • 2.75 kB
JavaScript
import{M as y,V as $,S as I,a as T,p as F}from"./index-3170cb36.js";import{y as V,_ as S,B as k,P as q,Z as C,r as o,o as u,c,a as s,t as r,h as B,w as a,j as R,b as n,F as h,e as i}from"./index-a4b07d74.js";import{C as w}from"./CompilerSelect-907e67c9.js";import"./service-214aa7b1.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:w,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"},j={class:"wrap"},M={class:"opera"};function P(e,t,D,E,l,p){const g=o("FormTip"),f=o("el-input"),d=o("FormItemTip"),_=o("el-form-item"),v=o("el-form"),b=o("el-button");return u(),c("div",U,[s("div",j,[s("h2",null,r(e.$t("plugin.create")),1),l.service!=null?(u(),B(g,{key:0},{default:a(()=>[e.$i18n.locale==="en"?(u(),c(h,{key:0},[i(r(e.$t("plugin.createFor")),1),s("em",null,r(l.service),1),i(". ")],64)):(u(),c(h,{key:1},[i(r(e.$t("plugin.createFor1")),1),s("em",null,r(l.service),1),i(r(e.$t("plugin.createFor2"))+"。 ",1)],64))]),_:1})):R("",!0),n(v,{ref:"form",model:l.form,rules:p.getRules()},{default:a(()=>[n(_,{label:e.$t("plugin.label"),prop:"label",required:""},{default:a(()=>[n(f,{ref:"labelInput",modelValue:l.form.label,"onUpdate:modelValue":t[0]||(t[0]=m=>l.form.label=m),onInput:p.handleLabelInput},null,8,["modelValue","onInput"]),n(d,{content:e.$t("plugin.labelTip")},null,8,["content"])]),_:1},8,["label"]),n(_,{label:e.$t("plugin.name"),prop:"name",required:""},{default:a(()=>[n(f,{class:"follow-input",modelValue:l.form.name,"onUpdate:modelValue":t[1]||(t[1]=m=>l.form.name=m)},null,8,["modelValue"]),n(d,{content:e.$t("plugin.nameTip")},null,8,["content"])]),_:1},8,["label"])]),_:1},8,["model","rules"]),s("div",M,[n(b,{type:"primary",onClick:p.create},{default:a(()=>[i(r(e.$t("plugin.create")),1)]),_:1},8,["onClick"])])])])}const H=S(L,[["render",P],["__scopeId","data-v-40a415ff"]]);export{H as default};