|
|
|
@ -17,7 +17,7 @@ |
|
|
|
</view> |
|
|
|
<view class="indices_grid"> |
|
|
|
<view v-for="(index, i) in countryInfo" :key="i" class="index_item"> |
|
|
|
<IndexCard :market="index.market" :stockName="index.name" :currentPrice="index.price" :changeAmount="index.change" :changePercent="index.changePercent" :isRising="index.isRising" /> |
|
|
|
<IndexCard :market="index.market" :stockName="index.name" :currentPrice="index.price" :changeAmount="index.change" :changePercent="index.changePercent" :isRising="index.isRising" @click="viewIndexDetail(index,i)"/> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
@ -95,6 +95,8 @@ |
|
|
|
import { ref, computed, onMounted, watch } from "vue"; |
|
|
|
import IndexCard from "../../components/IndexCard.vue"; |
|
|
|
import { queryStockDataAPI } from "@/api/marketSituation/marketSituation"; |
|
|
|
import { useMarketSituationStore } from "../../stores/modules/marketSituation.js"; |
|
|
|
const marketSituationStore = useMarketSituationStore(); |
|
|
|
|
|
|
|
onMounted(() => { |
|
|
|
switchTab(0); |
|
|
|
@ -111,6 +113,11 @@ const switchTab = (i) => { |
|
|
|
}).then((res) => { |
|
|
|
if (res.code === 200) { |
|
|
|
countryInfo.value = res.data.dataPage.records; |
|
|
|
marketSituationStore.countryMarketCardData = countryInfo.value.map((item) => ({ |
|
|
|
market: item.market, |
|
|
|
stockCode: item.code, |
|
|
|
stockName: item.name, |
|
|
|
})); |
|
|
|
console.log(res.data) |
|
|
|
console.log(res.data.dataPage.records) |
|
|
|
console.log(countryInfo.value); |
|
|
|
@ -149,12 +156,23 @@ const props = defineProps({ |
|
|
|
|
|
|
|
// 计算当前国家信息 |
|
|
|
const countryInfo = ref('') |
|
|
|
|
|
|
|
// 方法:查看指数详情 |
|
|
|
const viewIndexDetail = (item, index) => { |
|
|
|
console.log("查看指数详情:", item); |
|
|
|
uni.navigateTo({ |
|
|
|
url: `/pages/marketSituation/marketCondition?stockInformation=${encodeURIComponent(JSON.stringify(item))}&index=${index}&from=countryMarket`, |
|
|
|
}); |
|
|
|
}; |
|
|
|
// 处理从父组件接收的数据 |
|
|
|
const handleTabData = (tabData) => { |
|
|
|
if (tabData && tabData.type === 'country' && tabData.data) { |
|
|
|
if (tabData.data.dataPage && tabData.data.dataPage.records) { |
|
|
|
countryInfo.value = tabData.data.dataPage.records; |
|
|
|
marketSituationStore.countryMarketCardData = countryInfo.value.map((item) => ({ |
|
|
|
market: item.market, |
|
|
|
stockCode: item.code, |
|
|
|
stockName: item.name, |
|
|
|
})); |
|
|
|
console.log('countryMarket接收到数据:', countryInfo.value); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -169,9 +187,6 @@ watch(() => props.tabData, (newTabData) => { |
|
|
|
|
|
|
|
// 查看更多占位 |
|
|
|
const viewMore = (type) => { |
|
|
|
// 可根据 type 跳转到相应页面或加载更多 |
|
|
|
// 例如:indices/sectors/stocks |
|
|
|
// uni.navigateTo({ url: `/pages/marketSituation/${type}List` }) |
|
|
|
}; |
|
|
|
</script> |
|
|
|
|
|
|
|
|