|
|
|
@ -36,7 +36,7 @@ |
|
|
|
<scroll-view class="content" :style="{ top: contentTopPosition + 'px' }" scroll-y="true"> |
|
|
|
<!-- 股票列表 --> |
|
|
|
<view class="stock-list"> |
|
|
|
<view class="stock-row" v-for="(item,index) in sortedStockList" :key="item" @click="viewIndexDetail(item,index)"> |
|
|
|
<view class="stock-row" v-for="(item, index) in sortedStockList" :key="item" @click="viewIndexDetail(item, index)"> |
|
|
|
<view class="stock-cell name-column"> |
|
|
|
<view class="stock-name">{{ item.stockName }}</view> |
|
|
|
<view class="stock-code">{{ item.stockCode }}</view> |
|
|
|
@ -48,7 +48,7 @@ |
|
|
|
</view> |
|
|
|
<view class="stock-cell change-column"> |
|
|
|
<text class="stock-change" :class="item.isRising ? 'rising' : 'falling'"> |
|
|
|
{{ item.changePercent }} |
|
|
|
{{ judgeSymbol(item.changePercent) }} |
|
|
|
</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
@ -79,107 +79,6 @@ const sortType = ref(""); // 排序类型:'price' 或 'change' |
|
|
|
const sortOrder = ref("desc"); // 排序顺序:'asc' 或 'desc' |
|
|
|
|
|
|
|
const regionalGroupArray = ref([]); |
|
|
|
// 股票数据 |
|
|
|
const stockList = ref([ |
|
|
|
{ |
|
|
|
stockName: "Telecommunication", |
|
|
|
stockCode: "888607", |
|
|
|
price: 1349.47, |
|
|
|
change: "+7.67%", |
|
|
|
isRising: true, |
|
|
|
}, |
|
|
|
{ |
|
|
|
stockName: "Other", |
|
|
|
stockCode: "888607", |
|
|
|
price: 1349.47, |
|
|
|
change: "+6.67%", |
|
|
|
isRising: true, |
|
|
|
}, |
|
|
|
{ |
|
|
|
stockName: "Consumer Discretio...", |
|
|
|
stockCode: "888610", |
|
|
|
price: 1349.47, |
|
|
|
change: "+5.67%", |
|
|
|
isRising: true, |
|
|
|
}, |
|
|
|
{ |
|
|
|
stockName: "Telecommunication", |
|
|
|
stockCode: "888607", |
|
|
|
price: 1349.47, |
|
|
|
change: "+4.67%", |
|
|
|
isRising: true, |
|
|
|
}, |
|
|
|
{ |
|
|
|
stockName: "Other", |
|
|
|
stockCode: "888611", |
|
|
|
price: 1359.47, |
|
|
|
change: "+3.67%", |
|
|
|
isRising: true, |
|
|
|
}, |
|
|
|
{ |
|
|
|
stockName: "Consumer Discretio...", |
|
|
|
stockCode: "888610", |
|
|
|
price: 1349.47, |
|
|
|
change: "+2.67%", |
|
|
|
isRising: true, |
|
|
|
}, |
|
|
|
{ |
|
|
|
stockName: "Telecommunication", |
|
|
|
stockCode: "888607", |
|
|
|
price: 1349.47, |
|
|
|
change: "+1.67%", |
|
|
|
isRising: true, |
|
|
|
}, |
|
|
|
{ |
|
|
|
stockName: "Other", |
|
|
|
stockCode: "888611", |
|
|
|
price: 1009.98, |
|
|
|
change: "-1.67%", |
|
|
|
isRising: false, |
|
|
|
}, |
|
|
|
{ |
|
|
|
stockName: "Consumer Discretio...", |
|
|
|
stockCode: "888610", |
|
|
|
price: 1009.98, |
|
|
|
change: "-0.67%", |
|
|
|
isRising: false, |
|
|
|
}, |
|
|
|
{ |
|
|
|
stockName: "Telecommunication", |
|
|
|
stockCode: "888607", |
|
|
|
price: 1009.98, |
|
|
|
change: "-0.67%", |
|
|
|
isRising: false, |
|
|
|
}, |
|
|
|
{ |
|
|
|
stockName: "Other", |
|
|
|
stockCode: "888611", |
|
|
|
price: 1009.98, |
|
|
|
change: "-1.67%", |
|
|
|
isRising: false, |
|
|
|
}, |
|
|
|
{ |
|
|
|
stockName: "Consumer Discretio...", |
|
|
|
stockCode: "888610", |
|
|
|
price: 1009.98, |
|
|
|
change: "-4.67%", |
|
|
|
isRising: false, |
|
|
|
}, |
|
|
|
{ |
|
|
|
stockName: "Consumer Discretio...", |
|
|
|
stockCode: "888610", |
|
|
|
price: 1009.98, |
|
|
|
change: "-3.67%", |
|
|
|
isRising: false, |
|
|
|
}, |
|
|
|
{ |
|
|
|
stockName: "Consumer Discretio...", |
|
|
|
stockCode: "888610", |
|
|
|
price: 1009.98, |
|
|
|
change: "-3.67%", |
|
|
|
isRising: false, |
|
|
|
}, |
|
|
|
]); |
|
|
|
|
|
|
|
// 计算属性 |
|
|
|
const contentTopPosition = computed(() => { |
|
|
|
@ -206,6 +105,10 @@ const sortedStockList = computed(() => { |
|
|
|
return list; |
|
|
|
}); |
|
|
|
|
|
|
|
const judgeSymbol = (num) => { |
|
|
|
return num[0] === "-" ? num : "+" + num; |
|
|
|
}; |
|
|
|
|
|
|
|
const getRegionalGroupList = async () => { |
|
|
|
try { |
|
|
|
const result = await getRegionalGroupListAPI({ |
|
|
|
@ -224,7 +127,7 @@ const goBack = () => { |
|
|
|
}; |
|
|
|
|
|
|
|
// 方法:查看指数详情 |
|
|
|
const viewIndexDetail = (item,index) => { |
|
|
|
const viewIndexDetail = (item, index) => { |
|
|
|
console.log("查看指数详情:", item.stockName); |
|
|
|
// 这里可以跳转到具体的指数详情页面 |
|
|
|
uni.navigateTo({ |
|
|
|
@ -348,7 +251,6 @@ const sendTcpMessage = (command) => { |
|
|
|
break; |
|
|
|
} |
|
|
|
if (!messageData) { |
|
|
|
|
|
|
|
return; |
|
|
|
} else { |
|
|
|
try { |
|
|
|
|