ref: 功能优化

This commit is contained in:
muwoo 2021-06-21 10:23:04 +08:00
parent 3446b294ac
commit 0d6872d12b
7 changed files with 39 additions and 8 deletions

View File

@ -32,7 +32,7 @@ export default {
return arg
},
setExpendHeight({height}, mainWindow) {
mainWindow.setSize(788, height || 60);
mainWindow.setSize(800, height || 60);
},
db: {
put({data}) {

View File

@ -33,7 +33,7 @@ export default function init(mainWindow) {
});
ipcMain.on('changeWindowSize-rubick', (event, arg) => {
mainWindow.setSize(arg.width || 788, arg.height);
mainWindow.setSize(arg.width || 800, arg.height);
});
mainWindow.on('blur', () => {

View File

@ -22,7 +22,7 @@ function createWindow () {
mainWindow = new BrowserWindow({
height: 60,
useContentSize: true,
width: 788,
width: 800,
frame: false,
title: '拉比克',
webPreferences: {

View File

@ -44,8 +44,8 @@ function mkdirFolder(name) {
});
}
function downloadFunc(downloadRepoUrl, name, gitUrl) {
const targetGit = gitUrl ? gitUrl : `github:clouDr-f2e/${name}`;
function downloadFunc(downloadRepoUrl, name) {
const targetGit = downloadRepoUrl ? downloadRepoUrl : `github:clouDr-f2e/${name}`;
const plugin_path = path.join(__static, './plugins');
return new Promise(async (resolve, reject) => {
@ -107,10 +107,34 @@ function mergePlugins(plugins) {
]
}
function find(p) {
try {
let result;
const fileList = fs.readdirSync(p);
for (let i = 0; i < fileList.length; i++) {
let thisPath = p + "/" + fileList[i];
const data = fs.statSync(thisPath);
if (data.isFile() && fileList[i] === 'plugin.json') {
result = path.join(thisPath, '../');
return result;
}
if (data.isDirectory()) {
result = find(thisPath);
}
}
return result;
} catch (e) {
console.log(e);
}
}
export {
getWindowHeight,
searchKeyValues,
downloadFunc,
sysFile,
mergePlugins,
find,
}

View File

@ -15,7 +15,7 @@
开发者
</a-menu-item>
<a-menu-item key="settings">
<a-icon type="settings"/>
<a-icon type="setting"/>
设置
</a-menu-item>
</a-menu>

View File

@ -31,7 +31,7 @@
<div slot="title">{{ item.pluginName }}</div>
<a-avatar
slot="avatar"
src="https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png"
:src="item.logo"
/>
</a-list-item-meta>
</a-list-item>
@ -120,6 +120,12 @@ export default {
align-items: center;
justify-content: space-between;
}
.ant-list-item-meta-description {
width: 200px;
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
}
}
</style>

View File

@ -6,6 +6,7 @@ import {
downloadFunc,
sysFile,
mergePlugins,
find,
} from '../../assets/common/utils';
import systemMethod from '../../assets/common/system';
import fs from "fs";
@ -198,7 +199,7 @@ const actions = {
},
async downloadPlugin({commit}, payload) {
await downloadFunc(payload.gitUrl, payload.name);
const fileUrl = path.join(__static, `plugins/${payload.name}`);
const fileUrl = find(path.join(__static, `plugins/${payload.name}`));
// 复制文件
const config = JSON.parse(fs.readFileSync(`${fileUrl}/plugin.json`, 'utf-8'));
const pluginConfig = {