Pārlūkot izejas kodu

我的股票修改

Zhangbw 3 mēneši atpakaļ
vecāks
revīzija
3756ee9994

+ 0 - 0
STOCK_LIST_FEATURE.md


+ 31 - 30
dist/dev/mp-weixin/components/StockListItem.js

@@ -21,26 +21,37 @@ const _sfc_main = {
     let currentX = 0;
     let autoResetTimer = null;
     let checkTimer = null;
-    const AUTO_RESET_DELAY = 2e3;
-    let lastSlideTime = 0;
+    const AUTO_RESET_DELAY = 2500;
+    let isSlideOpen = false;
+    const forceReset = () => {
+      console.log("[滑动删除] 强制还原");
+      moveX.value = 0;
+      currentX = 0;
+      isSlideOpen = false;
+      clearAutoResetTimer();
+    };
     const startAutoResetTimer = () => {
-      lastSlideTime = Date.now();
       clearAutoResetTimer();
+      isSlideOpen = true;
+      console.log("[滑动删除] 启动自动还原计时器");
       autoResetTimer = setTimeout(() => {
-        if (moveX.value < 0) {
-          moveX.value = 0;
-          currentX = 0;
-        }
+        console.log("[滑动删除] 主计时器触发");
+        forceReset();
       }, AUTO_RESET_DELAY);
-      if (!checkTimer) {
-        checkTimer = setInterval(() => {
-          if (moveX.value < 0 && Date.now() - lastSlideTime > AUTO_RESET_DELAY) {
-            moveX.value = 0;
-            currentX = 0;
-            clearAutoResetTimer();
-          }
-        }, 500);
-      }
+      checkTimer = setInterval(() => {
+        if (isSlideOpen && moveX.value < 0) {
+          console.log("[滑动删除] 备用检查中...");
+        } else if (isSlideOpen && moveX.value === 0) {
+          isSlideOpen = false;
+          clearAutoResetTimer();
+        }
+      }, 500);
+      setTimeout(() => {
+        if (isSlideOpen) {
+          console.log("[滑动删除] 保险计时器触发");
+          forceReset();
+        }
+      }, AUTO_RESET_DELAY + 1e3);
     };
     const clearAutoResetTimer = () => {
       if (autoResetTimer) {
@@ -170,10 +181,6 @@ const _sfc_main = {
     };
     const handleMoveChange = (e) => {
       currentX = e.detail.x;
-      if (props.showDelete && currentX <= -deleteWidth / 2) {
-        lastSlideTime = Date.now();
-        startAutoResetTimer();
-      }
     };
     const handleMoveEnd = () => {
       if (!props.showDelete)
@@ -182,14 +189,11 @@ const _sfc_main = {
         moveX.value = -deleteWidth;
         startAutoResetTimer();
       } else {
-        moveX.value = 0;
-        currentX = 0;
-        clearAutoResetTimer();
+        forceReset();
       }
     };
     const handleDelete = () => {
-      clearAutoResetTimer();
-      moveX.value = 0;
+      forceReset();
       emit("delete");
     };
     common_vendor.onMounted(() => {
@@ -215,11 +219,8 @@ const _sfc_main = {
       }
     });
     common_vendor.watch(moveX, (newVal) => {
-      if (newVal < 0 && props.showDelete) {
-        if (!autoResetTimer) {
-          startAutoResetTimer();
-        }
-      } else if (newVal === 0) {
+      if (newVal === 0 && isSlideOpen) {
+        isSlideOpen = false;
         clearAutoResetTimer();
       }
     });

+ 2 - 7
dist/dev/mp-weixin/pages/mine/mine.js

@@ -6,14 +6,9 @@ const _sfc_main = {
   __name: "mine",
   setup(__props) {
     const isLoggedIn = common_vendor.ref(false);
-    common_vendor.ref(false);
     const userInfo = common_vendor.ref({
       nickname: "",
-      avatar: "",
-      phone: ""
-    });
-    common_vendor.onMounted(() => {
-      loadUserInfo();
+      avatar: ""
     });
     common_vendor.onShow(() => {
       loadUserInfo();
@@ -49,7 +44,7 @@ const _sfc_main = {
           if (res.confirm) {
             utils_auth.logout();
             isLoggedIn.value = false;
-            userInfo.value = { nickname: "", avatar: "", phone: "" };
+            userInfo.value = { nickname: "", avatar: "" };
             common_vendor.index.showToast({ title: "已退出登录", icon: "none" });
           }
         }

+ 5 - 14
dist/dev/mp-weixin/pages/pool/pool.js

@@ -7,8 +7,6 @@ const _sfc_main = {
   setup(__props) {
     const isPurchased = common_vendor.ref(false);
     const showModal = common_vendor.ref(false);
-    const showPhoneAuth = common_vendor.ref(false);
-    common_vendor.ref("reward");
     const startMonth = common_vendor.ref("2025-01");
     const endMonth = common_vendor.ref("2025-11");
     const isLoggedIn = common_vendor.ref(false);
@@ -137,20 +135,13 @@ const _sfc_main = {
         g: endMonth.value,
         h: common_vendor.o(onEndMonthChange),
         i: common_vendor.o(onHistorySearch),
-        j: showPhoneAuth.value
-      }, showPhoneAuth.value ? {
-        k: common_vendor.o((...args) => _ctx.onGetPhoneNumber && _ctx.onGetPhoneNumber(...args)),
-        l: common_vendor.o(() => {
-        }),
-        m: common_vendor.o((...args) => _ctx.closePhoneAuth && _ctx.closePhoneAuth(...args))
-      } : {}, {
-        n: showModal.value
+        j: showModal.value
       }, showModal.value ? {
-        o: common_vendor.o(closePurchaseModal),
-        p: common_vendor.o(handlePurchase),
-        q: common_vendor.o(() => {
+        k: common_vendor.o(closePurchaseModal),
+        l: common_vendor.o(handlePurchase),
+        m: common_vendor.o(() => {
         }),
-        r: common_vendor.o(closePurchaseModal)
+        n: common_vendor.o(closePurchaseModal)
       } : {});
     };
   }

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
dist/dev/mp-weixin/pages/pool/pool.wxml


+ 0 - 59
dist/dev/mp-weixin/pages/pool/pool.wxss

@@ -334,62 +334,3 @@
 .bottom-safe-area {
   height: 80rpx;
 }
-
-/* 手机号授权弹窗 */
-.phone-auth-mask {
-  position: fixed;
-  top: 0;
-  left: 0;
-  right: 0;
-  bottom: 0;
-  background: rgba(0, 0, 0, 0.6);
-  display: flex;
-  align-items: center;
-  justify-content: center;
-  z-index: 9999;
-}
-.phone-auth-prompt {
-  width: 560rpx;
-  background: #ffffff;
-  border-radius: 24rpx;
-  padding: 50rpx 40rpx;
-  text-align: center;
-  box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.3);
-}
-.auth-icon {
-  font-size: 72rpx;
-  margin-bottom: 20rpx;
-}
-.auth-title {
-  display: block;
-  font-size: 32rpx;
-  font-weight: 600;
-  color: #222222;
-  margin-bottom: 12rpx;
-}
-.auth-desc {
-  display: block;
-  font-size: 24rpx;
-  color: #999999;
-  line-height: 1.5;
-  margin-bottom: 32rpx;
-}
-.auth-button {
-  width: 100%;
-  height: 80rpx;
-  background: linear-gradient(135deg, #FF9800, #FFA726);
-  color: #ffffff;
-  border-radius: 40rpx;
-  font-size: 30rpx;
-  font-weight: 600;
-  box-shadow: 0 8rpx 24rpx rgba(255, 152, 0, 0.4);
-  display: flex;
-  align-items: center;
-  justify-content: center;
-  border: none;
-  padding: 0;
-  line-height: 80rpx;
-}
-.auth-button::after {
-  border: none;
-}

+ 34 - 6
dist/dev/mp-weixin/pages/rank/rank.js

@@ -12,6 +12,9 @@ const _sfc_main = {
     const isLoggedIn = common_vendor.ref(false);
     const myStocks = common_vendor.ref([]);
     const viewMode = common_vendor.ref("list");
+    const isLoading = common_vendor.ref(false);
+    const lastLoadTime = common_vendor.ref(0);
+    const CACHE_DURATION = 5e3;
     const setViewMode = (mode) => {
       viewMode.value = mode;
     };
@@ -83,15 +86,30 @@ const _sfc_main = {
         return "market-cy";
       return "market-sh";
     };
-    const loadMyStocks = async () => {
-      console.log("[我的股票] loadMyStocks 开始执行, isLoggedIn=", isLoggedIn.value);
+    const loadMyStocks = async (forceRefresh = false) => {
+      console.log("[我的股票] loadMyStocks 开始执行, isLoggedIn=", isLoggedIn.value, "forceRefresh=", forceRefresh);
       if (!isLoggedIn.value) {
         myStocks.value = [];
         stopAutoRefresh();
         return;
       }
+      if (isLoading.value) {
+        console.log("[我的股票] 正在加载中,跳过");
+        return;
+      }
+      const now = Date.now();
+      if (!forceRefresh && myStocks.value.length > 0 && now - lastLoadTime.value < CACHE_DURATION) {
+        console.log("[我的股票] 使用缓存数据,只刷新行情");
+        await fetchIndexData();
+        await refreshAllQuotes();
+        startAutoRefresh();
+        return;
+      }
       try {
-        common_vendor.index.showLoading({ title: "加载中..." });
+        isLoading.value = true;
+        if (myStocks.value.length === 0 || forceRefresh) {
+          common_vendor.index.showLoading({ title: "加载中..." });
+        }
         console.log("[我的股票] 调用 getUserStocks 接口");
         const res = await utils_api.getUserStocks();
         console.log("[我的股票] 服务器返回:", JSON.stringify(res));
@@ -108,6 +126,7 @@ const _sfc_main = {
             changePercent: item.changePercent,
             trendData: item.trendData
           }));
+          lastLoadTime.value = Date.now();
           console.log("[我的股票] 加载完成, 股票数量:", myStocks.value.length);
         } else {
           myStocks.value = [];
@@ -121,8 +140,12 @@ const _sfc_main = {
       } catch (e) {
         common_vendor.index.hideLoading();
         console.error("[我的股票] 加载失败:", e);
-        myStocks.value = [];
+        if (myStocks.value.length === 0) {
+          myStocks.value = [];
+        }
         startAutoRefresh();
+      } finally {
+        isLoading.value = false;
       }
     };
     const refreshAllQuotes = async () => {
@@ -236,12 +259,17 @@ const _sfc_main = {
     common_vendor.onLoad(() => {
       console.log("[我的股票] onLoad 触发");
       isLoggedIn.value = utils_auth.isLoggedIn();
-      loadMyStocks();
+      loadMyStocks(true);
     });
     common_vendor.onShow(() => {
       console.log("[我的股票] onShow 触发");
+      const wasLoggedIn = isLoggedIn.value;
       isLoggedIn.value = utils_auth.isLoggedIn();
-      loadMyStocks();
+      if (wasLoggedIn !== isLoggedIn.value) {
+        loadMyStocks(true);
+      } else {
+        loadMyStocks(false);
+      }
       common_vendor.index.setNavigationBarTitle({ title: "量化交易大师" });
     });
     common_vendor.onHide(() => {

+ 0 - 1
dist/dev/mp-weixin/pages/strong/strong.js

@@ -7,7 +7,6 @@ const _sfc_main = {
   setup(__props) {
     const isPurchased = common_vendor.ref(false);
     const showModal = common_vendor.ref(false);
-    common_vendor.ref("yearly");
     const stockList = common_vendor.ref([
       {
         name: "信维通信",

+ 44 - 39
src/components/StockListItem.vue

@@ -78,35 +78,52 @@ const deleteWidth = 60 // 删除按钮宽度(px)
 const moveX = ref(0)
 let currentX = 0
 let autoResetTimer = null // 自动还原计时器
-let checkTimer = null // 检查计时器
-const AUTO_RESET_DELAY = 2000 // 自动还原延迟时间(ms)
-let lastSlideTime = 0 // 最后滑动时间
+let checkTimer = null // 检查计时器(备用)
+const AUTO_RESET_DELAY = 2500 // 自动还原延迟时间(ms)
+let isSlideOpen = false // 标记滑动是否打开
+
+// 强制还原到初始位置
+const forceReset = () => {
+  console.log('[滑动删除] 强制还原')
+  moveX.value = 0
+  currentX = 0
+  isSlideOpen = false
+  clearAutoResetTimer()
+}
 
 // 启动自动还原计时器
 const startAutoResetTimer = () => {
-  lastSlideTime = Date.now()
-  
   // 清除之前的计时器
   clearAutoResetTimer()
   
-  // 使用 setTimeout 作为主计时器
+  isSlideOpen = true
+  console.log('[滑动删除] 启动自动还原计时器')
+  
+  // 主计时器
   autoResetTimer = setTimeout(() => {
-    if (moveX.value < 0) {
-      moveX.value = 0
-      currentX = 0
-    }
+    console.log('[滑动删除] 主计时器触发')
+    forceReset()
   }, AUTO_RESET_DELAY)
   
-  // 使用 setInterval 作为备用检查,确保一定会返回
-  if (!checkTimer) {
-    checkTimer = setInterval(() => {
-      if (moveX.value < 0 && Date.now() - lastSlideTime > AUTO_RESET_DELAY) {
-        moveX.value = 0
-        currentX = 0
-        clearAutoResetTimer()
-      }
-    }, 500)
-  }
+  // 备用检查计时器,每500ms检查一次,确保一定会还原
+  checkTimer = setInterval(() => {
+    if (isSlideOpen && moveX.value < 0) {
+      // 如果主计时器失效,备用计时器在3秒后强制还原
+      console.log('[滑动删除] 备用检查中...')
+    } else if (isSlideOpen && moveX.value === 0) {
+      // 已经还原了,清理状态
+      isSlideOpen = false
+      clearAutoResetTimer()
+    }
+  }, 500)
+  
+  // 额外的保险:3.5秒后无论如何都还原
+  setTimeout(() => {
+    if (isSlideOpen) {
+      console.log('[滑动删除] 保险计时器触发')
+      forceReset()
+    }
+  }, AUTO_RESET_DELAY + 1000)
 }
 
 // 清除自动还原计时器
@@ -278,11 +295,6 @@ const generateMockTrendData = () => {
 // 滑动变化
 const handleMoveChange = (e) => {
   currentX = e.detail.x
-  // 如果滑动到了删除按钮位置,更新最后滑动时间并启动计时器
-  if (props.showDelete && currentX <= -deleteWidth / 2) {
-    lastSlideTime = Date.now()
-    startAutoResetTimer()
-  }
 }
 
 // 滑动结束
@@ -295,17 +307,14 @@ const handleMoveEnd = () => {
     // 启动自动还原计时器
     startAutoResetTimer()
   } else {
-    moveX.value = 0
-    currentX = 0
-    // 滑回初始位置,清除计时器
-    clearAutoResetTimer()
+    // 滑回初始位置
+    forceReset()
   }
 }
 
 // 处理删除
 const handleDelete = () => {
-  clearAutoResetTimer() // 点击删除时清除计时器
-  moveX.value = 0
+  forceReset() // 点击删除时还原位置
   emit('delete')
 }
 
@@ -338,15 +347,11 @@ watch(() => props.stock.changePercent, () => {
   }
 })
 
-// 监听滑动位置变化,确保自动还原计时器正确工作
+// 监听滑动位置变化
 watch(moveX, (newVal) => {
-  if (newVal < 0 && props.showDelete) {
-    // 滑动到删除位置,确保计时器在运行
-    if (!autoResetTimer) {
-      startAutoResetTimer()
-    }
-  } else if (newVal === 0) {
-    // 已还原,清除计时器
+  if (newVal === 0 && isSlideOpen) {
+    // 已还原,清理状态
+    isSlideOpen = false
     clearAutoResetTimer()
   }
 })

+ 3 - 12
src/pages/mine/mine.vue

@@ -43,23 +43,14 @@
 </template>
 
 <script setup>
-import { ref, onMounted } from 'vue'
+import { ref } from 'vue'
 import { onShow } from '@dcloudio/uni-app'
 import { isLoggedIn as checkLogin, getUserInfo as getStoredUserInfo, logout, checkLogin as requireLogin } from '@/utils/auth.js'
 
 const isLoggedIn = ref(false)
-const showPhoneAuth = ref(false)
 const userInfo = ref({
   nickname: '',
-  avatar: '',
-  phone: ''
-})
-
-/**
- * 页面加载时检查登录状态
- */
-onMounted(() => {
-  loadUserInfo()
+  avatar: ''
 })
 
 /**
@@ -118,7 +109,7 @@ const handleLogout = () => {
       if (res.confirm) {
         logout()
         isLoggedIn.value = false
-        userInfo.value = { nickname: '', avatar: '', phone: '' }
+        userInfo.value = { nickname: '', avatar: '' }
         uni.showToast({ title: '已退出登录', icon: 'none' })
       }
     }

+ 0 - 85
src/pages/pool/pool.vue

@@ -102,22 +102,6 @@
       </view>
     </scroll-view>
 
-    <!-- 手机号授权弹窗 -->
-    <view v-if="showPhoneAuth" class="phone-auth-mask" @click="closePhoneAuth">
-      <view class="phone-auth-prompt" @click.stop>
-        <text class="auth-title">授权手机号</text>
-        <text class="auth-desc">为了完成登录,需要获取您的手机号</text>
-        
-        <button 
-          class="auth-button" 
-          open-type="getPhoneNumber" 
-          @getphonenumber="onGetPhoneNumber"
-        >
-          授权手机号
-        </button>
-      </view>
-    </view>
-
     <!-- 购买弹窗 -->
     <view v-if="showModal" class="modal-overlay" @click="closePurchaseModal">
       <view class="modal-content" @click.stop>
@@ -156,8 +140,6 @@ import { isLoggedIn as checkLoginStatus } from '../../utils/auth.js'
 
 const isPurchased = ref(false)
 const showModal = ref(false)
-const showPhoneAuth = ref(false)  // 是否显示手机号授权按钮
-const selectedPlan = ref('reward')  // 固定为打赏
 const startMonth = ref('2025-01')  // 开始月份
 const endMonth = ref('2025-11')    // 结束月份
 const isLoggedIn = ref(false)
@@ -295,8 +277,6 @@ const onHistorySearch = () => {
     icon: 'none',
     duration: 2000
   })
-  // TODO: 调用后端API查询历史数据
-  // const response = await getHistoryPoolData(startMonth.value, endMonth.value)
 }
 
 // 使用uni-app生命周期钩子
@@ -704,69 +684,4 @@ onShow(() => {
 .bottom-safe-area {
   height: 80rpx;
 }
-
-/* 手机号授权弹窗 */
-.phone-auth-mask {
-  position: fixed;
-  top: 0;
-  left: 0;
-  right: 0;
-  bottom: 0;
-  background: rgba(0, 0, 0, 0.6);
-  display: flex;
-  align-items: center;
-  justify-content: center;
-  z-index: 9999;
-}
-
-.phone-auth-prompt {
-  width: 560rpx;
-  background: #ffffff;
-  border-radius: 24rpx;
-  padding: 50rpx 40rpx;
-  text-align: center;
-  box-shadow: 0 20rpx 60rpx rgba(0, 0, 0, 0.3);
-}
-
-.auth-icon {
-  font-size: 72rpx;
-  margin-bottom: 20rpx;
-}
-
-.auth-title {
-  display: block;
-  font-size: 32rpx;
-  font-weight: 600;
-  color: #222222;
-  margin-bottom: 12rpx;
-}
-
-.auth-desc {
-  display: block;
-  font-size: 24rpx;
-  color: #999999;
-  line-height: 1.5;
-  margin-bottom: 32rpx;
-}
-
-.auth-button {
-  width: 100%;
-  height: 80rpx;
-  background: linear-gradient(135deg, #FF9800, #FFA726);
-  color: #ffffff;
-  border-radius: 40rpx;
-  font-size: 30rpx;
-  font-weight: 600;
-  box-shadow: 0 8rpx 24rpx rgba(255, 152, 0, 0.4);
-  display: flex;
-  align-items: center;
-  justify-content: center;
-  border: none;
-  padding: 0;
-  line-height: 80rpx;
-}
-
-.auth-button::after {
-  border: none;
-}
 </style>

+ 1 - 2
src/pages/profile/edit.vue

@@ -118,8 +118,7 @@ export default {
         // 上传头像(如果更换了头像且不是默认头像)
         let uploadedAvatarUrl = this.avatarUrl
         if (this.avatarUrl !== this.originalAvatar && !this.avatarUrl.startsWith('/static/')) {
-          // TODO: 这里需要上传头像到服务器
-          // 暂时直接使用微信临时路径
+          // 暂时直接使用微信临时路径,后续可扩展上传到服务器
           uploadedAvatarUrl = this.avatarUrl
         }
 

+ 48 - 15
src/pages/rank/rank.vue

@@ -120,13 +120,11 @@ import StockListItem from '../../components/StockListItem.vue'
 const isLoggedIn = ref(false)
 const myStocks = ref([])
 const viewMode = ref('list') // 'list' 或 'table'
+const isLoading = ref(false) // 加载状态
+const lastLoadTime = ref(0) // 上次加载时间
+const CACHE_DURATION = 5000 // 缓存有效期5秒
 
-// 切换视图模式
-const toggleViewMode = () => {
-  viewMode.value = viewMode.value === 'list' ? 'table' : 'list'
-}
-
-// 设置视图模式(只切换显示,不重新加载数据)
+// 设置视图模式
 const setViewMode = (mode) => {
   viewMode.value = mode
 }
@@ -200,8 +198,8 @@ const getMarketClass = (code) => {
 }
 
 // 加载我的股票列表(从服务器数据库查询)
-const loadMyStocks = async () => {
-  console.log('[我的股票] loadMyStocks 开始执行, isLoggedIn=', isLoggedIn.value)
+const loadMyStocks = async (forceRefresh = false) => {
+  console.log('[我的股票] loadMyStocks 开始执行, isLoggedIn=', isLoggedIn.value, 'forceRefresh=', forceRefresh)
   
   if (!isLoggedIn.value) {
     myStocks.value = []
@@ -209,11 +207,32 @@ const loadMyStocks = async () => {
     return
   }
   
+  // 如果正在加载中,跳过
+  if (isLoading.value) {
+    console.log('[我的股票] 正在加载中,跳过')
+    return
+  }
+  
+  // 如果有缓存数据且未过期,只刷新行情不重新加载列表
+  const now = Date.now()
+  if (!forceRefresh && myStocks.value.length > 0 && (now - lastLoadTime.value) < CACHE_DURATION) {
+    console.log('[我的股票] 使用缓存数据,只刷新行情')
+    // 只刷新行情数据
+    await fetchIndexData()
+    await refreshAllQuotes()
+    startAutoRefresh()
+    return
+  }
+  
   try {
-    // 显示加载提示
-    uni.showLoading({ title: '加载中...' })
+    isLoading.value = true
+    
+    // 只有首次加载或强制刷新时显示loading
+    if (myStocks.value.length === 0 || forceRefresh) {
+      uni.showLoading({ title: '加载中...' })
+    }
     
-    // 从服务器获取用户自选股票(每次都从数据库查询)
+    // 从服务器获取用户自选股票
     console.log('[我的股票] 调用 getUserStocks 接口')
     const res = await getUserStocks()
     console.log('[我的股票] 服务器返回:', JSON.stringify(res))
@@ -233,6 +252,7 @@ const loadMyStocks = async () => {
         changePercent: item.changePercent,
         trendData: item.trendData
       }))
+      lastLoadTime.value = Date.now()
       console.log('[我的股票] 加载完成, 股票数量:', myStocks.value.length)
     } else {
       myStocks.value = []
@@ -252,8 +272,13 @@ const loadMyStocks = async () => {
   } catch (e) {
     uni.hideLoading()
     console.error('[我的股票] 加载失败:', e)
-    myStocks.value = []
+    // 加载失败时不清空已有数据
+    if (myStocks.value.length === 0) {
+      myStocks.value = []
+    }
     startAutoRefresh()
+  } finally {
+    isLoading.value = false
   }
 }
 
@@ -390,14 +415,22 @@ const removeStock = async (idx) => {
 onLoad(() => {
   console.log('[我的股票] onLoad 触发')
   isLoggedIn.value = checkLoginStatus()
-  loadMyStocks()
+  loadMyStocks(true) // 首次加载强制刷新
 })
 
 onShow(() => {
   console.log('[我的股票] onShow 触发')
+  const wasLoggedIn = isLoggedIn.value
   isLoggedIn.value = checkLoginStatus()
-  // 每次页面显示时都从数据库重新加载
-  loadMyStocks()
+  
+  // 如果登录状态变化了,强制刷新
+  if (wasLoggedIn !== isLoggedIn.value) {
+    loadMyStocks(true)
+  } else {
+    // 否则使用缓存策略
+    loadMyStocks(false)
+  }
+  
   uni.setNavigationBarTitle({ title: '量化交易大师' })
 })
 

+ 0 - 10
src/pages/strong/strong.vue

@@ -153,7 +153,6 @@ import { getStockQuotes, addUserStock } from '../../utils/api.js'
 // 购买状态
 const isPurchased = ref(false)
 const showModal = ref(false)
-const selectedPlan = ref('yearly')
 
 // 股票列表数据
 const stockList = ref([
@@ -261,13 +260,6 @@ const handlePurchase = () => {
   })
 }
 
-// 跳转到登录页
-const goToLogin = () => {
-  uni.navigateTo({
-    url: '/pages/login/login'
-  })
-}
-
 // 开始月份选择变化
 const onStartMonthChange = (e) => {
   startMonth.value = e.detail.value
@@ -302,8 +294,6 @@ const onHistorySearch = () => {
     icon: 'none',
     duration: 2000
   })
-  // TODO: 调用后端API查询历史数据
-  // const response = await getHistoryPoolData(startMonth.value, endMonth.value)
 }
 
 // 添加到我的股票

+ 1 - 1
src/pages/transaction/transaction.vue

@@ -65,7 +65,7 @@
 </template>
 
 <script setup>
-import { ref, computed, onMounted } from 'vue'
+import { ref, onMounted } from 'vue'
 import { onLoad, onShow } from '@dcloudio/uni-app'
 import { isLoggedIn as checkLoginStatus } from '../../utils/auth.js'
 

+ 0 - 19
src/utils/util.js

@@ -1,19 +0,0 @@
-export const formatTime = date => {
-  const year = date.getFullYear()
-  const month = date.getMonth() + 1
-  const day = date.getDate()
-  const hour = date.getHours()
-  const minute = date.getMinutes()
-  const second = date.getSeconds()
-
-  return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}`
-}
-
-const formatNumber = n => {
-  n = n.toString()
-  return n[1] ? n : `0${n}`
-}
-
-module.exports = {
-  formatTime
-}

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels