feat: 增加系统app搜索功能

This commit is contained in:
muwoo
2021-06-28 20:08:54 +08:00
parent 56bf86286c
commit 74f7f3ebdf
4 changed files with 122 additions and 6 deletions

View File

@@ -8,10 +8,12 @@ import {
mergePlugins,
find,
downloadZip,
fileLists,
} from '../../assets/common/utils';
import systemMethod from '../../assets/common/system';
import fs from "fs";
import path from 'path';
import {execSync} from 'child_process';
const state = {
selected: null,
@@ -89,7 +91,7 @@ const actions = {
})
})
},
onSearch ({ commit }, paylpad) {
async onSearch ({ commit }, paylpad) {
if (state.selected && state.selected.key !== 'plugin-container') {
commit('commonUpdate', {searchValue: ''});
return;
@@ -199,6 +201,16 @@ const actions = {
]
})
});
options = [
...options,
...(fileLists.filter(plugin => plugin.name.indexOf(value) >= 0)).map(plugin => {
plugin.click = () => {
console.log(plugin)
actions.openPlugin({commit}, {plugin});
}
return plugin
}),
]
}
commit('commonUpdate', {
@@ -224,6 +236,19 @@ const actions = {
});
},
openPlugin({commit}, {cmd, plugin, feature, router}) {
if (plugin.type === 'app') {
execSync(plugin.action);
commit('commonUpdate', {
selected: null,
showMain: false,
options: [],
searchValue: '',
});
ipcRenderer.send('changeWindowSize-rubick', {
height: getWindowHeight([]),
});
return;
}
commit('commonUpdate', {
selected: {
key: 'plugin-container',