From b07ff2e2f1e4e4f8e87927b182c4be3861f8e565 Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Mon, 9 Sep 2024 13:38:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=93=8D=E4=BD=9C=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/UserVideo/index.module.scss | 2 +- src/page/Home/User/index.tsx | 63 ++++++++++------------ 2 files changed, 29 insertions(+), 36 deletions(-) diff --git a/src/components/UserVideo/index.module.scss b/src/components/UserVideo/index.module.scss index b1d7b15..c08ae26 100644 --- a/src/components/UserVideo/index.module.scss +++ b/src/components/UserVideo/index.module.scss @@ -65,7 +65,7 @@ height: 0; .userVideoContentListItem { - height: 13%; + height: 24%; width: calc(100% / 3 - 8px); padding: 4px; diff --git a/src/page/Home/User/index.tsx b/src/page/Home/User/index.tsx index a48a247..0818734 100644 --- a/src/page/Home/User/index.tsx +++ b/src/page/Home/User/index.tsx @@ -79,43 +79,36 @@ const User: React.FC = () => { } const fileUpLoad = async (data: { url: string, content: string, fileName: string }): Promise => { const setting = await JSON.parse(storage.getItem('setting') as string) - if (setting.isShareSavePath) { - window.electron.selectFilePath({ - fileName: data.fileName, - filePath: data.url - }) - } else { - try { - const response = await fetch(data.url); - const arrayBuffer = await response.arrayBuffer(); - const buffer = Buffer.from(arrayBuffer); - await fs.writeFile(`${setting.shareFilesPath}\\${data.fileName}`, buffer, {}); - setChangeImportModal(false) - confirm({ - title: '提示', - icon: , - content: data.content, - centered: true, - okText: '打开文件夹', - cancelText: '关闭', - async onOk() { - await fs.access(setting.shareFilesPath, fs.constants.F_OK); - if (process.platform === 'win32') { - exec(`explorer "${setting.shareFilesPath}"`); - } else if (process.platform === 'darwin') { - exec(`open "${setting.shareFilesPath}"`); - } - }, - onCancel() { + try { + const response = await fetch(data.url); + const arrayBuffer = await response.arrayBuffer(); + const buffer = Buffer.from(arrayBuffer); + await fs.writeFile(`${setting.shareFilesPath}\\${data.fileName}`, buffer, {}); + setChangeImportModal(false) + confirm({ + title: '提示', + icon: , + content: data.content, + centered: true, + okText: '打开文件夹', + cancelText: '关闭', + async onOk() { + await fs.access(setting.shareFilesPath, fs.constants.F_OK); + if (process.platform === 'win32') { + exec(`explorer "${setting.shareFilesPath}"`); + } else if (process.platform === 'darwin') { + exec(`open "${setting.shareFilesPath}"`); } - }) - } catch (error: any) { - if (error.code === 'ENOENT') { - message.error('文件夹不存在!') - return - } else { - message.error(error) + }, + onCancel() { } + }) + } catch (error: any) { + if (error.code === 'ENOENT') { + message.error('文件夹不存在!') + return + } else { + message.error(error) } } }