mirror of
https://github.com/rubickCenter/rubick
synced 2025-07-17 12:47:33 +08:00
✨ 适配超级面板
This commit is contained in:
parent
b3a00c88ad
commit
1ee379b288
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { reactive, ref } from "vue";
|
import { reactive, ref } from "vue";
|
||||||
|
import { message } from "ant-design-vue";
|
||||||
|
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
const formState = reactive({
|
const formState = reactive({
|
||||||
@ -45,6 +46,7 @@ const downloadPlugin = async (pluginName) => {
|
|||||||
name: pluginName,
|
name: pluginName,
|
||||||
isDev: true,
|
isDev: true,
|
||||||
});
|
});
|
||||||
|
message.success(`${pluginName}安装成功!`);
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -6,8 +6,9 @@
|
|||||||
<div class="container" v-else>
|
<div class="container" v-else>
|
||||||
<div class="installed-list">
|
<div class="installed-list">
|
||||||
<div
|
<div
|
||||||
:class="currentSelect === index ? 'item active' : 'item'"
|
:class="currentSelect[0] === index ? 'item active' : 'item'"
|
||||||
:key="index"
|
:key="index"
|
||||||
|
@click="currentSelect = [index]"
|
||||||
v-for="(plugin, index) in localPlugins"
|
v-for="(plugin, index) in localPlugins"
|
||||||
>
|
>
|
||||||
<img :src="plugin.logo" />
|
<img :src="plugin.logo" />
|
||||||
@ -101,7 +102,7 @@ const localPlugins = computed(() =>
|
|||||||
);
|
);
|
||||||
const updateLocalPlugin = () => store.dispatch("updateLocalPlugin");
|
const updateLocalPlugin = () => store.dispatch("updateLocalPlugin");
|
||||||
|
|
||||||
const currentSelect = ref(0);
|
const currentSelect = ref([0]);
|
||||||
|
|
||||||
const pluginDetail = computed(() => {
|
const pluginDetail = computed(() => {
|
||||||
return localPlugins.value[currentSelect.value] || {};
|
return localPlugins.value[currentSelect.value] || {};
|
||||||
|
@ -81,10 +81,12 @@ const newList = computed(() => {
|
|||||||
<style lang="less">
|
<style lang="less">
|
||||||
.finder {
|
.finder {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100vh;
|
height: 100%;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
&::-webkit-scrollbar {
|
||||||
|
width: 0;
|
||||||
|
}
|
||||||
.ant-carousel .slick-slide {
|
.ant-carousel .slick-slide {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
height: 235px;
|
height: 235px;
|
||||||
|
@ -78,6 +78,7 @@ import {
|
|||||||
|
|
||||||
import { defineProps, ref } from "vue";
|
import { defineProps, ref } from "vue";
|
||||||
import { useStore } from "vuex";
|
import { useStore } from "vuex";
|
||||||
|
import { message } from "ant-design-vue";
|
||||||
|
|
||||||
const store = useStore();
|
const store = useStore();
|
||||||
|
|
||||||
@ -95,6 +96,7 @@ defineProps({
|
|||||||
const downloadPlugin = async (plugin) => {
|
const downloadPlugin = async (plugin) => {
|
||||||
startDownload(plugin.name);
|
startDownload(plugin.name);
|
||||||
await window.market.downloadPlugin(plugin);
|
await window.market.downloadPlugin(plugin);
|
||||||
|
message.success(`${plugin.name}安装成功!`);
|
||||||
successDownload(plugin.name);
|
successDownload(plugin.name);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ const pluginInstance = new PluginHandler({
|
|||||||
global.LOCAL_PLUGINS = {
|
global.LOCAL_PLUGINS = {
|
||||||
PLUGINS: [],
|
PLUGINS: [],
|
||||||
async downloadPlugin(plugin) {
|
async downloadPlugin(plugin) {
|
||||||
console.log(plugin);
|
|
||||||
await pluginInstance.install([plugin.name], { isDev: plugin.isDev });
|
await pluginInstance.install([plugin.name], { isDev: plugin.isDev });
|
||||||
if (plugin.isDev) {
|
if (plugin.isDev) {
|
||||||
// 获取 dev 插件信息
|
// 获取 dev 插件信息
|
||||||
@ -30,7 +29,6 @@ global.LOCAL_PLUGINS = {
|
|||||||
...pluginInfo,
|
...pluginInfo,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
console.log(plugin);
|
|
||||||
global.LOCAL_PLUGINS.addPlugin(plugin);
|
global.LOCAL_PLUGINS.addPlugin(plugin);
|
||||||
return global.LOCAL_PLUGINS.PLUGINS;
|
return global.LOCAL_PLUGINS.PLUGINS;
|
||||||
},
|
},
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { BrowserView, BrowserWindow, session } from "electron";
|
import { BrowserView, BrowserWindow, session } from "electron";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import commonConst from "../../common/utils/commonConst";
|
import commonConst from "../../common/utils/commonConst";
|
||||||
|
import { PLUGIN_INSTALL_DIR as baseDir } from "@/common/constans/main";
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
let view;
|
let view;
|
||||||
@ -12,10 +13,19 @@ export default () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const createView = (plugin, window: BrowserWindow) => {
|
const createView = (plugin, window: BrowserWindow) => {
|
||||||
|
let pluginIndexPath = plugin.indexPath;
|
||||||
|
if (!pluginIndexPath) {
|
||||||
|
const pluginPath = path.resolve(baseDir, "node_modules", plugin.name);
|
||||||
|
pluginIndexPath = `file://${path.join(pluginPath, "./", plugin.main)}`;
|
||||||
|
}
|
||||||
const preload =
|
const preload =
|
||||||
commonConst.dev() && plugin.name === "rubick-system-feature"
|
commonConst.dev() && plugin.name === "rubick-system-feature"
|
||||||
? path.resolve(__static, `../feature/public/preload.js`)
|
? path.resolve(__static, `../feature/public/preload.js`)
|
||||||
: path.resolve(plugin.indexPath.replace("file:", ""), `../`, plugin.preload);
|
: path.resolve(
|
||||||
|
pluginIndexPath.replace("file:", ""),
|
||||||
|
`../`,
|
||||||
|
plugin.preload
|
||||||
|
);
|
||||||
|
|
||||||
const ses = session.fromPartition("<" + plugin.name + ">");
|
const ses = session.fromPartition("<" + plugin.name + ">");
|
||||||
ses.setPreloads([`${__static}/preload.js`]);
|
ses.setPreloads([`${__static}/preload.js`]);
|
||||||
@ -33,7 +43,7 @@ export default () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
window.setBrowserView(view);
|
window.setBrowserView(view);
|
||||||
view.webContents.loadURL(plugin.indexPath);
|
view.webContents.loadURL(pluginIndexPath);
|
||||||
window.once("ready-to-show", () => {
|
window.once("ready-to-show", () => {
|
||||||
view.setBounds({ x: 0, y: 60, width: 800, height: 600 });
|
view.setBounds({ x: 0, y: 60, width: 800, height: 600 });
|
||||||
view.setAutoResize({ width: true });
|
view.setAutoResize({ width: true });
|
||||||
|
@ -26,6 +26,11 @@ const API: any = {
|
|||||||
runnerInstance.removeView(window);
|
runnerInstance.removeView(window);
|
||||||
runnerInstance.init(plugin, window);
|
runnerInstance.init(plugin, window);
|
||||||
API.currentPlugin = plugin;
|
API.currentPlugin = plugin;
|
||||||
|
window.webContents.executeJavaScript(
|
||||||
|
`window.setCurrentPlugin(${JSON.stringify({
|
||||||
|
currentPlugin: API.currentPlugin,
|
||||||
|
})})`
|
||||||
|
);
|
||||||
},
|
},
|
||||||
removePlugin(e, window) {
|
removePlugin(e, window) {
|
||||||
API.currentPlugin = null;
|
API.currentPlugin = null;
|
||||||
|
@ -86,7 +86,6 @@ const openMenu = () => {
|
|||||||
|
|
||||||
const choosePlugin = () => {
|
const choosePlugin = () => {
|
||||||
const currentChoose = options.value[currentSelect.value];
|
const currentChoose = options.value[currentSelect.value];
|
||||||
console.log(currentChoose);
|
|
||||||
currentChoose.click();
|
currentChoose.click();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
@ -83,6 +83,12 @@ const createPluginManager = (): any => {
|
|||||||
remote.getGlobal("LOCAL_PLUGINS").updatePlugin(currentPlugin);
|
remote.getGlobal("LOCAL_PLUGINS").updatePlugin(currentPlugin);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
window.setCurrentPlugin = ({ currentPlugin }) => {
|
||||||
|
console.log(currentPlugin);
|
||||||
|
state.currentPlugin = currentPlugin;
|
||||||
|
setSearchValue("");
|
||||||
|
};
|
||||||
|
|
||||||
window.initRubick = () => {
|
window.initRubick = () => {
|
||||||
state.currentPlugin = {};
|
state.currentPlugin = {};
|
||||||
setSearchValue("");
|
setSearchValue("");
|
||||||
|
1
src/renderer/shims-vue.d.ts
vendored
1
src/renderer/shims-vue.d.ts
vendored
@ -19,4 +19,5 @@ interface Window {
|
|||||||
removeSubInput: () => void;
|
removeSubInput: () => void;
|
||||||
updatePlugin: (plugin: any) => void;
|
updatePlugin: (plugin: any) => void;
|
||||||
initRubick: () => void;
|
initRubick: () => void;
|
||||||
|
setCurrentPlugin: (plugin: any) => void;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user