diff --git a/src/api/all/generationWorkshop-writer.ts b/src/api/all/generationWorkshop-writer.ts new file mode 100644 index 0000000..a2a1f98 --- /dev/null +++ b/src/api/all/generationWorkshop-writer.ts @@ -0,0 +1,128 @@ +/** + * 写手端接口 + */ + +import Http from '@/api'; + +// 内容稿件-批量添加(写手) +export const postWorksBatchWriter = (writerCode: string, data: any) => { + return Http.post('/v1/writer/works/batch', data, { + headers: { 'writer-code': writerCode }, + }); +}; + +// 内容稿件-分页(写手) +export const getWorksPageWriter = (writerCode: string, params: any) => { + return Http.get( + '/v1/writer/works', + { params }, + { + headers: { 'writer-code': writerCode }, + }, + ); +}; + +// 内容稿件-详情(写手) +export const getWorkDetailWriter = (writerCode: string, id: string) => { + return Http.get(`/v1/writer/works/${id}`, { + headers: { 'writer-code': writerCode }, + }); +}; + +// 内容稿件-修改(写手) +export const putWorksUpdateWriter = (params = {}) => { + const { id, writerCode, ...rest } = params as { id: string; writerCode: string; [key: string]: any }; + return Http.put(`/v1/writer/works/${id}`, rest, { + headers: { 'writer-code': writerCode }, + }); +}; + +// 内容稿件-删除(写手) +export const deleteWorkWriter = (writerCode: string, id: string) => { + return Http.delete(`/v1/writer/works/${id}`, { + headers: { 'writer-code': writerCode }, + }); +}; + +// 内容稿件-获取模板(写手) +export const getTemplateUrlWriter = (writerCode: string) => { + return Http.get('/v1/writer/works/template', { + headers: { 'writer-code': writerCode }, + }); +}; + +// 内容稿件审核-分页(写手) +export const getWorkAuditsPageWriter = (writerCode: string, params: any) => { + return Http.get( + '/v1/writer/work-audits', + { params }, + { + headers: { 'writer-code': writerCode }, + }, + ); +}; + +// 内容稿件审核-详情(写手) +export const getWorkAuditDetailWriter = (writerCode: string, id: string) => { + return Http.get(`/v1/writer/work-audits/${id}`, { + headers: { 'writer-code': writerCode }, + }); +}; + +// 内容稿件审核-多个详情(写手) +export const getWorkAuditsBatchDetailWriter = (writerCode: string, params: any) => { + return Http.get( + '/v1/writer/work-audits/list', + { params }, + { + headers: { 'writer-code': writerCode }, + }, + ); +}; + +// 内容稿件-审核(写手) +export const patchWorkAuditsAuditWriter = (writerCode: string, id: string, data: any) => { + return Http.patch(`/v1/writer/work-audits/${id}/audit`, data, { + headers: { 'writer-code': writerCode }, + }); +}; + +// 内容稿件-批量审核(写手) +export const patchWorkAuditsBatchAuditWriter = (writerCode: string, data: any) => { + return Http.patch('/v1/writer/work-audits/batch-audit', data, { + headers: { 'writer-code': writerCode }, + }); +}; + +// 内容稿件审核-修改(写手) +export const putWorkAuditsUpdateWriter = (writerCode: string, params = {}) => { + const { id: auditId, ...rest } = params as { id: string; [key: string]: any }; + return Http.put(`/v1/writer/work-audits/${auditId}`, rest, { + headers: { 'writer-code': writerCode }, + }); +}; + +// 内容稿件审核-审核通过(写手) +export const putWorkAuditsAuditPassWriter = (writerCode: string, id: string) => { + return Http.put( + `/v1/writer/work-audits/${id}/audit-pass`, + {}, + { + headers: { 'writer-code': writerCode }, + }, + ); +}; + +// 内容稿件审核-AI审查(写手) +export const postWorkAuditsAiReviewWriter = (writerCode: string, id: string, data: any) => { + return Http.post(`/v1/writer/work-audits/${id}/ai-review`, data, { + headers: { 'writer-code': writerCode }, + }); +}; + +// 内容稿件审核-获取AI审查结果(写手) +export const getWorkAuditsAiReviewResultWriter = (writerCode: string, id: string, ticket: string) => { + return Http.get(`/v1/writer/work-audits/${id}/ai-review/${ticket}`, { + headers: { 'writer-code': writerCode }, + }); +}; diff --git a/src/api/all/generationWorkshop.ts b/src/api/all/generationWorkshop.ts index e0c22cc..4787dda 100644 --- a/src/api/all/generationWorkshop.ts +++ b/src/api/all/generationWorkshop.ts @@ -16,8 +16,8 @@ export const postWorksByLink = (params = {}) => { }; // 内容稿件-通过文档获取稿件 -export const postWorksByFile = (params = {}) => { - return Http.post('/v1/works/by-file', params); +export const postWorksByFile = (params = {}, config = {}) => { + return Http.post('/v1/works/by-file', params, config); }; // 内容稿件-批量添加 diff --git a/src/router/routes/modules/creativeGenerationWorkshop.ts b/src/router/routes/modules/creativeGenerationWorkshop.ts index 92393fd..cbeeac1 100644 --- a/src/router/routes/modules/creativeGenerationWorkshop.ts +++ b/src/router/routes/modules/creativeGenerationWorkshop.ts @@ -11,8 +11,8 @@ const COMPONENTS: AppRouteRecordRaw[] = [ meta: { locale: '内容稿件', icon: IconContentManuscript, - requiresAuth: false, - requireLogin: false, + requiresAuth: true, + requireLogin: true, roles: ['*'], id: MENU_GROUP_IDS.CREATIVE_GENERATION_WORKSHOP_ID, }, @@ -22,8 +22,8 @@ const COMPONENTS: AppRouteRecordRaw[] = [ name: 'ManuscriptList', meta: { locale: '内容稿件列表', - requiresAuth: false, - requireLogin: false, + requiresAuth: true, + requireLogin: true, roles: ['*'], }, component: () => import('@/views/creative-generation-workshop/manuscript/list/index.vue'), @@ -33,8 +33,8 @@ const COMPONENTS: AppRouteRecordRaw[] = [ name: 'ManuscriptUpload', meta: { locale: '稿件上传', - requiresAuth: false, - requireLogin: false, + requiresAuth: true, + requireLogin: true, hideFooter: true, roles: ['*'], hideInMenu: true, @@ -47,8 +47,8 @@ const COMPONENTS: AppRouteRecordRaw[] = [ name: 'ManuscriptEdit', meta: { locale: '账号详情', - requiresAuth: false, - requireLogin: false, + requiresAuth: true, + requireLogin: true, hideFooter: true, roles: ['*'], hideInMenu: true, @@ -61,8 +61,8 @@ const COMPONENTS: AppRouteRecordRaw[] = [ name: 'ManuscriptDetail', meta: { locale: '稿件详情', - requiresAuth: false, - requireLogin: false, + requiresAuth: true, + requireLogin: true, hideFooter: true, roles: ['*'], hideInMenu: true, @@ -75,8 +75,8 @@ const COMPONENTS: AppRouteRecordRaw[] = [ name: 'ManuscriptCheckList', meta: { locale: '内容稿件审核', - requiresAuth: false, - requireLogin: false, + requiresAuth: true, + requireLogin: true, roles: ['*'], }, component: () => import('@/views/creative-generation-workshop/manuscript/check-list/index.vue'), @@ -86,8 +86,8 @@ const COMPONENTS: AppRouteRecordRaw[] = [ name: 'ManuscriptCheckListDetail', meta: { locale: '内容稿件审核详情', - requiresAuth: false, - requireLogin: false, + requiresAuth: true, + requireLogin: true, hideFooter: true, hideInMenu: true, roles: ['*'], @@ -100,8 +100,8 @@ const COMPONENTS: AppRouteRecordRaw[] = [ name: 'ManuscriptCheck', meta: { locale: '稿件审核', - requiresAuth: false, - requireLogin: false, + requiresAuth: true, + requireLogin: true, hideFooter: true, roles: ['*'], hideInMenu: true, diff --git a/src/router/routes/modules/manuscript-writer.ts b/src/router/routes/modules/manuscript-writer.ts new file mode 100644 index 0000000..69b2adb --- /dev/null +++ b/src/router/routes/modules/manuscript-writer.ts @@ -0,0 +1,115 @@ +import type { AppRouteRecordRaw } from '../types'; +import IconContentManuscript from '@/assets/svg/svg-contentManuscript.svg'; +import { MENU_GROUP_IDS } from '@/router/constants'; + +// 内容稿件-写手端 +const COMPONENTS: AppRouteRecordRaw[] = [ + { + path: '/writer/manuscript', + name: 'WriterManuscript', + redirect: 'writer/manuscript/list', + meta: { + locale: '内容稿件', + icon: IconContentManuscript, + requiresAuth: false, + requireLogin: false, + roles: ['*'], + id: MENU_GROUP_IDS.CREATIVE_GENERATION_WORKSHOP_ID, + }, + children: [ + { + path: 'list/:writerCode', + name: 'WriterManuscriptList', + meta: { + locale: '内容稿件列表', + requiresAuth: false, + requireLogin: false, + roles: ['*'], + }, + component: () => import('@/views/creative-generation-workshop/manuscript-writer/list/index.vue'), + }, + { + path: 'upload/:writerCode/:id', + name: 'WriterManuscriptUpload', + meta: { + locale: '稿件上传', + requiresAuth: false, + requireLogin: false, + hideFooter: true, + roles: ['*'], + hideInMenu: true, + activeMenu: 'WriterManuscriptList', + }, + component: () => import('@/views/creative-generation-workshop/manuscript-writer/upload/index.vue'), + }, + { + path: 'edit/:writerCode/:id', + name: 'WriterManuscriptEdit', + meta: { + locale: '账号详情', + requiresAuth: false, + requireLogin: false, + hideFooter: true, + roles: ['*'], + hideInMenu: true, + activeMenu: 'WriterManuscriptList', + }, + component: () => import('@/views/creative-generation-workshop/manuscript-writer/edit/index.vue'), + }, + { + path: 'detail/:writerCode/:id', + name: 'WriterManuscriptDetail', + meta: { + locale: '稿件详情', + requiresAuth: false, + requireLogin: false, + hideFooter: true, + roles: ['*'], + hideInMenu: true, + activeMenu: 'ManuscriptList', + }, + component: () => import('@/views/creative-generation-workshop/manuscript-writer/detail/index.vue'), + }, + { + path: 'check-list/:writerCode', + name: 'WriterManuscriptCheckList', + meta: { + locale: '内容稿件审核', + requiresAuth: false, + requireLogin: false, + roles: ['*'], + }, + component: () => import('@/views/creative-generation-workshop/manuscript-writer/check-list/index.vue'), + }, + { + path: 'check-list/detail/:id/:writerCode', + name: 'WriterManuscriptCheckListDetail', + meta: { + locale: '内容稿件审核详情', + requiresAuth: false, + requireLogin: false, + hideFooter: true, + hideInMenu: true, + roles: ['*'], + activeMenu: 'WriterManuscriptCheckList', + }, + component: () => import('@/views/creative-generation-workshop/manuscript-writer/detail/index.vue'), + }, + { + path: 'check/:writerCode', + name: 'WriterManuscriptCheck', + meta: { + locale: '稿件审核', + requiresAuth: false, + requireLogin: false, + hideFooter: true, + roles: ['*'], + hideInMenu: true, + activeMenu: 'WriterManuscriptCheckList', + }, + component: () => import('@/views/creative-generation-workshop/manuscript-writer/check/index.vue'), + }, + ], + }, +]; +export default COMPONENTS; diff --git a/src/views/creative-generation-workshop/manuscript/components/edit-form/index.vue b/src/views/creative-generation-workshop/manuscript/components/edit-form/index.vue index da6a2fd..4f483fb 100644 --- a/src/views/creative-generation-workshop/manuscript/components/edit-form/index.vue +++ b/src/views/creative-generation-workshop/manuscript/components/edit-form/index.vue @@ -212,7 +212,7 @@ export default { action="/" draggable custom-request={uploadVideo} - accept=".mp4,.webm,.ogg,.mov,.avi,.flv,.wmv,.mkv" + accept=".mp4,.mov,.avi,.flv,.wmv" show-file-list={false} > {{ @@ -386,10 +386,10 @@ export default { onInput={onChange} placeholder="请输入作品描述" size="large" - class="h-200px !w-784px" + class="h-300px !w-784px" show-word-limit max-length={1000} - auto-size={{ minRows: 7, maxRows: 9 }} + auto-size={{ minRows: 7, maxRows: 12 }} /> {isVideo.value ? renderVideo() : renderImage()} diff --git a/src/views/creative-generation-workshop/manuscript/list/components/upload-manuscript-modal/index.vue b/src/views/creative-generation-workshop/manuscript/list/components/upload-manuscript-modal/index.vue index e009548..2f7a4e8 100644 --- a/src/views/creative-generation-workshop/manuscript/list/components/upload-manuscript-modal/index.vue +++ b/src/views/creative-generation-workshop/manuscript/list/components/upload-manuscript-modal/index.vue @@ -12,7 +12,8 @@ import { Textarea, } from '@arco-design/web-vue'; import { useClipboard } from '@vueuse/core'; -import { getWriterLinksGenerate, getTemplateUrl } from '@/api/all/generationWorkshop'; +import { getWriterLinksGenerate, getTemplateUrl, postWorksByLink, postWorksByFile } from '@/api/all/generationWorkshop'; +import { generateFullUrl } from '@/utils/tools'; import TextOverTips from '@/components/text-over-tips'; import icon1 from '@/assets/img/media-account/icon-feedback-fail.png'; @@ -33,17 +34,10 @@ const UPLOAD_TYPE = { // 初始表单数据 const INITIAL_FORM = { - linkUrl: '', + link: '', writerLink: '', }; -// 模拟数据生成 -const generateMockData = (count = 20) => - Array.from({ length: count }, (_, i) => ({ - id: `item-${i + 1}`, - content: '挖到宝了!这个平价好物让我素颜出门都自信✨挖到宝了!这个平价好物让我素颜出门都自信✨', - })); - export default { setup(props, { emit, expose }) { const update = inject('update'); @@ -55,8 +49,7 @@ export default { const uploadType = ref(UPLOAD_TYPE.LINK); const taskStatus = ref(TASK_STATUS.DEFAULT); const form = ref(cloneDeep(INITIAL_FORM)); - const uploadList = ref([]); - const totalCount = ref(0); + const works = ref([]); // 剪贴板功能 const { copy } = useClipboard({ source: form.value.writerLink }); @@ -83,26 +76,18 @@ export default { uploadType.value = UPLOAD_TYPE.LINK; taskStatus.value = TASK_STATUS.DEFAULT; form.value = cloneDeep(INITIAL_FORM); - uploadList.value = []; - totalCount.value = 0; + works.value = []; }; const getWriterLink = async () => { - const data = { - code: 1, - }; - const url = new URL(window.location.href); - url.searchParams.set('writer_code', data.code); - form.value.writerLink = url.toString(); - console.log('getWriterLinksGenerate -----writer-code---->', form.value.writerLink); - - // const { code, data } = await getWriterLinksGenerate(); - // if (code === 200) { - // const url = new URL(window.location.href); - // url.searchParams.set('writer_code', data.code); - // form.value.writerLink = url.toString(); - // console.log('getWriterLinksGenerate -----writer-code---->', form.value.writerLink); - // } + const { code, data } = await getWriterLinksGenerate(); + if (code === 200) { + const url = router.resolve({ + path: `/writer/manuscript/list/${data.code}`, + }).href; + form.value.writerLink = generateFullUrl(url); + console.log('getWriterLinksGenerate -----writer-code---->', form.value.writerLink); + } }; const open = () => { @@ -121,15 +106,17 @@ export default { handleHandwriteSubmit(); return; } - - taskStatus.value = TASK_STATUS.LOADING; - - // 模拟上传过程 - setTimeout(() => { - taskStatus.value = TASK_STATUS.SUCCESS; - totalCount.value = 30; - uploadList.value = generateMockData(); - }, 2000); + formRef.value?.validate(async (errors) => { + if (!errors) { + taskStatus.value = TASK_STATUS.LOADING; + const { link } = form.value; + const { code, data } = await postWorksByLink({ link }); + if (code === 200) { + taskStatus.value = TASK_STATUS.SUCCESS; + works.value = data; + } + } + }); }, 300); // 提交处理 @@ -156,15 +143,28 @@ export default { }; // 文件上传处理 - const handleUpload = async (file) => { - console.log('handleUpload', file); - taskStatus.value = TASK_STATUS.LOADING; + const handleUpload = async (option) => { + try { + taskStatus.value = TASK_STATUS.LOADING; - setTimeout(() => { - taskStatus.value = TASK_STATUS.SUCCESS; - totalCount.value = 30; - uploadList.value = generateMockData(); - }, 2000); + const { + fileItem: { file }, + } = option; + + const formData = new FormData(); + formData.append('file', file); + const { code, data } = await postWorksByFile(formData, { + headers: { + 'Content-Type': 'multipart/form-data', + }, + }); + if (code === 200) { + taskStatus.value = TASK_STATUS.SUCCESS; + works.value = data; + } + } finally { + taskStatus.value = TASK_STATUS.DEFAULT; + } }; // 跳转编辑 @@ -174,11 +174,9 @@ export default { }; // 删除项目 - const onDelete = (item) => { - console.log('onDelete', item); - uploadList.value = uploadList.value.filter((i) => i.id !== item.id); - totalCount.value = uploadList.value.length; - AMessage.success('删除成功'); + const onDelete = (index) => { + works.value.splice(index, 1); + // AMessage.success('删除成功'); }; // 上传方式切换 @@ -200,11 +198,11 @@ export default { // 渲染链接上传表单 const renderLinkForm = () => ( - +