diff --git a/src/apis/plugin.js b/src/apis/plugin.js
index 645f22f..eda0d5c 100644
--- a/src/apis/plugin.js
+++ b/src/apis/plugin.js
@@ -8,8 +8,14 @@ const plugin = `${apiUrl}/gateway/opt/plugin`;
// 查询插件列表
export const queryPlugins = params => http.post(`${plugin}/query`, params);
+// 获取一个随机id
+export const randomId = params => http.post(`${plugin}/randomId`, params);
+
// 创建插件
export const savePlugin = params => http.post(`${plugin}/save`, params);
// 修改插件信息
export const updatePlugin = params => http.post(`${plugin}/update`, params);
+
+// 删除插件
+export const delPlugin = params => http.post(`${plugin}/del`, params);
diff --git a/src/components/leftMenu.vue b/src/components/leftMenu.vue
index a1d561a..85a4f5e 100644
--- a/src/components/leftMenu.vue
+++ b/src/components/leftMenu.vue
@@ -21,7 +21,7 @@ const data = reactive({
{ title: '创建业务', name: 'desk-add-business', disabled: false },
{ title: '创建插件', name: 'desk-add-plugin', disabled: false },
{ title: '我的业务', name: 'desk-business-list', disabled: false },
- { title: '我的插件', name: 'desk-plugin-list', disabled: true },
+ { title: '我的插件', name: 'desk-plugin-list', disabled: false },
],
});
diff --git a/src/components/listTable.vue b/src/components/listTable.vue
index e5dfadb..1027208 100644
--- a/src/components/listTable.vue
+++ b/src/components/listTable.vue
@@ -1,7 +1,7 @@
-
+
diff --git a/src/components/plugin.vue b/src/components/plugin.vue
index 4a9b96a..be88c99 100644
--- a/src/components/plugin.vue
+++ b/src/components/plugin.vue
@@ -20,7 +20,6 @@ setPlugin();
// 获取插件信息
function setPlugin() {
- console.log('props.plugin: ', props.plugin);
let id = '';
if (props.plugin) {
if (props.plugin.id) {
@@ -30,7 +29,10 @@ function setPlugin() {
id = props.plugin.pluginId;
}
}
- if (!props.plugin || !id) return;
+ if (!props.plugin || !id) {
+ previewAddPlugin();
+ return;
+ }
const reg = /data-root=["|']?(\w+)["|']?/gi;
let uuid = '';
// FIXME: 没有兼容 只有js, 没有html的情况
@@ -65,4 +67,19 @@ function handleDom(js, id) {
}
// 没有id
+function previewAddPlugin() {
+ console.log('props.plugin: ', props.plugin);
+ // FIXME: 没有兼容 只有js, 没有html的情况
+ if (props.plugin.html) {
+ // 查有没有data-root=“xxx” 有的话 将xxx替换为 pluginTaskId
+ data.pluginContent = props.plugin.html;
+ const scriptDom = document.createElement('script');
+ scriptDom.setAttribute('data-type', 'plugin');
+ scriptDom.innerHTML = props.plugin.js;
+ console.log('scriptDom: ', scriptDom);
+ nextTick(() => {
+ document.body.append(scriptDom);
+ });
+ }
+}
diff --git a/src/components/pluginListTable.vue b/src/components/pluginListTable.vue
new file mode 100644
index 0000000..d820871
--- /dev/null
+++ b/src/components/pluginListTable.vue
@@ -0,0 +1,113 @@
+
+
+
+
+
+
+
+
+
+
{{ scope.row.startUsing ? '启动' : '禁用' }}
+
+
+
+
+
+
+
+
{{ scope.row.pub ? '公开' : '非公开' }}
+
+
+
+
+
+
+
+
+
+ 删除
+
+
+ 配置..
+ 查看
+
+
+
+ 没有记录哦~
+
+
+
+
+
+
+
+
+
diff --git a/src/views/index-list/add-plugin.vue b/src/views/index-list/add-plugin.vue
index fcdacf1..19087b1 100644
--- a/src/views/index-list/add-plugin.vue
+++ b/src/views/index-list/add-plugin.vue
@@ -2,6 +2,13 @@
上传插件
+
+
+ {{ form.id }}
+
+
+ 点击生成插件id
+
@@ -86,29 +93,34 @@
发布
重置
-
+
diff --git a/src/views/index-list/business-detail.vue b/src/views/index-list/business-detail.vue
index 95ba8d5..8ca079d 100644
--- a/src/views/index-list/business-detail.vue
+++ b/src/views/index-list/business-detail.vue
@@ -96,8 +96,6 @@ async function copy(Msg) {
// 复制
await toClipboard(Msg);
ElMessage.success('复制成功');
- // 下面可以设置复制成功的提示框等操作
- // ...
} catch (e) {
// 复制失败
console.error(e);
diff --git a/src/views/index-list/business-list.vue b/src/views/index-list/business-list.vue
index db454fe..e1df6e2 100644
--- a/src/views/index-list/business-list.vue
+++ b/src/views/index-list/business-list.vue
@@ -24,11 +24,6 @@ import { queryBusiness } from '@/apis/business.js';
const router = useRouter();
const store = useStore();
-function openPage() {
- router.push({ name: 'desk-add-business' });
- store.commit('plugin/setLeftIndex', 1);
-}
-
const data = reactive({
lists: [],
currentPage: 1,
@@ -36,6 +31,11 @@ const data = reactive({
total: 0,
});
+function openPage() {
+ router.push({ name: 'desk-add-business' });
+ store.commit('plugin/setLeftIndex', 1);
+}
+
function handleSizeChange(val) {
data.pageSize = val;
handleQueryBusiness();
diff --git a/src/views/index-list/plugin-list.vue b/src/views/index-list/plugin-list.vue
index aea2a3a..1516cc4 100644
--- a/src/views/index-list/plugin-list.vue
+++ b/src/views/index-list/plugin-list.vue
@@ -4,21 +4,79 @@
创建插件
-
+
+
diff --git a/src/views/index-list/plugin-shop.vue b/src/views/index-list/plugin-shop.vue
index c110818..ec55491 100644
--- a/src/views/index-list/plugin-shop.vue
+++ b/src/views/index-list/plugin-shop.vue
@@ -34,6 +34,7 @@ function handleCurrentChange(val) {
/**
* 查询插件列表
* @param {number} depth 查询深度 0则只查名称,1则查询全部
+ * @param {number} mine 查询全部插件还是自己的插件 0全部 1自己
* @param {number} name 插件名称,为空则不实用该条件
* @param {number} pageNum 第几页
* @param {number} pageSize 每页几条信息
@@ -44,6 +45,7 @@ async function handleQueryPlugins() {
const params = {
param: {
depth: 1,
+ mine: 0,
name: '',
pageNum: currentPage,
pageSize,