feat: 写手端上传接口替换
This commit is contained in:
@ -144,3 +144,17 @@ export const postWorksByLinkWriter = (writerCode: string, params = {}) => {
|
||||
export const postWorksByFileWriter = (params = {}, config = {}) => {
|
||||
return Http.post('/v1/writer/works/by-file', params, config);
|
||||
};
|
||||
|
||||
// 获取图片上传地址
|
||||
export const getImagePreSignedUrlWriter = (writerCode: string,params = {}) => {
|
||||
return Http.get('/v1/writer/oss/image-pre-signed-url', params, {
|
||||
headers: { 'writer-code': writerCode },
|
||||
});
|
||||
};
|
||||
|
||||
// 获取视频上传地址
|
||||
export const getVideoPreSignedUrlWriter = (writerCode: string,params = {}) => {
|
||||
return Http.get('/v1/writer/oss/video-pre-signed-url', params, {
|
||||
headers: { 'writer-code': writerCode },
|
||||
});
|
||||
};
|
||||
|
||||
@ -7,9 +7,8 @@ import TextOverTips from '@/components/text-over-tips';
|
||||
import ImgBox from './img-box';
|
||||
|
||||
import { formatFileSize, getVideoInfo, formatDuration, formatUploadSpeed } from '@/utils/tools';
|
||||
import { getProjectList } from '@/api/all/propertyMarketing';
|
||||
import { EnumManuscriptType } from '@/views/creative-generation-workshop/manuscript/list/constants.ts';
|
||||
import { getImagePreSignedUrl, getVideoPreSignedUrl } from '@/api/all/common';
|
||||
import { getVideoPreSignedUrlWriter, getImagePreSignedUrlWriter } from '@/api/all/generationWorkshop-writer';
|
||||
|
||||
// import icon1 from '@/assets/img/creative-generation-workshop/icon-close.png';
|
||||
|
||||
@ -56,6 +55,7 @@ export default {
|
||||
},
|
||||
emits: ['reValidate', 'change', 'update:modelValue', 'updateVideoInfo'],
|
||||
setup(props, { emit, expose }) {
|
||||
const route = useRoute();
|
||||
const formRef = ref(null);
|
||||
const formData = ref({});
|
||||
const uploadRef = ref(null);
|
||||
@ -65,6 +65,8 @@ export default {
|
||||
return match ? match[1].toLowerCase() : '';
|
||||
}
|
||||
const isVideo = computed(() => formData.value.type === EnumManuscriptType.Video);
|
||||
const writerCode = computed(() => route.params.writerCode);
|
||||
|
||||
const setVideoInfo = (file) => {
|
||||
formData.value.videoInfo.percent = 0;
|
||||
formData.value.videoInfo.name = file.name;
|
||||
@ -133,7 +135,7 @@ export default {
|
||||
} = option;
|
||||
setVideoInfo(file);
|
||||
|
||||
const response = await getVideoPreSignedUrl({ suffix: getFileExtension(file.name) });
|
||||
const response = await getVideoPreSignedUrlWriter(writerCode.value, { suffix: getFileExtension(file.name) });
|
||||
const { file_name, upload_url, file_url } = response?.data;
|
||||
if (!upload_url) {
|
||||
throw new Error('未能获取有效的预签名上传地址');
|
||||
@ -171,7 +173,7 @@ export default {
|
||||
return;
|
||||
}
|
||||
const { name, size, type } = file;
|
||||
const response = await getImagePreSignedUrl({ suffix: getFileExtension(name) });
|
||||
const response = await getImagePreSignedUrlWriter(writerCode.value, { suffix: getFileExtension(name) });
|
||||
const { file_name, upload_url, file_url } = response?.data;
|
||||
|
||||
const blob = new Blob([file], { type });
|
||||
|
||||
Reference in New Issue
Block a user