|
@@ -93,6 +93,7 @@ const strongPrice = ref(98) // 强势池价格,默认98
|
|
|
|
|
|
|
|
const stockList = ref([])
|
|
const stockList = ref([])
|
|
|
let refreshTimer = null
|
|
let refreshTimer = null
|
|
|
|
|
+let subscriptionTimer = null
|
|
|
|
|
|
|
|
// 获取涨跌样式
|
|
// 获取涨跌样式
|
|
|
const getChangeClass = (changePercent) => {
|
|
const getChangeClass = (changePercent) => {
|
|
@@ -135,6 +136,23 @@ const stopAutoRefresh = () => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+const startSubscriptionRefresh = () => {
|
|
|
|
|
+ stopSubscriptionRefresh()
|
|
|
|
|
+ if (!isPageVisible.value) return
|
|
|
|
|
+ subscriptionTimer = setInterval(() => {
|
|
|
|
|
+ if (isPageVisible.value) {
|
|
|
|
|
+ checkPurchaseStatus()
|
|
|
|
|
+ }
|
|
|
|
|
+ }, 30000)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const stopSubscriptionRefresh = () => {
|
|
|
|
|
+ if (subscriptionTimer) {
|
|
|
|
|
+ clearInterval(subscriptionTimer)
|
|
|
|
|
+ subscriptionTimer = null
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// 检查购买状态(从后端查询)
|
|
// 检查购买状态(从后端查询)
|
|
|
const checkPurchaseStatus = async () => {
|
|
const checkPurchaseStatus = async () => {
|
|
|
if (!checkLoginStatus()) {
|
|
if (!checkLoginStatus()) {
|
|
@@ -328,12 +346,14 @@ onLoad(() => {
|
|
|
console.log('[强势池] onLoad')
|
|
console.log('[强势池] onLoad')
|
|
|
isPageVisible.value = true
|
|
isPageVisible.value = true
|
|
|
checkPurchaseStatus()
|
|
checkPurchaseStatus()
|
|
|
|
|
+ startSubscriptionRefresh()
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
onShow(() => {
|
|
onShow(() => {
|
|
|
console.log('[强势池] onShow')
|
|
console.log('[强势池] onShow')
|
|
|
isPageVisible.value = true
|
|
isPageVisible.value = true
|
|
|
checkPurchaseStatus()
|
|
checkPurchaseStatus()
|
|
|
|
|
+ startSubscriptionRefresh()
|
|
|
uni.setNavigationBarTitle({ title: '量化交易大师' })
|
|
uni.setNavigationBarTitle({ title: '量化交易大师' })
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -341,11 +361,13 @@ onHide(() => {
|
|
|
console.log('[强势池] onHide')
|
|
console.log('[强势池] onHide')
|
|
|
isPageVisible.value = false
|
|
isPageVisible.value = false
|
|
|
stopAutoRefresh()
|
|
stopAutoRefresh()
|
|
|
|
|
+ stopSubscriptionRefresh()
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
onUnmounted(() => {
|
|
onUnmounted(() => {
|
|
|
isPageVisible.value = false
|
|
isPageVisible.value = false
|
|
|
stopAutoRefresh()
|
|
stopAutoRefresh()
|
|
|
|
|
+ stopSubscriptionRefresh()
|
|
|
})
|
|
})
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|