发布任务
This commit is contained in:
@ -100,7 +100,7 @@
|
||||
<div class="section-title">发布内容</div>
|
||||
<div class="font-size-12px text-[#999999]">(必填)</div>
|
||||
</div>
|
||||
<div class="form-section material-section">
|
||||
<div class="form-section material-section" v-if="hasChoseFinishedProducts == false">
|
||||
<Button @click="handleAddContent" class="add-material-btn">
|
||||
<template #icon>
|
||||
<icon-plus size="16" class="mr-8px" />
|
||||
@ -110,6 +110,12 @@
|
||||
|
||||
<p class="material-hint">前往成品库,选择要发布的内容</p>
|
||||
</div>
|
||||
<div v-else class="flex flex-col items-start w-full">
|
||||
<div class="mb-12px">{{ selectedProducts.data[0].title }}</div>
|
||||
<div v-for="item in selectedProducts.images" :key="item.id">
|
||||
<img v-if="item.cover" :src="item.cover" class="w-88 h-88 mr-8px border-rounded-8px mb-12px" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -188,11 +194,12 @@ import icon4 from '@/assets/img/error-img.png';
|
||||
// 引入子组件
|
||||
import RawMaterialDrawer from './raw-material-drawer.vue';
|
||||
import FinishedProductDrawer from './finished-product-drawer.vue';
|
||||
|
||||
import { message } from 'ant-design-vue';
|
||||
// 状态管理
|
||||
const choseText = ref('');
|
||||
const taskDescription = ref('');
|
||||
const hasChoseMaterial = ref(false);
|
||||
const hasChoseFinishedProducts = ref(false);
|
||||
const isActive = ref('ai');
|
||||
const showDriwer = ref(false);
|
||||
const showDrawer2 = ref(false);
|
||||
@ -310,6 +317,19 @@ const handleProductConfirm = (result) => {
|
||||
text: result.choseText,
|
||||
images: result.choseImgArray,
|
||||
};
|
||||
|
||||
// 如果是单选模式,确保只选择一个项目
|
||||
if (result.selectedRows && result.selectedRows.length > 0) {
|
||||
hasChoseFinishedProducts.value = true;
|
||||
// 取第一个选中的项目
|
||||
const selectedProduct = result.selectedRows[0];
|
||||
selectedProducts.value = {
|
||||
keys: [selectedProduct.id],
|
||||
data: [selectedProduct],
|
||||
text: '1个稿件',
|
||||
images: [selectedProduct],
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
// 处理成品库取消
|
||||
@ -360,12 +380,24 @@ watch(showDriwer, (newVal) => {
|
||||
// 点击创建任务按钮时触发
|
||||
const handleCreateTask = () => {
|
||||
// 验证表单
|
||||
if (isActive.value === 'chose' && selectedProducts.value.keys.length === 0) {
|
||||
if (localQuery.value.ids.length == 0) {
|
||||
// 可以添加错误提示:请选择发布内容
|
||||
console.log('请选择发布内容');
|
||||
message.error('请选择发布账号');
|
||||
return;
|
||||
}
|
||||
console.log('selectedMaterials', selectedMaterials.value);
|
||||
console.log('selectedProducts', selectedProducts.value);
|
||||
console.log('isActive', isActive.value);
|
||||
if (isActive.value === 'chose' && selectedProducts.value.keys.length === 0) {
|
||||
// 可以添加错误提示:请选择发布内容
|
||||
message.error('请选择发布内容');
|
||||
return;
|
||||
}
|
||||
if (isActive.value === 'ai' && selectedMaterials.value.keys.length === 0) {
|
||||
// 可以添加错误提示:请选择发布内容
|
||||
message.error('请选择发布内容');
|
||||
return;
|
||||
}
|
||||
console.log(localQuery.value);
|
||||
// 准备提交的数据
|
||||
const taskData = {
|
||||
media_account_id: localQuery.value.ids[0],
|
||||
@ -376,6 +408,7 @@ const handleCreateTask = () => {
|
||||
publish_type: publishType.value == 'immediate' ? 0 : 1,
|
||||
execution_time:
|
||||
publishType.value === 'timing' ? `${dayjs(currentDate.value).format('YYYY-MM-DD')} ${strValue.value}` : null,
|
||||
work_id: selectedProducts.value.keys[0],
|
||||
};
|
||||
// 发射创建任务事件
|
||||
emit('create-task', taskData);
|
||||
@ -445,6 +478,7 @@ defineExpose({
|
||||
align-items: center;
|
||||
width: 400px;
|
||||
border-radius: 8px;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.publish-section {
|
||||
|
||||
Reference in New Issue
Block a user