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 return arg
}, },
setExpendHeight({height}, mainWindow) { setExpendHeight({height}, mainWindow) {
mainWindow.setSize(788, height || 60); mainWindow.setSize(800, height || 60);
}, },
db: { db: {
put({data}) { put({data}) {

View File

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

View File

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

View File

@ -44,8 +44,8 @@ function mkdirFolder(name) {
}); });
} }
function downloadFunc(downloadRepoUrl, name, gitUrl) { function downloadFunc(downloadRepoUrl, name) {
const targetGit = gitUrl ? gitUrl : `github:clouDr-f2e/${name}`; const targetGit = downloadRepoUrl ? downloadRepoUrl : `github:clouDr-f2e/${name}`;
const plugin_path = path.join(__static, './plugins'); const plugin_path = path.join(__static, './plugins');
return new Promise(async (resolve, reject) => { 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 { export {
getWindowHeight, getWindowHeight,
searchKeyValues, searchKeyValues,
downloadFunc, downloadFunc,
sysFile, sysFile,
mergePlugins, mergePlugins,
find,
} }

View File

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

View File

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

View File

@ -6,6 +6,7 @@ import {
downloadFunc, downloadFunc,
sysFile, sysFile,
mergePlugins, mergePlugins,
find,
} from '../../assets/common/utils'; } from '../../assets/common/utils';
import systemMethod from '../../assets/common/system'; import systemMethod from '../../assets/common/system';
import fs from "fs"; import fs from "fs";
@ -198,7 +199,7 @@ const actions = {
}, },
async downloadPlugin({commit}, payload) { async downloadPlugin({commit}, payload) {
await downloadFunc(payload.gitUrl, payload.name); 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 config = JSON.parse(fs.readFileSync(`${fileUrl}/plugin.json`, 'utf-8'));
const pluginConfig = { const pluginConfig = {