Browse Source

fix: horizontal layout for exercise log, teal theme for journal, add health journal to + menu

17846405080 1 month ago
parent
commit
43f365ce27

+ 1 - 0
campus_health_app/frontend/campus-health-app/src/app/app.html

@@ -61,6 +61,7 @@
     <div class="quick-add-sheet">
       <button class="quick-add-btn" (click)="goToAddExercise()">+ 添加运动记录</button>
       <button class="quick-add-btn" (click)="goToAddMeal()">+ 添加饮食记录</button>
+      <button class="quick-add-btn" (click)="goToHealthJournal()">+ 记录健康状况</button>
       <button class="quick-add-cancel" (click)="closeQuickAdd()">取消</button>
     </div>
   </div>

+ 5 - 0
campus_health_app/frontend/campus-health-app/src/app/app.ts

@@ -57,4 +57,9 @@ export class App {
     this.showQuickAdd = false;
     this.router.navigate(['/exercise/add']);
   }
+
+  goToHealthJournal(): void {
+    this.showQuickAdd = false;
+    this.router.navigate(['/health-journal']);
+  }
 }

+ 4 - 3
campus_health_app/frontend/campus-health-app/src/app/modules/exercise/exercise-actions/exercise-actions.component.html

@@ -41,10 +41,11 @@
           <button class="link-btn keep" *ngIf="action.keepUrl" (click)="openKeep(action.keepUrl!)">
             <span>🏃</span><span>Keep</span>
           </button>
-          <button class="link-btn" style="background:#e8f5e9;color:#2e7d32;" (click)="startLog(action.id, action.name)">
-            <span>📝</span><span>记一组</span>
-          </button>
         </div>
+        <button *ngIf="!logForm[action.id]" (click)="startLog(action.id, action.name)"
+                style="grid-column:1/-1;margin-top:8px;padding:8px;background:#e6fffa;color:#0d9488;border:1px solid #0d9488;border-radius:8px;cursor:pointer;font-size:13px;">
+          📝 记一组
+        </button>
         <div *ngIf="logForm[action.id]" style="grid-column:1/-1;background:#f9fbe7;padding:10px;border-radius:8px;margin-top:8px;">
           <div style="display:flex;gap:8px;align-items:center;flex-wrap:wrap;">
             <input type="number" [(ngModel)]="logForm[action.id].weightKg" placeholder="重量kg" style="width:80px;padding:6px;border:1px solid #ddd;border-radius:4px;">

+ 7 - 7
campus_health_app/frontend/campus-health-app/src/app/modules/health-journal/health-journal.component.html

@@ -14,8 +14,8 @@
       <div style="display:flex;gap:8px;flex-wrap:wrap;">
         <button *ngFor="let t of ['none','western','chinese_patent','chinese_herb']" type="button"
                 (click)="form.medicineType=t"
-                [style.background]="form.medicineType===t ? '#e3f2fd' : '#f5f5f5'"
-                [style.border]="form.medicineType===t ? '1px solid #1976d2' : '1px solid #ddd'"
+                [style.background]="form.medicineType===t ? '#ccfbf1' : '#f5f5f5'"
+                [style.border]="form.medicineType===t ? '1px solid #0d9488' : '1px solid #ddd'"
                 style="padding:6px 12px;border-radius:16px;cursor:pointer;font-size:13px;">{{ typeLabel(t) }}</button>
       </div>
     </div>
@@ -29,8 +29,8 @@
       <label style="display:block;font-size:13px;color:#555;margin-bottom:4px;">自觉效果</label>
       <div style="display:flex;gap:8px;">
         <button *ngFor="let e of ['good','normal','none','bad']" type="button" (click)="form.effect=e"
-                [style.background]="form.effect===e ? '#e8f5e9' : '#f5f5f5'"
-                [style.border]="form.effect===e ? '1px solid #2e7d32' : '1px solid #ddd'"
+                [style.background]="form.effect===e ? '#ccfbf1' : '#f5f5f5'"
+                [style.border]="form.effect===e ? '1px solid #0d9488' : '1px solid #ddd'"
                 style="padding:6px 12px;border-radius:16px;cursor:pointer;font-size:13px;">{{ effectLabel(e) }}</button>
       </div>
     </div>
@@ -61,7 +61,7 @@
       <textarea [(ngModel)]="form.notes" rows="3" placeholder="如:黄芪15g、党参10g、白术10g..." style="width:100%;padding:8px;border:1px solid #ddd;border-radius:6px;box-sizing:border-box;"></textarea>
     </div>
 
-    <button (click)="save" style="width:100%;padding:12px;background:#1976d2;color:#fff;border:none;border-radius:8px;font-size:15px;cursor:pointer;">保存</button>
+    <button (click)="save" style="width:100%;padding:12px;background:#0d9488;color:#fff;border:none;border-radius:8px;font-size:15px;cursor:pointer;">保存</button>
   </div>
 
   <!-- 历史 -->
@@ -71,8 +71,8 @@
     <div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:6px;">
       <strong>{{ e.recordDate }}</strong>
       <div>
-        <span style="font-size:12px;background:#e3f2fd;padding:2px 8px;border-radius:10px;margin-right:4px;">{{ typeLabel(e.medicineType) }}</span>
-        <span *ngIf="e.effect" style="font-size:12px;background:#e8f5e9;padding:2px 8px;border-radius:10px;">{{ effectLabel(e.effect) }}</span>
+        <span style="font-size:12px;background:#ccfbf1;padding:2px 8px;border-radius:10px;margin-right:4px;">{{ typeLabel(e.medicineType) }}</span>
+        <span *ngIf="e.effect" style="font-size:12px;background:#ccfbf1;padding:2px 8px;border-radius:10px;">{{ effectLabel(e.effect) }}</span>
         <button (click)="remove(e.id)" style="margin-left:8px;background:none;border:none;color:#c62828;cursor:pointer;font-size:13px;">删除</button>
       </div>
     </div>