From a50aa756e5ee0c06f81f0ea3dc1fc6fa21d7a4b8 Mon Sep 17 00:00:00 2001 From: yj <1336058017@qq.com> Date: Tue, 13 Aug 2024 09:36:11 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=96=B0=E5=A2=9E=E9=80=9A?= =?UTF-8?q?=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.tsx | 1 + src/components/StupWizard/index.module.scss | 16 +++++ src/components/StupWizard/index.tsx | 68 ++++++++++++++------- 3 files changed, 63 insertions(+), 22 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index ff0e0e5..bf6df5d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -173,6 +173,7 @@ const App: React.FC = () => { recordingFilesPath: '', //本地录制保存路径 shareFilesPath: '', //共享文件保存路径 isShareSavePath: true, //是否下载钱询问每个文件保存的位置 + closeSetting: 'hide', //关闭按钮设置 })) } }, []) diff --git a/src/components/StupWizard/index.module.scss b/src/components/StupWizard/index.module.scss index e7d3c53..bd57960 100644 --- a/src/components/StupWizard/index.module.scss +++ b/src/components/StupWizard/index.module.scss @@ -209,4 +209,20 @@ white-space: nowrap; } } +} + +.currencyComponents { + >div { + >div { + display: flex; + flex-direction: column; + + >span { + color: #bfbfbf; + font-size: 16px; + } + } + } + + } \ No newline at end of file diff --git a/src/components/StupWizard/index.tsx b/src/components/StupWizard/index.tsx index 18ec7c1..9dbe933 100644 --- a/src/components/StupWizard/index.tsx +++ b/src/components/StupWizard/index.tsx @@ -1,6 +1,6 @@ import styles from '@/components/StupWizard/index.module.scss' import ImageUrl from '@/utils/package/ImageUrl'; -import { Button, Checkbox, Empty, Input, Modal, Popover, Select, Slider, message } from 'antd'; +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'; @@ -19,11 +19,17 @@ const StupWizard = forwardRef((props: any, ref: any) => { })) const [list, setList] = useState([ { - title: '视频', + title: '通用', icon: ImageUrl.icon39, iconActive: ImageUrl.icon39Active, active: true, }, + { + title: '视频', + icon: ImageUrl.icon39, + iconActive: ImageUrl.icon39Active, + active: false, + }, { title: '音频', icon: ImageUrl.icon40, @@ -88,27 +94,56 @@ const StupWizard = forwardRef((props: any, ref: any) => { setIsStupWizard(false) }} /> - {list[0].active ? : null} - {list[1].active ? : null} - {list[2].active ? : null} - {list[3].active ? : null} + {list[0].active ? : null} + {list[1].active ? : null} + {list[2].active ? : null} + {list[3].active ? : null} + {list[4].active ? : null} ) }) - +const CurrencyComponents = () => { + const [optionsValue, setOperationValue] = useState<'hide' | 'quit'>('hide'); + const setting = JSON.parse(storage.getItem('setting') as string) + useEffect(() => { + setOperationValue(setting.closeSetting) + }, []); + return ( + <> +
+ 通用 +
+
+
+ 关闭按钮设置 + { + setting.closeSetting = e.target.value; + storage.setItem('setting', JSON.stringify(setting)) + setOperationValue(e.target.value) + }} style={{ flexShrink: 0, margin: '10px 0' }} value={optionsValue}> + 退出主程序 + 不退出程序,最小化到托盘 + +
+
+
+
+ + ) +} const VideoComponents = () => { const [videoDeviceManager, setVideoDeviceManager] = useState({ list: [], item: null, }); + const setting = JSON.parse(storage.getItem('setting') as string) useEffect(() => { getVideoDeviceList() }, []); const getVideoDeviceList = async (): Promise => { - const setting = await JSON.parse(storage.getItem('setting') as string) const userInfo = JSON.parse(storage.getItem('user') as string) agora.getVideoDeviceManager().then(async (res) => { const { item, list } = res @@ -181,7 +216,6 @@ const VideoComponents = () => { placeholder={videoDeviceManager.list.length ? '请选择设备' : '未检测到摄像头'} options={videoDeviceManager.list} style={{ flexGrow: 1, marginRight: '10px' }} value={videoDeviceManager.item} onChange={async (e) => { - const setting = await JSON.parse(storage.getItem('setting') as string) setting.videoDeviceId = e; storage.setItem('setting', JSON.stringify(setting)) setVideoDeviceManager({ @@ -209,6 +243,7 @@ const AudioComponents = () => { ecordingVolume: 0, autoEcordingVolume: true, }); + const setting = JSON.parse(storage.getItem('setting') as string) useEffect(() => { getAudioMediaList() agora.registerEventHandler({ @@ -222,7 +257,6 @@ const AudioComponents = () => { }, []); const getAudioMediaList = async (): Promise => { const { playBackList, ecordingList, playBackItem, ecordingItem, ecordingVolume } = await agora.getAudioMediaList(); - const setting = await JSON.parse(storage.getItem('setting') as string) if ((!setting.ecordingDeviceId && ecordingItem.deviceId) || (!(ecordingList.find((item: any) => item.deviceId === setting.ecordingDeviceId)) && ecordingItem.deviceId)) { setting.ecordingDeviceId = ecordingItem.deviceId } @@ -275,7 +309,6 @@ const AudioComponents = () => { placeholder={audioDeviceManager.ecordingList.length ? '请选择设备' : '未检测到麦克风'} options={audioDeviceManager.ecordingList} style={{ flexGrow: 1 }} value={audioDeviceManager.ecordingItem} onChange={async (e) => { - const setting = await JSON.parse(storage.getItem('setting') as string) setting.ecordingDeviceId = e; storage.setItem('setting', JSON.stringify(setting)) setAudioDeviceManager({ @@ -313,7 +346,6 @@ const AudioComponents = () => {
输入音量: { - const setting = await JSON.parse(storage.getItem('setting') as string) setting.ecordingVolume = e; storage.setItem('setting', JSON.stringify(setting)) await agora.setRecordingDeviceVolume(e) @@ -325,7 +357,6 @@ const AudioComponents = () => {
{ - const setting = await JSON.parse(storage.getItem('setting') as string) setting.autoEcordingVolume = e.target.checked; storage.setItem('setting', JSON.stringify(setting)) setAudioDeviceManager({ @@ -342,7 +373,6 @@ const AudioComponents = () => { placeholder={audioDeviceManager.playBackList.length ? '请选择设备' : '未检测到麦克风'} options={audioDeviceManager.playBackList} style={{ flexGrow: 1 }} value={audioDeviceManager.playBackItem} onChange={async (e) => { - const setting = await JSON.parse(storage.getItem('setting') as string) setting.playBackDeviceId = e; storage.setItem('setting', JSON.stringify(setting)) setAudioDeviceManager({ @@ -380,7 +410,6 @@ const AudioComponents = () => {
输出音量: { - const setting = await JSON.parse(storage.getItem('setting') as string) setting.playBackVolume = e; storage.setItem('setting', JSON.stringify(setting)) agora.setPlaybackDeviceVolume(e) @@ -398,8 +427,8 @@ const AudioComponents = () => { } const RecordingComponents = () => { const [filePath, setFilePath] = useState('') + const setting = JSON.parse(storage.getItem('setting') as string) useEffect(() => { - const setting = JSON.parse(storage.getItem('setting') as string) if (!setting.recordingFilesPath) { setting.recordingFilesPath = path.dirname(process.execPath) + '\\'; setFilePath(setting.recordingFilesPath) @@ -414,7 +443,6 @@ const RecordingComponents = () => { }, []) const handleCustomStorageChange = (e: any): void => { if (e.key === 'setting') { - const setting = JSON.parse(storage.getItem('setting') as string) setFilePath(setting.recordingFilesPath) } }; @@ -432,7 +460,6 @@ const RecordingComponents = () => { style={{ margin: '0 14px', flexGrow: 1 }} value={filePath} onChange={async (e) => { - const setting = await JSON.parse(storage.getItem('setting') as string) setting.recordingFilesPath = e.target.value; storage.setItem('setting', JSON.stringify(setting)) setFilePath(e.target.value) @@ -468,8 +495,8 @@ const RecordingComponents = () => { const FileComponents = () => { const [filePath, setFilePath] = useState('') const [isShareSavePath, setIsShareSavePath] = useState(true) + const setting = JSON.parse(storage.getItem('setting') as string) useEffect(() => { - const setting = JSON.parse(storage.getItem('setting') as string) if (!setting.shareFilesPath) { setting.shareFilesPath = path.dirname(process.execPath) + '\\'; setFilePath(setting.shareFilesPath) @@ -485,7 +512,6 @@ const FileComponents = () => { }, []) const handleCustomStorageChange = (e: any): void => { if (e.key === 'setting') { - const setting = JSON.parse(storage.getItem('setting') as string) setFilePath(setting.shareFilesPath) } }; @@ -503,7 +529,6 @@ const FileComponents = () => { style={{ margin: '0 14px', flexGrow: 1 }} value={filePath} onChange={async (e) => { - const setting = await JSON.parse(storage.getItem('setting') as string) setting.shareFilesPath = e.target.value; storage.setItem('setting', JSON.stringify(setting)) setFilePath(e.target.value) @@ -533,7 +558,6 @@ const FileComponents = () => {
{ - const setting = await JSON.parse(storage.getItem('setting') as string) setting.isShareSavePath = e.target.checked; storage.setItem('setting', JSON.stringify(setting)) setIsShareSavePath(e.target.checked)