Browse Source

style(admin): B-13 根级管理页迁移 PageHeader + StatusTag/StatCard/SectionTitle,删死样式(Children/Points/Rewards/Tasks/Wishes)

liaoxg 1 month ago
parent
commit
c30eda9656

+ 10 - 17
cfc-web/src/views/Children.vue

@@ -1,18 +1,9 @@
 <template>
   <div class="page-container">
     <el-card>
-      <div slot="header">
-        <span>孩子管理</span>
-        <el-button
-          type="primary"
-          size="small"
-          style="float: right"
-          @click="handleRefresh"
-          :loading="loading"
-        >
-          刷新
-        </el-button>
-      </div>
+      <PageHeader slot="header" title="孩子管理">
+        <el-button type="primary" size="small" @click="handleRefresh" :loading="loading">刷新</el-button>
+      </PageHeader>
 
       <!-- 搜索筛选 -->
       <el-form :inline="true" :model="searchForm" style="margin-bottom: 20px">
@@ -58,7 +49,7 @@
         </el-table-column>
         <el-table-column prop="totalPoints" label="当前积分" width="120">
           <template slot-scope="scope">
-            <el-tag type="success">{{ scope.row.totalPoints || 0 }}</el-tag>
+            <StatusTag type="success" :text="String(scope.row.totalPoints || 0)" />
           </template>
         </el-table-column>
         <el-table-column prop="streakDays" label="连续打卡" width="100">
@@ -73,9 +64,11 @@
         </el-table-column>
         <el-table-column prop="penaltyEnabled" label="扣分" width="80">
           <template slot-scope="scope">
-            <el-tag :type="scope.row.penaltyEnabled ? 'danger' : 'info'" size="small">
-              {{ scope.row.penaltyEnabled ? '开启' : '关闭' }}
-            </el-tag>
+            <StatusTag
+              size="small"
+              :type="scope.row.penaltyEnabled ? 'danger' : 'info'"
+              :text="scope.row.penaltyEnabled ? '开启' : '关闭'"
+            />
           </template>
           <template slot="header">
             <span class="sort-header" @click.stop="onSortClick('penaltyEnabled', $event)">扣分<span v-if="sortIndex('penaltyEnabled') !== null" class="sort-index" :class="sortClass('penaltyEnabled') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('penaltyEnabled') }}</span>{{ sortIcon('penaltyEnabled') }}</span>
@@ -346,6 +339,6 @@ export default {
   white-space: nowrap;
 }
 .sort-header:hover {
-  color: #409eff;
+  color: var(--adm-primary);
 }
 </style>

+ 6 - 17
cfc-web/src/views/Points.vue

@@ -1,18 +1,9 @@
 <template>
   <div class="page-container">
     <el-card>
-      <div slot="header">
-        <span>积分管理</span>
-        <el-button
-          type="primary"
-          size="small"
-          style="float: right"
-          @click="handleRefresh"
-          :loading="loading"
-        >
-          刷新
-        </el-button>
-      </div>
+      <PageHeader slot="header" title="积分管理">
+        <el-button type="primary" size="small" @click="handleRefresh" :loading="loading">刷新</el-button>
+      </PageHeader>
 
       <!-- 搜索筛选 -->
       <el-form :inline="true" :model="searchForm" style="margin-bottom: 20px">
@@ -77,7 +68,7 @@
         </el-table-column>
         <el-table-column prop="amount" label="积分变动" width="120">
           <template slot-scope="scope">
-            <span :style="{ color: scope.row.amount > 0 ? '#67C23A' : '#F56C6C', fontWeight: 'bold' }">
+            <span :style="{ color: scope.row.amount > 0 ? 'var(--adm-success)' : 'var(--adm-error)', fontWeight: 'bold' }">
               {{ scope.row.amount > 0 ? '+' : '' }}{{ scope.row.amount }}
             </span>
           </template>
@@ -87,9 +78,7 @@
         </el-table-column>
         <el-table-column prop="type" label="类型" width="100">
           <template slot-scope="scope">
-            <el-tag :type="getTypeTag(scope.row.type)" size="small">
-              {{ getTypeText(scope.row.type) }}
-            </el-tag>
+            <StatusTag :type="getTypeTag(scope.row.type)" :text="getTypeText(scope.row.type)" size="small" />
           </template>
           <template slot="header">
             <span class="sort-header" @click.stop="onSortClick('type', $event)">类型<span v-if="sortIndex('type') !== null" class="sort-index" :class="sortClass('type') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('type') }}</span>{{ sortIcon('type') }}</span>
