上传图片错误优化

This commit is contained in:
禺狨 2023-04-23 10:36:04 +08:00
parent f2e6da5329
commit 89ef2401cf
4 changed files with 70 additions and 55 deletions

View File

@ -29,7 +29,7 @@
display: flex;
align-items: center;
.nav-item {
width: 64px;
width: auto;
height: 40px;
font-size: 16px;
font-weight: 400;
@ -47,7 +47,7 @@
}
.nav-active-item {
width: 64px;
width: auto;
height: 40px;
font-size: 16px;
font-weight: 600;

View File

@ -6,7 +6,7 @@ import { useDispatch } from "react-redux";
import { loginAction } from "../../store/user/loginUserSlice";
import type { UploadProps } from "antd";
import config from "../../js/config";
import { getToken } from "../../utils/index";
import { getToken, changeAppUrl } from "../../utils/index";
interface PropInterface {
open: boolean;
@ -40,7 +40,7 @@ export const UserInfoModel: React.FC<PropInterface> = ({ open, onCancel }) => {
name: "file",
multiple: false,
method: "PUT",
action: config.app_url + "api/v1/user/avatar",
action: changeAppUrl(config.app_url) + "api/v1/user/avatar",
headers: {
Accept: "application/json",
authorization: "Bearer " + getToken(),

View File

@ -7,65 +7,71 @@
display: flex;
flex-direction: column;
justify-content: space-between;
.title {
width: 120px;
height: auto;
font-size: 30px;
font-weight: 600;
color: #333333;
line-height: 30px;
border-bottom: 4px solid #ff4d4f;
box-sizing: border-box;
padding-bottom: 10px;
margin: 0 auto;
margin-top: 100px;
}
.login-box {
width: 1200px;
height: 366px;
background: #ffffff;
.top-content {
width: 100%;
display: flex;
margin: 0 auto;
margin-top: 80px;
.left-box {
width: 595px;
height: 100%;
flex-direction: column;
align-items: flex-start;
.title {
min-width: 125px;
height: auto;
font-size: 30px;
font-weight: 600;
color: #333333;
line-height: 30px;
border-bottom: 4px solid #ff4d4f;
box-sizing: border-box;
padding: 33px 60px;
.icon {
width: 475px;
height: 300px;
}
padding-bottom: 10px;
margin: 0 auto;
margin-top: 100px;
}
.right-box {
width: 520px;
height: 100%;
box-sizing: border-box;
border-left: 1px solid #d8d8d8;
padding: 0px 60px;
.login-box {
width: 1200px;
height: 366px;
background: #ffffff;
display: flex;
flex-direction: column;
.captcha-box {
width: 125px;
height: 54px;
margin-left: 15px;
border-radius: 8px;
background-color: rgba(#ff4d4f, 0.1);
display: flex;
.catpcha-loading-box {
width: 125px;
height: 54px;
line-height: 54px;
text-align: center;
margin: 0 auto;
margin-top: 80px;
.left-box {
width: 595px;
height: 100%;
box-sizing: border-box;
padding: 33px 60px;
.icon {
width: 475px;
height: 300px;
}
.captcha {
}
.right-box {
width: 520px;
height: 100%;
box-sizing: border-box;
border-left: 1px solid #d8d8d8;
padding: 0px 60px;
display: flex;
flex-direction: column;
.captcha-box {
width: 125px;
height: 54px;
border: none;
cursor: pointer;
margin-left: 15px;
border-radius: 8px;
background-color: rgba(#ff4d4f, 0.1);
display: flex;
.catpcha-loading-box {
width: 125px;
height: 54px;
line-height: 54px;
text-align: center;
}
.captcha {
width: 125px;
height: 54px;
border: none;
cursor: pointer;
border-radius: 8px;
}
}
}
}

View File

@ -95,3 +95,12 @@ export function setDepName(token: string) {
export function clearDepName() {
window.localStorage.removeItem("playedu-frontend-depatmentName");
}
export function changeAppUrl(str: string) {
let key = str.slice(str.length - 1);
if (key === "/") {
return str;
} else {
return str + "/";
}
}