From 0d6872d12b3fb4868e3e7f2e6c6757aaf8addaea Mon Sep 17 00:00:00 2001 From: muwoo <2424880409@qq.com> Date: Mon, 21 Jun 2021 10:23:04 +0800 Subject: [PATCH] =?UTF-8?q?ref:=20=E5=8A=9F=E8=83=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/common/api.js | 2 +- src/main/common/common.js | 2 +- src/main/index.js | 2 +- src/renderer/assets/common/utils.js | 28 +++++++++++++++++-- src/renderer/pages/search/index.vue | 2 +- src/renderer/pages/search/subpages/market.vue | 8 +++++- src/renderer/store/modules/main.js | 3 +- 7 files changed, 39 insertions(+), 8 deletions(-) diff --git a/src/main/common/api.js b/src/main/common/api.js index e500634..231e456 100644 --- a/src/main/common/api.js +++ b/src/main/common/api.js @@ -32,7 +32,7 @@ export default { return arg }, setExpendHeight({height}, mainWindow) { - mainWindow.setSize(788, height || 60); + mainWindow.setSize(800, height || 60); }, db: { put({data}) { diff --git a/src/main/common/common.js b/src/main/common/common.js index 4add339..15a6dc3 100644 --- a/src/main/common/common.js +++ b/src/main/common/common.js @@ -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', () => { diff --git a/src/main/index.js b/src/main/index.js index ec29a51..a29bd62 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -22,7 +22,7 @@ function createWindow () { mainWindow = new BrowserWindow({ height: 60, useContentSize: true, - width: 788, + width: 800, frame: false, title: '拉比克', webPreferences: { diff --git a/src/renderer/assets/common/utils.js b/src/renderer/assets/common/utils.js index 1238e95..71316a2 100644 --- a/src/renderer/assets/common/utils.js +++ b/src/renderer/assets/common/utils.js @@ -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, } diff --git a/src/renderer/pages/search/index.vue b/src/renderer/pages/search/index.vue index c83a42e..e19f8e3 100644 --- a/src/renderer/pages/search/index.vue +++ b/src/renderer/pages/search/index.vue @@ -15,7 +15,7 @@ 开发者 - + 设置 diff --git a/src/renderer/pages/search/subpages/market.vue b/src/renderer/pages/search/subpages/market.vue index def2a7a..3677da0 100644 --- a/src/renderer/pages/search/subpages/market.vue +++ b/src/renderer/pages/search/subpages/market.vue @@ -31,7 +31,7 @@
{{ item.pluginName }}
@@ -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; + } } diff --git a/src/renderer/store/modules/main.js b/src/renderer/store/modules/main.js index ea18a56..1b58452 100644 --- a/src/renderer/store/modules/main.js +++ b/src/renderer/store/modules/main.js @@ -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 = {