@@ -261,6 +250,6 @@ export default {
   white-space: nowrap;
 }
 .sort-header:hover {
-  color: #409eff;
+  color: var(--adm-primary);
 }
 </style>

+ 7 - 18
cfc-web/src/views/Rewards.vue

@@ -1,18 +1,9 @@
 <template>
   <div class="page-container">
     <el-card>
-      <div slot="header">
-        <span>奖励管理</span>
-        <el-button
-          type="primary"
-          size="small"
-          style="float: right"
-          @click="handleRefresh"
-          :loading="loading"
-        >
-          刷新
-        </el-button>
-      </div>
+      <PageHeader slot="header" title="奖励管理">
+        <el-button type="primary" size="small" @click="handleRefresh" :loading="loading">刷新</el-button>
+      </PageHeader>
 
       <el-tabs v-model="activeTab" @tab-click="handleTabClick">
         <!-- 奖励列表 -->
@@ -85,7 +76,7 @@
              </el-table-column>
              <el-table-column prop="pointsRequired" label="所需积分" width="120">
                <template slot-scope="scope">
-                 <el-tag type="warning">{{ scope.row.pointsRequired }}</el-tag>
+                 <StatusTag type="warning" :text="String(scope.row.pointsRequired)" />
                </template>
                <template slot="header">
                  <span class="sort-header" @click.stop="onSortClick('pointsRequired', $event)">所需积分<span v-if="sortIndex('pointsRequired') !== null" class="sort-index" :class="sortClass('pointsRequired') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('pointsRequired') }}</span>{{ sortIcon('pointsRequired') }}</span>
@@ -103,9 +94,7 @@
              </el-table-column>
              <el-table-column prop="status" label="状态" width="100">
                <template slot-scope="scope">
-                 <el-tag :type="getStatusType(scope.row.status)" size="small">
-                   {{ getStatusText(scope.row.status) }}
-                 </el-tag>
+                 <StatusTag :type="getStatusType(scope.row.status)" :text="getStatusText(scope.row.status)" size="small" />
                </template>
                <template slot="header">
                  <span class="sort-header" @click.stop="onSortClick('status', $event)">状态<span v-if="sortIndex('status') !== null" class="sort-index" :class="sortClass('status') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('status') }}</span>{{ sortIcon('status') }}</span>
@@ -165,7 +154,7 @@
             <el-table-column prop="title" label="模板名称" min-width="200"></el-table-column>
             <el-table-column prop="pointsRequired" label="所需积分" width="120">
               <template slot-scope="scope">
-                <el-tag type="warning">{{ scope.row.pointsRequired }}</el-tag>
+                <StatusTag type="warning" :text="String(scope.row.pointsRequired)" />
               </template>
             </el-table-column>
             <el-table-column prop="category" label="分类" width="100"></el-table-column>
@@ -464,6 +453,6 @@ export default {
   white-space: nowrap;
 }
 .sort-header:hover {
-  color: #409eff;
+  color: var(--adm-primary);
 }
 </style>

+ 6 - 17
cfc-web/src/views/Tasks.vue

@@ -1,18 +1,9 @@
 <template>
   <div class="page-container">
     <el-card>
-      <div slot="header">
-        <span>任务管理</span>
-        <el-button
-          type="primary"
-          size="small"
-          style="float: right"
-          @click="handleRefresh"
-          :loading="loading"
-        >
-          刷新
-        </el-button>
-      </div>
+      <PageHeader slot="header" title="任务管理">
+        <el-button type="primary" size="small" @click="handleRefresh" :loading="loading">刷新</el-button>
+      </PageHeader>
 
       <!-- 搜索筛选 -->
       <el-form :inline="true" :model="searchForm" style="margin-bottom: 20px">
@@ -102,7 +93,7 @@
         </el-table-column>
         <el-table-column prop="points" label="积分" width="80">
           <template slot-scope="scope">
-            <el-tag type="success">{{ scope.row.points }}</el-tag>
+            <StatusTag type="success" :text="String(scope.row.points || 0)" />
           </template>
           <template slot="header">
             <span class="sort-header" @click.stop="onSortClick('points', $event)">积分<span v-if="sortIndex('points') !== null" class="sort-index" :class="sortClass('points') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('points') }}</span>{{ sortIcon('points') }}</span>
@@ -123,9 +114,7 @@
         </el-table-column>
         <el-table-column prop="status" label="状态" width="100">
           <template slot-scope="scope">
