goldpankit
Version:
GoldPanKit是一款极速研发套件,可在套件中快速构建各类技术框架和项目。开源作者可发布自己的项目,并为其设定金额,实现开源项目的盈利。
2 lines (1 loc) • 4.6 kB
JavaScript
import{P}from"./Pagination-51f8e31c.js";import{_ as $,E as w,m as I,r as u,z as A,o as i,c,a,t as s,A as N,F as B,f as E,g as h,b as m,i as y,w as g,e as _,p as T,k as z}from"./index-298973e7.js";import{d as D,f as F}from"./user.service-05933fc3.js";import{b as M}from"./service-4294fe6c.js";import{B as L}from"./BeanAmount-c7652d3e.js";import{S as V}from"./ServiceTitle-8f2e231c.js";import{S as q}from"./ServiceStatus-25e598c5.js";const O={components:{ServiceStatus:q,ServiceTitle:V,BeanAmount:L,Empty:w,Pagination:P},data(){return{loading:!1,pagination:{page:1,capacity:10,total:0},services:[]}},computed:{...I(["userInfo"])},methods:{openSettings(e){if(e.type==="MAIN"){this.$router.push({name:"ServiceSettings",query:{space:e.space.name,service:e.name}});return}this.$router.push({name:"PluginSettings",query:{space:e.space.name,service:e.mainService.name,plugin:e.name}})},deleteService(e){let n;e.type==="MAIN"?n={space:e.space.name,service:e.name}:n={space:e.space.name,service:e.mainService.name,plugin:e.name},this.deleteConfirm(this.$t("service.confirmDeleteTip")).then(()=>{D({id:e.id,...n}).then(()=>{this.services.length===1&&(this.pagination.page-=1),this.fetchPage(),this.$tip.success(this.$t("common.deleteSuccessfully"))}).catch(p=>{this.$tip.apiFailed(p)})}).catch(()=>{})},handleCurrentChange(e){this.pagination.page=e,this.fetchPage()},handleSizeChange(e){this.pagination.capacity=e,this.fetchPage()},fetchPage(){this.loading||(this.loading=!0,this.pagination.page<1&&(this.pagination.page=1),F({...this.pagination,model:{}}).then(e=>{this.services=e.records,this.pagination.total=e.total,this.fetchLocalServices()}).catch(e=>{this.$tip.apiFailed(e)}).finally(()=>{this.loading=!1}))},fetchLocalServices(){M().then(e=>{this.services.forEach(n=>{if(n.codespace=null,n.type==="MAIN"){const o=e.find(l=>l.space===n.space.name&&l.name===n.name);o!=null&&(n.repository=o.repository,n.codespace=o.codespace);return}const p=e.find(o=>o.space===n.space.name&&o.service===n.mainService.name&&o.name===n.name);p!=null&&(n.repository=p.repository,n.codespace=p.codespace)})}).catch(e=>{this.$tip.apiFailed(e)})}},created(){this.fetchPage()}},U=e=>(T("data-v-2631c567"),e=e(),z(),e),j={class:"page"},G={class:"wrap"},H={class:"header"},J={class:"service-list-wrap"},K={key:0,class:"service-list"},Q={class:"introduce"},R={class:"info"},W={class:"info"},X={class:"footer-info"},Y={key:0,class:"user-profile"},Z=["src"],x=U(()=>a("span",null,"|",-1)),ee={class:"text-info-1 text-mini"},te={key:2,class:"opera"};function ae(e,n,p,o,l,r){const f=u("ServiceTitle"),v=u("ServiceStatus"),d=u("el-button"),C=u("Empty"),k=u("Pagination"),b=A("loading");return i(),c("div",j,[a("div",G,[a("div",H,[a("h2",null,s(e.$t("user.leasedAndPrivateServices")),1)]),N((i(),c("div",J,[l.services.length>0?(i(),c("ul",K,[(i(!0),c(B,null,E(l.services,t=>(i(),c("li",{key:t.id},[t.type==="MAIN"?(i(),h(f,{key:0,space:t.space.name,service:t.name,"service-label":t.label,"with-type":!0},null,8,["space","service","service-label"])):(i(),h(f,{key:1,space:t.space.name,service:t.mainService.name,"service-label":t.mainService.label,plugin:t.name,"plugin-label":t.label,"with-type":!0},null,8,["space","service","service-label","plugin","plugin-label"])),a("p",Q,s(t.introduce),1),a("div",R,[a("label",null,s(e.$t("service.codespace"))+":",1),a("p",null,s(t.codespace),1)]),a("div",W,[a("label",null,s(e.$t("service.repository"))+":",1),a("p",null,s(t.repository),1)]),a("div",X,[t.user!=null?(i(),c("div",Y,[a("img",{src:e.getAvatarUri(t.user.avatar)},null,8,Z),a("span",null,s(t.user.username),1)])):y("",!0),m(v,{"with-private":t.withPrivate},null,8,["with-private"]),x,a("p",ee,s(t.lastPublish==null?e.$t("service.unPublish"):e.getDateOffsetText(t.lastPublish)),1)]),t.user!=null&&e.userInfo.id===t.user.id?(i(),c("ul",te,[a("li",null,[t.type==="MAIN"?(i(),h(d,{key:0,onClick:S=>r.openSettings(t)},{default:g(()=>[_(s(e.$t("service.serviceSettings")),1)]),_:2},1032,["onClick"])):(i(),h(d,{key:1,onClick:S=>r.openSettings(t)},{default:g(()=>[_(s(e.$t("plugin.settings")),1)]),_:2},1032,["onClick"]))]),a("li",null,[m(d,{text:"",type:"danger",onClick:S=>r.deleteService(t)},{default:g(()=>[_(s(e.$t("common.delete")),1)]),_:2},1032,["onClick"])])])):y("",!0)]))),128))])):(i(),h(C,{key:1,description:e.$t("service.noServices")},null,8,["description"])),m(k,{pagination:l.pagination,onCurrentChange:r.handleCurrentChange,onSizeChange:r.handleSizeChange},null,8,["pagination","onCurrentChange","onSizeChange"])])),[[b,l.loading]])])])}const re=$(O,[["render",ae],["__scopeId","data-v-2631c567"]]);export{re as default};