操作优化
This commit is contained in:
parent
953749867b
commit
b07ff2e2f1
|
|
@ -65,7 +65,7 @@
|
|||
height: 0;
|
||||
|
||||
.userVideoContentListItem {
|
||||
height: 13%;
|
||||
height: 24%;
|
||||
width: calc(100% / 3 - 8px);
|
||||
padding: 4px;
|
||||
|
||||
|
|
|
|||
|
|
@ -79,43 +79,36 @@ const User: React.FC = () => {
|
|||
}
|
||||
const fileUpLoad = async (data: { url: string, content: string, fileName: string }): Promise<void> => {
|
||||
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: <ExclamationCircleFilled />,
|
||||
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: <ExclamationCircleFilled />,
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue