Browse Source

refactor(ui-kit): /screen 按 G 类重建——深底 token + 姓名脱敏 + 加载/错误/空/正常态

- 深底 #12243D 全屏,文字三级 #FFFFFF/#C8D6E4/#8FC4EE,分隔 #24405F
- 清除全部 Tailwind 色(#e2e8f0/#475569/#f1f5f9/#facc15/#34d399/#d1fae5 等),替换为深底 token 等价
- 进度条/投票条/品牌文字渐变改纯色(红线:渐变禁用于进度条与文字);#2E6FA8 仅保留在浅底弹窗 tab,深底图形统一 #4A9BD7/#8FC4EE/#14B8A6
- 学员姓名脱敏:u.name → maskUid(uid)「学员·后四位」;底部状态条标注「数据已脱敏·仅展示聚合统计」
- 新增 screenState(error/loading/empty/normal):fetch 失败保留上一帧并显示连接中断、首载骨架 #24405F、空态「暂无数据」不用 0 冒充;排行首项 #8FC4EE 高亮(无点击交互)
- 数据源 statsScreen/config/step/start/voteRecord 与全部设置弹窗逻辑零改动

红线回归:无学员姓名明文/手机号/二维码引流;无 #2E6FA8 深底图形;build EXIT=0
liaoxg 1 day ago
parent
commit
c619d1f962
1 changed files with 166 additions and 123 deletions
  1. 166 123
      train-web/src/views/Screen.vue

+ 166 - 123
train-web/src/views/Screen.vue

@@ -25,6 +25,11 @@
       </div>
     </div>
 
+    <!-- 连接中断提示(错误态) -->
+    <div class="net-error" v-if="screenState === 'error'">
+      <span class="net-dot err"></span>数据连接中断,正在重试 · 最后同步 {{ now }}
+    </div>
+
     <!-- 环节步骤条 -->
     <div class="agenda-bar" v-if="config.agenda && config.agenda.length > 0">
       <div class="step-item" v-for="(ag, i) in config.agenda" :key="i"
@@ -42,7 +47,7 @@
           <span>小组积分榜</span>
           <span class="panel-sub">GROUP RANKING</span>
         </div>
-        <div class="rank-list">
+        <div class="rank-list" v-if="screenState !== 'loading'">
           <div class="rank-card" v-for="(g, i) in scoreboard" :key="g.groupId" :class="{ 'rank-top': i === 0 }">
             <div class="rank-no">{{ i + 1 }}</div>
             <div class="rank-name">
@@ -53,6 +58,9 @@
           </div>
           <div v-if="scoreboard.length === 0" class="empty">暂无小组数据</div>
         </div>
+        <div class="rank-list" v-else>
+          <div class="rank-card sk-card" v-for="n in 3" :key="'sk' + n"></div>
+        </div>
       </div>
 
       <!-- 右侧列 -->
@@ -67,12 +75,12 @@
           </div>
           <div class="scroll-box">
             <div class="c-item done" v-for="u in checkins.checkedList" :key="u.uid">
-              <span class="dot ok"></span>{{ u.name }}
+              <span class="dot ok"></span>{{ maskUid(u.uid) }}
             </div>
             <div class="c-item todo" v-for="u in checkins.uncheckedList" :key="u.uid">
-              <span class="dot no"></span>{{ u.name }}
+              <span class="dot no"></span>{{ maskUid(u.uid) }}
             </div>
-            <div v-if="checkins.total === 0" class="empty">暂无学员</div>
+            <div v-if="checkins.total === 0 && screenState !== 'loading'" class="empty">暂无学员</div>
           </div>
         </div>
 
@@ -82,16 +90,16 @@
             <span class="stat-badge">{{ progress.eligible || 0 }} / {{ progress.total || 0 }}</span>
           </div>
           <div class="meter">
-            <div class="meter-fill green" :style="{ width: progressPct + '%' }"></div>
+            <div class="meter-fill teal" :style="{ width: progressPct + '%' }"></div>
           </div>
           <div class="scroll-box">
             <div class="c-item done" v-for="u in certList" :key="u.uid">
-              <span class="dot ok"></span>{{ u.name }}<span class="cert-tag">已完课</span>
+              <span class="dot ok"></span>{{ maskUid(u.uid) }}<span class="cert-tag">已完课</span>
             </div>
             <div class="c-item todo" v-for="u in rows" :key="'r' + u.uid">
-              <span class="dot no"></span>{{ u.name }}<span class="cert-tag gray">{{ u.okCount }}/6</span>
+              <span class="dot no"></span>{{ maskUid(u.uid) }}<span class="cert-tag gray">{{ u.okCount }}/6</span>
             </div>
-            <div v-if="progress.total === 0" class="empty">暂无学员</div>
+            <div v-if="progress.total === 0 && screenState !== 'loading'" class="empty">暂无学员</div>
           </div>
         </div>
       </div>
@@ -150,7 +158,6 @@
         </div>
         <div class="material-list">
           <div class="m-item" v-for="m in materials" :key="m.id">
-            <span class="m-icon">📄</span>
             <span class="m-name">{{ m.title }}</span>
           </div>
           <div v-if="materials.length === 0" class="empty">暂无资料</div>
@@ -160,8 +167,8 @@
 
     <!-- 底部状态条 -->
     <div class="screen-footer">
-      <div class="foot-item">数据每 30 秒自动刷新</div>
-      <div class="foot-item live-dot">LIVE</div>
+      <div class="foot-item"><span class="net-dot" :class="screenState === 'error' ? 'err' : 'ok'"></span>{{ screenState === 'error' ? '连接中断' : '连接正常 · 数据每 30 秒自动刷新' }}</div>
+      <div class="foot-item">数据已脱敏 · 仅展示聚合统计</div>
     </div>
 
     <!-- 悬浮控制条(鼠标移动显示) -->
@@ -320,7 +327,9 @@ export default {
         showBanner: true, showTimer: true, agenda: [], banner: ''
       },
       pollTimer: null,
-      clockTimer: null
+      clockTimer: null,
+      fetchFailed: false,
+      loaded: false
     }
   },
   computed: {
@@ -365,6 +374,16 @@ export default {
     currentVoteBars: function () {
       var key = 'round' + this.voteRound
       return this.votes[key] || []
+    },
+    // 投屏状态:error / loading / empty / normal(无点击交互,「选中」即排行首项高亮)
+    screenState: function () {
+      if (this.fetchFailed) return 'error'
+      if (!this.loaded) return 'loading'
+      var hasData = (this.scoreboard.length > 0) ||
+        (this.checkins.total || 0) > 0 ||
+        (this.progress.total || 0) > 0 ||
+        (this.groupProgress.length > 0)
+      return hasData ? 'normal' : 'empty'
     }
   },
   mounted: function () {
@@ -381,6 +400,10 @@ export default {
     if (this.pollTimer) clearInterval(this.pollTimer)
   },
   methods: {
+    maskUid: function (uid) {
+      var s = String(uid)
+      return '学员·' + (s.length > 4 ? s.slice(-4) : s)
+    },
     loadClasses: function () {
       var self = this
       classList().then(function (res) {
@@ -406,6 +429,8 @@ export default {
         self.votes = data.votes || {}
         self.config = data.config || {}
         self.startAt = data.startAt || ''
+        self.fetchFailed = false
+        self.loaded = true
         if (self.config.banner !== undefined) {
           self.banner = self.config.banner || ''
         }
@@ -419,7 +444,11 @@ export default {
             self.classId = String(cls[0].id)
           }
         }
-      }).catch(function () {})
+      }).catch(function () {
+        // 保留上一帧数据,仅标记连接中断
+        self.fetchFailed = true
+        self.loaded = true
+      })
     },
     refreshClock: function () {
       var d = new Date()
@@ -594,12 +623,12 @@ export default {
   left: 0;
   right: 0;
   bottom: 0;
-  background: radial-gradient(1200px 600px at 20% -10%, #1F4E79 0%, #12243D 55%, #12243D 100%);
-  color: #e2e8f0;
+  background: #12243D;
+  color: #C8D6E4;
   display: flex;
   flex-direction: column;
   padding: 28px 40px 20px;
-  font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
+  font-family: 'HarmonyOS Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
   overflow: hidden;
 }
 
@@ -615,9 +644,7 @@ export default {
   font-size: 26px;
   font-weight: 700;
   letter-spacing: 2px;
-  background: linear-gradient(135deg, #8FC4EE, #C8D6E4);
-  -webkit-background-clip: text;
-  -webkit-text-fill-color: transparent;
+  color: #FFFFFF;
 }
 .title-box {
   text-align: center;
@@ -625,13 +652,12 @@ export default {
 .course-title {
   font-size: 40px;
   font-weight: 700;
-  color: #F5FAFE;
+  color: #FFFFFF;
   letter-spacing: 4px;
-  text-shadow: 0 0 30px rgba(46, 111, 168, 0.35);
 }
 .banner-text {
   margin-top: 6px;
-  font-size: 20px;
+  font-size: 24px;
   color: #8FC4EE;
 }
 .clock {
@@ -640,15 +666,40 @@ export default {
 .clock .time {
   font-size: 44px;
   font-weight: 700;
-  color: #ffffff;
+  color: #FFFFFF;
   font-variant-numeric: tabular-nums;
 }
 .clock .date {
-  font-size: 16px;
+  font-size: 24px;
   color: #C8D6E4;
   margin-top: 2px;
 }
 
+/* 连接中断提示 */
+.net-error {
+  flex-shrink: 0;
+  display: flex;
+  align-items: center;
+  gap: 10px;
+  padding: 10px 20px;
+  margin-bottom: 16px;
+  border: 1px solid #24405F;
+  border-radius: 8px;
+  font-size: 24px;
+  color: #C8D6E4;
+}
+
+/* 状态点(纯图形) */
+.net-dot {
+  display: inline-block;
+  width: 14px;
+  height: 14px;
+  border-radius: 50%;
+  margin-right: 6px;
+}
+.net-dot.ok { background: #34A853; }
+.net-dot.err { background: #E26B5A; }
+
 /* 主体 */
 .screen-body {
   flex: 1;
@@ -657,8 +708,8 @@ export default {
   min-height: 0;
 }
 .panel {
-  background: rgba(255, 255, 255, 0.06);
-  border: 1px solid rgba(148, 163, 184, 0.18);
+  background: rgba(255, 255, 255, 0.04);
+  border: 1px solid #24405F;
   border-radius: 16px;
   padding: 20px 24px;
   display: flex;
@@ -668,7 +719,7 @@ export default {
 .panel-title {
   font-size: 24px;
   font-weight: 600;
-  color: #f1f5f9;
+  color: #FFFFFF;
   display: flex;
   align-items: baseline;
   justify-content: space-between;
@@ -684,6 +735,7 @@ export default {
   font-size: 26px;
   color: #8FC4EE;
   font-weight: 700;
+  font-variant-numeric: tabular-nums;
 }
 
 /* 积分榜 */
@@ -702,14 +754,14 @@ export default {
   display: flex;
   align-items: center;
   gap: 20px;
-  background: rgba(18, 36, 61, 0.5);
+  background: rgba(255, 255, 255, 0.04);
   border-radius: 12px;
   padding: 14px 24px;
-  border-left: 4px solid #475569;
+  border-left: 4px solid #24405F;
 }
 .rank-card.rank-top {
-  background: linear-gradient(90deg, rgba(250, 204, 21, 0.18), rgba(18, 36, 61, 0.5));
-  border-left-color: #facc15;
+  background: rgba(143, 196, 238, 0.12);
+  border-left-color: #8FC4EE;
 }
 .rank-no {
   font-size: 34px;
@@ -719,7 +771,7 @@ export default {
   color: #C8D6E4;
 }
 .rank-top .rank-no {
-  color: #facc15;
+  color: #8FC4EE;
 }
 .rank-name {
   flex: 1;
@@ -728,7 +780,7 @@ export default {
 .g-name {
   font-size: 28px;
   font-weight: 700;
-  color: #f1f5f9;
+  color: #FFFFFF;
 }
 .g-slogan {
   font-size: 14px;
@@ -741,7 +793,7 @@ export default {
 .rank-score {
   font-size: 44px;
   font-weight: 800;
-  color: #F5FAFE;
+  color: #FFFFFF;
   font-variant-numeric: tabular-nums;
 }
 .rank-score .unit {
@@ -765,7 +817,7 @@ export default {
 }
 .meter {
   height: 14px;
-  background: rgba(148, 163, 184, 0.2);
+  background: #24405F;
   border-radius: 8px;
   overflow: hidden;
   margin-bottom: 12px;
@@ -773,12 +825,12 @@ export default {
 }
 .meter-fill {
   height: 100%;
-  background: linear-gradient(90deg, #4A9BD7, #2E6FA8 52%, #1F4E79);
+  background: #4A9BD7;
   border-radius: 8px;
   transition: width 0.6s ease;
 }
-.meter-fill.green {
-  background: linear-gradient(90deg, #0E8A4F, #14B8A6);
+.meter-fill.teal {
+  background: #14B8A6;
 }
 .scroll-box {
   flex: 1;
@@ -797,7 +849,7 @@ export default {
   text-overflow: ellipsis;
 }
 .c-item.done {
-  color: #d1fae5;
+  color: #8FC4EE;
 }
 .c-item.todo {
   color: #C8D6E4;
@@ -809,15 +861,15 @@ export default {
   flex-shrink: 0;
 }
 .dot.ok {
-  background: #34d399;
+  background: #34A853;
 }
 .dot.no {
-  background: #475569;
+  background: #24405F;
 }
 .cert-tag {
   font-size: 13px;
-  color: #34d399;
-  border: 1px solid rgba(52, 211, 153, 0.4);
+  color: #8FC4EE;
+  border: 1px solid rgba(143, 196, 238, 0.4);
   border-radius: 4px;
   padding: 0 6px;
   margin-left: 8px;
@@ -825,15 +877,22 @@ export default {
 }
 .cert-tag.gray {
   color: #C8D6E4;
-  border-color: rgba(148, 163, 184, 0.4);
+  border-color: rgba(143, 196, 238, 0.25);
 }
 .empty {
-  color: #475569;
-  font-size: 20px;
+  color: #C8D6E4;
+  font-size: 22px;
   text-align: center;
   padding: 30px 0;
 }
 
+/* 骨架(加载态:#24405F 描边块,保留标题与时间) */
+.sk-card {
+  height: 64px;
+  background: #24405F;
+  border-radius: 12px;
+}
+
 /* 底部 */
 .screen-footer {
   flex-shrink: 0;
@@ -841,21 +900,13 @@ export default {
   justify-content: space-between;
   align-items: center;
   margin-top: 16px;
+  border-top: 1px solid #24405F;
+  padding-top: 14px;
 }
 .foot-item {
-  font-size: 14px;
+  font-size: 22px;
   color: #C8D6E4;
 }
-.live-dot {
-  color: #34d399;
-  font-weight: 700;
-  letter-spacing: 2px;
-  animation: pulse 1.6s infinite;
-}
-@keyframes pulse {
-  0%, 100% { opacity: 1; }
-  50% { opacity: 0.35; }
-}
 
 /* 课程进行时间(突出显示) */
 .timer-row {
@@ -867,21 +918,19 @@ export default {
   display: inline-flex;
   align-items: center;
   gap: 18px;
-  background: linear-gradient(90deg, rgba(46, 111, 168, 0.18), rgba(15, 118, 110, 0.18));
-  border: 1px solid rgba(46, 111, 168, 0.45);
+  background: rgba(74, 155, 215, 0.14);
+  border: 1px solid #4A9BD7;
   border-radius: 40px;
   padding: 10px 32px;
-  box-shadow: 0 0 34px rgba(46, 111, 168, 0.28);
 }
 .timer-box.idle {
-  background: rgba(148, 163, 184, 0.12);
-  border-color: rgba(148, 163, 184, 0.4);
-  box-shadow: none;
+  background: rgba(255, 255, 255, 0.04);
+  border-color: #24405F;
 }
 .timer-label {
-  font-size: 22px;
+  font-size: 24px;
   font-weight: 600;
-  color: #F5FAFE;
+  color: #FFFFFF;
   letter-spacing: 2px;
 }
 .timer-value {
@@ -890,7 +939,6 @@ export default {
   color: #8FC4EE;
   font-variant-numeric: tabular-nums;
   line-height: 1;
-  text-shadow: 0 0 24px rgba(46, 111, 168, 0.5);
 }
 .timer-box.idle .timer-value,
 .timer-idle {
@@ -899,11 +947,11 @@ export default {
   font-weight: 600;
 }
 .step-pill {
-  font-size: 22px;
+  font-size: 24px;
   font-weight: 600;
   color: #8FC4EE;
-  background: rgba(46, 111, 168, 0.2);
-  border: 1px solid rgba(46, 111, 168, 0.4);
+  background: rgba(74, 155, 215, 0.14);
+  border: 1px solid #4A9BD7;
   border-radius: 20px;
   padding: 4px 16px;
 }
@@ -920,37 +968,36 @@ export default {
   display: flex;
   align-items: center;
   gap: 8px;
-  background: rgba(255, 255, 255, 0.05);
-  border: 1px solid rgba(148, 163, 184, 0.2);
+  background: rgba(255, 255, 255, 0.04);
+  border: 1px solid #24405F;
   border-radius: 20px;
   padding: 6px 16px;
   opacity: 0.55;
 }
 .step-item.active {
   opacity: 1;
-  background: rgba(46, 111, 168, 0.2);
+  background: rgba(74, 155, 215, 0.16);
   border-color: #8FC4EE;
-  box-shadow: 0 0 16px rgba(46, 111, 168, 0.3);
 }
 .step-item.done {
   opacity: 0.85;
-  border-color: rgba(52, 211, 153, 0.5);
+  border-color: #14B8A6;
 }
 .step-dot {
   width: 12px;
   height: 12px;
   border-radius: 50%;
-  background: #475569;
+  background: #24405F;
 }
 .step-item.active .step-dot {
   background: #8FC4EE;
 }
 .step-item.done .step-dot {
-  background: #34d399;
+  background: #14B8A6;
 }
 .step-name {
-  font-size: 18px;
-  color: #e2e8f0;
+  font-size: 24px;
+  color: #C8D6E4;
   white-space: nowrap;
 }
 
@@ -975,13 +1022,13 @@ export default {
 }
 .gp-head {
   color: #C8D6E4;
-  font-size: 16px;
+  font-size: 24px;
   padding: 0 8px 4px;
 }
 .gp-cell {
   text-align: center;
-  font-size: 18px;
-  color: #e2e8f0;
+  font-size: 24px;
+  color: #C8D6E4;
   white-space: nowrap;
   overflow: hidden;
   text-overflow: ellipsis;
@@ -989,26 +1036,26 @@ export default {
 .gp-cell.group {
   text-align: left;
   font-weight: 700;
-  color: #f1f5f9;
+  color: #FFFFFF;
 }
 .gp-row {
-  background: rgba(18, 36, 61, 0.45);
+  background: rgba(255, 255, 255, 0.04);
   border-radius: 10px;
   padding: 10px 8px;
 }
 .status-pill {
   display: inline-block;
   min-width: 74px;
-  font-size: 16px;
+  font-size: 24px;
   padding: 3px 10px;
   border-radius: 16px;
-  border: 1px solid rgba(148, 163, 184, 0.4);
+  border: 1px solid #24405F;
   color: #C8D6E4;
 }
 .status-pill.ok {
-  color: #34d399;
-  border-color: rgba(52, 211, 153, 0.5);
-  background: rgba(52, 211, 153, 0.12);
+  color: #8FC4EE;
+  border-color: #8FC4EE;
+  background: rgba(143, 196, 238, 0.12);
 }
 
 /* 底部区域:投票 + 资料 */
@@ -1034,8 +1081,8 @@ export default {
   margin-bottom: 12px;
 }
 .vote-tabs.light .vote-tab {
-  color: #475569;
-  border-color: #C3D2DF;
+  color: #3B5A78;
+  border-color: #DCE7F1;
 }
 .vote-tabs.light .vote-tab.active {
   color: #2E6FA8;
@@ -1043,17 +1090,17 @@ export default {
   background: #E8F3FC;
 }
 .vote-tab {
-  font-size: 16px;
+  font-size: 24px;
   color: #C8D6E4;
   padding: 3px 12px;
   border-radius: 14px;
-  border: 1px solid rgba(148, 163, 184, 0.4);
+  border: 1px solid #24405F;
   cursor: pointer;
 }
 .vote-tab.active {
   color: #8FC4EE;
   border-color: #8FC4EE;
-  background: rgba(46, 111, 168, 0.15);
+  background: rgba(74, 155, 215, 0.14);
 }
 .vote-edit-list {
   max-height: 320px;
@@ -1064,11 +1111,11 @@ export default {
   align-items: center;
   justify-content: space-between;
   padding: 8px 4px;
-  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
+  border-bottom: 1px solid #24405F;
 }
 .vote-edit-name {
-  font-size: 16px;
-  color: #e2e8f0;
+  font-size: 24px;
+  color: #C8D6E4;
 }
 .vote-bars {
   flex: 1;
@@ -1084,9 +1131,9 @@ export default {
   gap: 12px;
 }
 .v-name {
-  width: 130px;
-  font-size: 18px;
-  color: #e2e8f0;
+  width: 160px;
+  font-size: 24px;
+  color: #C8D6E4;
   white-space: nowrap;
   overflow: hidden;
   text-overflow: ellipsis;
@@ -1095,22 +1142,22 @@ export default {
 .v-track {
   flex: 1;
   height: 16px;
-  background: rgba(148, 163, 184, 0.2);
+  background: #24405F;
   border-radius: 8px;
   overflow: hidden;
 }
 .v-fill {
   height: 100%;
-  background: linear-gradient(90deg, #4A9BD7, #2E6FA8 52%, #1F4E79);
+  background: #4A9BD7;
   border-radius: 8px;
   transition: width 0.6s ease;
 }
 .v-count {
-  width: 40px;
+  width: 60px;
   text-align: right;
-  font-size: 20px;
+  font-size: 24px;
   font-weight: 700;
-  color: #F5FAFE;
+  color: #FFFFFF;
   font-variant-numeric: tabular-nums;
 }
 .material-list {
@@ -1122,12 +1169,9 @@ export default {
   display: flex;
   align-items: center;
   gap: 10px;
-  font-size: 20px;
+  font-size: 24px;
   padding: 8px 4px;
-  color: #e2e8f0;
-}
-.m-icon {
-  font-size: 20px;
+  color: #C8D6E4;
 }
 .m-name {
   white-space: nowrap;
@@ -1146,20 +1190,20 @@ export default {
   gap: 12px;
   padding: 12px 14px;
   border-radius: 10px;
-  border: 1px solid rgba(148, 163, 184, 0.2);
+  border: 1px solid #24405F;
   margin-bottom: 8px;
   cursor: pointer;
 }
 .step-edit-item.active {
-  border-color: #2E6FA8;
-  background: rgba(46, 111, 168, 0.1);
+  border-color: #4A9BD7;
+  background: rgba(74, 155, 215, 0.12);
 }
 .step-edit-dot {
   width: 28px;
   height: 28px;
   border-radius: 50%;
-  background: #475569;
-  color: #e2e8f0;
+  background: #24405F;
+  color: #C8D6E4;
   display: flex;
   align-items: center;
   justify-content: center;
@@ -1167,15 +1211,15 @@ export default {
   flex-shrink: 0;
 }
 .step-edit-item.active .step-edit-dot {
-  background: #2E6FA8;
+  background: #4A9BD7;
 }
 .step-edit-name {
   flex: 1;
-  font-size: 16px;
-  color: #e2e8f0;
+  font-size: 24px;
+  color: #C8D6E4;
 }
 .step-edit-min {
-  font-size: 14px;
+  font-size: 22px;
   color: #C8D6E4;
 }
 .agenda-editor {
@@ -1189,7 +1233,7 @@ export default {
 }
 .banner-hint {
   font-size: 13px;
-  color: #C8D6E4;
+  color: #6B7B8C;
   margin-bottom: 8px;
 }
 
@@ -1199,17 +1243,16 @@ export default {
   top: 12px;
   left: 50%;
   transform: translateX(-50%);
-  background: rgba(15, 23, 42, 0.9);
-  border: 1px solid rgba(148, 163, 184, 0.3);
+  background: rgba(18, 36, 61, 0.92);
+  border: 1px solid #24405F;
   border-radius: 10px;
   padding: 8px 12px;
   display: flex;
   align-items: center;
   gap: 10px;
   z-index: 100;
-  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
 }
 .back-link {
   color: #8FC4EE !important;
 }
-</style>
+</style>