-            <el-tag :type="getStatusType(scope.row.status)" size="small">
-              {{ getStatusText(scope.row.status) }}
-            </el-tag>
+            <StatusTag :type="getStatusType(scope.row.status)" :text="getStatusText(scope.row.status)" size="small" />
           </template>
           <template slot="header">
             <span class="sort-header" @click.stop="onSortClick('status', $event)">状态<span v-if="sortIndex('status') !== null" class="sort-index" :class="sortClass('status') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('status') }}</span>{{ sortIcon('status') }}</span>
@@ -391,6 +380,6 @@ export default {
   white-space: nowrap;
 }
 .sort-header:hover {
-  color: #409eff;
+  color: var(--adm-primary);
 }
 </style>

+ 17 - 71
cfc-web/src/views/Wishes.vue

@@ -1,18 +1,9 @@
 <template>
   <div class="page-container">
     <el-card>
-      <div slot="header">
-        <span>心愿管理</span>
-        <el-button
-          type="primary"
-          size="small"
-          style="float: right"
-          @click="handleRefresh"
-          :loading="loading"
-        >
-          刷新
-        </el-button>
-      </div>
+      <PageHeader slot="header" title="心愿管理">
+        <el-button type="primary" size="small" @click="handleRefresh" :loading="loading">刷新</el-button>
+      </PageHeader>
 
       <el-tabs v-model="activeTab" @tab-click="handleTabClick">
         <!-- 待处理列表 -->
@@ -20,34 +11,22 @@
           <!-- 统计卡片 -->
           <el-row :gutter="20" style="margin-bottom: 20px">
             <el-col :span="6">
-              <el-card shadow="hover" class="stat-card draft">
-                <div class="stat-num">{{ draftCount }}</div>
-                <div class="stat-label">待定价</div>
-              </el-card>
+              <StatCard label="待定价" :value="draftCount" color="info" icon="el-icon-price-tag" />
             </el-col>
             <el-col :span="6">
-              <el-card shadow="hover" class="stat-card pending">
-                <div class="stat-num">{{ pendingCount }}</div>
-                <div class="stat-label">待审批</div>
-              </el-card>
+              <StatCard label="待审批" :value="pendingCount" color="warning" icon="el-icon-time" />
             </el-col>
             <el-col :span="6">
-              <el-card shadow="hover" class="stat-card approved">
-                <div class="stat-num">{{ approvedCount }}</div>
-                <div class="stat-label">待兑现</div>
-              </el-card>
+              <StatCard label="待兑现" :value="approvedCount" color="primary" icon="el-icon-circle-check" />
             </el-col>
             <el-col :span="6">
-              <el-card shadow="hover" class="stat-card exchanging">
-                <div class="stat-num">{{ exchangingCount }}</div>
-                <div class="stat-label">待收货</div>
-              </el-card>
+              <StatCard label="待收货" :value="exchangingCount" color="primary" icon="el-icon-box" />
             </el-col>
           </el-row>
 
           <!-- 待定价列表 -->
           <div v-if="draftWishes.length > 0" class="wish-section">
-            <div class="section-title">待定价</div>
+            <SectionTitle title="待定价" />
 <div class="adm-table-wrap">
 <el-table style="width: 100%" height="100%" :data="draftWishes" border v-loading="loading">
               <el-table-column prop="id" label="ID" width="80"></el-table-column>
@@ -78,7 +57,7 @@
 
           <!-- 待审批兑换列表 -->
           <div v-if="pendingExchangeWishes.length > 0" class="wish-section">
-            <div class="section-title">⏳ 待审批兑换</div>
+            <SectionTitle title="⏳ 待审批兑换" />
                         <div class="adm-table-wrap">
 <el-table :data="pendingExchangeWishes" border v-loading="loading" style="width: 100%" height="100%">
               <el-table-column prop="id" label="ID" width="80"></el-table-column>
@@ -86,7 +65,7 @@
               <el-table-column prop="title" label="心愿名称" min-width="200"></el-table-column>
               <el-table-column prop="pointsRequired" label="所需积分" width="120">
                 <template slot-scope="scope">
-                  <el-tag type="warning">{{ scope.row.pointsRequired }}</el-tag>
+                  <StatusTag type="warning" :text="String(scope.row.pointsRequired)" />
                 </template>
               </el-table-column>
               <el-table-column prop="exchangeRequestedAt" label="申请时间" width="180">
@@ -113,7 +92,7 @@
 
           <!-- 待兑现列表 -->
           <div v-if="approvedWishes.length > 0" class="wish-section">
