插件中心更新

This commit is contained in:
技术老胡
2024-12-02 16:54:58 +08:00
parent 860a87b20c
commit af607036a5
3 changed files with 63 additions and 14 deletions

View File

@@ -101,11 +101,18 @@
table.on('tool(plugin-table)', function (obj) {
const id = obj.data.id;
if (obj.event === 'pluginInstall') {
layer.msg(obj.event);
layer.msg('功能开发中,有需要请联系作者');
} else if (obj.event === 'pluginUpdate') {
layer.msg(obj.event);
layer.msg('功能开发中,有需要请联系作者');
} else if (obj.event === 'pluginUninstall') {
layer.msg(obj.event);
layer.confirm('卸载之后无法恢复,确认吗?', { icon: 3, title: '卸载插件' }, function (index) {
layer.close(index);
config = {
platform: obj.data.platform,
classname: obj.data.class_name
}
plugin.uninstall(config);
});
}
});
// 启用状态
@@ -146,6 +153,20 @@
layer.msg(rec_info.msg, { icon: 2, time: 1200 }, () => { obj.elem.checked = !obj.elem.checked });
}
}
// 卸载插件
plugin.uninstall = async (config) => {
const res = await fetch('/api/Plugin/uninstallPlugin', { method: 'post', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(config) });
if (res.status !== 200) {
layer.msg('请求失败,请重试!', { tips: 2, time: 1200 });
return false;
}
const rec_info = await res.json();
if (rec_info.code === 0) {
layer.msg(rec_info.msg, { icon: 1, time: 1200 }, () => { table.reload('plugin-table'); });
} else {
layer.msg(rec_info.msg, { icon: 2, time: 1200 });
}
}
});
</script>
</body>