From a430284aa21e3ae1f0d5654e55b2ad2852519cc2 Mon Sep 17 00:00:00 2001 From: wwf <yearningwang@iqtogether.com> Date: 星期三, 04 六月 2025 15:17:49 +0800 Subject: [PATCH] 初始化 --- app/components/base/voice-input/index.tsx | 26 +++++++++++++------------- 1 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/components/base/voice-input/index.tsx b/app/components/base/voice-input/index.tsx index 5a5400a..37ebe3d 100644 --- a/app/components/base/voice-input/index.tsx +++ b/app/components/base/voice-input/index.tsx @@ -49,8 +49,8 @@ const ctx = ctxRef.current! const dataUnit8Array = recorder.current.getRecordAnalyseData() const dataArray = [].slice.call(dataUnit8Array) - const lineLength = Number.parseInt(`${canvas.width / 3}`) - const gap = Number.parseInt(`${1024 / lineLength}`) + const lineLength = parseInt(`${canvas.width / 3}`) + const gap = parseInt(`${1024 / lineLength}`) ctx.clearRect(0, 0, canvas.width, canvas.height) ctx.beginPath() @@ -111,7 +111,7 @@ onConverted(audioResponse.text) onCancel() } - catch { + catch (e) { onConverted('') onCancel() } @@ -125,7 +125,7 @@ if (canvasRef.current && ctxRef.current) drawRecord() } - catch { + catch (e) { onCancel() } } @@ -161,15 +161,15 @@ } }, []) - const minutes = Number.parseInt(`${Number.parseInt(`${originDuration}`) / 60}`) - const seconds = Number.parseInt(`${originDuration}`) % 60 + const minutes = parseInt(`${parseInt(`${originDuration}`) / 60}`) + const seconds = parseInt(`${originDuration}`) % 60 return ( <div className={cn(s.wrapper, 'absolute inset-0 rounded-xl')}> - <div className='absolute inset-[1.5px] flex items-center overflow-hidden rounded-[10.5px] bg-primary-25 py-[14px] pl-[14.5px] pr-[6.5px]'> - <canvas id='voice-input-record' className='absolute bottom-0 left-0 h-4 w-full' /> + <div className='absolute inset-[1.5px] flex items-center pl-[14.5px] pr-[6.5px] py-[14px] bg-primary-25 rounded-[10.5px] overflow-hidden'> + <canvas id='voice-input-record' className='absolute left-0 bottom-0 w-full h-4' /> { - startConvert && <RiLoader2Line className='mr-2 h-4 w-4 animate-spin text-primary-700' /> + startConvert && <RiLoader2Line className='animate-spin mr-2 w-4 h-4 text-primary-700' /> } <div className='grow'> { @@ -190,20 +190,20 @@ { startRecord && ( <div - className='mr-1 flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg hover:bg-primary-100' + className='flex justify-center items-center mr-1 w-8 h-8 hover:bg-primary-100 rounded-lg cursor-pointer' onClick={handleStopRecorder} > - <StopCircle className='h-5 w-5 text-primary-600' /> + <StopCircle className='w-5 h-5 text-primary-600' /> </div> ) } { startConvert && ( <div - className='mr-1 flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg hover:bg-gray-200' + className='flex justify-center items-center mr-1 w-8 h-8 hover:bg-gray-200 rounded-lg cursor-pointer' onClick={onCancel} > - <RiCloseLine className='h-4 w-4 text-gray-500' /> + <RiCloseLine className='w-4 h-4 text-gray-500' /> </div> ) } -- Gitblit v1.8.0