上传图片错误优化

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

View File

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

View File

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