From b98c1b9ed8c51957518ede69bc4b51fb795101ad Mon Sep 17 00:00:00 2001
From: amass <168062547@qq.com>
Date: Thu, 15 Jun 2023 15:37:17 +0800
Subject: [PATCH] =?UTF-8?q?1.=E5=88=87=E6=8D=A2=E5=88=B0=E7=94=9F=E4=BA=A7?=
=?UTF-8?q?=E7=8E=AF=E5=A2=83=202.=E5=AE=8C=E6=88=90=E9=A2=91=E8=B0=B1?=
=?UTF-8?q?=E8=BF=9B=E5=BA=A6=E6=9D=A1=E7=9A=84=E5=AE=9E=E7=8E=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/MainPage.js | 2 +
src/PlayerBar.js | 16 +--
src/RecordList.js | 22 ++++-
src/business/recorderSlice.js | 6 +-
src/business/request.js | 24 +++--
src/components/ProgressBar.js | 179 ++++++++++++++++++++++++++++++++++
src/setupProxy.js | 16 ++-
7 files changed, 245 insertions(+), 20 deletions(-)
create mode 100644 src/components/ProgressBar.js
diff --git a/src/MainPage.js b/src/MainPage.js
index e88d785..9906c29 100644
--- a/src/MainPage.js
+++ b/src/MainPage.js
@@ -39,6 +39,8 @@ export default function () {
useEffect(() => {
yzs.get_record_list(accessToken, passportId).then(list => {
dispatch(setList(list.result));
+ }).catch(error => {
+ console.log("get list failed", error);
});
}, [accessToken, passportId]);
return
diff --git a/src/PlayerBar.js b/src/PlayerBar.js
index 95a043f..6adc9f4 100644
--- a/src/PlayerBar.js
+++ b/src/PlayerBar.js
@@ -7,7 +7,7 @@ import pauseIcon from "./assets/play.png";
import playIcon from "./assets/pause.png";
import downloadIcon from "./assets/download.png";
import { setCurrentTime, togglePauseState } from "./business/recorderSlice.js"
-import Waveform from "./components/Waveform";
+import ProgressBar from "./components/ProgressBar";
const durationFormat = (time) => {
if (isNaN(time)) return "00:00:00";
@@ -20,11 +20,12 @@ const durationFormat = (time) => {
export default function ({ currentTime }) {
const dispatch = useDispatch();
- const [duration, setDuration] = useState(0);
+ const [duration, setDuration] = useState(0); // 秒,有小数点
const [canvasWidth, setCanvasWidth] = useState(0);
const currentIndex = useSelector(state => state.recorder.currentIndex);
const recordList = useSelector(state => state.recorder.list);
const currentBlob = useSelector(state => state.recorder.currentBlob);
+ const currentWaveData = useSelector(state => state.recorder.currentWaveData);
const pause = useSelector(state => state.recorder.pause);
const player = useRef(null);
useEffect(() => {
@@ -49,7 +50,7 @@ export default function ({ currentTime }) {
}
const onResize = useCallback((width, height) => {
- setCanvasWidth(width - 90 - 60);
+ setCanvasWidth(width - 90 - 70);
}, []);
const { ref: playerBar } = useResizeDetector({
@@ -60,7 +61,7 @@ export default function ({ currentTime }) {
player.current.currentTime = second;
}
- return
-
-
+
+