所有接口使用代理。
This commit is contained in:
parent
9e2fc3e6c2
commit
584950ce4d
@ -17,6 +17,9 @@ import { useNavigate } from "react-router-dom";
|
|||||||
export default function () {
|
export default function () {
|
||||||
const avatarUrl = useSelector(state => state.user.avatarUrl);
|
const avatarUrl = useSelector(state => state.user.avatarUrl);
|
||||||
const nickName = useSelector(state => state.user.nickName);
|
const nickName = useSelector(state => state.user.nickName);
|
||||||
|
const userName = useSelector(state => state.user.userName);
|
||||||
|
const name = (nickName && nickName.length > 0) ? nickName : userName;
|
||||||
|
|
||||||
const [cookies, setCookie, removeCookie] = useCookies(['accessToken']);
|
const [cookies, setCookie, removeCookie] = useCookies(['accessToken']);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [anchorElUser, setAnchorElUser] = React.useState(null);
|
const [anchorElUser, setAnchorElUser] = React.useState(null);
|
||||||
@ -50,9 +53,9 @@ export default function () {
|
|||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
}} >
|
}} >
|
||||||
<IconButton onClick={handleOpenUserMenu} sx={{ p: 0 }}>
|
<IconButton onClick={handleOpenUserMenu} sx={{ p: 0 }}>
|
||||||
<Avatar alt={nickName} src={avatarUrl} />
|
<Avatar alt={name} src={avatarUrl} />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<Typography sx={{ color: "#FFFFFF", paddingLeft: 2 }}>{nickName}</Typography>
|
<Typography onClick={handleOpenUserMenu} sx={{ color: "#FFFFFF", paddingLeft: 2 }}>{name}</Typography>
|
||||||
<Menu
|
<Menu
|
||||||
sx={{ mt: '45px' }}
|
sx={{ mt: '45px' }}
|
||||||
id="menu-appbar"
|
id="menu-appbar"
|
||||||
|
@ -39,6 +39,14 @@ export default function ({ width, currentTime }) {
|
|||||||
dispatch(togglePauseState());
|
dispatch(togglePauseState());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onDownload = () => {
|
||||||
|
if (recordList.length <= 0 || currentIndex < 0) return;
|
||||||
|
let link = document.createElement('a');
|
||||||
|
link.href = currentBlob;
|
||||||
|
link.download = recordList.at(currentIndex).name;
|
||||||
|
link.click();
|
||||||
|
};
|
||||||
|
|
||||||
const onDurationChange = (event) => {
|
const onDurationChange = (event) => {
|
||||||
setDuration(player.current.duration);
|
setDuration(player.current.duration);
|
||||||
}
|
}
|
||||||
@ -65,7 +73,7 @@ export default function ({ width, currentTime }) {
|
|||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
}}>
|
}}>
|
||||||
<Typography variant="h6" sx={{ flexGrow: 1 }} >{recordList.length > 0 ? recordList.at(currentIndex).editName : ""}</Typography>
|
<Typography variant="h6" sx={{ flexGrow: 1 }} >{recordList.length > 0 ? recordList.at(currentIndex).editName : ""}</Typography>
|
||||||
<IconButton onClick={toggleState}>
|
<IconButton onClick={onDownload}>
|
||||||
<img src={downloadIcon} />
|
<img src={downloadIcon} />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Container>
|
</Container>
|
||||||
|
@ -44,7 +44,7 @@ const yzs = {
|
|||||||
body.timestamp = parseInt(new Date().getTime() / 1000);
|
body.timestamp = parseInt(new Date().getTime() / 1000);
|
||||||
body.flushToken = flushToken;
|
body.flushToken = flushToken;
|
||||||
|
|
||||||
return fetch(`${accessServer}/rest/v2/token/get_access_token`, {
|
return fetch("/rest/v2/token/get_access_token", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: constructParameter(body),
|
body: constructParameter(body),
|
||||||
headers: {
|
headers: {
|
||||||
@ -64,7 +64,7 @@ const yzs = {
|
|||||||
body.timestamp = parseInt(new Date().getTime() / 1000);
|
body.timestamp = parseInt(new Date().getTime() / 1000);
|
||||||
body.accessToken = accessToken;
|
body.accessToken = accessToken;
|
||||||
|
|
||||||
return fetch(`${accessServer}/rest/v2/token/refresh_access_token`, {
|
return fetch("/rest/v2/token/refresh_access_token", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: constructParameter(body),
|
body: constructParameter(body),
|
||||||
headers: {
|
headers: {
|
||||||
@ -85,7 +85,7 @@ const yzs = {
|
|||||||
body.timestamp = parseInt(new Date().getTime() / 1000);
|
body.timestamp = parseInt(new Date().getTime() / 1000);
|
||||||
body.accessToken = accessToken;
|
body.accessToken = accessToken;
|
||||||
|
|
||||||
return fetch(`${accessServer}/rest/v2/user/get_user_info`, {
|
return fetch("/rest/v2/user/get_user_info", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: constructParameter(body),
|
body: constructParameter(body),
|
||||||
headers: {
|
headers: {
|
||||||
@ -175,7 +175,7 @@ const yzs = {
|
|||||||
body.account = account;
|
body.account = account;
|
||||||
body.password = md5(password);
|
body.password = md5(password);
|
||||||
|
|
||||||
return fetch(`${accessServer}/rest/v2/user/login`, {
|
return fetch("/rest/v2/user/login", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: constructParameter(body),
|
body: constructParameter(body),
|
||||||
// mode: "no-cors",
|
// mode: "no-cors",
|
||||||
@ -196,7 +196,7 @@ const yzs = {
|
|||||||
body.timestamp = Math.round(new Date().getTime() / 1000);
|
body.timestamp = Math.round(new Date().getTime() / 1000);
|
||||||
body.userCell = userCell;
|
body.userCell = userCell;
|
||||||
body.phoneCode = phoneCode;
|
body.phoneCode = phoneCode;
|
||||||
return fetch(`${accessServer}/rest/v2/phone/login`, {
|
return fetch("/rest/v2/phone/login", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: constructParameter(body),
|
body: constructParameter(body),
|
||||||
// mode: "no-cors",
|
// mode: "no-cors",
|
||||||
@ -217,7 +217,7 @@ const yzs = {
|
|||||||
body.clientId = udid;
|
body.clientId = udid;
|
||||||
body.timestamp = Math.round(new Date().getTime() / 1000);
|
body.timestamp = Math.round(new Date().getTime() / 1000);
|
||||||
body.userCell = userCell;
|
body.userCell = userCell;
|
||||||
return fetch(`${accessServer}/rest/v2/phone/send_phone_code`, {
|
return fetch("/rest/v2/phone/send_phone_code", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: constructParameter(body),
|
body: constructParameter(body),
|
||||||
// mode: "no-cors",
|
// mode: "no-cors",
|
||||||
|
@ -6,7 +6,61 @@ const { createProxyMiddleware } = require('http-proxy-middleware');
|
|||||||
const appKey = "tp3szvq45m3yn6rdjhxlzrrikf6fc3a75t2yh3y3";
|
const appKey = "tp3szvq45m3yn6rdjhxlzrrikf6fc3a75t2yh3y3";
|
||||||
const server = "https://ai-api.hivoice.cn";
|
const server = "https://ai-api.hivoice.cn";
|
||||||
|
|
||||||
|
const accessServer = "https://uc.hivoice.cn";
|
||||||
|
|
||||||
module.exports = function (app) {
|
module.exports = function (app) {
|
||||||
|
app.use(
|
||||||
|
'/rest/v2/phone/login',
|
||||||
|
createProxyMiddleware({
|
||||||
|
target: accessServer,
|
||||||
|
changeOrigin: true,
|
||||||
|
logger: console,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
app.use(
|
||||||
|
'/rest/v2/phone/send_phone_code',
|
||||||
|
createProxyMiddleware({
|
||||||
|
target: accessServer,
|
||||||
|
changeOrigin: true,
|
||||||
|
logger: console,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
app.use(
|
||||||
|
'/rest/v2/user/login',
|
||||||
|
createProxyMiddleware({
|
||||||
|
target: accessServer,
|
||||||
|
changeOrigin: true,
|
||||||
|
logger: console,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
app.use(
|
||||||
|
'/rest/v2/user/get_user_info',
|
||||||
|
createProxyMiddleware({
|
||||||
|
target: accessServer,
|
||||||
|
changeOrigin: true,
|
||||||
|
logger: console,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
app.use(
|
||||||
|
'/rest/v2/token/get_access_token',
|
||||||
|
createProxyMiddleware({
|
||||||
|
target: accessServer,
|
||||||
|
changeOrigin: true,
|
||||||
|
logger: console,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
app.use(
|
||||||
|
'/rest/v2/token/refresh_access_token',
|
||||||
|
createProxyMiddleware({
|
||||||
|
target: accessServer,
|
||||||
|
changeOrigin: true,
|
||||||
|
logger: console,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
app.use(
|
app.use(
|
||||||
'/api/app/app-voice-recorder/rest/v1/trans/info/list',
|
'/api/app/app-voice-recorder/rest/v1/trans/info/list',
|
||||||
createProxyMiddleware({
|
createProxyMiddleware({
|
||||||
|
Loading…
Reference in New Issue
Block a user