From 67a2ce7564ae1aa2b99ee3f613c653a7b7f888bb Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 4 Jan 2026 10:46:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=89=8D=E7=AB=AF=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E8=B7=B3=E8=BF=87=E7=A7=AF=E5=88=86=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/CreateTask.vue | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/frontend/src/views/CreateTask.vue b/frontend/src/views/CreateTask.vue index 4952d76..02be5ff 100644 --- a/frontend/src/views/CreateTask.vue +++ b/frontend/src/views/CreateTask.vue @@ -12,7 +12,8 @@ - 本次任务预估消耗: {{ estimatedScore }} 分 + 管理员身份,无需积分即可发起任务 + 本次任务预估消耗: {{ estimatedScore }} 分 @@ -418,6 +419,20 @@ const loading = ref(false) // 团队积分余额 const teamScore = ref(0) +// 判断是否是管理员(管理员跳过积分检查) +const isAdmin = computed(() => { + const userInfo = authStore.userInfo + if (!userInfo) return false + // 检查 isAdmin 字段 + if (userInfo.isAdmin === 1 || userInfo.isAdmin === true) return true + // 检查角色 + if (userInfo.roleIds) { + const roleIds = userInfo.roleIds.split(',').map((id: string) => id.trim()) + if (roleIds.includes('1') || roleIds.includes('2')) return true // 1=SUPER_ADMIN, 2=ADMIN + } + return false +}) + // 任务子类型列表 const taskSubTypes = ref([]) @@ -665,7 +680,8 @@ const totalPipelineHours = computed(() => { const calculateScore = () => { // 计算已在computed中完成 const score = estimatedScore.value - if (score > teamScore.value) { + // 管理员跳过积分检查 + if (!isAdmin.value && score > teamScore.value) { message.warning('团队积分余额不足,无法发起此任务') } } @@ -695,8 +711,8 @@ const handleSubmit = async () => { return } - // 检查积分余额 - if (estimatedScore.value > teamScore.value) { + // 检查积分余额(管理员跳过) + if (!isAdmin.value && estimatedScore.value > teamScore.value) { message.error('团队积分余额不足') return }