-            <div class="section-title">待兑现</div>
+            <SectionTitle title="待兑现" />
                         <div class="adm-table-wrap">
 <el-table :data="approvedWishes" border v-loading="loading" style="width: 100%" height="100%">
               <el-table-column prop="id" label="ID" width="80"></el-table-column>
@@ -121,7 +100,7 @@
               <el-table-column prop="title" label="心愿名称" min-width="200"></el-table-column>
               <el-table-column prop="pointsRequired" label="已扣积分" width="120">
                 <template slot-scope="scope">
-                  <el-tag type="success">{{ scope.row.pointsRequired }}</el-tag>
+                  <StatusTag type="success" :text="String(scope.row.pointsRequired)" />
                 </template>
               </el-table-column>
               <el-table-column prop="exchangeApprovedAt" label="批准时间" width="180">
@@ -140,7 +119,7 @@
 
           <!-- 待收货列表 -->
           <div v-if="exchangingWishes.length > 0" class="wish-section">
-            <div class="section-title">待收货确认</div>
+            <SectionTitle title="待收货确认" />
                         <div class="adm-table-wrap">
 <el-table :data="exchangingWishes" border v-loading="loading" style="width: 100%" height="100%">
               <el-table-column prop="id" label="ID" width="80"></el-table-column>
@@ -238,7 +217,7 @@
             </el-table-column>
             <el-table-column prop="pointsRequired" label="所需积分" width="120">
               <template slot-scope="scope">
-                <el-tag v-if="scope.row.pointsRequired" type="warning">{{ scope.row.pointsRequired }}</el-tag>
+                <StatusTag v-if="scope.row.pointsRequired" type="warning" :text="String(scope.row.pointsRequired)" />
                 <span v-else class="no-price">未定价</span>
               </template>
               <template slot="header">
@@ -252,9 +231,7 @@
             </el-table-column>
             <el-table-column prop="status" label="状态" width="100">
               <template slot-scope="scope">
-                <el-tag :type="getStatusType(scope.row.status)" size="small">
-                  {{ scope.row.statusText }}
-                </el-tag>
+                <StatusTag :type="getStatusType(scope.row.status)" :text="scope.row.statusText" size="small" />
               </template>
               <template slot="header">
                 <span class="sort-header" @click.stop="onSortClick('status', $event)">状态<span v-if="sortIndex('status') !== null" class="sort-index" :class="sortClass('status') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('status') }}</span>{{ sortIcon('status') }}</span>
@@ -262,9 +239,7 @@
             </el-table-column>
             <el-table-column prop="creatorType" label="创建者" width="80">
               <template slot-scope="scope">
-                <el-tag :type="scope.row.creatorType === 'parent' ? 'primary' : 'success'" size="small">
-                  {{ scope.row.creatorType === 'parent' ? '家长' : '孩子' }}
-                </el-tag>
+                <StatusTag :type="scope.row.creatorType === 'parent' ? 'primary' : 'success'" :text="scope.row.creatorType === 'parent' ? '家长' : '孩子'" size="small" />
               </template>
               <template slot="header">
                 <span class="sort-header" @click.stop="onSortClick('creatorType', $event)">创建者<span v-if="sortIndex('creatorType') !== null" class="sort-index" :class="sortClass('creatorType') === 'sort-asc' ? 'sort-asc-badge' : 'sort-desc-badge'">{{ sortIndex('creatorType') }}</span>{{ sortIcon('creatorType') }}</span>
@@ -584,39 +559,10 @@ export default {
 </script>
 
 <style scoped>
-.stat-card {
-  text-align: center;
-  cursor: pointer;
-}
-
-.stat-card.draft { border-top: 3px solid #909399; }
-.stat-card.pending { border-top: 3px solid #E6A23C; }
-.stat-card.approved { border-top: 3px solid #409EFF; }
-.stat-card.exchanging { border-top: 3px solid #409EFF; }
-
-.stat-num {
-  font-size: 32px;
-  font-weight: bold;
-  color: #333;
-}
-
-.stat-label {
-  font-size: 14px;
-  color: #666;
-  margin-top: 5px;
-}
-
 .wish-section {
   margin-bottom: 30px;
 }
 
-.section-title {
-  font-size: 16px;
-  font-weight: bold;
-  margin-bottom: 15px;
-  color: #333;
-}
-
 .no-price {
   color: #999;
   font-size: 12px;
@@ -630,6 +576,6 @@ export default {
   white-space: nowrap;
 }
 .sort-header:hover {
-  color: #409eff;
+  color: var(--adm-primary);
 }
 </style>