Sfoglia il codice sorgente

APP工时、工分、开屏数字相关优化

ouyj 2 mesi fa
parent
commit
ebda162030
3 ha cambiato i file con 14 aggiunte e 8 eliminazioni
  1. 3 3
      pages/score/index.uvue
  2. 8 2
      pages/splash/index.uvue
  3. 3 3
      pages/worktime/index.uvue

+ 3 - 3
pages/score/index.uvue

@@ -159,18 +159,18 @@
 			<!-- 统计数据 -->
 			<view class="stats-content">
 			  <view class="total-score">
-				<text class="score-value">{{ totalScore }}分</text>
+				<text class="score-value">{{ formatNumber(totalScore) }}分</text>
 				<text class="score-label">{{ monthTitle }}总工分</text>
 			  </view>
 
 			  <view class="score-breakdown">
 				<view class="breakdown-item">
 				  <text class="breakdown-label">维保工分</text>
-				  <text class="breakdown-value">{{ maintenanceScore }}分</text>
+				  <text class="breakdown-value">{{ formatNumber(maintenanceScore) }}分</text>
 				</view>
 				<view class="breakdown-item">
 				  <text class="breakdown-label">维修工分</text>
-				  <text class="breakdown-value">{{ repairScore }}分</text>
+				  <text class="breakdown-value">{{ formatNumber(repairScore) }}分</text>
 				</view>
 				<!-- <view v-if="rank !== null && totalRankingUsers !== null" class="breakdown-item">
 				  <text class="breakdown-label">排名</text>

+ 8 - 2
pages/splash/index.uvue

@@ -8,7 +8,7 @@
         <text class="module-title">本月工分</text>
         <view class="score-container">
           <text class="score-icon">🏆</text>
-          <text class="score-value">{{ userData.monthlyScore }}</text>
+          <text class="score-value">{{ formatNumber(userData.monthlyScore) }}</text>
         </view>
       </view>
 
@@ -305,6 +305,11 @@ export default {
       return `size-${size}`;
     };
 
+    function formatNumber(value: number | null) {
+      if (value == null) return '0.0'
+      return value.toFixed(2)
+    }
+
     onUnmounted(() => {
       if (countdownTimer != null) {
         clearInterval(countdownTimer as number);
@@ -319,7 +324,8 @@ export default {
       userData,
       closeSplash,
       getRankingIcon,
-      getRankingSizeClass
+      getRankingSizeClass,
+      formatNumber
     };
   }
 };

+ 3 - 3
pages/worktime/index.uvue

@@ -81,18 +81,18 @@
       <!-- 统计数据 -->
       <view class="stats-content">
         <view class="total-hours" v-if="orderTypeFilter === ''">
-          <text class="hours-value">{{ totalHours }}小时</text>
+          <text class="hours-value">{{ formatNumber(totalHours) }}小时</text>
           <text class="hours-label">{{ timeRangeTitle }}总工时</text>
         </view>
 
         <view class="hours-breakdown">
           <view v-if="orderTypeFilter !== '1'" class="breakdown-item">
             <text class="breakdown-label">维保工时</text>
-            <text class="breakdown-value">{{ maintenanceHours }}小时</text>
+            <text class="breakdown-value">{{ formatNumber(maintenanceHours) }}小时</text>
           </view>
           <view v-if="orderTypeFilter !== '2'" class="breakdown-item">
             <text class="breakdown-label">维修工时</text>
-            <text class="breakdown-value">{{ repairHours }}小时</text>
+            <text class="breakdown-value">{{ formatNumber(repairHours) }}小时</text>
           </view>
           <!-- <view v-if="rank !== null && totalRankingUsers !== null" class="breakdown-item">
             <text class="breakdown-label">排名</text>