mirror of
https://github.com/PlayEdu/backend
synced 2025-06-16 18:47:05 +08:00
图片上传url检测
This commit is contained in:
parent
12cc5edbf6
commit
6010ac39d8
@ -2,7 +2,7 @@ import { Button, message, Modal } from "antd";
|
||||
import Dragger from "antd/es/upload/Dragger";
|
||||
import { useState } from "react";
|
||||
import config from "../../../js/config";
|
||||
import { getToken } from "../../../utils";
|
||||
import { getToken, checkUrl } from "../../../utils";
|
||||
import { InboxOutlined } from "@ant-design/icons";
|
||||
|
||||
interface PropsInterface {
|
||||
@ -17,8 +17,8 @@ export const UploadImageSub = (props: PropsInterface) => {
|
||||
name: "file",
|
||||
multiple: true,
|
||||
action:
|
||||
config.app_url +
|
||||
"/backend/v1/upload/minio?category_ids=" +
|
||||
checkUrl(config.app_url) +
|
||||
"backend/v1/upload/minio?category_ids=" +
|
||||
props.categoryIds.join(","),
|
||||
headers: {
|
||||
authorization: "Bearer " + getToken(),
|
||||
|
@ -124,3 +124,12 @@ export function ValidataCredentials(value: any) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function checkUrl(value: any) {
|
||||
let url = value;
|
||||
let str = url.substr(url.length - 1, 1);
|
||||
if (str !== "/") {
|
||||
url = url + "/";
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user