创建时间

This commit is contained in:
lq
2025-09-20 11:25:34 +08:00
parent c70b44022b
commit 15492d6d33
3 changed files with 85 additions and 68 deletions

View File

@ -61,6 +61,10 @@
</div>
<!-- 素材添加区域 -->
<div class="form-section material-section">
<div v-if="hasChose" class="flex items-center">
</div>
<div v-else class="flex flex-col items-center">
<Button class="add-material-btn" @click="handleAddMaterial">
<template #icon>
<icon-plus size="16" class="mr-8px" />
@ -70,6 +74,7 @@
<p class="material-hint">AI会参考添加的文本图片视频等素材完成符合需求的创作</p>
</div>
</div>
</div>
<div v-show="isActive == 'chose'">
<!-- 任务描述区域 -->
<div class="form-section">
@ -255,7 +260,6 @@ onMounted(() => {
handleSearch();
});
const handleSelect = (value) => {
console.log('++++++++++', value);
isActive.value = value;
};
const handleAddMaterial = () => {

View File

@ -1,33 +1,28 @@
<template>
<a-trigger trigger="click" position="bl">
<a-trigger trigger="click" position="br" @click.stop>
<div class="task-item">
<div class="w-4px h-18px rounded-2px" :style="{ background: getTaskColor() }"></div>
<div>{{ task?.name || '-' }}</div>
<div class="color-indicator" :style="{ background: getTaskColor() }"></div>
<div class="task-name" :title="task?.name || '-'">{{ task?.name || '-' }}</div>
</div>
<template #content>
<div
class="flex flex-col items-start"
style="background-color: #fff; box-shadow: #e6e6e8 0px 2px 8px; border-radius: 4px"
@click="gotoDetail"
>
<div class="flex flex-col items-start popup-content" @click="gotoDetail">
<div class="flex flex-col items-start p-16px w-full" @click="gotoDetail">
<div class="flex justify-between w-full items-center">
<div class="flex items-center">
<div class="flex items-center title-container">
<img
:src="getPlatformIcon(record.platform)"
style="border-radius: 8px; width: 16px; height: 16px; margin-right: 8px; font-size: 14px"
/>
<div style="font-size: 16px; font-style: medium; font-weight: 500">{{ record.name || '-' }}</div>
<div class="task-title" :title="record.name || '-'">{{ record.name || '-' }}</div>
</div>
<div
class="status-tag"
:style="{
color: getTaskColor(),
backgroundColor: getTaskColor() + '50',
padding: '2px 8px',
borderRadius: '4px',
}"
>
{{ getTaskStatusText(record.status) }}
{{ getTaskStatusText(task.status) }}
</div>
</div>
@ -36,13 +31,13 @@
</div>
</div>
<div class="font-size-14px color-#211F24 color-#211F24 p-12px" style="margin-top: -10px">
<div class="font-size-14px color-#211F24 color-#211F24 p-12px task-description" :title="task.name || '未命名'">
{{ task.name || '未命名' }}
</div>
<div class="flex items-center mt-12px w-full h-1px bg-#E6E6E8"></div>
<div class="flex items-center mt-12px mb-16px">
<div class="flex items-center mt-12px mb-16px action-buttons">
<div class="flex items-center mr-12px" @click.stop="handleDelete">
<icon-delete style="font-size: 20px; margin: 0px 22px" />
<icon-delete style="font-size: 20px; margin-left: 16px" />
</div>
<button class="opt-btn" @click.stop="handleTimeChange">修改发布时间</button>
<button class="opt-btn ml-12px opt-right mr-16px" @click.stop="handleAICreate">AI立即生成</button>
@ -70,6 +65,10 @@ const props = defineProps({
record: Object,
});
onMounted(() => {
console.log('props.task', props.task, props.record);
});
const isPanelVisible = ref(false);
const toggleTimePanel = () => {
isPanelVisible.value = !isPanelVisible.value;
@ -141,6 +140,7 @@ const getTaskColor = () => {
};
const getTaskStatusText = (status) => {
console.log('任务状态:', status);
switch (status) {
case 0:
return '待生成';
@ -164,12 +164,68 @@ const getTaskStatusText = (status) => {
display: flex;
align-items: center;
gap: 4px;
min-width: 0;
&:last-child {
margin-bottom: 0;
}
}
.color-indicator {
width: 4px;
height: 18px;
border-radius: 2px;
flex-shrink: 0;
}
.task-name {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
min-width: 0;
width: 0;
}
.popup-content {
width: 388px;
background-color: #fff;
box-shadow: #e6e6e8 0px 2px 8px;
border-radius: 4px;
}
.title-container {
flex: 1;
min-width: 0;
}
.task-title {
font-size: 16px;
font-weight: 500;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
flex: 1;
min-width: 0;
line-height: 1.2;
}
.task-description {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
line-height: 1.2;
flex: 1;
min-width: 0;
width: 365px;
}
.status-tag {
padding: 2px 8px;
border-radius: 4px;
flex-shrink: 0;
}
.opt-btn {
width: 154px;
height: 32px;

View File

@ -203,32 +203,10 @@ const platformOptions = ref(platformConfig.options);
const getPlatformIcon = (platform: number) => platformConfig.icons[platform] || iconWarn;
const getPlatformName = (platform: number) => platformConfig.names[platform] || '未知平台';
const getTaskColor = (taskType: number, executionTime: number) => {
const isExpired = executionTime * 1000 < Date.now();
return isExpired ? (taskType === 0 ? '#A794FE' : '#FFCF66') : taskType === 0 ? '#6d4cfe' : '#ffae00';
};
// const formatTaskName = (name: string) => {
// if (!name) return '未命名';
// return name.length > 8 ? name.substring(0, 8) + '...' : name;
// };
const timestampToDayNumber = (timestamp: number) => {
return new Date(timestamp * 1000).getDate();
};
// // 获取任务列表
// const handleSearch = async () => {
// const { data: accountData } = await fetchAccountOperators();
// const { data: mediaAccountData } = await getMediaAccountList();
// operators.value = accountData;
// accountList.value = mediaAccountData;
// };
// const timestampToTime = (timestamp: number): string => {
// const date = new Date(timestamp * 1000);
// return `${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}`;
// };
// 处理表格数据
const processTableData = (apiData: any[]) => {
const processedData: any[] = [];
@ -251,12 +229,7 @@ const processTableData = (apiData: any[]) => {
account.task_schedules.forEach((task: any) => {
const taskDay = timestampToDayNumber(task.execution_time);
if (dateHeaders.includes(taskDay)) {
rowData[taskDay].push({
id: task.id,
name: task.name,
type: task.type,
execution_time: task.execution_time,
});
rowData[taskDay].push(task);
}
});
}
@ -479,22 +452,6 @@ const handleRowClick = (record: any, index: number, event: Event) => {
drawerPopupRef.value.showDrawer(accountInfo);
};
// 处理表格行双击事件
const handleRowDblClick = (record: any, index: number, event: Event) => {
console.log('双击行:', record);
console.log('行索引:', index);
console.log('事件对象:', event);
// 双击行时打开创建任务弹窗并传递账号信息
if (drawerPopupRef.value) {
const accountInfo = {
id: record.id,
name: record.name,
platform: record.platform
};
drawerPopupRef.value.showDrawer(accountInfo);
}
};
// 任务操作处理
const handleTaskAction = (action: string, task: any, ...args: any[]) => {
switch (action) {