From 89f9cad9a7da6fc9427b1a0a793798391980f240 Mon Sep 17 00:00:00 2001 From: Megghy Date: Mon, 21 Apr 2025 01:57:10 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E9=97=AE=E7=AD=94?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=92=8C=E9=97=AE=E9=A2=98=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 QAInfo 接口中为答案添加了创建时间字段。 - 在 QuestionItem 组件中增加了得分颜色计算函数,优化了得分显示逻辑。 - 更新了问题管理视图,增强了问题的筛选和显示功能,支持更灵活的用户交互。 - 改进了分享卡片的样式和功能,提升了用户体验。 - 增强了 OBS 组件的预览功能,提供了更直观的展示效果。 --- src/api/api-models.ts | 2 +- src/components/QuestionItem.vue | 42 +- src/store/useQuestionBox.ts | 29 +- src/store/useWebFetcher.ts | 20 +- src/views/manage/AnalyzeView.vue | 2 +- src/views/manage/QuestionBoxManageView.vue | 1815 ++++++++++++-------- 6 files changed, 1141 insertions(+), 769 deletions(-) diff --git a/src/api/api-models.ts b/src/api/api-models.ts index 1289d71..21a0e4d 100644 --- a/src/api/api-models.ts +++ b/src/api/api-models.ts @@ -358,7 +358,7 @@ export interface QAInfo { sender: UserBasicInfo target: UserBasicInfo question: { message: string; image?: string } - answer?: { message: string; image?: string } + answer?: { message: string; image?: string, createdAt: number } isReaded?: boolean isSenderRegisted: boolean isPublic: boolean diff --git a/src/components/QuestionItem.vue b/src/components/QuestionItem.vue index bdf0086..6a1d9b2 100644 --- a/src/components/QuestionItem.vue +++ b/src/components/QuestionItem.vue @@ -11,6 +11,21 @@ const useQA = useQuestionBox() const isViolation = props.item.reviewResult?.isApproved == false const showContent = ref(!isViolation) + +// 计算得分颜色的函数 +function getScoreColor(score: number | undefined): string { + if (score === undefined) { + return 'grey'; // 如果没有分数,返回灰色 + } + // 将分数限制在 0 到 100 之间 + const clampedScore = Math.max(0, Math.min(100, score)); + // 插值计算色相: 0 (红色) for score 0, 120 (绿色) for score 100 + const hue = 120 * (clampedScore / 100); // 反转插值逻辑 + // 固定饱和度和亮度 (可根据需要调整) + const saturation = 50; + const lightness = 45; // 稍暗以提高与白色文本的对比度 + return `hsl(${hue}, ${saturation}%, ${lightness}%)`; +} - - - - {{ item.question?.message }} - - + + {{ item.question?.message }}