修改创建任务
This commit is contained in:
@ -24,6 +24,7 @@
|
||||
:maxTagCount="999"
|
||||
popup-container=".filter-popup-content"
|
||||
/>
|
||||
|
||||
<div class="ai-content-generator">
|
||||
<div class="flex mt-16px">
|
||||
<Button
|
||||
@ -204,7 +205,17 @@ 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';
|
||||
import { fetchAccountOperators, getMediaAccountList } from '@/api/all/propertyMarketing';
|
||||
import { getMediaAccountList } from '@/api/all/propertyMarketing';
|
||||
// 平台图标
|
||||
import iconDy from '@/assets/img/platform/icon-dy.png';
|
||||
import iconXhs from '@/assets/img/platform/icon-xhs.png';
|
||||
import iconBilibili from '@/assets/img/platform/icon-bilibili.png';
|
||||
import iconKs from '@/assets/img/platform/icon-ks.png';
|
||||
import iconSph from '@/assets/img/platform/icon-sph.png';
|
||||
import iconWb from '@/assets/img/platform/icon-wb.png';
|
||||
import iconGzh from '@/assets/img/platform/icon-gzh.png';
|
||||
import iconWarn from '@/assets/img/media-account/icon-warn.png';
|
||||
|
||||
// 状态管理
|
||||
const choseText = ref('');
|
||||
const taskDescription = ref('');
|
||||
@ -219,10 +230,38 @@ onMounted(() => {
|
||||
getData();
|
||||
});
|
||||
|
||||
// 平台配置
|
||||
const platformConfig = {
|
||||
icons: { 0: iconDy, 1: iconXhs, 2: iconBilibili, 3: iconKs, 4: iconSph, 5: iconWb, 6: iconGzh },
|
||||
names: { 0: '抖音', 1: '小红书', 2: 'B站', 3: '快手', 4: '视频号', 5: '微博', 6: '公众号' },
|
||||
options: [
|
||||
{ id: 0, name: '抖音', icon: iconDy },
|
||||
{ id: 1, name: '小红书', icon: iconXhs },
|
||||
{ id: 2, name: 'B站', icon: iconBilibili },
|
||||
{ id: 3, name: '快手', icon: iconKs },
|
||||
{ id: 4, name: '视频号', icon: iconSph },
|
||||
{ id: 5, name: '微博', icon: iconWb },
|
||||
{ id: 6, name: '公众号', icon: iconGzh },
|
||||
],
|
||||
};
|
||||
const platformOptions = ref(platformConfig.options);
|
||||
|
||||
// 工具函数
|
||||
const getPlatformIcon = (platform: number) => platformConfig.icons[platform] || iconWarn;
|
||||
const getPlatformName = (platform: number) => platformConfig.names[platform] || '未知平台';
|
||||
const getData = async () => {
|
||||
const res = await fetchAccountOperators();
|
||||
if (res.code === 200) {
|
||||
accountList.value = res.data;
|
||||
try {
|
||||
const { code, data: accountData } = await getMediaAccountList();
|
||||
if (code === 200) {
|
||||
accountList.value = accountData.map((account: any) => ({
|
||||
value: account.id,
|
||||
name: `${account.name}(${getPlatformName(account.platform)})`,
|
||||
platform: account.platform,
|
||||
icon: getPlatformIcon(account.platform),
|
||||
}));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('获取账号列表失败:', error);
|
||||
}
|
||||
};
|
||||
// 发布类型选项
|
||||
@ -414,9 +453,6 @@ const handleCreateTask = () => {
|
||||
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('请选择发布内容');
|
||||
@ -436,7 +472,7 @@ const handleCreateTask = () => {
|
||||
products: selectedProducts.value.keys,
|
||||
publish_type: publishType.value == 'immediate' ? 0 : 1,
|
||||
execution_time:
|
||||
publishType.value === 'timing' ? `${dayjs(currentDate.value).format('YYYY-MM-DD')} ${strValue.value}` : null,
|
||||
publishType.value === 'timing' ? `${dayjs(currentDate.value).format('YYYY-MM-DD')} ${strValue.value}` : undefined,
|
||||
work_id: selectedProducts.value.keys[0],
|
||||
};
|
||||
// 发射创建任务事件
|
||||
|
||||
@ -72,11 +72,8 @@
|
||||
<icon-delete style="font-size: 20px; margin-left: 0" />
|
||||
</div>
|
||||
<div class="flex w-full" :class="{ 'justify-between': task.ai_generate_status == 0 }">
|
||||
<!-- <button class="opt-btn" :class="{ 'flex-1': task.ai_generate_status != 0 }" @click.stop="handleTimeChange">
|
||||
修改发布时间
|
||||
</button> -->
|
||||
<a-date-picker
|
||||
v-model:value="datePickerValue"
|
||||
v-model="datePickerValue"
|
||||
placeholder="修改发布时间"
|
||||
:show-time="{ format: 'HH:mm' }"
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
@ -200,7 +197,7 @@ const timestampToTime1 = (timestamp: number): string => {
|
||||
if (!timestamp) {
|
||||
timestamp = Date.now() / 1000; // 使用秒级时间戳保持一致性
|
||||
}
|
||||
|
||||
|
||||
const date = new Date(timestamp * 1000);
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, '0'); // 补零
|
||||
|
||||
Reference in New Issue
Block a user