From 6010ac39d8262cca94e35e70ffca25413483f59e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BA=E7=8B=A8?= <18119604035@163.com> Date: Fri, 9 Jun 2023 13:54:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E7=89=87=E4=B8=8A=E4=BC=A0url?= =?UTF-8?q?=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../upload-image-button/upload-image-sub/index.tsx | 6 +++--- src/utils/index.ts | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/compenents/upload-image-button/upload-image-sub/index.tsx b/src/compenents/upload-image-button/upload-image-sub/index.tsx index 91aa87a..db609ea 100644 --- a/src/compenents/upload-image-button/upload-image-sub/index.tsx +++ b/src/compenents/upload-image-button/upload-image-sub/index.tsx @@ -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(), diff --git a/src/utils/index.ts b/src/utils/index.ts index 816b890..05c0a0c 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -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; +}