perf: 修改路由配置、新增写手路由
This commit is contained in:
128
src/api/all/generationWorkshop-writer.ts
Normal file
128
src/api/all/generationWorkshop-writer.ts
Normal file
@ -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 },
|
||||||
|
});
|
||||||
|
};
|
||||||
@ -16,8 +16,8 @@ export const postWorksByLink = (params = {}) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 内容稿件-通过文档获取稿件
|
// 内容稿件-通过文档获取稿件
|
||||||
export const postWorksByFile = (params = {}) => {
|
export const postWorksByFile = (params = {}, config = {}) => {
|
||||||
return Http.post('/v1/works/by-file', params);
|
return Http.post('/v1/works/by-file', params, config);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 内容稿件-批量添加
|
// 内容稿件-批量添加
|
||||||
|
|||||||
@ -11,8 +11,8 @@ const COMPONENTS: AppRouteRecordRaw[] = [
|
|||||||
meta: {
|
meta: {
|
||||||
locale: '内容稿件',
|
locale: '内容稿件',
|
||||||
icon: IconContentManuscript,
|
icon: IconContentManuscript,
|
||||||
requiresAuth: false,
|
requiresAuth: true,
|
||||||
requireLogin: false,
|
requireLogin: true,
|
||||||
roles: ['*'],
|
roles: ['*'],
|
||||||
id: MENU_GROUP_IDS.CREATIVE_GENERATION_WORKSHOP_ID,
|
id: MENU_GROUP_IDS.CREATIVE_GENERATION_WORKSHOP_ID,
|
||||||
},
|
},
|
||||||
@ -22,8 +22,8 @@ const COMPONENTS: AppRouteRecordRaw[] = [
|
|||||||
name: 'ManuscriptList',
|
name: 'ManuscriptList',
|
||||||
meta: {
|
meta: {
|
||||||
locale: '内容稿件列表',
|
locale: '内容稿件列表',
|
||||||
requiresAuth: false,
|
requiresAuth: true,
|
||||||
requireLogin: false,
|
requireLogin: true,
|
||||||
roles: ['*'],
|
roles: ['*'],
|
||||||
},
|
},
|
||||||
component: () => import('@/views/creative-generation-workshop/manuscript/list/index.vue'),
|
component: () => import('@/views/creative-generation-workshop/manuscript/list/index.vue'),
|
||||||
@ -33,8 +33,8 @@ const COMPONENTS: AppRouteRecordRaw[] = [
|
|||||||
name: 'ManuscriptUpload',
|
name: 'ManuscriptUpload',
|
||||||
meta: {
|
meta: {
|
||||||
locale: '稿件上传',
|
locale: '稿件上传',
|
||||||
requiresAuth: false,
|
requiresAuth: true,
|
||||||
requireLogin: false,
|
requireLogin: true,
|
||||||
hideFooter: true,
|
hideFooter: true,
|
||||||
roles: ['*'],
|
roles: ['*'],
|
||||||
hideInMenu: true,
|
hideInMenu: true,
|
||||||
@ -47,8 +47,8 @@ const COMPONENTS: AppRouteRecordRaw[] = [
|
|||||||
name: 'ManuscriptEdit',
|
name: 'ManuscriptEdit',
|
||||||
meta: {
|
meta: {
|
||||||
locale: '账号详情',
|
locale: '账号详情',
|
||||||
requiresAuth: false,
|
requiresAuth: true,
|
||||||
requireLogin: false,
|
requireLogin: true,
|
||||||
hideFooter: true,
|
hideFooter: true,
|
||||||
roles: ['*'],
|
roles: ['*'],
|
||||||
hideInMenu: true,
|
hideInMenu: true,
|
||||||
@ -61,8 +61,8 @@ const COMPONENTS: AppRouteRecordRaw[] = [
|
|||||||
name: 'ManuscriptDetail',
|
name: 'ManuscriptDetail',
|
||||||
meta: {
|
meta: {
|
||||||
locale: '稿件详情',
|
locale: '稿件详情',
|
||||||
requiresAuth: false,
|
requiresAuth: true,
|
||||||
requireLogin: false,
|
requireLogin: true,
|
||||||
hideFooter: true,
|
hideFooter: true,
|
||||||
roles: ['*'],
|
roles: ['*'],
|
||||||
hideInMenu: true,
|
hideInMenu: true,
|
||||||
@ -75,8 +75,8 @@ const COMPONENTS: AppRouteRecordRaw[] = [
|
|||||||
name: 'ManuscriptCheckList',
|
name: 'ManuscriptCheckList',
|
||||||
meta: {
|
meta: {
|
||||||
locale: '内容稿件审核',
|
locale: '内容稿件审核',
|
||||||
requiresAuth: false,
|
requiresAuth: true,
|
||||||
requireLogin: false,
|
requireLogin: true,
|
||||||
roles: ['*'],
|
roles: ['*'],
|
||||||
},
|
},
|
||||||
component: () => import('@/views/creative-generation-workshop/manuscript/check-list/index.vue'),
|
component: () => import('@/views/creative-generation-workshop/manuscript/check-list/index.vue'),
|
||||||
@ -86,8 +86,8 @@ const COMPONENTS: AppRouteRecordRaw[] = [
|
|||||||
name: 'ManuscriptCheckListDetail',
|
name: 'ManuscriptCheckListDetail',
|
||||||
meta: {
|
meta: {
|
||||||
locale: '内容稿件审核详情',
|
locale: '内容稿件审核详情',
|
||||||
requiresAuth: false,
|
requiresAuth: true,
|
||||||
requireLogin: false,
|
requireLogin: true,
|
||||||
hideFooter: true,
|
hideFooter: true,
|
||||||
hideInMenu: true,
|
hideInMenu: true,
|
||||||
roles: ['*'],
|
roles: ['*'],
|
||||||
@ -100,8 +100,8 @@ const COMPONENTS: AppRouteRecordRaw[] = [
|
|||||||
name: 'ManuscriptCheck',
|
name: 'ManuscriptCheck',
|
||||||
meta: {
|
meta: {
|
||||||
locale: '稿件审核',
|
locale: '稿件审核',
|
||||||
requiresAuth: false,
|
requiresAuth: true,
|
||||||
requireLogin: false,
|
requireLogin: true,
|
||||||
hideFooter: true,
|
hideFooter: true,
|
||||||
roles: ['*'],
|
roles: ['*'],
|
||||||
hideInMenu: true,
|
hideInMenu: true,
|
||||||
|
|||||||
115
src/router/routes/modules/manuscript-writer.ts
Normal file
115
src/router/routes/modules/manuscript-writer.ts
Normal file
@ -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;
|
||||||
@ -212,7 +212,7 @@ export default {
|
|||||||
action="/"
|
action="/"
|
||||||
draggable
|
draggable
|
||||||
custom-request={uploadVideo}
|
custom-request={uploadVideo}
|
||||||
accept=".mp4,.webm,.ogg,.mov,.avi,.flv,.wmv,.mkv"
|
accept=".mp4,.mov,.avi,.flv,.wmv"
|
||||||
show-file-list={false}
|
show-file-list={false}
|
||||||
>
|
>
|
||||||
{{
|
{{
|
||||||
@ -386,10 +386,10 @@ export default {
|
|||||||
onInput={onChange}
|
onInput={onChange}
|
||||||
placeholder="请输入作品描述"
|
placeholder="请输入作品描述"
|
||||||
size="large"
|
size="large"
|
||||||
class="h-200px !w-784px"
|
class="h-300px !w-784px"
|
||||||
show-word-limit
|
show-word-limit
|
||||||
max-length={1000}
|
max-length={1000}
|
||||||
auto-size={{ minRows: 7, maxRows: 9 }}
|
auto-size={{ minRows: 7, maxRows: 12 }}
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
{isVideo.value ? renderVideo() : renderImage()}
|
{isVideo.value ? renderVideo() : renderImage()}
|
||||||
|
|||||||
@ -12,7 +12,8 @@ import {
|
|||||||
Textarea,
|
Textarea,
|
||||||
} from '@arco-design/web-vue';
|
} from '@arco-design/web-vue';
|
||||||
import { useClipboard } from '@vueuse/core';
|
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 TextOverTips from '@/components/text-over-tips';
|
||||||
import icon1 from '@/assets/img/media-account/icon-feedback-fail.png';
|
import icon1 from '@/assets/img/media-account/icon-feedback-fail.png';
|
||||||
@ -33,17 +34,10 @@ const UPLOAD_TYPE = {
|
|||||||
|
|
||||||
// 初始表单数据
|
// 初始表单数据
|
||||||
const INITIAL_FORM = {
|
const INITIAL_FORM = {
|
||||||
linkUrl: '',
|
link: '',
|
||||||
writerLink: '',
|
writerLink: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
// 模拟数据生成
|
|
||||||
const generateMockData = (count = 20) =>
|
|
||||||
Array.from({ length: count }, (_, i) => ({
|
|
||||||
id: `item-${i + 1}`,
|
|
||||||
content: '挖到宝了!这个平价好物让我素颜出门都自信✨挖到宝了!这个平价好物让我素颜出门都自信✨',
|
|
||||||
}));
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
setup(props, { emit, expose }) {
|
setup(props, { emit, expose }) {
|
||||||
const update = inject('update');
|
const update = inject('update');
|
||||||
@ -55,8 +49,7 @@ export default {
|
|||||||
const uploadType = ref(UPLOAD_TYPE.LINK);
|
const uploadType = ref(UPLOAD_TYPE.LINK);
|
||||||
const taskStatus = ref(TASK_STATUS.DEFAULT);
|
const taskStatus = ref(TASK_STATUS.DEFAULT);
|
||||||
const form = ref(cloneDeep(INITIAL_FORM));
|
const form = ref(cloneDeep(INITIAL_FORM));
|
||||||
const uploadList = ref([]);
|
const works = ref([]);
|
||||||
const totalCount = ref(0);
|
|
||||||
|
|
||||||
// 剪贴板功能
|
// 剪贴板功能
|
||||||
const { copy } = useClipboard({ source: form.value.writerLink });
|
const { copy } = useClipboard({ source: form.value.writerLink });
|
||||||
@ -83,26 +76,18 @@ export default {
|
|||||||
uploadType.value = UPLOAD_TYPE.LINK;
|
uploadType.value = UPLOAD_TYPE.LINK;
|
||||||
taskStatus.value = TASK_STATUS.DEFAULT;
|
taskStatus.value = TASK_STATUS.DEFAULT;
|
||||||
form.value = cloneDeep(INITIAL_FORM);
|
form.value = cloneDeep(INITIAL_FORM);
|
||||||
uploadList.value = [];
|
works.value = [];
|
||||||
totalCount.value = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getWriterLink = async () => {
|
const getWriterLink = async () => {
|
||||||
const data = {
|
const { code, data } = await getWriterLinksGenerate();
|
||||||
code: 1,
|
if (code === 200) {
|
||||||
};
|
const url = router.resolve({
|
||||||
const url = new URL(window.location.href);
|
path: `/writer/manuscript/list/${data.code}`,
|
||||||
url.searchParams.set('writer_code', data.code);
|
}).href;
|
||||||
form.value.writerLink = url.toString();
|
form.value.writerLink = generateFullUrl(url);
|
||||||
console.log('getWriterLinksGenerate -----writer-code---->', form.value.writerLink);
|
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 open = () => {
|
const open = () => {
|
||||||
@ -121,15 +106,17 @@ export default {
|
|||||||
handleHandwriteSubmit();
|
handleHandwriteSubmit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
formRef.value?.validate(async (errors) => {
|
||||||
taskStatus.value = TASK_STATUS.LOADING;
|
if (!errors) {
|
||||||
|
taskStatus.value = TASK_STATUS.LOADING;
|
||||||
// 模拟上传过程
|
const { link } = form.value;
|
||||||
setTimeout(() => {
|
const { code, data } = await postWorksByLink({ link });
|
||||||
taskStatus.value = TASK_STATUS.SUCCESS;
|
if (code === 200) {
|
||||||
totalCount.value = 30;
|
taskStatus.value = TASK_STATUS.SUCCESS;
|
||||||
uploadList.value = generateMockData();
|
works.value = data;
|
||||||
}, 2000);
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}, 300);
|
}, 300);
|
||||||
|
|
||||||
// 提交处理
|
// 提交处理
|
||||||
@ -156,15 +143,28 @@ export default {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 文件上传处理
|
// 文件上传处理
|
||||||
const handleUpload = async (file) => {
|
const handleUpload = async (option) => {
|
||||||
console.log('handleUpload', file);
|
try {
|
||||||
taskStatus.value = TASK_STATUS.LOADING;
|
taskStatus.value = TASK_STATUS.LOADING;
|
||||||
|
|
||||||
setTimeout(() => {
|
const {
|
||||||
taskStatus.value = TASK_STATUS.SUCCESS;
|
fileItem: { file },
|
||||||
totalCount.value = 30;
|
} = option;
|
||||||
uploadList.value = generateMockData();
|
|
||||||
}, 2000);
|
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) => {
|
const onDelete = (index) => {
|
||||||
console.log('onDelete', item);
|
works.value.splice(index, 1);
|
||||||
uploadList.value = uploadList.value.filter((i) => i.id !== item.id);
|
// AMessage.success('删除成功');
|
||||||
totalCount.value = uploadList.value.length;
|
|
||||||
AMessage.success('删除成功');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 上传方式切换
|
// 上传方式切换
|
||||||
@ -200,11 +198,11 @@ export default {
|
|||||||
|
|
||||||
// 渲染链接上传表单
|
// 渲染链接上传表单
|
||||||
const renderLinkForm = () => (
|
const renderLinkForm = () => (
|
||||||
<FormItem label="链接地址">
|
<FormItem label="链接地址" field="link" required>
|
||||||
<Textarea
|
<Textarea
|
||||||
v-model={form.value.linkUrl}
|
v-model={form.value.link}
|
||||||
size="large"
|
size="large"
|
||||||
placeholder="请输入..."
|
placeholder="请输入链接地址"
|
||||||
autoSize={{ minRows: 5, maxRows: 8 }}
|
autoSize={{ minRows: 5, maxRows: 8 }}
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
@ -212,8 +210,8 @@ export default {
|
|||||||
|
|
||||||
// 渲染手写上传表单
|
// 渲染手写上传表单
|
||||||
const renderHandwriteForm = () => (
|
const renderHandwriteForm = () => (
|
||||||
<FormItem label="上传链接">
|
<FormItem label="上传链接" field="writerLink">
|
||||||
<Input v-model={form.value.writerLink} placeholder="请输入..." disabled size="large" />
|
<Input v-model={form.value.writerLink} placeholder="请输入上传链接" disabled size="large" />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -267,18 +265,18 @@ export default {
|
|||||||
// 渲染成功状态
|
// 渲染成功状态
|
||||||
const renderSuccessState = () => (
|
const renderSuccessState = () => (
|
||||||
<div class="flex flex-col py-12px max-h-540px rounded-8px bg-#F7F8FA">
|
<div class="flex flex-col py-12px max-h-540px rounded-8px bg-#F7F8FA">
|
||||||
<span class="tip mb-8px px-12px fs-14px !text-left">共 {totalCount.value} 个内容稿件</span>
|
<span class="tip mb-8px px-12px fs-14px !text-left">共 {works.value.length} 个内容稿件</span>
|
||||||
<div class="flex-1 overflow-y-auto overflow-x-hidden px-12px">
|
<div class="flex-1 overflow-y-auto overflow-x-hidden px-12px">
|
||||||
{uploadList.value.map((item) => (
|
{works.value.map((item, index) => (
|
||||||
<div key={item.id} class="rounded-8px bg-#fff px-8px py-8px flex justify-between items-center mt-8px">
|
<div key={item.id} class="rounded-8px bg-#fff px-8px py-8px flex justify-between items-center mt-8px">
|
||||||
<div class="flex-1 overflow-hidden flex items-center mr-12px">
|
<div class="flex-1 overflow-hidden flex items-center mr-12px">
|
||||||
<img width="32" height="32" class="rounded-3px mr-8px" />
|
<img src={item.cover} width="32" height="32" class="rounded-3px mr-8px" />
|
||||||
<TextOverTips class="text" context={item.content} />
|
<TextOverTips class="text" context={item.title} />
|
||||||
</div>
|
</div>
|
||||||
<icon-delete
|
<icon-delete
|
||||||
size="16px"
|
size="16px"
|
||||||
class="color-#737478 cursor-pointer hover:!color-#211F24"
|
class="color-#737478 cursor-pointer hover:!color-#211F24"
|
||||||
onClick={() => onDelete(item)}
|
onClick={() => onDelete(index)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
@ -364,7 +362,15 @@ export default {
|
|||||||
footer: () => renderFooterButtons(),
|
footer: () => renderFooterButtons(),
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Form ref="formRef" model={form.value} layout="horizontal" auto-label-width>
|
<Form
|
||||||
|
ref={formRef}
|
||||||
|
rules={{
|
||||||
|
link: [{ required: true, message: '请输入链接地址' }],
|
||||||
|
}}
|
||||||
|
model={form.value}
|
||||||
|
layout="horizontal"
|
||||||
|
auto-label-width
|
||||||
|
>
|
||||||
{isDefault.value && (
|
{isDefault.value && (
|
||||||
<FormItem label="上传方式">
|
<FormItem label="上传方式">
|
||||||
<RadioGroup v-model={uploadType.value} onChange={onUploadTypeChange}>
|
<RadioGroup v-model={uploadType.value} onChange={onUploadTypeChange}>
|
||||||
|
|||||||
Reference in New Issue
Block a user