|
|
@ -30,7 +30,7 @@ |
|
|
</view> |
|
|
</view> |
|
|
|
|
|
|
|
|
<!-- 内容区域 --> |
|
|
<!-- 内容区域 --> |
|
|
<scroll-view class="content" :style="{ top: contentTopPosition + 'px' }" scroll-y="true"> |
|
|
|
|
|
|
|
|
<scroll-view class="content" :style="{ top: contentTopPosition + 'px' }" scroll-y="true" v-if="isDataLoaded"> |
|
|
<!-- 亚太-中华 --> |
|
|
<!-- 亚太-中华 --> |
|
|
<view class="market-section" v-for="(item, parentIndex) in marketSituationStore.gloablCardData" :key="item"> |
|
|
<view class="market-section" v-for="(item, parentIndex) in marketSituationStore.gloablCardData" :key="item"> |
|
|
<view class="market-header"> |
|
|
<view class="market-header"> |
|
|
@ -66,6 +66,7 @@ |
|
|
|
|
|
|
|
|
<script setup> |
|
|
<script setup> |
|
|
import { ref, onMounted, onUnmounted, computed, nextTick, watch } from "vue"; |
|
|
import { ref, onMounted, onUnmounted, computed, nextTick, watch } from "vue"; |
|
|
|
|
|
import { onShow, onHide } from "@dcloudio/uni-app"; |
|
|
import footerBar from "../../components/footerBar.vue"; |
|
|
import footerBar from "../../components/footerBar.vue"; |
|
|
import IndexCard from "../../components/IndexCard.vue"; |
|
|
import IndexCard from "../../components/IndexCard.vue"; |
|
|
import { getRegionalGroupAPI } from "../../api/marketSituation/marketSituation.js"; |
|
|
import { getRegionalGroupAPI } from "../../api/marketSituation/marketSituation.js"; |
|
|
@ -78,6 +79,9 @@ const headerHeight = ref(0); // 头部高度 |
|
|
const searchValue = ref(""); // 搜索值 |
|
|
const searchValue = ref(""); // 搜索值 |
|
|
const isWarnTextOverflow = ref(false); // warn文字是否溢出 |
|
|
const isWarnTextOverflow = ref(false); // warn文字是否溢出 |
|
|
|
|
|
|
|
|
|
|
|
// 数据状态加载 |
|
|
|
|
|
const isDataLoaded = ref(false); |
|
|
|
|
|
|
|
|
// warn文字的class计算属性 |
|
|
// warn文字的class计算属性 |
|
|
const warnTextClass = computed(() => { |
|
|
const warnTextClass = computed(() => { |
|
|
return isWarnTextOverflow.value ? "warn_text scroll-active" : "warn_text"; |
|
|
return isWarnTextOverflow.value ? "warn_text scroll-active" : "warn_text"; |
|
|
@ -109,125 +113,6 @@ const checkWarnTextOverflow = () => { |
|
|
}); |
|
|
}); |
|
|
}; |
|
|
}; |
|
|
const globalIndexArray = ref([]); |
|
|
const globalIndexArray = ref([]); |
|
|
// 亚太-中华指数数据 |
|
|
|
|
|
const asiachinaIndexes = ref([ |
|
|
|
|
|
{ |
|
|
|
|
|
flagIcon: "/static/c1.png", |
|
|
|
|
|
stockName: "上证指数", |
|
|
|
|
|
stockCode: "noCode", |
|
|
|
|
|
currentPrice: "3933.96", |
|
|
|
|
|
changeAmount: "+24.32", |
|
|
|
|
|
changePercent: "+0.62%", |
|
|
|
|
|
isRising: true, |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
flagIcon: "/static/c2.png", |
|
|
|
|
|
stockName: "深证成指", |
|
|
|
|
|
stockCode: "noCode", |
|
|
|
|
|
currentPrice: "45757.90", |
|
|
|
|
|
changeAmount: "-123.45", |
|
|
|
|
|
changePercent: "-0.27%", |
|
|
|
|
|
isRising: false, |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
flagIcon: "/static/c3.png", |
|
|
|
|
|
stockName: "创业板指", |
|
|
|
|
|
stockCode: "noCode", |
|
|
|
|
|
currentPrice: "6606.08", |
|
|
|
|
|
changeAmount: "+89.76", |
|
|
|
|
|
changePercent: "+1.38%", |
|
|
|
|
|
isRising: true, |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
flagIcon: "/static/c4.png", |
|
|
|
|
|
stockName: "HSI50", |
|
|
|
|
|
stockCode: "noCode", |
|
|
|
|
|
currentPrice: "22333.96", |
|
|
|
|
|
changeAmount: "+156.78", |
|
|
|
|
|
changePercent: "+0.71%", |
|
|
|
|
|
isRising: true, |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
flagIcon: "/static/c5.png", |
|
|
|
|
|
stockName: "沪深300", |
|
|
|
|
|
stockCode: "noCode", |
|
|
|
|
|
currentPrice: "45757.90", |
|
|
|
|
|
changeAmount: "-89.12", |
|
|
|
|
|
changePercent: "-0.19%", |
|
|
|
|
|
isRising: false, |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
flagIcon: "/static/c6.png", |
|
|
|
|
|
stockName: "上证50", |
|
|
|
|
|
stockCode: "noCode", |
|
|
|
|
|
currentPrice: "45757.90", |
|
|
|
|
|
changeAmount: "+234.56", |
|
|
|
|
|
changePercent: "+0.52%", |
|
|
|
|
|
isRising: true, |
|
|
|
|
|
}, |
|
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
// 亚太指数数据 |
|
|
|
|
|
const asiaIndexes = ref([ |
|
|
|
|
|
{ |
|
|
|
|
|
flagIcon: "/static/c7.png", |
|
|
|
|
|
stockName: "日经225", |
|
|
|
|
|
stockCode: "noCode", |
|
|
|
|
|
currentPrice: "28456.78", |
|
|
|
|
|
changeAmount: "+234.56", |
|
|
|
|
|
changePercent: "+0.83%", |
|
|
|
|
|
isRising: true, |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
flagIcon: "/static/c8.png", |
|
|
|
|
|
stockName: "韩国KOSPI", |
|
|
|
|
|
stockCode: "noCode", |
|
|
|
|
|
currentPrice: "2567.89", |
|
|
|
|
|
changeAmount: "-12.34", |
|
|
|
|
|
changePercent: "-0.48%", |
|
|
|
|
|
isRising: false, |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
flagIcon: "/static/c9.png", |
|
|
|
|
|
stockName: "印度孟买", |
|
|
|
|
|
stockCode: "noCode", |
|
|
|
|
|
currentPrice: "65432.10", |
|
|
|
|
|
changeAmount: "+456.78", |
|
|
|
|
|
changePercent: "+0.70%", |
|
|
|
|
|
isRising: true, |
|
|
|
|
|
}, |
|
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
// 美洲指数数据 |
|
|
|
|
|
const americaIndexes = ref([ |
|
|
|
|
|
{ |
|
|
|
|
|
flagIcon: "/static/c7.png", |
|
|
|
|
|
stockName: "道琼斯指数", |
|
|
|
|
|
stockCode: "noCode", |
|
|
|
|
|
currentPrice: "34567.89", |
|
|
|
|
|
changeAmount: "+123.45", |
|
|
|
|
|
changePercent: "+0.36%", |
|
|
|
|
|
isRising: true, |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
flagIcon: "/static/c8.png", |
|
|
|
|
|
stockName: "纳斯达克", |
|
|
|
|
|
stockCode: "noCode", |
|
|
|
|
|
currentPrice: "13456.78", |
|
|
|
|
|
changeAmount: "-67.89", |
|
|
|
|
|
changePercent: "-0.50%", |
|
|
|
|
|
isRising: false, |
|
|
|
|
|
}, |
|
|
|
|
|
{ |
|
|
|
|
|
flagIcon: "/static/c9.png", |
|
|
|
|
|
stockName: "标普500", |
|
|
|
|
|
stockCode: "noCode", |
|
|
|
|
|
currentPrice: "4234.56", |
|
|
|
|
|
changeAmount: "+23.45", |
|
|
|
|
|
changePercent: "+0.56%", |
|
|
|
|
|
isRising: true, |
|
|
|
|
|
}, |
|
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
// 计算属性:内容区域顶部位置 |
|
|
// 计算属性:内容区域顶部位置 |
|
|
const contentTopPosition = computed(() => { |
|
|
const contentTopPosition = computed(() => { |
|
|
@ -482,6 +367,8 @@ const parseStockData = (message) => { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
// 数据状态加载完成 |
|
|
|
|
|
isDataLoaded.value = true; |
|
|
} else if ((typeof message === "string" && message.includes('{"count')) || isMorePacket.batch_real_time) { |
|
|
} else if ((typeof message === "string" && message.includes('{"count')) || isMorePacket.batch_real_time) { |
|
|
if (typeof message === "string" && message.includes('{"count')) { |
|
|
if (typeof message === "string" && message.includes('{"count')) { |
|
|
console.log("开始接受分包数据"); |
|
|
console.log("开始接受分包数据"); |
|
|
@ -564,6 +451,22 @@ const startTcp = () => { |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
onShow(async () => { |
|
|
|
|
|
console.log("显示页面"); |
|
|
|
|
|
await getRegionalGroup(); |
|
|
|
|
|
initTcpListeners(); |
|
|
|
|
|
await nextTick(); |
|
|
|
|
|
// 开始连接 |
|
|
|
|
|
startTcp(); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
onHide(() => { |
|
|
|
|
|
console.log("隐藏页面"); |
|
|
|
|
|
sendTcpMessage("stop_real_time"); |
|
|
|
|
|
removeTcpListeners(); |
|
|
|
|
|
disconnectTcp(); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
onUnmounted(() => { |
|
|
onUnmounted(() => { |
|
|
sendTcpMessage("stop_real_time"); |
|
|
sendTcpMessage("stop_real_time"); |
|
|
removeTcpListeners(); |
|
|
removeTcpListeners(); |
|
|
@ -572,11 +475,6 @@ onUnmounted(() => { |
|
|
|
|
|
|
|
|
// 生命周期:页面挂载 |
|
|
// 生命周期:页面挂载 |
|
|
onMounted(async () => { |
|
|
onMounted(async () => { |
|
|
await getRegionalGroup(); |
|
|
|
|
|
initTcpListeners(); |
|
|
|
|
|
await nextTick(); |
|
|
|
|
|
// 开始连接 |
|
|
|
|
|
startTcp(); |
|
|
|
|
|
// 获取系统信息 |
|
|
// 获取系统信息 |
|
|
const systemInfo = uni.getSystemInfoSync(); |
|
|
const systemInfo = uni.getSystemInfoSync(); |
|
|
iSMT.value = systemInfo.statusBarHeight || 0; |
|
|
iSMT.value = systemInfo.statusBarHeight || 0; |
|
|
|