Skip to content

Let's use AI to Earn!

feat(发布弹框): 上传图片和上传视频完成

gaoSir647a8e247931
diff --git a/.env b/.env
index 7b3ec4d8..4d7cfa6c 100644
--- a/.env
+++ b/.env
@@ -1,2 +1,5 @@
# baseURL 代理字段
NEXT_PUBLIC_API_URL_PROXY="/baseUrlProxy/"
+
+# OSS URL
+NEXT_PUBLIC_OSS_URL="https://ai-to-earn.oss-cn-beijing.aliyuncs.com/"
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 6504afe3..2e420d99 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,17 +4,32 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
- <list default="true" id="8ce961ad-7c9e-494c-bc53-9ecde4358af8" name="更改" comment="fix: platInfo添加一些非空判断">
+ <list default="true" id="8ce961ad-7c9e-494c-bc53-9ecde4358af8" name="更改" comment="feat: 发布记录展示添加状态展示">
+ <change afterPath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PubParmasTextarea/PubParmasTextareaUpload.tsx" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/.env" beforeDir="false" afterPath="$PROJECT_DIR$/.env" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/RecordCore.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/RecordCore.tsx" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/recordCore.module.scss" beforeDir="false" afterPath="$PROJECT_DIR$/src/app/[lng]/accounts/components/CalendarTiming/CalendarTimingItem/recordCore.module.scss" afterDir="false" />
- <change beforePath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PublishDialogPreview.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PublishDialogPreview.tsx" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/api/plat/publish.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/api/plat/publish.ts" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/api/plat/types/publish.types.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/api/plat/types/publish.types.ts" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/api/tools.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/api/tools.ts" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PubParmasTextarea/pubCommonComps.module.scss" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/PublishDialog/compoents/PubParmasTextarea/pubCommonComps.module.scss" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/components/PublishDialog/index.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/PublishDialog/index.tsx" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/components/PublishDialog/publishDialog.type.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/components/PublishDialog/publishDialog.type.ts" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/constant.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/constant.ts" afterDir="false" />
+ <change beforePath="$PROJECT_DIR$/src/utils/FetchService/FetchService.ts" beforeDir="false" afterPath="$PROJECT_DIR$/src/utils/FetchService/FetchService.ts" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
+ <component name="FileTemplateManagerImpl">
+ <option name="RECENT_TEMPLATES">
+ <list>
+ <option value="tsx组件模板" />
+ </list>
+ </option>
+ </component>
<component name="Git.Settings">
<option name="PUSH_AUTO_UPDATE" value="true" />
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
@@ -79,7 +94,7 @@
<option name="presentableId" value="Default" />
<updated>1751977665735</updated>
<workItem from="1751977666787" duration="3372000" />
- <workItem from="1751981060502" duration="5059000" />
+ <workItem from="1751981060502" duration="13055000" />
</task>
<task id="LOCAL-00001" summary="feat(CalendarTiming): 优化发布记录列表展示&#10;- 调整日历记录项的样式和布局&#10;- 优化 RecordCore组件,添加平台图标和时间显示&#10;- 修改 CalendarTimingItem 组件,移除不必要的 Fragment&#10;-调整 index.tsx 中的日期格式化逻辑">
<option name="closed" value="true" />
@@ -105,7 +120,15 @@
<option name="project" value="LOCAL" />
<updated>1751986703860</updated>
</task>
- <option name="localTasksCounter" value="4" />
+ <task id="LOCAL-00004" summary="feat: 发布记录展示添加状态展示">
+ <option name="closed" value="true" />
+ <created>1752049408523</created>
+ <option name="number" value="00004" />
+ <option name="presentableId" value="LOCAL-00004" />
+ <option name="project" value="LOCAL" />
+ <updated>1752049408523</updated>
+ </task>
+ <option name="localTasksCounter" value="5" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@@ -117,6 +140,7 @@
<MESSAGE value="feat(CalendarTiming): 优化发布记录列表展示&#10;- 调整日历记录项的样式和布局&#10;- 优化 RecordCore组件,添加平台图标和时间显示&#10;- 修改 CalendarTimingItem 组件,移除不必要的 Fragment&#10;-调整 index.tsx 中的日期格式化逻辑" />
<MESSAGE value="feat(CalendarTiming): 优化发布记录列表展示&#10;- 调整日历记录项的样式和布局&#10;- 优化 RecordCore组件,添加平台图标和时间显示&#10;- 调整 index.tsx 中的日期格式化逻辑" />
<MESSAGE value="fix: platInfo添加一些非空判断" />
- <option name="LAST_COMMIT_MESSAGE" value="fix: platInfo添加一些非空判断" />
+ <MESSAGE value="feat: 发布记录展示添加状态展示" />
+ <option name="LAST_COMMIT_MESSAGE" value="feat: 发布记录展示添加状态展示" />
</component>
</project>
\ No newline at end of file
diff --git a/src/api/plat/publish.ts b/src/api/plat/publish.ts
index d6e15ef3..4432c1b1 100644
--- a/src/api/plat/publish.ts
+++ b/src/api/plat/publish.ts
@@ -5,9 +5,14 @@ import {
PublishListResponse,
PublishParams,
} from "@/api/plat/types/publish.types";
+import { parseTopicString } from "@/utils";
// 创建发布
export const apiCreatePublish = (data: PublishParams) => {
+ const { topics, cleanedString } = parseTopicString(data.desc || '');
+ data.topics = [...new Set(data.topics?.concat(topics))];
+ data.desc = cleanedString;
+
return request({
url: "/plat/publish/create",
method: "POST",
diff --git a/src/api/plat/types/publish.types.ts b/src/api/plat/types/publish.types.ts
index 7109d0f4..c38f134a 100644
--- a/src/api/plat/types/publish.types.ts
+++ b/src/api/plat/types/publish.types.ts
@@ -10,15 +10,19 @@ export enum PublishStatus {
// 创建发布入参
export interface PublishParams {
+ // 传入账号UID
flowId: string;
type: PubType;
title: string;
desc?: string;
+ // 传入 account
accountId: string;
accountType: PlatType;
videoUrl?: string;
coverUrl?: string;
imgList?: string[];
+ // 话题
+ topics?: string[];
publishTime?: string;
option?: any;
}
diff --git a/src/api/tools.ts b/src/api/tools.ts
index cb4db328..eadbda54 100644
--- a/src/api/tools.ts
+++ b/src/api/tools.ts
@@ -7,6 +7,7 @@
*/
import http, { request } from "@/utils/request";
import { AiCreateType } from "./types/tools";
+import axios from "axios";
export const toolsApi = {
/**
@@ -92,18 +93,29 @@ export const toolsApi = {
/**
* 上传文件临时
*/
- async uploadFileTemp(file: Blob) {
+ async uploadFileTemp(
+ file: Blob,
+ onProgress?: (prog: number) => void,
+ ): Promise<string> {
const formData = new FormData();
formData.append("file", file);
- const res = await request<{ name: string }>({
- url: "/oss/upload",
- data: formData,
+
+ const res = await axios({
+ url: `${process.env.NEXT_PUBLIC_API_URL_PROXY}/oss/upload`,
method: "POST",
+ data: formData,
headers: {
"Content-Type": "multipart/form-data",
},
+ onUploadProgress: (progressEvent) => {
+ console.log(progressEvent);
+ const prog = Math.round(
+ (progressEvent.loaded * 100) / progressEvent.total!,
+ );
+ if (onProgress) onProgress(prog);
+ },
});
- return res!.data;
+ return res.data.data.name;
},
/**
diff --git a/src/components/PublishDialog/compoents/PubParmasTextarea/PubParmasTextareaUpload.tsx b/src/components/PublishDialog/compoents/PubParmasTextarea/PubParmasTextareaUpload.tsx
new file mode 100644
index 00000000..62a62664
--- /dev/null
+++ b/src/components/PublishDialog/compoents/PubParmasTextarea/PubParmasTextareaUpload.tsx
@@ -0,0 +1,181 @@
+import React, {
+ ForwardedRef,
+ forwardRef,
+ memo,
+ useCallback,
+ useRef,
+ useState,
+} from "react";
+import { Progress, Tooltip, Upload } from "antd";
+import {
+ formatImg,
+ formatVideo,
+} from "@/components/PublishDialog/PublishDialog.util";
+import { PlusOutlined } from "@ant-design/icons";
+import {
+ IImgFile,
+ IVideoFile,
+} from "@/components/PublishDialog/publishDialog.type";
+import { toolsApi } from "@/api/tools";
+import { OSS_URL } from "@/constant";
+import { RcFile } from "antd/es/upload";
+
+const { Dragger } = Upload;
+
+export interface IPubParmasTextareaUploadRef {}
+
+export interface IPubParmasTextareaUploadProps {
+ uploadAccept: string;
+ checkFileListType: (fileList: File[]) => boolean;
+ onVideoUpdateFinish: (video: IVideoFile) => void;
+ onImgUpdateFinish: (img: IImgFile[]) => void;
+}
+
+const PubParmasTextareaUpload = memo(
+ forwardRef(
+ (
+ {
+ uploadAccept,
+ checkFileListType,
+ onVideoUpdateFinish,
+ onImgUpdateFinish,
+ }: IPubParmasTextareaUploadProps,
+ ref: ForwardedRef<IPubParmasTextareaUploadRef>,
+ ) => {
+ // 上传数量
+ const [uploadCount, setUploadCount] = useState(0);
+ // 上传进度
+ const [uploadProgress, setUploadProgress] = useState(0);
+ // 上传loading
+ const [uploadLoading, setUploadLoading] = useState(false);
+ const chooseCount = useRef<number>(0);
+ const fileListRef = useRef<RcFile[]>([]);
+
+ // 上传视频
+ const uploadVideo = useCallback(
+ async (video: IVideoFile) => {
+ setUploadCount(1);
+ setUploadProgress(0);
+ setUploadLoading(true);
+ const uploadRes = await toolsApi.uploadFileTemp(
+ video.file,
+ (prog) => {
+ setUploadProgress(prog);
+ },
+ );
+ setUploadLoading(false);
+ video["videoOssUrl"] = `${OSS_URL}${uploadRes}`;
+ onVideoUpdateFinish(video);
+ },
+ [onVideoUpdateFinish],
+ );
+
+ // 上传图片
+ const uploadImg = useCallback(
+ async (fileList: RcFile[]) => {
+ setUploadCount(fileList.length);
+ setUploadProgress(0);
+ setUploadLoading(true);
+
+ let uploadFinishCount = 0;
+ const tasks: Promise<IImgFile>[] = [];
+
+ const uploadImgCore = async (image: IImgFile): Promise<IImgFile> => {
+ const uploadRes = await toolsApi.uploadFileTemp(image.file);
+ uploadFinishCount++;
+ image["videoOssUrl"] = `${OSS_URL}${uploadRes}`;
+ setUploadProgress(
+ Math.floor((uploadFinishCount / fileList.length) * 100),
+ );
+ return image;
+ };
+
+ for (const file of fileList) {
+ const image = await formatImg({
+ blob: file!,
+ path: file.name,
+ });
+ tasks.push(uploadImgCore(image));
+ }
+ const imagesRes = await Promise.all(tasks);
+ setUploadLoading(false);
+ onImgUpdateFinish(imagesRes);
+ },
+ [onImgUpdateFinish],
+ );
+
+ return (
+ <div
+ className="pubParmasTextarea-uploads-upload"
+ onClick={(e) => e.stopPropagation()}
+ >
+ {uploadLoading ? (
+ <div className="pubParmasTextarea-uploads-upload-loading">
+ <Progress
+ type="circle"
+ percent={uploadProgress}
+ size={80}
+ strokeWidth={4}
+ strokeColor="var(--theColor5)"
+ format={
+ uploadProgress >= 100
+ ? () => (
+ <span
+ style={{
+ fontSize: "var(--fs-xs)",
+ display: "inline-block",
+ padding: "10px",
+ color: "var(--theColor6)",
+ }}
+ >
+ Finishing up…
+ </span>
+ )
+ : undefined
+ }
+ />
+ {uploadCount > 1 && (
+ <div className="pubParmasTextarea-uploads-upload-count">
+ {uploadCount}
+ </div>
+ )}
+ </div>
+ ) : (
+ <Tooltip title="上传图片或视频">
+ <Dragger
+ accept={uploadAccept}
+ multiple={true}
+ listType="text"
+ beforeUpload={async (file, uploadFileList) => {
+ if (!checkFileListType(uploadFileList)) {
+ return Upload.LIST_IGNORE;
+ }
+ if (file.type.startsWith("video/")) {
+ const video = await formatVideo(file);
+ await uploadVideo(video);
+ } else {
+ chooseCount.current++;
+ fileListRef.current = [...fileListRef.current, file];
+
+ if (chooseCount.current === uploadFileList.length) {
+ await uploadImg(fileListRef.current);
+ fileListRef.current = [];
+ chooseCount.current = 0;
+ }
+ }
+ return false;
+ }}
+ showUploadList={false}
+ >
+ <PlusOutlined />
+ <p>拖放 & 选择图片或视频</p>
+ </Dragger>
+ </Tooltip>
+ )}
+ </div>
+ );
+ },
+ ),
+);
+
+export default PubParmasTextareaUpload;
diff --git a/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx b/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx
index 9feaa1d0..c13171d0 100644
--- a/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx
+++ b/src/components/PublishDialog/compoents/PubParmasTextarea/index.tsx
@@ -13,22 +13,16 @@ import { Button, Image, Input, message, Modal, Tooltip, Upload } from "antd";
import styles from "@/components/PublishDialog/compoents/PubParmasTextarea/pubCommonComps.module.scss";
import { ReactSortable } from "react-sortablejs";
import { CSSTransition, TransitionGroup } from "react-transition-group";
-import {
- CaretRightOutlined,
- CloseOutlined,
- PlusOutlined,
-} from "@ant-design/icons";
+import { CaretRightOutlined, CloseOutlined } from "@ant-design/icons";
import isEqual from "lodash/isEqual";
import { TextAreaRef } from "antd/es/input/TextArea";
import {
IImgFile,
IVideoFile,
} from "@/components/PublishDialog/publishDialog.type";
-import {
- formatImg,
- formatVideo,
-} from "@/components/PublishDialog/PublishDialog.util";
+
import VideoCoverSeting from "@/components/PublishDialog/compoents/PubParmasTextarea/VideoCoverSeting";
+import PubParmasTextareaUpload from "@/components/PublishDialog/compoents/PubParmasTextarea/PubParmasTextareaUpload";
const { TextArea } = Input;
const { Dragger } = Upload;
@@ -106,7 +100,6 @@ const PubParmasTextarea = memo(
};
if (onChange) onChange(values);
}, [imageFileList, videoFile, value]);
-
useEffect(() => {
if (imageFileListValue.length === 0 && imageFileList.length === 0)
return;
@@ -397,42 +390,18 @@ const PubParmasTextarea = memo(
}}
unmountOnExit
>
- <Tooltip title="上传图片或视频">
- <div onClick={(e) => e.stopPropagation()}>
- <Dragger
- accept={uploadAccept}
- multiple={true}
- listType="text"
- beforeUpload={async (file, fileList) => {
- if (!checkFileListType(fileList)) {
- return Upload.LIST_IGNORE;
- }
- if (file.type.startsWith("video/")) {
- // 视频
- const video = await formatVideo(file);
- // 封面
- setVideoFile(video);
- } else {
- // 图片
- const image = await formatImg({
- blob: file!,
- path: file.name,
- });
- setImageFileList((prevState) => {
- const newState = [...prevState];
- newState.push(image);
- return newState;
- });
- }
- return false;
- }}
- showUploadList={false}
- >
- <PlusOutlined />
- <p>拖放 & 选择图片或视频</p>
- </Dragger>
- </div>
- </Tooltip>
+ <PubParmasTextareaUpload
+ checkFileListType={checkFileListType}
+ uploadAccept={uploadAccept}
+ onVideoUpdateFinish={(video) => {
+ setVideoFile(video);
+ }}
+ onImgUpdateFinish={(imgs) => {
+ setImageFileList((prevState) => {
+ return [...prevState, ...imgs];
+ });
+ }}
+ />
</CSSTransition>
)}
</TransitionGroup>
diff --git a/src/components/PublishDialog/compoents/PubParmasTextarea/pubCommonComps.module.scss b/src/components/PublishDialog/compoents/PubParmasTextarea/pubCommonComps.module.scss
index c8d5deee..e87e52ec 100644
--- a/src/components/PublishDialog/compoents/PubParmasTextarea/pubCommonComps.module.scss
+++ b/src/components/PublishDialog/compoents/PubParmasTextarea/pubCommonComps.module.scss
@@ -19,7 +19,7 @@ $boxHegiht: 110px;
.ant-upload-wrapper {
display: block;
width: 100%;
- height: $boxHegiht;
+ height: 100%;
p {
font-size: 12px;
}
@@ -33,6 +33,31 @@ $boxHegiht: 110px;
grid-template-columns: repeat(5, 1fr);
flex-wrap: wrap;
gap: 10px;
+ .pubParmasTextarea-uploads-upload {
+ position: relative;
+ height: $boxHegiht;
+ &-loading {
+ border: 1px dashed var(--colorPrimary3);
+ height: 100%;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ border-radius: 6px;
+ }
+ &-count {
+ position: absolute;
+ top: 5px;
+ right: 5px;
+ background: var(--colorPrimary5);
+ color: #fff;
+ width: 18px;
+ height: 18px;
+ line-height: 18px;
+ text-align: center;
+ border-radius: 50%;
+ font-size: var(--fs-xs);
+ }
+ }
&-item {
//width: 98px;
height: $boxHegiht;
diff --git a/src/components/PublishDialog/index.tsx b/src/components/PublishDialog/index.tsx
index 4326c12e..7aaf2231 100644
--- a/src/components/PublishDialog/index.tsx
+++ b/src/components/PublishDialog/index.tsx
@@ -23,6 +23,12 @@ import PlatParamsSetting from "@/components/PublishDialog/compoents/PlatParamsSe
import PubParmasTextarea from "@/components/PublishDialog/compoents/PubParmasTextarea";
import usePubParamsVerify from "@/components/PublishDialog/hooks/usePubParamsVerify";
import PublishDialogDataPicker from "@/components/PublishDialog/compoents/PublishDialogDataPicker";
+import { apiCreatePublish } from "@/api/plat/publish";
+import { PubType } from "@/app/config/publishConfig";
+import dayjs from "dayjs";
+import utc from "dayjs/plugin/utc";
+
+dayjs.extend(utc);
export interface IPublishDialogRef {
// 设置发布时间
@@ -33,6 +39,8 @@ export interface IPublishDialogProps {
open: boolean;
onClose: () => void;
accounts: SocialAccount[];
+ // 发布成功
+ onPubSuccess?: () => void;
}
const { confirm } = Modal;
@@ -41,7 +49,7 @@ const { confirm } = Modal;
const PublishDialog = memo(
forwardRef(
(
- { open, onClose, accounts }: IPublishDialogProps,
+ { open, onClose, accounts, onPubSuccess }: IPublishDialogProps,
ref: ForwardedRef<IPublishDialogRef>,
) => {
const [openLeft, setOpenLeft] = useState(false);
@@ -59,6 +67,7 @@ const PublishDialog = memo(
expandedPubItem,
setErrParamsMap,
setPubTime,
+ pubTime,
} = usePublishDialog(
useShallow((state) => ({
pubListChoosed: state.pubListChoosed,
@@ -74,6 +83,7 @@ const PublishDialog = memo(
expandedPubItem: state.expandedPubItem,
setErrParamsMap: state.setErrParamsMap,
setPubTime: state.setPubTime,
+ pubTime: state.pubTime,
})),
);
const { errParamsMap } = usePubParamsVerify(pubListChoosed);
@@ -120,8 +130,38 @@ const PublishDialog = memo(
setErrParamsMap(errParamsMap);
}, [errParamsMap]);
- const pubClick = useCallback(() => {
- console.log("发布:", pubListChoosed);
+ const pubClick = useCallback(async () => {
+ const publishTime = dayjs(pubTime ? pubTime : dayjs().add(6, "minute"))
+ .utc()
+ .format();
+
+ for (const item of pubListChoosed) {
+ await apiCreatePublish({
+ topics: [],
+ flowId: item.account.uid,
+ type: PubType.VIDEO,
+ title: "",
+ desc: item.params.des,
+ accountId: item.account.account,
+ accountType: item.account.type,
+ videoUrl:
+ "https://v2-zj-bjcm.kwaicdn.com/upic/2025/06/24/09/BMjAyNTA2MjQwOTI3MjlfNDQwMjk3NjY1Nl8xNjc1OTkwOTUzNzBfMl8z_b_Bea472124f75ea09e1483d87c112ede39.mp4?tag=1-1751887066-unknown-0-uqpbdciha7-0f5473b4478e400b&provider=self&clientCacheKey=3xcwhdmk5jcyv8y_b.mp4&di=dfa08272&bp=14944&x-ks-ptid=167599095370&Aecs=172.17.4.195&ocid=100001260&tt=b&ss=vpm",
+ coverUrl: "https://education.yikart.cn/images/swiper/swiper1.png",
+ publishTime,
+ option: {
+ isAutoPublish: true,
+ isAutoDelete: true,
+ isAutoCover: true,
+ isAutoImg: true,
+ bilibili: {
+ tid: 21,
+ copyright: 1,
+ },
+ },
+ });
+ }
+
+ if (onPubSuccess) onPubSuccess();
}, [pubListChoosed]);
const imperativeHandle: IPublishDialogRef = {
diff --git a/src/components/PublishDialog/publishDialog.type.ts b/src/components/PublishDialog/publishDialog.type.ts
index 0394ac9f..a7514feb 100644
--- a/src/components/PublishDialog/publishDialog.type.ts
+++ b/src/components/PublishDialog/publishDialog.type.ts
@@ -13,6 +13,8 @@ export interface IImgFile {
width: number;
// 图片高度
height: number;
+ // 前端上传到oss后的url
+ videoOssUrl: string;
}
export interface IVideoFile {
@@ -20,6 +22,8 @@ export interface IVideoFile {
file: Blob;
// 前端临时路径,注意不要存到数据库
videoUrl: string;
+ // 前端上传到oss后的url
+ videoOssUrl: string;
filename: string;
// 视频宽度
width: number;
diff --git a/src/constant.ts b/src/constant.ts
index 45b9b701..22b11481 100644
--- a/src/constant.ts
+++ b/src/constant.ts
@@ -3,3 +3,6 @@ export const APP_HOT_URL = "https://att-contents.yikart.cn/api";
// 代理地址
export const ProxyUrls = [process.env.NEXT_PUBLIC_API_URL_PROXY];
+
+// OSS URL
+export const OSS_URL = process.env.NEXT_PUBLIC_OSS_URL;
diff --git a/src/utils/FetchService/FetchService.ts b/src/utils/FetchService/FetchService.ts
index 8f4ce237..c612dc88 100644
--- a/src/utils/FetchService/FetchService.ts
+++ b/src/utils/FetchService/FetchService.ts
@@ -77,10 +77,9 @@ class FetchService<T = Response> {
params = new URLSearchParams(requestParams.params).toString();
}
- const res = await fetch(
- params ? `${fetchURL}?${params}` : fetchURL,
- requestParams,
- );
+ const res = await fetch(params ? `${fetchURL}?${params}` : fetchURL, {
+ ...requestParams,
+ });
if (this.responseInterceptor) {
return resolve(this.responseInterceptor(res));