From e998978133d108d5ab367eabe516fcb80c0534ab Mon Sep 17 00:00:00 2001 From: JSR Date: Fri, 17 Jul 2026 21:41:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E7=A7=AF=E5=88=86?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E9=9D=A2=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/main.css | 52 ++++- src/components/Home.tsx | 430 +++++++++++++++++++++--------------- src/i18n/locales/ar-SA.json | 3 + src/i18n/locales/de-DE.json | 3 + src/i18n/locales/en-US.json | 3 + src/i18n/locales/es-ES.json | 3 + src/i18n/locales/fr-FR.json | 3 + src/i18n/locales/ja-JP.json | 3 + src/i18n/locales/ko-KR.json | 3 + src/i18n/locales/pt-BR.json | 3 + src/i18n/locales/ru-RU.json | 3 + src/i18n/locales/zh-CN.json | 3 + 12 files changed, 326 insertions(+), 186 deletions(-) diff --git a/src/assets/main.css b/src/assets/main.css index abe5e4c..afe0dba 100644 --- a/src/assets/main.css +++ b/src/assets/main.css @@ -268,6 +268,55 @@ html.platform-macos body { will-change: transform, opacity; } +.ss-home-operation-morph-modal .ss-operation-panel-section, +.ss-operation-drawer .ss-operation-panel-section { + min-width: 0; +} + +.ss-custom-score-buttons, +.ss-no-reason-quick-buttons, +.ss-reason-preset-buttons { + display: flex; + flex-wrap: wrap; + gap: 10px; +} + +.ss-custom-score-buttons .ant-btn { + min-width: 48px; + height: 38px; + padding: 0 14px; + font-size: 15px; +} + +.ss-reason-preset-buttons .ant-btn { + min-height: 42px; + padding: 6px 14px; + font-size: 15px; +} + +.ss-no-reason-quick-buttons .ant-btn { + min-width: 62px; + height: 50px; + padding: 0 18px; + font-size: 18px; + font-weight: 700; +} + +@media (max-width: 768px) { + .ss-operation-panel-grid { + grid-template-columns: 1fr !important; + } + + .ss-no-reason-quick-buttons .ant-btn { + min-width: 64px; + height: 52px; + } + + .ss-reason-preset-buttons .ant-btn { + min-height: 46px; + } +} + .ss-operation-mask-fade-enter, .ss-operation-mask-fade-appear { opacity: 0 !important; @@ -385,8 +434,7 @@ html.platform-macos body { line-height: 52px; } -.ss-immersive-toolbar-segment - .ss-immersive-toolbar-search.ant-input-affix-wrapper-focused, +.ss-immersive-toolbar-segment .ss-immersive-toolbar-search.ant-input-affix-wrapper-focused, .ss-immersive-toolbar-segment .ss-immersive-toolbar-search.ant-input-affix-wrapper:focus, .ss-immersive-toolbar-segment .ss-immersive-toolbar-search.ant-input-affix-wrapper:hover { border: none !important; diff --git a/src/components/Home.tsx b/src/components/Home.tsx index da6b245..2c78462 100644 --- a/src/components/Home.tsx +++ b/src/components/Home.tsx @@ -1098,6 +1098,15 @@ export const Home: React.FC = ({ performSubmit(targets, reason.delta, reason.content) } + const handleNoReasonQuickSelect = (delta: number) => { + const targets = batchMode ? selectedStudents : selectedStudent ? [selectedStudent] : [] + if (targets.length === 0) { + messageApi.warning(t("home.selectStudentFirst")) + return + } + performSubmit(targets, delta, "") + } + const cancelLongPress = () => { if (longPressTimerRef.current !== null) { window.clearTimeout(longPressTimerRef.current) @@ -2690,16 +2699,160 @@ export const Home: React.FC = ({ )} - {groupedReasons.length > 0 && ( -
-
+
+
+
+ + {t("home.customOperation")} + + +
+ +
+
+
+ {t("home.adjustPoints")} +
+
+ {[-5, -3, -2, -1, 1, 2, 3, 5, 10].map((num) => ( + + ))} + +
+
+ setCustomScore(v as number)} + min={-99} + max={99} + step={1} + style={{ width: "140px" }} + placeholder={t("home.customPoints")} + /> + + {t("home.customPointsHint")} + +
+
+ +
+
+ {t("home.reason")} +
+ setReasonContent(e.target.value)} + placeholder={t("home.reasonPlaceholder")} + suffix={ + reasonContent ? ( + setReasonContent("")} + style={{ cursor: "pointer" }} + /> + ) : undefined + } + /> +
+ + {customScore !== undefined && ( +
0 + ? "var(--ant-color-success-bg, #f6ffed)" + : customScore < 0 + ? "var(--ant-color-error-bg, #fff2f0)" + : "var(--ss-bg-color)", + borderRadius: "8px", + border: `1px solid ${customScore > 0 ? "var(--ant-color-success-border, #b7eb8f)" : customScore < 0 ? "var(--ant-color-error-border, #ffccc7)" : "var(--ss-border-color)"}`, + marginTop: "2px", + }} + > +
+ {t("home.preview")}: +
+
+ {isBatchOperation + ? t("home.selectedCount", { count: operationTargets.length }) + : selectedStudent?.name}{" "} + 0 + ? "var(--ant-color-success, #52c41a)" + : customScore < 0 + ? "var(--ant-color-error, #ff4d4f)" + : "inherit", + }} + > + {customScore > 0 ? `+${customScore}` : customScore} + {" "} + {t("home.points")} + + {reasonContent + ? `${t("home.reasonLabel")}${reasonContent}` + : t("home.noReason")} + +
+
+ )} +
+
+ +
+
= ({
-
- {groupedReasons.map(([category, items]) => ( -
+ +
+
+
+ {t("home.noReasonQuickActions")} +
+
+ {[-3, -2, -1, 1, 2, 3, 4, 5].map((num) => ( + + ))} +
+
+ + {groupedReasons.length > 0 && ( +
- {category} + {t("home.reasonPresets")}
- - {items.map((r) => ( - + {category} +
+
+ {items.map((r) => ( + + ))} +
+
))} - +
- ))} + )}
- )} - -
-
- - {t("home.adjustPoints")} - - -
-
- {[-5, -3, -2, -1, 1, 2, 3, 5, 10].map((num) => ( - - ))} - -
-
- setCustomScore(v as number)} - min={-99} - max={99} - step={1} - style={{ width: "140px" }} - placeholder={t("home.customPoints")} - /> - - {t("home.customPointsHint")} - -
- -
-
- - {t("home.reason")} - - -
- setReasonContent(e.target.value)} - placeholder={t("home.reasonPlaceholder")} - suffix={ - reasonContent ? ( - setReasonContent("")} style={{ cursor: "pointer" }} /> - ) : undefined - } - /> -
- - {customScore !== undefined && ( -
0 - ? "var(--ant-color-success-bg, #f6ffed)" - : customScore < 0 - ? "var(--ant-color-error-bg, #fff2f0)" - : "var(--ss-bg-color)", - borderRadius: "8px", - border: `1px solid ${customScore > 0 ? "var(--ant-color-success-border, #b7eb8f)" : customScore < 0 ? "var(--ant-color-error-border, #ffccc7)" : "var(--ss-border-color)"}`, - marginTop: "4px", - }} - > -
- {t("home.preview")}: -
-
- {isBatchOperation - ? t("home.selectedCount", { count: operationTargets.length }) - : selectedStudent?.name}{" "} - 0 - ? "var(--ant-color-success, #52c41a)" - : customScore < 0 - ? "var(--ant-color-error, #ff4d4f)" - : "inherit", - }} - > - {customScore > 0 ? `+${customScore}` : customScore} - {" "} - {t("home.points")} - - {reasonContent ? `${t("home.reasonLabel")}${reasonContent}` : t("home.noReason")} - -
-
- )}
) @@ -3730,7 +3792,7 @@ export const Home: React.FC = ({ confirmLoading={submitLoading} okText={t("home.submitOperation")} cancelText={t("common.cancel")} - width={560} + width={820} centered forceRender transitionName="" diff --git a/src/i18n/locales/ar-SA.json b/src/i18n/locales/ar-SA.json index 0c9cccc..abc056f 100644 --- a/src/i18n/locales/ar-SA.json +++ b/src/i18n/locales/ar-SA.json @@ -511,8 +511,11 @@ "currentScore": "النقاط الحالية", "quickOptions": "خيارات سريعة", "adjustPoints": "ضبط النقاط", + "customOperation": "مخصص", "customPoints": "نقاط مخصصة", "customPointsHint": "أدخل أي قيمة في حقل الإدخال", + "noReasonQuickActions": "إجراءات شائعة بدون سبب", + "reasonPresets": "إعدادات السبب المسبقة", "reason": "السبب", "reasonPlaceholder": "أدخل سبب تغيير النقاط (اختياري)", "preview": "معاينة التغيير", diff --git a/src/i18n/locales/de-DE.json b/src/i18n/locales/de-DE.json index c50435e..5732f8b 100644 --- a/src/i18n/locales/de-DE.json +++ b/src/i18n/locales/de-DE.json @@ -511,8 +511,11 @@ "currentScore": "Aktuelle Punkte", "quickOptions": "Schnelloptionen", "adjustPoints": "Punkte anpassen", + "customOperation": "Benutzerdefiniert", "customPoints": "Benutzerdefinierte Punkte", "customPointsHint": "Beliebigen Wert im Eingabefeld eingeben", + "noReasonQuickActions": "Häufige Aktionen ohne Grund", + "reasonPresets": "Grund-Vorlagen", "reason": "Grund", "reasonPlaceholder": "Grund für die Punkteänderung eingeben (optional)", "preview": "Änderungsvorschau", diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json index 196938c..d032340 100644 --- a/src/i18n/locales/en-US.json +++ b/src/i18n/locales/en-US.json @@ -504,8 +504,11 @@ "currentScore": "Current Points", "quickOptions": "Quick Options", "adjustPoints": "Adjust Points", + "customOperation": "Custom", "customPoints": "Custom Points", "customPointsHint": "Enter any value in the input box", + "noReasonQuickActions": "Common No-Reason Actions", + "reasonPresets": "Reason Presets", "reason": "Reason", "reasonPlaceholder": "Enter reason for points change (optional)", "preview": "Change Preview", diff --git a/src/i18n/locales/es-ES.json b/src/i18n/locales/es-ES.json index c518d70..2af13ae 100644 --- a/src/i18n/locales/es-ES.json +++ b/src/i18n/locales/es-ES.json @@ -511,8 +511,11 @@ "currentScore": "Puntos actuales", "quickOptions": "Opciones rápidas", "adjustPoints": "Ajustar puntos", + "customOperation": "Personalizado", "customPoints": "Puntos personalizados", "customPointsHint": "Ingrese cualquier valor en el campo de entrada", + "noReasonQuickActions": "Acciones comunes sin razón", + "reasonPresets": "Preajustes de razón", "reason": "Razón", "reasonPlaceholder": "Ingrese la razón de la modificación de puntos (opcional)", "preview": "Vista previa de la modificación", diff --git a/src/i18n/locales/fr-FR.json b/src/i18n/locales/fr-FR.json index bf1b1bf..1fe20e2 100644 --- a/src/i18n/locales/fr-FR.json +++ b/src/i18n/locales/fr-FR.json @@ -511,8 +511,11 @@ "currentScore": "Points actuels", "quickOptions": "Options rapides", "adjustPoints": "Ajuster les points", + "customOperation": "Personnalise", "customPoints": "Points personnalisés", "customPointsHint": "Entrez n'importe quelle valeur dans la zone de saisie", + "noReasonQuickActions": "Actions courantes sans raison", + "reasonPresets": "Préréglages de raison", "reason": "Raison", "reasonPlaceholder": "Entrez la raison de la modification des points (facultatif)", "preview": "Aperçu de la modification", diff --git a/src/i18n/locales/ja-JP.json b/src/i18n/locales/ja-JP.json index 8889805..e44cff6 100644 --- a/src/i18n/locales/ja-JP.json +++ b/src/i18n/locales/ja-JP.json @@ -511,8 +511,11 @@ "currentScore": "現在のポイント", "quickOptions": "クイックオプション", "adjustPoints": "ポイントを調整", + "customOperation": "カスタム", "customPoints": "カスタムポイント", "customPointsHint": "入力ボックスで任意の値を入力できます", + "noReasonQuickActions": "理由なしのよく使う操作", + "reasonPresets": "理由プリセット", "reason": "理由", "reasonPlaceholder": "ポイント変動の理由を入力(任意)", "preview": "変更プレビュー", diff --git a/src/i18n/locales/ko-KR.json b/src/i18n/locales/ko-KR.json index 578b077..8ae09fd 100644 --- a/src/i18n/locales/ko-KR.json +++ b/src/i18n/locales/ko-KR.json @@ -511,8 +511,11 @@ "currentScore": "현재 포인트", "quickOptions": "빠른 옵션", "adjustPoints": "포인트 조정", + "customOperation": "사용자 정의", "customPoints": "사용자 정의 포인트", "customPointsHint": "입력란에 원하는 값을 입력하세요", + "noReasonQuickActions": "이유 없는 자주 쓰는 작업", + "reasonPresets": "이유 프리셋", "reason": "이유", "reasonPlaceholder": "포인트 변경 이유 입력 (선택 사항)", "preview": "변경 미리보기", diff --git a/src/i18n/locales/pt-BR.json b/src/i18n/locales/pt-BR.json index 3bd3490..eee683b 100644 --- a/src/i18n/locales/pt-BR.json +++ b/src/i18n/locales/pt-BR.json @@ -511,8 +511,11 @@ "currentScore": "Pontos atuais", "quickOptions": "Opções rápidas", "adjustPoints": "Ajustar pontos", + "customOperation": "Personalizado", "customPoints": "Pontos personalizados", "customPointsHint": "Insira qualquer valor no campo de entrada", + "noReasonQuickActions": "Ações comuns sem motivo", + "reasonPresets": "Predefinições de motivo", "reason": "Motivo", "reasonPlaceholder": "Insira o motivo da alteração de pontos (opcional)", "preview": "Visualização da alteração", diff --git a/src/i18n/locales/ru-RU.json b/src/i18n/locales/ru-RU.json index 737eead..23567cc 100644 --- a/src/i18n/locales/ru-RU.json +++ b/src/i18n/locales/ru-RU.json @@ -511,8 +511,11 @@ "currentScore": "Текущие баллы", "quickOptions": "Быстрые опции", "adjustPoints": "Настройка баллов", + "customOperation": "Пользовательское", "customPoints": "Пользовательские баллы", "customPointsHint": "Введите любое значение в поле ввода", + "noReasonQuickActions": "Частые действия без причины", + "reasonPresets": "Предустановленные причины", "reason": "Причина", "reasonPlaceholder": "Введите причину изменения баллов (необязательно)", "preview": "Предпросмотр изменения", diff --git a/src/i18n/locales/zh-CN.json b/src/i18n/locales/zh-CN.json index 27bffb4..23affd8 100644 --- a/src/i18n/locales/zh-CN.json +++ b/src/i18n/locales/zh-CN.json @@ -504,8 +504,11 @@ "currentScore": "当前积分", "quickOptions": "快捷选项", "adjustPoints": "调整分值", + "customOperation": "自定义", "customPoints": "自定义分值", "customPointsHint": "可在输入框微调特输入任意分值", + "noReasonQuickActions": "无理由常用操作", + "reasonPresets": "理由预设", "reason": "操作理由", "reasonPlaceholder": "输入加分/扣分的原因(可选)", "preview": "变更预览",