mirror of
https://github.com/PlayEdu/backend
synced 2025-06-23 02:34:11 +08:00
commit
55e2fdbbed
@ -1,16 +1,9 @@
|
|||||||
import client from "./internal/httpClient";
|
import client from "./internal/httpClient";
|
||||||
|
|
||||||
export function login(
|
export function login(email: string, password: string) {
|
||||||
email: string,
|
|
||||||
password: string,
|
|
||||||
captchaKey: string,
|
|
||||||
captchaVal: string
|
|
||||||
) {
|
|
||||||
return client.post("/backend/v1/auth/login", {
|
return client.post("/backend/v1/auth/login", {
|
||||||
email: email,
|
email: email,
|
||||||
password: password,
|
password: password,
|
||||||
captcha_key: captchaKey,
|
|
||||||
captcha_value: captchaVal,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ export class UploadChunk {
|
|||||||
|
|
||||||
constructor(file: File, uploadId: string, filename: string) {
|
constructor(file: File, uploadId: string, filename: string) {
|
||||||
this.client = axios.create({
|
this.client = axios.create({
|
||||||
timeout: 15000,
|
timeout: 60000,
|
||||||
withCredentials: false,
|
withCredentials: false,
|
||||||
});
|
});
|
||||||
this.file = file;
|
this.file = file;
|
||||||
|
@ -109,7 +109,7 @@ export const CourseHourUpdate: React.FC<PropInterface> = ({
|
|||||||
if (videos[i].disabled === false) {
|
if (videos[i].disabled === false) {
|
||||||
hours.push({
|
hours.push({
|
||||||
chapter_id: 0,
|
chapter_id: 0,
|
||||||
sort: i,
|
sort: treeData.length + i,
|
||||||
title: videos[i].name,
|
title: videos[i].name,
|
||||||
type: videos[i].type,
|
type: videos[i].type,
|
||||||
duration: videos[i].duration,
|
duration: videos[i].duration,
|
||||||
@ -144,7 +144,7 @@ export const CourseHourUpdate: React.FC<PropInterface> = ({
|
|||||||
if (videos[i].disabled === false) {
|
if (videos[i].disabled === false) {
|
||||||
hours.push({
|
hours.push({
|
||||||
chapter_id: data[addvideoCurrent].id,
|
chapter_id: data[addvideoCurrent].id,
|
||||||
sort: i,
|
sort: data[addvideoCurrent].hours.length + i,
|
||||||
title: videos[i].name,
|
title: videos[i].name,
|
||||||
type: videos[i].type,
|
type: videos[i].type,
|
||||||
duration: videos[i].duration,
|
duration: videos[i].duration,
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
width: 440px;
|
width: 440px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 80px 10px 80px 30px;
|
padding: 90px 10px 80px 30px;
|
||||||
.icon {
|
.icon {
|
||||||
width: 400px;
|
width: 400px;
|
||||||
height: 400px;
|
height: 400px;
|
||||||
@ -39,7 +39,7 @@
|
|||||||
width: 440px;
|
width: 440px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
padding: 50px 30px;
|
padding: 90px 30px 50px 30px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import styles from "./index.module.less";
|
import styles from "./index.module.less";
|
||||||
import { Spin, Input, Button, message } from "antd";
|
import { Input, Button, message } from "antd";
|
||||||
import { login as loginApi, system } from "../../api/index";
|
import { login as loginApi, system } from "../../api/index";
|
||||||
import { setToken } from "../../utils/index";
|
import { setToken } from "../../utils/index";
|
||||||
import { useDispatch } from "react-redux";
|
import { useDispatch } from "react-redux";
|
||||||
@ -18,22 +18,8 @@ const LoginPage = () => {
|
|||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const [loading, setLoading] = useState<boolean>(false);
|
const [loading, setLoading] = useState<boolean>(false);
|
||||||
const [image, setImage] = useState<string>("");
|
|
||||||
const [email, setEmail] = useState<string>("");
|
const [email, setEmail] = useState<string>("");
|
||||||
const [password, setPassword] = useState<string>("");
|
const [password, setPassword] = useState<string>("");
|
||||||
const [captchaVal, setCaptchaVal] = useState<string>("");
|
|
||||||
const [captchaKey, setCaptchaKey] = useState<string>("");
|
|
||||||
const [captchaLoading, setCaptchaLoading] = useState(true);
|
|
||||||
|
|
||||||
const fetchImageCaptcha = () => {
|
|
||||||
setCaptchaVal("");
|
|
||||||
setCaptchaLoading(true);
|
|
||||||
system.getImageCaptcha().then((res: any) => {
|
|
||||||
setImage(res.data.image);
|
|
||||||
setCaptchaKey(res.data.key);
|
|
||||||
setCaptchaLoading(false);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const loginSubmit = async () => {
|
const loginSubmit = async () => {
|
||||||
if (!email) {
|
if (!email) {
|
||||||
@ -44,14 +30,6 @@ const LoginPage = () => {
|
|||||||
message.error("请输入密码");
|
message.error("请输入密码");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!captchaVal) {
|
|
||||||
message.error("请输入图形验证码");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (captchaVal.length !== 4) {
|
|
||||||
message.error("图形验证码错误");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await handleSubmit();
|
await handleSubmit();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -61,12 +39,7 @@ const LoginPage = () => {
|
|||||||
}
|
}
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
try {
|
try {
|
||||||
let res: any = await loginApi.login(
|
let res: any = await loginApi.login(email, password);
|
||||||
email,
|
|
||||||
password,
|
|
||||||
captchaKey,
|
|
||||||
captchaVal
|
|
||||||
);
|
|
||||||
setToken(res.data.token); //将token写入本地
|
setToken(res.data.token); //将token写入本地
|
||||||
await getSystemConfig(); //获取系统配置并写入store
|
await getSystemConfig(); //获取系统配置并写入store
|
||||||
await getUser(); //获取登录用户的信息并写入store
|
await getUser(); //获取登录用户的信息并写入store
|
||||||
@ -75,7 +48,6 @@ const LoginPage = () => {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error("错误信息", e);
|
console.error("错误信息", e);
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
fetchImageCaptcha(); //刷新图形验证码
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -104,10 +76,6 @@ const LoginPage = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
fetchImageCaptcha();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles["login-content"]}>
|
<div className={styles["login-content"]}>
|
||||||
<div className={styles["banner-box"]}>
|
<div className={styles["banner-box"]}>
|
||||||
@ -142,33 +110,6 @@ const LoginPage = () => {
|
|||||||
placeholder="请输入密码"
|
placeholder="请输入密码"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="d-flex mt-50">
|
|
||||||
<Input
|
|
||||||
value={captchaVal}
|
|
||||||
style={{ width: 260, height: 54 }}
|
|
||||||
placeholder="请输入图形验证码"
|
|
||||||
onChange={(e) => {
|
|
||||||
setCaptchaVal(e.target.value);
|
|
||||||
}}
|
|
||||||
allowClear
|
|
||||||
onKeyUp={(e) => keyUp(e)}
|
|
||||||
/>
|
|
||||||
<div className={styles["captcha-box"]}>
|
|
||||||
{captchaLoading && (
|
|
||||||
<div className={styles["catpcha-loading-box"]}>
|
|
||||||
<Spin size="small" />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{!captchaLoading && (
|
|
||||||
<img
|
|
||||||
className={styles["captcha"]}
|
|
||||||
onClick={fetchImageCaptcha}
|
|
||||||
src={image}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div className="login-box d-flex mt-50">
|
<div className="login-box d-flex mt-50">
|
||||||
<Button
|
<Button
|
||||||
style={{ width: 400, height: 54 }}
|
style={{ width: 400, height: 54 }}
|
||||||
|
@ -286,6 +286,20 @@ const SystemConfigPage = () => {
|
|||||||
>
|
>
|
||||||
<Input style={{ width: 274 }} placeholder="请填写API访问地址" />
|
<Input style={{ width: 274 }} placeholder="请填写API访问地址" />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
style={{ marginBottom: 30 }}
|
||||||
|
label="PC端访问地址"
|
||||||
|
name="system.pc_url"
|
||||||
|
>
|
||||||
|
<Input style={{ width: 274 }} placeholder="请填写PC端访问地址" />
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item
|
||||||
|
style={{ marginBottom: 30 }}
|
||||||
|
label="H5端访问地址"
|
||||||
|
name="system.h5_url"
|
||||||
|
>
|
||||||
|
<Input style={{ width: 274 }} placeholder="请填写H5端访问地址" />
|
||||||
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
style={{ marginBottom: 30 }}
|
style={{ marginBottom: 30 }}
|
||||||
label="网站标题"
|
label="网站标题"
|
||||||
@ -308,21 +322,6 @@ const SystemConfigPage = () => {
|
|||||||
placeholder="请填写网站页脚"
|
placeholder="请填写网站页脚"
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
{/*
|
|
||||||
<Form.Item
|
|
||||||
style={{ marginBottom: 30 }}
|
|
||||||
label="PC端访问地址"
|
|
||||||
name="system.pc_url"
|
|
||||||
>
|
|
||||||
<Input style={{ width: 274 }} placeholder="请填写PC端访问地址" />
|
|
||||||
</Form.Item>
|
|
||||||
<Form.Item
|
|
||||||
style={{ marginBottom: 30 }}
|
|
||||||
label="H5端访问地址"
|
|
||||||
name="system.h5_url"
|
|
||||||
>
|
|
||||||
<Input style={{ width: 274 }} placeholder="请填写H5端访问地址" />
|
|
||||||
</Form.Item> */}
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
style={{ marginBottom: 30 }}
|
style={{ marginBottom: 30 }}
|
||||||
wrapperCol={{ offset: 3, span: 21 }}
|
wrapperCol={{ offset: 3, span: 21 }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user