diff --git a/src/api/all/generationWorkshop-writer.ts b/src/api/all/generationWorkshop-writer.ts index 3485f8e..db522c5 100644 --- a/src/api/all/generationWorkshop-writer.ts +++ b/src/api/all/generationWorkshop-writer.ts @@ -3,131 +3,149 @@ */ import Http from '@/api'; +import { useRoute } from 'vue-router'; const getWriterCode = () => { const route = useRoute(); - return route.params.writerCode as string; + return route?.params?.writerCode as string; }; // 内容稿件-批量添加(写手) -export const postWorksBatchWriter = (params: {}) => { +export const postWorksBatchWriter = (params = {}, writerCode: string) => { return Http.post('/v1/writer/works/batch', params, { - headers: { 'writer-code': getWriterCode() }, + headers: { 'writer-code': writerCode }, }); }; // 内容稿件-分页(写手) -export const getWorksPageWriter = (params: {}) => { +export const getWorksPageWriter = (writerCode: string, params = {}) => { return Http.get('/v1/writer/works', params, { - headers: { 'writer-code': getWriterCode() }, + headers: { 'writer-code': writerCode }, }); }; // 内容稿件-详情(写手) -export const getWorksDetailWriter = (id: string) => { - return Http.get(`/v1/writer/works/${id}`, { - headers: { 'writer-code': getWriterCode() }, - }); +export const getWorksDetailWriter = (writerCode: string, id: string) => { + return Http.get( + `/v1/writer/works/${id}`, + {}, + { + headers: { 'writer-code': writerCode }, + }, + ); }; // 内容稿件-修改(写手) -export const putWorksUpdateWriter = (params = {}) => { +export const putWorksUpdateWriter = (writerCode: string, params = {}) => { const { id, ...rest } = params as { id: string; [key: string]: any }; return Http.put(`/v1/writer/works/${id}`, rest, { - headers: { 'writer-code': getWriterCode() }, + headers: { 'writer-code': writerCode }, }); }; // 内容稿件-删除(写手) -export const deleteWorkWriter = (id: string) => { +export const deleteWorkWriter = (writerCode: string, id: string) => { return Http.delete(`/v1/writer/works/${id}`, { - headers: { 'writer-code': getWriterCode() }, + headers: { 'writer-code': writerCode }, }); }; // 内容稿件-获取模板(写手) -export const getTemplateUrlWriter = () => { - return Http.get('/v1/writer/works/template', { - headers: { 'writer-code': getWriterCode() }, - }); +export const getTemplateUrlWriter = (writerCode: string) => { + return Http.get( + '/v1/writer/works/template', + {}, + { + headers: { 'writer-code': writerCode }, + }, + ); }; // 内容稿件审核-分页(写手) -export const getWorkAuditsPageWriter = (params: any) => { +export const getWorkAuditsPageWriter = (writerCode: string, params = {}) => { return Http.get('/v1/writer/work-audits', params, { - headers: { 'writer-code': getWriterCode() }, + headers: { 'writer-code': writerCode }, }); }; // 内容稿件审核-详情(写手) -export const getWorkAuditsDetailWriter = (id: string) => { - return Http.get(`/v1/writer/work-audits/${id}`, { - headers: { 'writer-code': getWriterCode() }, - }); +export const getWorkAuditsDetailWriter = (writerCode: string, id: string) => { + return Http.get( + `/v1/writer/work-audits/${id}`, + {}, + { + headers: { 'writer-code': writerCode }, + }, + ); }; // 内容稿件审核-多个详情(写手) -export const getWorkAuditsBatchDetailWriter = (params: any) => { +export const getWorkAuditsBatchDetailWriter = (writerCode: string, params = {}) => { return Http.get('/v1/writer/work-audits/list', params, { - headers: { 'writer-code': getWriterCode() }, + headers: { 'writer-code': writerCode }, }); }; // 内容稿件-审核(写手) -export const patchWorkAuditsAuditWriter = (id: string, params = {}) => { - return Http.patch(`/v1/writer/work-audits/${id}/audit`, params, { - headers: { 'writer-code': getWriterCode() }, - }); +export const patchWorkAuditsAuditWriter = (id: string, writerCode: string) => { + return Http.patch( + `/v1/writer/work-audits/${id}/audit`, + {}, + { + headers: { 'writer-code': writerCode }, + }, + ); }; // 内容稿件-批量审核(写手) -export const patchWorkAuditsBatchAuditWriter = (params: {}) => { +export const patchWorkAuditsBatchAuditWriter = (writerCode: string, params: {}) => { return Http.patch('/v1/writer/work-audits/batch-audit', params, { - headers: { 'writer-code': getWriterCode() }, + headers: { 'writer-code': writerCode }, }); }; // 内容稿件审核-修改(写手) -export const putWorkAuditsUpdateWriter = (params = {}) => { +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': getWriterCode() }, + headers: { 'writer-code': writerCode }, }); }; // 内容稿件审核-审核通过(写手) -export const putWorkAuditsAuditPassWriter = (params = {}) => { +export const putWorkAuditsAuditPassWriter = (writerCode: string, params = {}) => { const { id: auditId, ...rest } = params as { id: string; [key: string]: any }; return Http.put(`/v1/writer/work-audits/${auditId}/audit-pass`, rest, { - headers: { 'writer-code': getWriterCode() }, + headers: { 'writer-code': writerCode }, }); }; // 内容稿件审核-AI审查(写手) export const postWorkAuditsAiReviewWriter = (params = {}) => { - const { id: auditId, ...rest } = params as { id: string; [key: string]: any }; + const { id: auditId, writerCode, ...rest } = params as { id: string; writerCode: string; [key: string]: any }; return Http.post(`/v1/writer/work-audits/${auditId}/ai-review`, rest, { - headers: { 'writer-code': getWriterCode() }, + headers: { 'writer-code': writerCode }, }); }; // 内容稿件审核-获取AI审查结果(写手) -export const getWorkAuditsAiReviewResultWriter = (id: string, ticket: string) => { - return Http.get(`/v1/writer/work-audits/${id}/ai-review/${ticket}`, { - headers: { 'writer-code': getWriterCode() }, - }); +export const getWorkAuditsAiReviewResultWriter = (id: string, ticket: string, writerCode: string) => { + return Http.get( + `/v1/writer/work-audits/${id}/ai-review/${ticket}`, + {}, + { + headers: { 'writer-code': writerCode }, + }, + ); }; // 内容稿件-通过链接获取稿件 -export const postWorksByLinkWriter = (params = {}) => { +export const postWorksByLinkWriter = (writerCode: string, params = {}) => { return Http.post('/v1/writer/works/by-link', params, { - headers: { 'writer-code': getWriterCode() }, + headers: { 'writer-code': writerCode }, }); }; // 内容稿件-通过文档获取稿件 export const postWorksByFileWriter = (params = {}, config = {}) => { - return Http.post('/v1/writer/works/by-file', params, { - ...config, - headers: { 'writer-code': getWriterCode() }, - }); + return Http.post('/v1/writer/works/by-file', params, config); }; diff --git a/src/hooks/useGetAiReviewResult.ts b/src/hooks/useGetAiReviewResult.ts index d2f2f9b..188fd8c 100644 --- a/src/hooks/useGetAiReviewResult.ts +++ b/src/hooks/useGetAiReviewResult.ts @@ -6,18 +6,31 @@ export default function useGetAiReviewResult({ }: { cardInfo: any; updateAiReview: (ai_review: any) => void; - startAiReviewFn: (params: { id: string; platform: string; content: string }) => Promise; - getAiReviewResultFn: (id: string, ticket: string) => Promise; + startAiReviewFn: (params: { + id: string; + platform: string; + content: string; + writerCode: string | undefined; + }) => Promise; + getAiReviewResultFn: (id: string, ticket: string, writerCode: string | undefined) => Promise; }) { + const route = useRoute(); const statusPollingTimer = ref(null); const ticket = ref(''); const checkLoading = ref(false); const checkResult = ref({}); + const writerCode = computed(() => route.params.writerCode); + const handleStartCheck = async () => { checkLoading.value = true; const { id, platform, content } = cardInfo.value; - const { code, data } = await startAiReviewFn({ id, platform, content }); + const { code, data } = await startAiReviewFn({ + id, + platform, + content, + writerCode: writerCode.value as string | undefined, + }); if (code === 200) { ticket.value = data.ticket; startStatusPolling(); @@ -32,7 +45,11 @@ export default function useGetAiReviewResult({ const startStatusPolling = () => { clearStatusPollingTimer(); statusPollingTimer.value = setInterval(async () => { - const { code, data } = await getAiReviewResultFn(cardInfo.value.id, ticket.value); + const { code, data } = await getAiReviewResultFn( + cardInfo.value.id, + ticket.value, + writerCode.value as string | undefined, + ); if (code === 200 && data.status === 1) { checkResult.value = data.ai_review; updateAiReview?.(data.ai_review); diff --git a/src/views/creative-generation-workshop/manuscript-writer/check-list/components/manuscript-check-table/delete-manuscript-modal.vue b/src/views/creative-generation-workshop/manuscript-writer/check-list/components/manuscript-check-table/delete-manuscript-modal.vue index a7cdc71..8cc9527 100644 --- a/src/views/creative-generation-workshop/manuscript-writer/check-list/components/manuscript-check-table/delete-manuscript-modal.vue +++ b/src/views/creative-generation-workshop/manuscript-writer/check-list/components/manuscript-check-table/delete-manuscript-modal.vue @@ -1,19 +1,12 @@ @@ -24,12 +17,14 @@ import { deleteWorkWriter } from '@/api/all/generationWorkshop-writer.ts'; import icon1 from '@/assets/img/media-account/icon-warn-1.png'; const update = inject('update'); +const route = useRoute(); const visible = ref(false); const projectId = ref(null); const projectName = ref(''); const isBatch = computed(() => Array.isArray(projectId.value)); +const writerCode = computed(() => route.params.writerCode); function onClose() { visible.value = false; @@ -46,10 +41,10 @@ const open = (record) => { }; async function onDelete() { - const { code } = await deleteWorkWriter(projectId.value); + const { code } = await deleteWorkWriter(writerCode.value, projectId.value); if (code === 200) { AMessage.success('删除成功'); - update() + update(); onClose(); } } diff --git a/src/views/creative-generation-workshop/manuscript-writer/check-list/components/manuscript-check-table/index.vue b/src/views/creative-generation-workshop/manuscript-writer/check-list/components/manuscript-check-table/index.vue index 49905b0..73de974 100644 --- a/src/views/creative-generation-workshop/manuscript-writer/check-list/components/manuscript-check-table/index.vue +++ b/src/views/creative-generation-workshop/manuscript-writer/check-list/components/manuscript-check-table/index.vue @@ -74,9 +74,6 @@ }} - -