Version: 0.9.81.dev.260506
后端: 1. Credit 价格规则补齐利润率与实际计费单价语义:新增 `profit_rate_bps` 与 `charge_*_price_micros` 展示字段,下沉共享价格推导 helper,tokenstore rpc/client/proto/model/default rule 全链路同步,LLM usage 扣费统一改按加价后的 charge 单价换算。 2. task-class 更新链路修正全量覆盖与归属校验:`runtime/conv` 保留 item id,DAO 更新前显式校验 task-class 与 item 归属,改用显式字段 map 落库 nil/空切片/零值,避免 `RowsAffected=0` 误判越权,同时补齐任务项可编辑字段更新。 3. GormCache task-class 失效补空 user_id 保护:更新语句缺少模型上下文时直接跳过失效,避免缓存插件因空指针影响主事务。 前端: 4. 课表中心补齐任务类编辑能力:新增 `updateTaskClass` API,创建弹窗支持编辑态回填与 item id 提交,日程页支持先拉详情再编辑并在保存后刷新任务类详情与列表。 5. 计划广场详情补点赞交互与奖励提示:详情页新增点赞/取消点赞按钮、奖励反馈文案与计数展示,论坛类型补 `reward_hint`,评论区与帖子作者头像统一接入兜底头像工具。 6. 品牌与展示细节收口:侧边栏与 favicon 切到项目 logo,首页标题改为 `SmartMate`,主面板缩放上限微调,论坛列表头像显示与整体品牌观感同步统一。
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="icon" href="https://dl2.lecspace.com/SmartFlow-Agent/logo.png" />
|
||||
<title>SmartMate</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -181,3 +181,19 @@ export async function importCourses(payload: CourseImportPayload, idempotencyKey
|
||||
throw new Error(extractErrorMessage(error, '\u8bfe\u7a0b\u5bfc\u5165\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u91cd\u8bd5'))
|
||||
}
|
||||
}
|
||||
|
||||
export async function updateTaskClass(taskClassId: number, payload: TaskClassCreatePayload, idempotencyKey = createIdempotencyKey('task-class-update')) {
|
||||
try {
|
||||
const response = await http.put<PlainResponse>('/task-class/update', payload, {
|
||||
params: {
|
||||
task_class_id: taskClassId,
|
||||
},
|
||||
headers: {
|
||||
'X-Idempotency-Key': idempotencyKey,
|
||||
},
|
||||
})
|
||||
return response.data
|
||||
} catch (error) {
|
||||
throw new Error(extractErrorMessage(error, '更新任务类失败,请稍后重试'))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,9 @@ function handleSidebarNavigate(item: SidebarItem) {
|
||||
|
||||
<template>
|
||||
<aside class="dashboard-sidebar">
|
||||
<div class="dashboard-sidebar__brand">S</div>
|
||||
<div class="dashboard-sidebar__brand">
|
||||
<img src="https://dl2.lecspace.com/SmartFlow-Agent/logo.png" alt="SmartFlow" />
|
||||
</div>
|
||||
<nav class="dashboard-sidebar__nav">
|
||||
<div class="dashboard-sidebar__nav-indicator" :style="activeIndicatorStyle" />
|
||||
<button
|
||||
@@ -89,13 +91,17 @@ function handleSidebarNavigate(item: SidebarItem) {
|
||||
height: 48px;
|
||||
border-radius: 14px;
|
||||
background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
|
||||
color: #fff;
|
||||
font-size: 20px;
|
||||
font-weight: 800;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.dashboard-sidebar__brand img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.dashboard-sidebar__nav { position: relative; display: grid; gap: 12px; align-content: start; }
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import { reactive, watch } from 'vue'
|
||||
import { computed, reactive, watch } from 'vue'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
import type { TaskClassCreatePayload, TaskClassCreateItemPayload } from '@/types/schedule'
|
||||
import type { TaskClassCreatePayload, TaskClassCreateItemPayload, TaskClassDetail } from '@/types/schedule'
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: boolean
|
||||
loading?: boolean
|
||||
initialData?: TaskClassDetail | null
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -36,21 +37,39 @@ watch(
|
||||
return
|
||||
}
|
||||
|
||||
form.name = ''
|
||||
form.start_date = ''
|
||||
form.end_date = ''
|
||||
form.total_slots = 8
|
||||
form.allow_filler_course = true
|
||||
form.strategy = 'steady'
|
||||
form.excluded_slots = []
|
||||
form.items = [
|
||||
{ order: 1, content: '', embedded_time: null },
|
||||
{ order: 2, content: '', embedded_time: null },
|
||||
{ order: 3, content: '', embedded_time: null },
|
||||
]
|
||||
if (props.initialData) {
|
||||
form.name = props.initialData.name
|
||||
form.start_date = props.initialData.start_date
|
||||
form.end_date = props.initialData.end_date
|
||||
form.total_slots = props.initialData.config.total_slots
|
||||
form.allow_filler_course = props.initialData.config.allow_filler_course
|
||||
form.strategy = props.initialData.config.strategy
|
||||
form.excluded_slots = props.initialData.config.excluded_slots || []
|
||||
form.items = props.initialData.items.map(item => ({
|
||||
id: item.id,
|
||||
order: item.order,
|
||||
content: item.content,
|
||||
embedded_time: item.embedded_time,
|
||||
}))
|
||||
} else {
|
||||
form.name = ''
|
||||
form.start_date = ''
|
||||
form.end_date = ''
|
||||
form.total_slots = 8
|
||||
form.allow_filler_course = true
|
||||
form.strategy = 'steady'
|
||||
form.excluded_slots = []
|
||||
form.items = [
|
||||
{ order: 1, content: '', embedded_time: null },
|
||||
{ order: 2, content: '', embedded_time: null },
|
||||
{ order: 3, content: '', embedded_time: null },
|
||||
]
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
const isEdit = computed(() => !!props.initialData)
|
||||
|
||||
function addItem() {
|
||||
form.items.push({
|
||||
order: form.items.length + 1,
|
||||
@@ -69,9 +88,10 @@ function removeItem(index: number) {
|
||||
function handleSubmit() {
|
||||
const filteredItems = form.items
|
||||
.map((item, index) => ({
|
||||
id: item.id,
|
||||
order: index + 1,
|
||||
content: item.content.trim(),
|
||||
embedded_time: null,
|
||||
embedded_time: item.embedded_time,
|
||||
}))
|
||||
.filter((item) => item.content)
|
||||
|
||||
@@ -109,7 +129,7 @@ function handleSubmit() {
|
||||
<template>
|
||||
<el-dialog
|
||||
:model-value="modelValue"
|
||||
title="创建任务类"
|
||||
:title="isEdit ? '编辑任务类' : '创建任务类'"
|
||||
width="720px"
|
||||
align-center
|
||||
class="task-class-dialog"
|
||||
@@ -187,7 +207,9 @@ function handleSubmit() {
|
||||
<template #footer>
|
||||
<div class="task-class-dialog__footer">
|
||||
<el-button @click="emit('update:modelValue', false)">取消</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="handleSubmit">创建任务类</el-button>
|
||||
<el-button type="primary" :loading="loading" @click="handleSubmit">
|
||||
{{ isEdit ? '保存修改' : '确认创建' }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
@@ -82,10 +82,17 @@ export interface ForumPageEnvelope<T> {
|
||||
has_more: boolean
|
||||
}
|
||||
|
||||
export interface ForumRewardHint {
|
||||
receiver: string
|
||||
status: string
|
||||
amount: number
|
||||
}
|
||||
|
||||
export interface ForumInteractionResult {
|
||||
post_id: number
|
||||
liked: boolean
|
||||
like_count: number
|
||||
reward_hint?: ForumRewardHint
|
||||
}
|
||||
|
||||
export interface ForumImportResult {
|
||||
|
||||
@@ -65,6 +65,7 @@ export interface TaskClassDetail {
|
||||
}
|
||||
|
||||
export interface TaskClassCreateItemPayload {
|
||||
id?: number
|
||||
order: number
|
||||
content: string
|
||||
embedded_time: TaskClassEmbeddedTime | null
|
||||
|
||||
16
frontend/src/utils/avatar.ts
Normal file
16
frontend/src/utils/avatar.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* 获取头像 URL,支持默认兜底
|
||||
* @param url 原始头像 URL
|
||||
* @param seed 兜底种(如用户 ID 或昵称),确保同一用户的默认头像一致
|
||||
* @returns 最终可用的头像 URL
|
||||
*/
|
||||
export function getAvatarUrl(url?: string, seed?: string | number): string {
|
||||
if (url && url.trim() && (url.startsWith('http') || url.startsWith('/') || url.startsWith('data:'))) {
|
||||
return url
|
||||
}
|
||||
|
||||
// 使用 DiceBear 提供的 avataaars 系列作为默认头像
|
||||
// 如果没有提供 seed,则生成一个随机字符串
|
||||
const avatarSeed = seed !== undefined && seed !== null ? String(seed) : 'default'
|
||||
return `https://api.dicebear.com/7.x/avataaars/svg?seed=${encodeURIComponent(avatarSeed)}`
|
||||
}
|
||||
@@ -236,7 +236,7 @@ function syncDashboardMainScale() {
|
||||
const naturalHeight = topbar.offsetHeight + content.scrollHeight + gridGap
|
||||
if (!availableHeight || !naturalHeight) return
|
||||
|
||||
const nextScale = Number(Math.min(1, (availableHeight / naturalHeight) * 0.96).toFixed(4))
|
||||
const nextScale = Number(Math.min(1.1, (availableHeight / naturalHeight) * 1.05).toFixed(4))
|
||||
dashboardMainScale.value = nextScale
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ watch([() => tasks.value.length, () => todayEvents.value.length, taskLoading, sc
|
||||
<header ref="dashboardTopbarRef" class="dashboard-topbar glass-panel dashboard-item-pop" :style="{ '--anim-delay': '0s' }">
|
||||
<div>
|
||||
<div class="dashboard-topbar__brandline">
|
||||
<strong>AI 智慧日程系统</strong>
|
||||
<strong>SmartMate</strong>
|
||||
<span>{{ pageTitleDate }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -15,6 +15,7 @@ import { getTaskClassList } from '@/api/scheduleCenter'
|
||||
import { useRouter } from 'vue-router'
|
||||
import type { ForumPostBrief } from '@/types/forum'
|
||||
import type { TaskClassListItem } from '@/types/schedule'
|
||||
import { getAvatarUrl } from '@/utils/avatar'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
@@ -293,7 +294,7 @@ onBeforeUnmount(() => {
|
||||
|
||||
<div class="post-card__footer">
|
||||
<div class="author-info">
|
||||
<img :src="post.author.avatar_url" class="author-avatar" />
|
||||
<img :src="getAvatarUrl(post.author.avatar_url, post.author.user_id)" class="author-avatar" />
|
||||
<span class="author-name">{{ post.author.nickname }}</span>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -2,16 +2,19 @@
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ArrowLeft, ChatDotRound, Check, Connection, Filter } from '@element-plus/icons-vue'
|
||||
import { ArrowLeft, ChatDotRound, Check, Connection, Filter, Star, StarFilled } from '@element-plus/icons-vue'
|
||||
|
||||
import {
|
||||
createForumComment,
|
||||
deleteForumComment,
|
||||
getForumPostDetail,
|
||||
importForumPost,
|
||||
likeForumPost,
|
||||
listForumComments,
|
||||
unlikeForumPost,
|
||||
} from '@/api/forum'
|
||||
import type { ForumCommentNode, ForumPostBrief, ForumPostDetail, ForumTemplateDetail } from '@/types/forum'
|
||||
import { getAvatarUrl } from '@/utils/avatar'
|
||||
|
||||
interface ForumPostDetailView extends ForumPostBrief {
|
||||
template: ForumTemplateDetail
|
||||
@@ -21,8 +24,9 @@ const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const isLoading = ref(true)
|
||||
const commentSubmitting = ref(false)
|
||||
const selectedPost = ref<ForumPostDetailView | null>(null)
|
||||
const isLiking = ref(false)
|
||||
const commentSubmitting = ref(false)
|
||||
const comments = ref<ForumCommentNode[]>([])
|
||||
const newComment = ref('')
|
||||
const replyingToId = ref<number | null>(null)
|
||||
@@ -174,6 +178,41 @@ async function handleImport() {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleLikeToggle() {
|
||||
if (!selectedPost.value || isLiking.value) return
|
||||
|
||||
isLiking.value = true
|
||||
const postId = selectedPost.value.post_id
|
||||
const isLiked = selectedPost.value.viewer_state.liked
|
||||
|
||||
try {
|
||||
const result = isLiked
|
||||
? await unlikeForumPost(postId)
|
||||
: await likeForumPost(postId)
|
||||
|
||||
// 以后端返回为准更新状态
|
||||
if (selectedPost.value) {
|
||||
selectedPost.value.viewer_state.liked = result.liked
|
||||
selectedPost.value.counters.like_count = result.like_count
|
||||
|
||||
if (result.liked && result.reward_hint) {
|
||||
ElMessage({
|
||||
message: `点赞成功!已为您支持的作者贡献了 ${result.reward_hint.amount} 积分奖励`,
|
||||
type: 'success',
|
||||
duration: 4000,
|
||||
showClose: true,
|
||||
})
|
||||
} else if (!isLiked) {
|
||||
ElMessage.success('已点赞')
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error(error instanceof Error ? error.message : '点赞操作失败')
|
||||
} finally {
|
||||
isLiking.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function submitComment() {
|
||||
const content = newComment.value.trim()
|
||||
if (!selectedPost.value || !content || commentSubmitting.value) {
|
||||
@@ -266,6 +305,16 @@ watch(
|
||||
<el-button :icon="ArrowLeft" circle @click="goBack" />
|
||||
<span class="nav-title">计划详情</span>
|
||||
<div class="nav-actions">
|
||||
<el-button
|
||||
round
|
||||
class="nav-like-btn"
|
||||
:class="{ 'is-active': selectedPost.viewer_state.liked }"
|
||||
:icon="selectedPost.viewer_state.liked ? StarFilled : Star"
|
||||
:loading="isLiking"
|
||||
@click="handleLikeToggle"
|
||||
>
|
||||
{{ selectedPost.counters.like_count }}
|
||||
</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
round
|
||||
@@ -280,7 +329,7 @@ watch(
|
||||
<div class="detail-main-layout">
|
||||
<aside class="detail-sidebar">
|
||||
<div class="author-card">
|
||||
<img :src="selectedPost.author.avatar_url" class="author-avatar" />
|
||||
<img :src="getAvatarUrl(selectedPost.author.avatar_url, selectedPost.author.user_id)" class="author-avatar" />
|
||||
<div class="author-name">{{ selectedPost.author.nickname }}</div>
|
||||
<div class="publish-time">发布于 {{ formatDate(selectedPost.created_at) }}</div>
|
||||
<div class="author-stats">
|
||||
@@ -336,6 +385,22 @@ watch(
|
||||
<el-tag v-for="tag in selectedPost.tags" :key="tag" class="mx-1" effect="plain">{{ tag }}</el-tag>
|
||||
</div>
|
||||
<p class="plan-description">{{ selectedPost.summary }}</p>
|
||||
|
||||
<div class="content-interaction">
|
||||
<button
|
||||
class="big-like-btn"
|
||||
:class="{ 'is-liked': selectedPost.viewer_state.liked }"
|
||||
:disabled="isLiking"
|
||||
@click="handleLikeToggle"
|
||||
>
|
||||
<div class="like-icon-wrapper">
|
||||
<el-icon v-if="isLiking" class="is-loading"><Connection /></el-icon>
|
||||
<el-icon v-else><StarFilled v-if="selectedPost.viewer_state.liked" /><Star v-else /></el-icon>
|
||||
</div>
|
||||
<span class="like-label">{{ selectedPost.viewer_state.liked ? '取消点赞' : '点赞支持' }}</span>
|
||||
<span class="like-count">{{ selectedPost.counters.like_count }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="comments-section">
|
||||
@@ -362,7 +427,7 @@ watch(
|
||||
|
||||
<div class="comments-list">
|
||||
<div v-for="comment in comments" :key="comment.comment_id" class="comment-item">
|
||||
<img :src="comment.author.avatar_url" class="c-avatar" />
|
||||
<img :src="getAvatarUrl(comment.author.avatar_url, comment.author.user_id)" class="c-avatar" />
|
||||
<div class="c-body">
|
||||
<div class="c-user">
|
||||
{{ comment.author.nickname }}
|
||||
@@ -398,7 +463,7 @@ watch(
|
||||
|
||||
<div v-if="comment.children.length > 0" class="comment-children">
|
||||
<div v-for="child in comment.children" :key="child.comment_id" class="comment-item child">
|
||||
<img :src="child.author.avatar_url" class="c-avatar small" />
|
||||
<img :src="getAvatarUrl(child.author.avatar_url, child.author.user_id)" class="c-avatar small" />
|
||||
<div class="c-body">
|
||||
<div class="c-user">
|
||||
{{ child.author.nickname }}
|
||||
@@ -480,6 +545,29 @@ watch(
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.nav-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.nav-like-btn {
|
||||
background: #f8fafc;
|
||||
border-color: #e2e8f0;
|
||||
color: #64748b;
|
||||
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
.nav-like-btn.is-active {
|
||||
background: #fff1f2;
|
||||
border-color: #fecdd3;
|
||||
color: #e11d48;
|
||||
}
|
||||
|
||||
.nav-like-btn:hover {
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.detail-main-layout {
|
||||
display: grid;
|
||||
grid-template-columns: 320px 1fr;
|
||||
@@ -678,6 +766,69 @@ watch(
|
||||
line-height: 1.8;
|
||||
color: #475569;
|
||||
white-space: pre-wrap;
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.content-interaction {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 24px 0;
|
||||
border-bottom: 1px solid #f1f5f9;
|
||||
}
|
||||
|
||||
.big-like-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 12px 28px;
|
||||
background: #ffffff;
|
||||
border: 2px solid #f1f5f9;
|
||||
border-radius: 100px;
|
||||
cursor: pointer;
|
||||
transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
|
||||
}
|
||||
|
||||
.big-like-btn:hover {
|
||||
transform: scale(1.05);
|
||||
border-color: #3b82f6;
|
||||
background: #f0f7ff;
|
||||
}
|
||||
|
||||
.big-like-btn.is-liked {
|
||||
background: #fff1f2;
|
||||
border-color: #fb7185;
|
||||
color: #e11d48;
|
||||
box-shadow: 0 8px 20px rgba(225, 29, 72, 0.12);
|
||||
}
|
||||
|
||||
.big-like-btn.is-liked .like-icon-wrapper {
|
||||
color: #e11d48;
|
||||
transform: scale(1.2);
|
||||
}
|
||||
|
||||
.like-icon-wrapper {
|
||||
font-size: 24px;
|
||||
display: flex;
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.like-label {
|
||||
font-weight: 700;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.like-count {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-weight: 800;
|
||||
background: rgba(0, 0, 0, 0.05);
|
||||
padding: 2px 8px;
|
||||
border-radius: 6px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.big-like-btn.is-liked .like-count {
|
||||
background: rgba(225, 29, 72, 0.1);
|
||||
}
|
||||
|
||||
.content-body h3, .comments-section h3 {
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
getWeekSchedule,
|
||||
smartPlanning,
|
||||
smartPlanningMulti,
|
||||
updateTaskClass,
|
||||
} from '@/api/scheduleCenter'
|
||||
import CreateTaskClassDialog from '@/components/schedule/CreateTaskClassDialog.vue'
|
||||
import TaskClassSidebar from '@/components/schedule/TaskClassSidebar.vue'
|
||||
@@ -131,6 +132,7 @@ const applyingLoading = ref(false)
|
||||
const deletingLoading = ref(false)
|
||||
const createDialogVisible = ref(false)
|
||||
const createDialogLoading = ref(false)
|
||||
const editDialogInitialData = ref<TaskClassDetail | null>(null)
|
||||
const courseImportDialogVisible = ref(false)
|
||||
|
||||
const taskClasses = ref<TaskClassListItem[]>([])
|
||||
@@ -1090,15 +1092,37 @@ function toggleManualEditMode() {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCreateTaskClass(payload: Parameters<typeof createTaskClass>[0]) {
|
||||
async function handleOpenEditDialog() {
|
||||
if (expandedTaskClassId.value === null) return
|
||||
|
||||
taskClassDetailLoading.value = true
|
||||
try {
|
||||
const detail = await getTaskClassDetail(expandedTaskClassId.value)
|
||||
editDialogInitialData.value = detail
|
||||
createDialogVisible.value = true
|
||||
} catch (error) {
|
||||
ElMessage.error(error instanceof Error ? error.message : '获取详情失败')
|
||||
} finally {
|
||||
taskClassDetailLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function handleTaskClassSubmit(payload: Parameters<typeof createTaskClass>[0]) {
|
||||
createDialogLoading.value = true
|
||||
try {
|
||||
await createTaskClass(payload)
|
||||
ElMessage.success('任务类已创建')
|
||||
if (editDialogInitialData.value && expandedTaskClassId.value !== null) {
|
||||
await updateTaskClass(expandedTaskClassId.value, payload)
|
||||
ElMessage.success('任务类已更新')
|
||||
// 更新详情缓存
|
||||
await loadTaskClassDetail(expandedTaskClassId.value)
|
||||
} else {
|
||||
await createTaskClass(payload)
|
||||
ElMessage.success('任务类已创建')
|
||||
}
|
||||
createDialogVisible.value = false
|
||||
await loadTaskClasses()
|
||||
} catch (error) {
|
||||
ElMessage.error(error instanceof Error ? error.message : '创建任务类失败')
|
||||
ElMessage.error(error instanceof Error ? error.message : '保存失败')
|
||||
} finally {
|
||||
createDialogLoading.value = false
|
||||
}
|
||||
@@ -1184,7 +1208,7 @@ onMounted(async () => {
|
||||
:manual-edit-mode="manualEditMode"
|
||||
@activate="handleActivateTaskClass"
|
||||
@toggle-multi-mode="handleToggleTaskClassMultiMode"
|
||||
@create="createDialogVisible = true"
|
||||
@create="() => { editDialogInitialData = null; createDialogVisible = true }"
|
||||
@delete-item="handleDeleteTaskItem"
|
||||
/>
|
||||
|
||||
@@ -1227,6 +1251,15 @@ onMounted(async () => {
|
||||
导入课表
|
||||
</button>
|
||||
|
||||
<button
|
||||
v-if="expandedTaskClassId !== null && !taskClassMultiSelectMode && !manualEditMode && !scheduleSelectionMode"
|
||||
type="button"
|
||||
class="schedule-board__toolbar-button schedule-board__toolbar-button--ghost"
|
||||
@click="handleOpenEditDialog"
|
||||
>
|
||||
编辑任务类
|
||||
</button>
|
||||
|
||||
<button
|
||||
v-if="showSmartPlanningButton"
|
||||
type="button"
|
||||
@@ -1308,7 +1341,8 @@ onMounted(async () => {
|
||||
<CreateTaskClassDialog
|
||||
v-model="createDialogVisible"
|
||||
:loading="createDialogLoading"
|
||||
@submit="handleCreateTaskClass"
|
||||
:initial-data="editDialogInitialData"
|
||||
@submit="handleTaskClassSubmit"
|
||||
/>
|
||||
|
||||
<CourseImageImportDialog
|
||||
|
||||
Reference in New Issue
Block a user