上传图片错误优化

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,8 +7,13 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
.top-content {
width: 100%;
display: flex;
flex-direction: column;
align-items: flex-start;
.title { .title {
width: 120px; min-width: 125px;
height: auto; height: auto;
font-size: 30px; font-size: 30px;
font-weight: 600; font-weight: 600;
@ -71,3 +76,4 @@
} }
} }
} }
}

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 + "/";
}
}