diff --git a/src/LoginPage.js b/src/LoginPage.js
index 7bbc749..36033c9 100644
--- a/src/LoginPage.js
+++ b/src/LoginPage.js
@@ -3,7 +3,11 @@ import { useNavigate } from "react-router-dom";
import yzs from "./business/request.js";
import styles from './LoginPage.module.css';
import { useSelector, useDispatch } from 'react-redux'
-import { setFlushToken, setAccessToken, setUserInfo, setAgreeAgreement } from "./business/userSlice.js"
+import {
+ setAccount, setPassword, setVerificationCode,
+ setFlushToken, setAccessToken, setUserInfo, setAgreeAgreement,
+ setSelectInfo,
+} from "./business/userSlice.js"
import logo from './assets/logo.png';
import { Container, Tab, Box, Snackbar, Alert, Button } from '@mui/material';
import TabPanel from '@mui/lab/TabPanel';
@@ -34,6 +38,7 @@ export default function () {
const navigate = useNavigate();
const dispatch = useDispatch();
const [cookies, setCookie] = useCookies(['accessToken']);
+ const [firstEnter, setFirstEnter] = useState(true);
const [value, setValue] = useState("1");
const [message, setMessage] = useState("");
const [openTooltip, setOpenTooltip] = useState(false);
@@ -59,7 +64,24 @@ export default function () {
// const debug_test = () => {
// console.log("accessToken", accessToken, yzs.uniqueDeviceIdentifier());
+ // console.log("userExists", yzs.userExists(yzs.uniqueDeviceIdentifier(), account));
+ // testPromiseLoading(2000, "你好").then(v => {
+ // console.log(v);
+ // })
// }
+
+ const handleInputChange = (event) => {
+ const { name, value } = event.target;
+ if (name === 'username') {
+ dispatch(setAccount(value));
+ if (firstEnter) setFirstEnter(false);
+ } else if (name === 'password') {
+ dispatch(setPassword(value));
+ } else if (name === 'verification_code') {
+ dispatch(setVerificationCode(value));
+ }
+ };
+
const handleSubmit = (event) => {
event.preventDefault();
let result = null;
@@ -77,9 +99,9 @@ export default function () {
yzs.get_user_info(yzs.uniqueDeviceIdentifier(), token).then(info => {
dispatch(setUserInfo(info));
yzs.user_select(yzs.uniqueDeviceIdentifier(), token).then(info => {
+ dispatch(setSelectInfo(info));
navigate("/");
})
-
});
})
}).catch(error => {
@@ -121,10 +143,17 @@ export default function () {
-
+
-
+
diff --git a/src/MainPage.js b/src/MainPage.js
index f744a7d..0cae234 100644
--- a/src/MainPage.js
+++ b/src/MainPage.js
@@ -1,4 +1,4 @@
-import { useEffect, useState } from 'react';
+import { React, useEffect, useState } from 'react';
import { useSelector, useDispatch } from 'react-redux'
import AppBar from './AppBar';
import RecordList from './components/RecordList';
@@ -7,6 +7,7 @@ import store from './business/store';
import yzs from "./business/request.js";
import { setList, setCurrentLyric, setCurrentBlob, setCurrentWaveData } from "./business/recorderSlice.js"
import { CssBaseline, Box } from '@mui/material';
+import MainSkeleton from './MainSkeleton';
import RecordLyrics from './RecordLyrics';
import { createTheme, ThemeProvider, styled } from '@mui/material/styles';
import expand from './assets/expand.png';
@@ -104,6 +105,19 @@ const Main = styled('main', { shouldForwardProp: (prop) => prop !== 'open' })(
}),
);
+const RecordPlayer = ({ loading, playerBarWidth, currentTime, hasLyric, currentLyric }) => {
+ if (loading) {
+ return
+ } else {
+ return
+ }
+};
+
export default function () {
const dispatch = useDispatch()
const accessToken = useSelector(state => state.user.accessToken);
@@ -112,15 +126,16 @@ export default function () {
const currentLyric = useSelector(state => state.recorder.currentLyric);
const currentIndex = useSelector(state => state.recorder.currentIndex);
const recordList = useSelector(state => state.recorder.list);
+ const loading = useSelector(state => state.recorder.loading);
const [playerBarWidth, setPlayerBarWidth] = useState(0);
const [open, setOpen] = useState(true);
const [hasLyric, setHasLyric] = useState(true);
useEffect(() => {
if (passportId <= 0) return;
yzs.get_record_list(accessToken, passportId).then(list => {
- dispatch(setList(list.result));
- if (list.result.length > 0) {
- fetchRecord(accessToken, list.result.at(0));
+ dispatch(setList(list));
+ if (list.length > 0) {
+ fetchRecord(accessToken, list.at(0));
}
}).catch(error => {
console.log("get list failed", error);
@@ -168,10 +183,8 @@ export default function () {
-
- {hasLyric ? :
- }
+
diff --git a/src/MainSkeleton.js b/src/MainSkeleton.js
new file mode 100644
index 0000000..4a34c4d
--- /dev/null
+++ b/src/MainSkeleton.js
@@ -0,0 +1,34 @@
+import Stack from '@mui/material/Stack';
+import Box from '@mui/material/Box';
+import Skeleton from '@mui/material/Skeleton';
+import { Container } from '@mui/material';
+
+export default function () {
+ return (
+
+
+
+
+
+
+ {/* For variant="text", adjust the height via font-size */}
+
+ {/* For other variants, adjust the size with `width` and `height` */}
+
+
+
+
+ );
+}
\ No newline at end of file
diff --git a/src/PlayerBar.js b/src/PlayerBar.js
index 934511e..fd96309 100644
--- a/src/PlayerBar.js
+++ b/src/PlayerBar.js
@@ -20,6 +20,7 @@ const durationFormat = (time) => {
export default function ({ width, currentTime }) {
const dispatch = useDispatch();
const [duration, setDuration] = useState(0); // 秒,有小数点
+ const [playbackRate, setPlaybackRate] = useState(1.0);
const currentIndex = useSelector(state => state.recorder.currentIndex);
const recordList = useSelector(state => state.recorder.list);
const currentBlob = useSelector(state => state.recorder.currentBlob);
@@ -28,6 +29,7 @@ export default function ({ width, currentTime }) {
const player = useRef(null);
useEffect(() => {
player.current.url = currentBlob
+ setPlaybackRate(1.0); // 恢复默认
console.log(player.current.url);
}, [currentBlob]);
@@ -66,6 +68,7 @@ export default function ({ width, currentTime }) {
}
const onChange = (event) => {
+ setPlaybackRate(event.target.value);
player.current.playbackRate = event.target.value;
};
@@ -107,7 +110,7 @@ export default function ({ width, currentTime }) {
waveData={currentWaveData}
/>