Просмотр исходного кода

fix: 测评/心智页面日期解析改用 parseDate(iOS 兼容)

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
asus 3 месяцев назад
Родитель
Сommit
32086f9276

+ 3 - 1
cfc-frontend/pages/assessment/execution.vue

@@ -105,6 +105,7 @@
 
 <script>
 import config from '@/config.js'
+import { parseDate } from '../../utils/format.js'
 
 export default {
   data() {
@@ -196,7 +197,8 @@ export default {
     },
     formatTime(timeStr) {
       if (!timeStr) return ''
-      const date = new Date(timeStr)
+      const date = parseDate(timeStr)
+      if (!date) return ''
       return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')} ${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}`
     },
     getStatusClass(exec) {

+ 3 - 1
cfc-frontend/pages/assessment/quota.vue

@@ -48,6 +48,7 @@
 
 <script>
 import { getAssessmentQuotas } from '../../utils/api.js'
+import { parseDate } from '../../utils/format.js'
 
 export default {
   data() {
@@ -78,7 +79,8 @@ export default {
     },
     formatDate(dateStr) {
       if (!dateStr) return ''
-      const d = new Date(dateStr)
+      const d = parseDate(dateStr)
+      if (!d) return ''
       return d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate()
     },
     goAppoint(item) {

+ 3 - 1
cfc-frontend/pages/assessment/results.vue

@@ -171,6 +171,7 @@
 
 <script>
 import { getMyAssessmentResults, getChildAssessmentResults } from '../../utils/api.js'
+import { parseDate } from '../../utils/format.js'
 
 export default {
   data() {
@@ -219,7 +220,8 @@ export default {
 
     formatDate(dateStr) {
       if (!dateStr) return ''
-      const date = new Date(dateStr)
+      const date = parseDate(dateStr)
+      if (!date) return ''
       return `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}-${String(date.getDate()).padStart(2, '0')}`
     },
     goToAppointments() {

+ 5 - 2
cfc-frontend/pages/mind-detail/emotion-trend.vue

@@ -125,6 +125,7 @@
 <script>
 import config from '../../config'
 import PsychCrisisBanner from '../../components/PsychCrisisBanner.vue'
+import { parseDate } from '../../utils/format.js'
 
 export default {
   components: { PsychCrisisBanner },
@@ -176,7 +177,8 @@ export default {
       if (this.trend && this.trend.dailyData) {
         for (const d of this.trend.dailyData) {
           if (d.date) {
-            const dateObj = new Date(d.date)
+            const dateObj = parseDate(d.date)
+            if (!dateObj) continue
             dataMap[dateObj.getDate()] = d
           }
         }
@@ -316,7 +318,8 @@ export default {
 
     formatDate(dateStr) {
       if (!dateStr) return ''
-      const d = new Date(dateStr)
+      const d = parseDate(dateStr)
+      if (!d) return ''
       return (d.getMonth() + 1) + '/' + d.getDate()
     },
 

+ 3 - 1
cfc-frontend/pages/mind-detail/family-dashboard.vue

@@ -162,6 +162,7 @@
 
 <script>
 import MpHtml from '@/components/mp-html/mp-html.vue'
+import { parseDate } from '../../utils/format.js'
 /**
  * FamilyDashboard — 家庭天盘详情页
  * 包含:运势数据、能量趋势、历史周报、月度日历等
@@ -603,7 +604,8 @@ export default {
     // 格式化日期
     formatDate(date) {
       if (!date) return ''
-      const d = new Date(date)
+      const d = parseDate(date)
+      if (!d) return ''
       return `${d.getMonth() + 1}月${d.getDate()}日`
     },
     

+ 5 - 2
cfc-frontend/pages/mind/emotion-trend.vue

@@ -121,6 +121,7 @@
 
 <script>
 import config from '../../config'
+import { parseDate } from '../../utils/format.js'
 
 export default {
   data() {
@@ -167,7 +168,8 @@ export default {
       if (this.trend && this.trend.dailyData) {
         for (const d of this.trend.dailyData) {
           if (d.date) {
-            const dateObj = new Date(d.date)
+            const dateObj = parseDate(d.date)
+            if (!dateObj) continue
             dataMap[dateObj.getDate()] = d
           }
         }
@@ -306,7 +308,8 @@ export default {
 
     formatDate(dateStr) {
       if (!dateStr) return ''
-      const d = new Date(dateStr)
+      const d = parseDate(dateStr)
+      if (!d) return ''
       return (d.getMonth() + 1) + '/' + d.getDate()
     },
 

+ 5 - 2
cfc-frontend/pages/mind/index.vue

@@ -176,6 +176,7 @@ import FamilyTianpanCard from '../../components/FamilyTianpanCard.vue'
 import FamilyMemberStrip from '../../components/FamilyMemberStrip.vue'
 import { getVisibleSections, getFeaturedArticles, getEmiReport, getFamilyEnergySandbox, getTodayTasksByCategory, getActivityList, getProductsByDomain, getChildren, getVisibleFamilyMembers, getEnergyOverview, getContactList, getHealthAlerts, getMilestones, getDanReportByChild, getFamilyFortune } from '../../utils/api.js'
 import config from '../../config.js'
+import { parseDate } from '../../utils/format.js'
 
 export default {
 components: { TabTransition, PageBanner, RadarChart, LoginGuideCard, FamilyEnergyBar, DimensionTasks, DimensionActivities, DimensionProducts, ArticleBookshelf, PsychCrisisBanner, AIFloatingAvatar, FamilyTianpanCard, FamilyMemberStrip },
@@ -594,7 +595,8 @@ components: { TabTransition, PageBanner, RadarChart, LoginGuideCard, FamilyEnerg
 
     formatDate: function(dateStr) {
       if (!dateStr) return ''
-      var d = new Date(dateStr)
+      var d = parseDate(dateStr)
+      if (!d) return ''
       var month = d.getMonth() + 1
       var day = d.getDate()
       return month + '月' + day + '日'
@@ -1003,7 +1005,8 @@ components: { TabTransition, PageBanner, RadarChart, LoginGuideCard, FamilyEnerg
     },
     formatDate: function(dateStr) {
       if (!dateStr) return ''
-      var d = new Date(dateStr)
+      var d = parseDate(dateStr)
+      if (!d) return ''
       return d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate()
     }
   }