Bladeren bron

超短池参考数据修正

Zhangbw 1 maand geleden
bovenliggende
commit
3158759ba6
3 gewijzigde bestanden met toevoegingen van 15 en 18 verwijderingen
  1. 1 1
      src/App.vue
  2. 5 4
      src/pages/history/history.vue
  3. 9 13
      src/pages/pool/pool.vue

+ 1 - 1
src/App.vue

@@ -73,7 +73,7 @@ export default {
   onShow: function() {
 	  const accountInfo = wx.getAccountInfoSync();
 	  //fakecheck
-	  // this.globalData.envVersion = accountInfo.miniProgram.envVersion
+	  this.globalData.envVersion = accountInfo.miniProgram.envVersion
     console.log('App Show')
     // 确保导航栏标题正确显示
     uni.setNavigationBarTitle({

+ 5 - 4
src/pages/history/history.vue

@@ -85,7 +85,7 @@
 </template>
 
 <script setup>
-import { ref, computed } from 'vue'
+import { ref } from 'vue'
 import { onLoad } from '@dcloudio/uni-app'
 import { getStockHistory } from '../../utils/api.js'
 
@@ -99,9 +99,8 @@ const loading = ref(false)
 const pageNum = ref(1)
 const pageSize = ref(20)
 
-// 统计成功和失败数量
-const successCount = computed(() => historyList.value.filter(item => item.status === 'success').length)
-const failCount = computed(() => historyList.value.filter(item => item.status === 'fail').length)
+const successCount = ref(0)
+const failCount = ref(0)
 
 // 格式化日期显示
 const formatDate = (dateStr) => {
@@ -155,6 +154,8 @@ const loadHistoryData = async () => {
     if (res.code === 200 && res.data) {
       if (pageNum.value === 1) {
         historyList.value = res.data.list || []
+        successCount.value = res.data.successCount || 0
+        failCount.value = res.data.failCount || 0
       } else {
         historyList.value = [...historyList.value, ...(res.data.list || [])]
       }

+ 9 - 13
src/pages/pool/pool.vue

@@ -128,20 +128,11 @@ const performanceStats = reactive({
   totalCount: 0
 })
 
-// 日期变化时加载统计数据
-const onDateChange = async ({ startDate, endDate, poolType }) => {
-  // 检查登录状态,未登录则不查询
-  if (!checkLogin()) {
-    console.log('[超短池] 未登录,跳过统计数据查询')
-    return
-  }
-
+// 加载全量统计数据(不受日期区间影响)
+const loadPerformanceStats = async (poolType) => {
+  if (!checkLogin()) return
   try {
-    const res = await getStockHistoryStats({
-      startDate,
-      endDate,
-      poolType
-    })
+    const res = await getStockHistoryStats({ poolType })
     if (res.code === 200 && res.data) {
       performanceStats.successRate = res.data.successRate || '0%'
       performanceStats.avgTrend = res.data.avgTrend || '+0%'
@@ -152,6 +143,10 @@ const onDateChange = async ({ startDate, endDate, poolType }) => {
   }
 }
 
+// 日期变化时只刷新列表,不再更新统计数据
+const onDateChange = async ({ startDate, endDate, poolType }) => {
+}
+
 // 获取涨跌样式
 const getChangeClass = (changePercent) => {
   if (!changePercent || changePercent === '-') return ''
@@ -415,6 +410,7 @@ onLoad(() => {
   isPageVisible.value = true
   checkPurchaseStatus()
   startSubscriptionRefresh()
+  loadPerformanceStats(1)
 })
 
 onShow(() => {