Browse Source

涨跌加符号,任务栏按钮变大

lihuilin/feature-20251024095243-我的
hongxilin 3 weeks ago
parent
commit
69c44c2a37
  1. 8
      components/IndexCard.vue
  2. 112
      pages/marketSituation/marketDetail.vue
  3. 4
      pages/marketSituation/marketSituation.vue

8
components/IndexCard.vue

@ -12,8 +12,8 @@
<view class="price-info">
<text class="current-price" :style="{ color: priceColor }">{{ currentPrice }}</text>
<view class="change-info">
<text class="change-amount" :style="{ color: priceColor }">{{ changeAmount }}</text>
<text class="change-percent" :style="{ color: priceColor }">{{ changePercent }}</text>
<text class="change-amount" :style="{ color: priceColor }">{{ judgeSymbol(changeAmount) }}</text>
<text class="change-percent" :style="{ color: priceColor }">{{ judgeSymbol(changePercent) }}</text>
</view>
</view>
@ -63,6 +63,10 @@ const props = defineProps({
},
});
const judgeSymbol = (num) => {
return num[0] === "-" ? num : "+" + num;
};
const getMarketFlag = (market) => {
let imagePath;

112
pages/marketSituation/marketDetail.vue

@ -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 {

4
pages/marketSituation/marketSituation.vue

@ -496,8 +496,8 @@ watch(headerHeight, (newHeight) => {
}
.scroll_indicator image {
width: 20rpx;
height: 20rpx;
width: 30rpx;
height: 30rpx;
opacity: 0.5;
}

Loading…
Cancel
Save