Compare commits

..

No commits in common. "3cfbd0da62fcdee4cd0d397013b47e16c46bcc9a" and "7b61a073bd8fa9367940c6b548c0b6f70e132b6c" have entirely different histories.

2 changed files with 544 additions and 559 deletions

View File

@ -138,7 +138,7 @@ app.on('ready', () => {
// 获取当前脚本所在目录的绝对路径
const currentDirectory = __dirname;
// 获取安装父目录
const parentDirectory = path.resolve(currentDirectory, '..');
const parentDirectory = path.resolve(currentDirectory, '../..');
const customFolderPath = path.join(parentDirectory, 'Downloads');
if (!fs.existsSync(customFolderPath)) {
// 如果不存在,则创建文件夹

View File

@ -1,14 +1,13 @@
import styles from '@/components/StupWizard/index.module.scss'
import ImageUrl from '@/utils/package/ImageUrl';
import {Button, Checkbox, Empty, Input, message, Modal, Popover, Radio, Select, Slider} from 'antd';
import {forwardRef, useEffect, useImperativeHandle, useState} from "react";
import { Button, Checkbox, Empty, Input, Modal, Popover, Radio, Select, Slider, message } from 'antd';
import { useState, useImperativeHandle, forwardRef, useEffect } from "react";
import agora from '@/utils/package/agora'
import {CloseOutlined, LoadingOutlined, QuestionCircleOutlined} from '@ant-design/icons';
import {storage} from '@/utils';
import { CloseOutlined, LoadingOutlined, QuestionCircleOutlined } from '@ant-design/icons';
import { storage } from '@/utils';
import path from 'path';
const fs = require('fs').promises;
const {exec} = require('child_process');
const { exec } = require('child_process');
const StupWizard = forwardRef((props: any, ref: any) => {
useImperativeHandle(ref, () => ({
changeModal: () => {
@ -74,7 +73,7 @@ const StupWizard = forwardRef((props: any, ref: any) => {
agora.stopPlaybackDeviceTest()
agora.stopRecordingDeviceTest()
}}>
<img src={row.active ? row.iconActive : row.icon} alt=""/>
<img src={row.active ? row.iconActive : row.icon} alt="" />
<span>{row.title}</span>
</div>
)
@ -95,11 +94,11 @@ const StupWizard = forwardRef((props: any, ref: any) => {
setIsStupWizard(false)
}}
/>
{list[0].active ? <CurrencyComponents/> : null}
{list[1].active ? <VideoComponents/> : null}
{list[2].active ? <AudioComponents/> : null}
{list[3].active ? <RecordingComponents/> : null}
{list[4].active ? <FileComponents/> : null}
{list[0].active ? <CurrencyComponents /> : null}
{list[1].active ? <VideoComponents /> : null}
{list[2].active ? <AudioComponents /> : null}
{list[3].active ? <RecordingComponents /> : null}
{list[4].active ? <FileComponents /> : null}
</div>
</div>
</Modal>
@ -124,7 +123,7 @@ const CurrencyComponents = () => {
setting.closeSetting = e.target.value;
storage.setItem('setting', JSON.stringify(setting))
setOperationValue(e.target.value)
}} style={{flexShrink: 0, margin: '10px 0'}} value={optionsValue}>
}} style={{ flexShrink: 0, margin: '10px 0' }} value={optionsValue}>
<Radio value={'quit'}>退</Radio>
<Radio value={'hide'}>退</Radio>
</Radio.Group>
@ -147,7 +146,7 @@ const VideoComponents = () => {
const getVideoDeviceList = async (): Promise<void> => {
const userInfo = JSON.parse(storage.getItem('user') as string)
agora.getVideoDeviceManager().then(async (res) => {
const {item, list} = res
const { item, list } = res
if ((!setting.videoDeviceId && item) || (!(list.find((item: any) => item.deviceId === setting.videoDeviceId)) && item)) {
setting.videoDeviceId = item
}
@ -185,12 +184,12 @@ const VideoComponents = () => {
right: '50%',
fontSize: '30px',
top: '50%',
}}/>
}} />
</div>
</div> :
<div>
<div style={{display: 'flex', justifyContent: 'center', alignItems: 'center'}}>
<Empty description={'未检测到摄像头'}/>
<div style={{ display: 'flex', justifyContent: 'center', alignItems: 'center' }}>
<Empty description={'未检测到摄像头'} />
</div>
</div>
}
@ -211,11 +210,11 @@ const VideoComponents = () => {
color: 'white',
cursor: 'pointer',
marginRight: '10px'
}}/>
}} />
</Popover>
<Select
placeholder={videoDeviceManager.list.length ? '请选择设备' : '未检测到摄像头'}
options={videoDeviceManager.list} style={{flexGrow: 1, marginRight: '10px'}}
options={videoDeviceManager.list} style={{ flexGrow: 1, marginRight: '10px' }}
value={videoDeviceManager.item} onChange={async (e) => {
setting.videoDeviceId = e;
storage.setItem('setting', JSON.stringify(setting))
@ -224,7 +223,7 @@ const VideoComponents = () => {
item: e
})
agora.setVideoDeviceManager(e)
}}/>
}} />
</div>
</div>
@ -257,13 +256,7 @@ const AudioComponents = () => {
})
}, []);
const getAudioMediaList = async (): Promise<void> => {
const {
playBackList,
ecordingList,
playBackItem,
ecordingItem,
ecordingVolume
} = await agora.getAudioMediaList();
const { playBackList, ecordingList, playBackItem, ecordingItem, ecordingVolume } = await agora.getAudioMediaList();
if ((!setting.ecordingDeviceId && ecordingItem.deviceId) || (!(ecordingList.find((item: any) => item.deviceId === setting.ecordingDeviceId)) && ecordingItem.deviceId)) {
setting.ecordingDeviceId = ecordingItem.deviceId
}
@ -314,7 +307,7 @@ const AudioComponents = () => {
<span></span>
<Select
placeholder={audioDeviceManager.ecordingList.length ? '请选择设备' : '未检测到麦克风'}
options={audioDeviceManager.ecordingList} style={{flexGrow: 1}}
options={audioDeviceManager.ecordingList} style={{ flexGrow: 1 }}
value={audioDeviceManager.ecordingItem} onChange={async (e) => {
setting.ecordingDeviceId = e;
storage.setItem('setting', JSON.stringify(setting))
@ -323,7 +316,7 @@ const AudioComponents = () => {
ecordingItem: e
})
agora.setRecordingDevice(e)
}}/>;
}} />;
{audioDeviceManager.ecordingActive ? <div onClick={() => {
agora.stopRecordingDeviceTest()
setAudioDeviceManager({
@ -342,18 +335,17 @@ const AudioComponents = () => {
}}></div>}
</div>
{audioDeviceManager.ecordingActive ? <div className={styles.audioComponentsVolume}>
<img src={ImageUrl.icon36} alt=""/>
<img src={ImageUrl.icon36} alt="" />
<div>
<img src={ImageUrl.icon34} alt=""/>
<img src={ImageUrl.icon34} alt="" />
<div id='deviceTest'>
<img src={ImageUrl.icon35} alt=""/>
<img src={ImageUrl.icon35} alt="" />
</div>
</div>
</div> : null}
<div className={styles.audioComponentsSlider}>
<span></span>
<Slider value={audioDeviceManager.ecordingVolume} style={{flexGrow: 1}} max={255}
onChange={async (e) => {
<Slider value={audioDeviceManager.ecordingVolume} style={{ flexGrow: 1 }} max={255} onChange={async (e) => {
setting.ecordingVolume = e;
storage.setItem('setting', JSON.stringify(setting))
await agora.setRecordingDeviceVolume(e)
@ -361,7 +353,7 @@ const AudioComponents = () => {
...audioDeviceManager,
ecordingVolume: e,
})
}} disabled={!audioDeviceManager.ecordingItem}/>
}} disabled={!audioDeviceManager.ecordingItem} />
</div>
<div>
<Checkbox onChange={async (e) => {
@ -379,7 +371,7 @@ const AudioComponents = () => {
<span></span>
<Select
placeholder={audioDeviceManager.playBackList.length ? '请选择设备' : '未检测到麦克风'}
options={audioDeviceManager.playBackList} style={{flexGrow: 1}}
options={audioDeviceManager.playBackList} style={{ flexGrow: 1 }}
value={audioDeviceManager.playBackItem} onChange={async (e) => {
setting.playBackDeviceId = e;
storage.setItem('setting', JSON.stringify(setting))
@ -388,7 +380,7 @@ const AudioComponents = () => {
playBackItem: e
})
agora.setPlaybackDevice(e)
}}/>;
}} />;
{audioDeviceManager.playBackActive ? <div onClick={() => {
agora.stopPlaybackDeviceTest()
setAudioDeviceManager({
@ -407,18 +399,17 @@ const AudioComponents = () => {
}}></div>}
</div>
{audioDeviceManager.playBackActive ? <div className={styles.audioComponentsVolume}>
<img src={ImageUrl.icon36} alt=""/>
<img src={ImageUrl.icon36} alt="" />
<div>
<img src={ImageUrl.icon34} alt=""/>
<img src={ImageUrl.icon34} alt="" />
<div id='deviceTest'>
<img src={ImageUrl.icon35} alt=""/>
<img src={ImageUrl.icon35} alt="" />
</div>
</div>
</div> : null}
<div className={styles.audioComponentsSlider}>
<span></span>
<Slider value={audioDeviceManager.playBackVolume} style={{flexGrow: 1}} max={255}
onChange={async (e) => {
<Slider value={audioDeviceManager.playBackVolume} style={{ flexGrow: 1 }} max={255} onChange={async (e) => {
setting.playBackVolume = e;
storage.setItem('setting', JSON.stringify(setting))
agora.setPlaybackDeviceVolume(e)
@ -426,7 +417,7 @@ const AudioComponents = () => {
...audioDeviceManager,
playBackVolume: e,
})
}} disabled={!audioDeviceManager.playBackItem}/>
}} disabled={!audioDeviceManager.playBackItem} />
</div>
</div>
</div>
@ -439,10 +430,7 @@ const RecordingComponents = () => {
const setting = JSON.parse(storage.getItem('setting') as string)
useEffect(() => {
if (!setting.recordingFilesPath) {
// 获取安装父目录
const currentDirectory = __dirname;
const parentDirectory = path.resolve(currentDirectory, '../../Downloads');
setting.recordingFilesPath = parentDirectory;
setting.recordingFilesPath = path.dirname(process.execPath) + '\\';
setFilePath(setting.recordingFilesPath)
storage.setItem('setting', JSON.stringify(setting))
} else {
@ -469,7 +457,7 @@ const RecordingComponents = () => {
<Input
disabled={true}
placeholder="请填入文件路径"
style={{margin: '0 14px', flexGrow: 1}}
style={{ margin: '0 14px', flexGrow: 1 }}
value={filePath}
onChange={async (e) => {
setting.recordingFilesPath = e.target.value;
@ -481,7 +469,7 @@ const RecordingComponents = () => {
window.electron.selectFilePath({
key: 'recordingFilesPath',
})
}} style={{backgroundColor: '#31353A', marginRight: '10px'}}></Button>
}} style={{ backgroundColor: '#31353A', marginRight: '10px' }}></Button>
<Button type="primary" onClick={async () => {
try {
await fs.access(filePath, fs.constants.F_OK);
@ -497,7 +485,7 @@ const RecordingComponents = () => {
message.error(error)
}
}
}} style={{backgroundColor: '#31353A'}}></Button>
}} style={{ backgroundColor: '#31353A' }}></Button>
</div>
</div>
</div>
@ -510,10 +498,7 @@ const FileComponents = () => {
const setting = JSON.parse(storage.getItem('setting') as string)
useEffect(() => {
if (!setting.shareFilesPath) {
// 获取安装父目录
const currentDirectory = __dirname;
const parentDirectory = path.resolve(currentDirectory, '../../Downloads');
setting.shareFilesPath = parentDirectory
setting.shareFilesPath = path.dirname(process.execPath) + '\\';
setFilePath(setting.shareFilesPath)
storage.setItem('setting', JSON.stringify(setting))
} else {
@ -541,7 +526,7 @@ const FileComponents = () => {
<Input
disabled={true}
placeholder="请填入保存目录"
style={{margin: '0 14px', flexGrow: 1}}
style={{ margin: '0 14px', flexGrow: 1 }}
value={filePath}
onChange={async (e) => {
setting.shareFilesPath = e.target.value;
@ -553,7 +538,7 @@ const FileComponents = () => {
window.electron.selectFilePath({
key: 'shareFilesPath',
})
}} style={{backgroundColor: '#31353A', marginRight: '10px'}}></Button>
}} style={{ backgroundColor: '#31353A', marginRight: '10px' }}></Button>
<Button type="primary" onClick={async () => {
try {
await fs.access(filePath, fs.constants.F_OK);
@ -569,7 +554,7 @@ const FileComponents = () => {
message.error(error)
}
}
}} style={{backgroundColor: '#31353A'}}></Button>
}} style={{ backgroundColor: '#31353A' }}></Button>
</div>
<div>
<Checkbox onChange={async (e) => {