Browse Source

合并冲突

zhaowenkang/feature-20251028181547-行情页面
no99 4 weeks ago
parent
commit
c5d106536b
  1. 60
      pages/marketSituation/globalIndex.vue
  2. 81
      pages/marketSituation/marketDetail.vue
  3. 292
      pages/marketSituation/marketOverview.vue

60
pages/marketSituation/globalIndex.vue

@ -43,7 +43,7 @@
</view>
<view class="cards-grid-three">
<view v-for="(item, index) in asiachinaIndexes" :key="index" class="card-item">
<IndexCard :flagIcon="item.flagIcon" :indexName="item.indexName"
<IndexCard :flagIcon="item.flagIcon" :stockName="item.stockName"
:currentPrice="item.currentPrice" :changeAmount="item.changeAmount"
:changePercent="item.changePercent" :isRising="item.isRising"
@click="viewIndexDetail(item)" />
@ -62,7 +62,7 @@
</view>
<view class="cards-grid-three">
<view v-for="(item, index) in asiaIndexes" :key="index" class="card-item">
<IndexCard :flagIcon="item.flagIcon" :indexName="item.indexName"
<IndexCard :flagIcon="item.flagIcon" :stockName="item.stockName"
:currentPrice="item.currentPrice" :changeAmount="item.changeAmount"
:changePercent="item.changePercent" :isRising="item.isRising"
@click="viewIndexDetail(item)" />
@ -81,7 +81,7 @@
</view>
<view class="cards-grid-three">
<view v-for="(item, index) in americaIndexes" :key="index" class="card-item">
<IndexCard :flagIcon="item.flagIcon" :indexName="item.indexName"
<IndexCard :flagIcon="item.flagIcon" :stockName="item.stockName"
:currentPrice="item.currentPrice" :changeAmount="item.changeAmount"
:changePercent="item.changePercent" :isRising="item.isRising"
@click="viewIndexDetail(item)" />
@ -145,7 +145,8 @@ const checkWarnTextOverflow = () => {
const asiachinaIndexes = ref([
{
flagIcon: '/static/c1.png',
indexName: '上证指数',
stockName: '上证指数',
stockCode:'noCode',
currentPrice: '3933.96',
changeAmount: '+24.32',
changePercent: '+0.62%',
@ -153,7 +154,8 @@ const asiachinaIndexes = ref([
},
{
flagIcon: '/static/c2.png',
indexName: '深证成指',
stockName: '深证成指',
stockCode:'noCode',
currentPrice: '45757.90',
changeAmount: '-123.45',
changePercent: '-0.27%',
@ -161,7 +163,8 @@ const asiachinaIndexes = ref([
},
{
flagIcon: '/static/c3.png',
indexName: '创业板指',
stockName: '创业板指',
stockCode:'noCode',
currentPrice: '6606.08',
changeAmount: '+89.76',
changePercent: '+1.38%',
@ -169,7 +172,8 @@ const asiachinaIndexes = ref([
},
{
flagIcon: '/static/c4.png',
indexName: 'HSI50',
stockName: 'HSI50',
stockCode:'noCode',
currentPrice: '22333.96',
changeAmount: '+156.78',
changePercent: '+0.71%',
@ -177,7 +181,8 @@ const asiachinaIndexes = ref([
},
{
flagIcon: '/static/c5.png',
indexName: '沪深300',
stockName: '沪深300',
stockCode:'noCode',
currentPrice: '45757.90',
changeAmount: '-89.12',
changePercent: '-0.19%',
@ -185,7 +190,8 @@ const asiachinaIndexes = ref([
},
{
flagIcon: '/static/c6.png',
indexName: '上证50',
stockName: '上证50',
stockCode:'noCode',
currentPrice: '45757.90',
changeAmount: '+234.56',
changePercent: '+0.52%',
@ -197,7 +203,8 @@ const asiachinaIndexes = ref([
const asiaIndexes = ref([
{
flagIcon: '/static/c7.png',
indexName: '日经225',
stockName: '日经225',
stockCode:'noCode',
currentPrice: '28456.78',
changeAmount: '+234.56',
changePercent: '+0.83%',
@ -205,7 +212,8 @@ const asiaIndexes = ref([
},
{
flagIcon: '/static/c8.png',
indexName: '韩国KOSPI',
stockName: '韩国KOSPI',
stockCode:'noCode',
currentPrice: '2567.89',
changeAmount: '-12.34',
changePercent: '-0.48%',
@ -213,7 +221,8 @@ const asiaIndexes = ref([
},
{
flagIcon: '/static/c9.png',
indexName: '印度孟买',
stockName: '印度孟买',
stockCode:'noCode',
currentPrice: '65432.10',
changeAmount: '+456.78',
changePercent: '+0.70%',
@ -225,7 +234,8 @@ const asiaIndexes = ref([
const americaIndexes = ref([
{
flagIcon: '/static/c7.png',
indexName: '道琼斯指数',
stockName: '道琼斯指数',
stockCode:'noCode',
currentPrice: '34567.89',
changeAmount: '+123.45',
changePercent: '+0.36%',
@ -233,7 +243,8 @@ const americaIndexes = ref([
},
{
flagIcon: '/static/c8.png',
indexName: '纳斯达克',
stockName: '纳斯达克',
stockCode:'noCode',
currentPrice: '13456.78',
changeAmount: '-67.89',
changePercent: '-0.50%',
@ -241,7 +252,8 @@ const americaIndexes = ref([
},
{
flagIcon: '/static/c9.png',
indexName: '标普500',
stockName: '标普500',
stockCode:'noCode',
currentPrice: '4234.56',
changeAmount: '+23.45',
changePercent: '+0.56%',
@ -281,16 +293,16 @@ const viewMore = (market) => {
//
const viewIndexDetail = (item) => {
console.log('查看指数详情:', item.indexName)
uni.showToast({
title: `查看 ${item.indexName} 详情`,
icon: 'none',
duration: 2000
})
//
// uni.navigateTo({
// url: `/pages/detail/indexDetail?id=${item.id}`
console.log('查看指数详情:', item.stockName)
// uni.showToast({
// title: ` ${item.stockName} `,
// icon: 'none',
// duration: 2000
// })
//
uni.navigateTo({
url: `/pages/marketSituation/marketCondition?stockInformation=${encodeURIComponent(JSON.stringify(item))}`
})
}
//

81
pages/marketSituation/marketDetail.vue

@ -37,10 +37,10 @@
<!-- 股票列表 -->
<view class="stock-list">
<view class="stock-row" v-for="(stock, index) in sortedStockList" :key="index"
@click="viewStockDetail(stock)">
@click="viewIndexDetail(stock)">
<view class="stock-cell name-column">
<view class="stock-name">{{ stock.name }}</view>
<view class="stock-code">{{ stock.code }}</view>
<view class="stock-name">{{ stock.stockName }}</view>
<view class="stock-code">{{ stock.stockCode }}</view>
</view>
<view class="stock-cell price-column">
<text class="stock-price"
@ -83,99 +83,99 @@ const sortOrder = ref('desc') // 排序顺序:'asc' 或 'desc'
//
const stockList = ref([
{
name: 'Telecommunication',
code: '888607',
stockName: 'Telecommunication',
stockCode: '888607',
price: 1349.47,
change: '+7.67%',
isRising: true
},
{
name: 'Other',
code: '888607',
stockName: 'Other',
stockCode: '888607',
price: 1349.47,
change: '+6.67%',
isRising: true
},
{
name: 'Consumer Discretio...',
code: '888610',
stockName: 'Consumer Discretio...',
stockCode: '888610',
price: 1349.47,
change: '+5.67%',
isRising: true
},
{
name: 'Telecommunication',
code: '888607',
stockName: 'Telecommunication',
stockCode: '888607',
price: 1349.47,
change: '+4.67%',
isRising: true
},
{
name: 'Other',
code: '888611',
stockName: 'Other',
stockCode: '888611',
price: 1359.47,
change: '+3.67%',
isRising: true
},
{
name: 'Consumer Discretio...',
code: '888610',
stockName: 'Consumer Discretio...',
stockCode: '888610',
price: 1349.47,
change: '+2.67%',
isRising: true
},
{
name: 'Telecommunication',
code: '888607',
stockName: 'Telecommunication',
stockCode: '888607',
price: 1349.47,
change: '+1.67%',
isRising: true
},
{
name: 'Other',
code: '888611',
stockName: 'Other',
stockCode: '888611',
price: 1009.98,
change: '-1.67%',
isRising: false
},
{
name: 'Consumer Discretio...',
code: '888610',
stockName: 'Consumer Discretio...',
stockCode: '888610',
price: 1009.98,
change: '-0.67%',
isRising: false
},
{
name: 'Telecommunication',
code: '888607',
stockName: 'Telecommunication',
stockCode: '888607',
price: 1009.98,
change: '-0.67%',
isRising: false
},
{
name: 'Other',
code: '888611',
stockName: 'Other',
stockCode: '888611',
price: 1009.98,
change: '-1.67%',
isRising: false
},
{
name: 'Consumer Discretio...',
code: '888610',
stockName: 'Consumer Discretio...',
stockCode: '888610',
price: 1009.98,
change: '-4.67%',
isRising: false
},
{
name: 'Consumer Discretio...',
code: '888610',
stockName: 'Consumer Discretio...',
stockCode: '888610',
price: 1009.98,
change: '-3.67%',
isRising: false
},
{
name: 'Consumer Discretio...',
code: '888610',
stockName: 'Consumer Discretio...',
stockCode: '888610',
price: 1009.98,
change: '-3.67%',
isRising: false
@ -232,6 +232,20 @@ const goBack = () => {
uni.navigateBack()
}
//
const viewIndexDetail = (item) => {
console.log('查看指数详情:', item.stockName)
// uni.showToast({
// title: ` ${item.stockName} `,
// icon: 'none',
// duration: 2000
// })
//
uni.navigateTo({
url: `/pages/marketSituation/marketCondition?stockInformation=${encodeURIComponent(JSON.stringify(item))}`
})
}
const sortByPrice = () => {
if (sortType.value === 'price') {
sortOrder.value = sortOrder.value === 'asc' ? 'desc' : 'asc'
@ -250,11 +264,6 @@ const sortByChange = () => {
}
}
const viewStockDetail = (stock) => {
console.log('查看股票详情:', stock)
//
}
onMounted(() => {
//
iSMT.value = uni.getSystemInfoSync().statusBarHeight;

292
pages/marketSituation/marketOverview.vue

@ -1,3 +1,5 @@
<!-- @format -->
<template>
<view class="main">
<!-- 可滚动内容区域 -->
@ -9,10 +11,10 @@
</view>
<view class="global_index">
<view class="global_index_title">
{{ $t('marketSituation.globalIndex') }}
{{ $t("marketSituation.globalIndex") }}
</view>
<view class="global_index_more" @click="goToGlobalIndex">
<text>{{ $t('marketSituation.globalIndexMore') }}</text>
<text>{{ $t("marketSituation.globalIndexMore") }}</text>
<image src="/static/marketSituation-image/more.png" mode="aspectFit"></image>
</view>
</view>
@ -20,15 +22,13 @@
<!-- 卡片网格 -->
<view class="cards_grid">
<view v-for="(card, index) in cardData" :key="index" class="card_item">
<IndexCard :flagIcon="card.flagIcon" :indexName="card.indexName"
:currentPrice="card.currentPrice" :changeAmount="card.changeAmount"
:changePercent="card.changePercent" :isRising="card.isRising" />
<IndexCard :flagIcon="card.flagIcon" :stockName="card.stockName" :currentPrice="card.currentPrice" :changeAmount="card.changeAmount" :changePercent="card.changePercent" :isRising="card.isRising" @click="viewIndexDetail(card)" />
</view>
</view>
<view class="warn">
<image src="/static/marketSituation-image/warn.png" mode="aspectFit"></image>
<view class="warn_text_container">
<text :class="warnTextClass">{{ $t('marketSituation.warn') }}</text>
<text :class="warnTextClass">{{ $t("marketSituation.warn") }}</text>
</view>
</view>
<!-- 底部安全区域防止被导航栏遮挡 -->
@ -39,190 +39,210 @@
</template>
<script setup>
import { ref, onMounted, watch, nextTick, computed } from 'vue'
import util from '../../common/util.js'
import IndexCard from '../../components/IndexCard.vue'
import { ref, onMounted, watch, nextTick, computed } from "vue";
import util from "../../common/util.js";
import IndexCard from "../../components/IndexCard.vue";
const iSMT = ref(0)
const searchValue = ref('')
const contentHeight = ref(0)
const headerHeight = ref(0) // header
const isWarnTextOverflow = ref(false) // warn
const iSMT = ref(0);
const searchValue = ref("");
const contentHeight = ref(0);
const headerHeight = ref(0); // header
const isWarnTextOverflow = ref(false); // warn
const pageIndex = ref(0)
const scrollToView = ref('')
const pageIndex = ref(0);
const scrollToView = ref("");
//
const goToChartExample = () => {
uni.navigateTo({
url: '/pages/marketSituation/chartExample'
})
}
url: "/pages/marketSituation/chartExample",
});
};
// contenttop
const contentTopPosition = computed(() => {
const statusBarHeight = iSMT.value || 0
const currentHeaderHeight = headerHeight.value > 0 ? headerHeight.value : 140
return statusBarHeight + currentHeaderHeight
})
const statusBarHeight = iSMT.value || 0;
const currentHeaderHeight = headerHeight.value > 0 ? headerHeight.value : 140;
return statusBarHeight + currentHeaderHeight;
});
// warnclass
const warnTextClass = computed(() => {
return isWarnTextOverflow.value ? 'warn_text scroll-active' : 'warn_text'
})
return isWarnTextOverflow.value ? "warn_text scroll-active" : "warn_text";
});
//
const showCountryModal = ref(false)
const selectedCountry = ref('概况')
const countryList = ref([
'概况', '新加坡', '马来西亚', '印度尼西亚', '美国', '中国香港',
'泰国', '中国', '加拿大', '越南', '外汇', '贵金属'
])
const showCountryModal = ref(false);
const selectedCountry = ref("概况");
const countryList = ref(["概况", "新加坡", "马来西亚", "印度尼西亚", "美国", "中国香港", "泰国", "中国", "加拿大", "越南", "外汇", "贵金属"]);
//
const cardData = ref([
{
flagIcon: '🇺🇸',
indexName: '道琼斯',
currentPrice: '45757.90',
changeAmount: '-125.22',
changePercent: '-0.27%',
isRising: false
flagIcon: "🇺🇸",
stockName: "道琼斯",
stockCode: "noCode",
currentPrice: "45757.90",
changeAmount: "-125.22",
changePercent: "-0.27%",
isRising: false,
},
{
flagIcon: '🇺🇸',
indexName: '纳斯达克',
currentPrice: '22333.96',
changeAmount: '+125.22',
changePercent: '+0.47%',
isRising: true
flagIcon: "🇺🇸",
stockName: "纳斯达克",
stockCode: "noCode",
currentPrice: "22333.96",
changeAmount: "+125.22",
changePercent: "+0.47%",
isRising: true,
},
{
flagIcon: '🇺🇸',
indexName: '标普500',
currentPrice: '6606.08',
changeAmount: '+125.22',
changePercent: '+0.27%',
isRising: true
flagIcon: "🇺🇸",
stockName: "标普500",
stockCode: "noCode",
currentPrice: "6606.08",
changeAmount: "+125.22",
changePercent: "+0.27%",
isRising: true,
},
{
flagIcon: '🇨🇳',
indexName: '上证指数',
currentPrice: '3333.96',
changeAmount: '+125.22',
changePercent: '+0.27%',
isRising: true
flagIcon: "🇨🇳",
stockName: "上证指数",
stockCode: "noCode",
currentPrice: "3333.96",
changeAmount: "+125.22",
changePercent: "+0.27%",
isRising: true,
},
{
flagIcon: '🇨🇳',
indexName: '科创50',
currentPrice: '757.90',
changeAmount: '-25.22',
changePercent: '-0.27%',
isRising: false
flagIcon: "🇨🇳",
stockName: "科创50",
stockCode: "noCode",
currentPrice: "757.90",
changeAmount: "-25.22",
changePercent: "-0.27%",
isRising: false,
},
{
flagIcon: '🇭🇰',
indexName: '恒生指数',
currentPrice: '19757.90',
changeAmount: '-125.22',
changePercent: '-0.63%',
isRising: false
flagIcon: "🇭🇰",
stockName: "恒生指数",
stockCode: "noCode",
currentPrice: "19757.90",
changeAmount: "-125.22",
changePercent: "-0.63%",
isRising: false,
},
{
flagIcon: '🇸🇬',
indexName: '道琼斯',
currentPrice: '3757.90',
changeAmount: '+85.22',
changePercent: '+2.31%',
isRising: true
flagIcon: "🇸🇬",
stockName: "道琼斯",
stockCode: "noCode",
currentPrice: "3757.90",
changeAmount: "+85.22",
changePercent: "+2.31%",
isRising: true,
},
{
flagIcon: '🇲🇾',
indexName: '纳斯达克',
currentPrice: '1657.90',
changeAmount: '-15.22',
changePercent: '-0.91%',
isRising: false
flagIcon: "🇲🇾",
stockName: "纳斯达克",
stockCode: "noCode",
currentPrice: "1657.90",
changeAmount: "-15.22",
changePercent: "-0.91%",
isRising: false,
},
{
flagIcon: '🇹🇭',
indexName: '标普500',
currentPrice: '1457.90',
changeAmount: '+35.22',
changePercent: '+2.48%',
isRising: true
}
])
flagIcon: "🇹🇭",
stockName: "标普500",
stockCode: "noCode",
currentPrice: "1457.90",
changeAmount: "+35.22",
changePercent: "+2.48%",
isRising: true,
},
]);
//
const onSearchInput = (e) => {
searchValue.value = e.detail.value
}
searchValue.value = e.detail.value;
};
//
const onSearchConfirm = (e) => {
console.log('搜索内容:', e.detail.value)
console.log("搜索内容:", e.detail.value);
//
performSearch(e.detail.value)
}
performSearch(e.detail.value);
};
//
const onSearchClick = () => {
if (searchValue.value.trim()) {
performSearch(searchValue.value)
}
performSearch(searchValue.value);
}
};
//
const performSearch = (keyword) => {
if (!keyword.trim()) {
uni.showToast({
title: '请输入搜索内容',
icon: 'none'
})
return
title: "请输入搜索内容",
icon: "none",
});
return;
}
uni.showToast({
title: `搜索: ${keyword}`,
icon: 'none'
})
icon: "none",
});
//
}
};
// warn
const checkWarnTextOverflow = () => {
nextTick(() => {
setTimeout(() => {
const query = uni.createSelectorQuery()
const query = uni.createSelectorQuery();
//
query.select('.warn_text_container').boundingClientRect()
query.select('.warn_text').boundingClientRect()
query.select(".warn_text_container").boundingClientRect();
query.select(".warn_text").boundingClientRect();
query.exec((res) => {
const containerRect = res[0]
const textRect = res[1]
const containerRect = res[0];
const textRect = res[1];
if (!containerRect || !textRect) {
return
return;
}
//
const isOverflow = textRect.width > (containerRect.width - 10)
isWarnTextOverflow.value = isOverflow
})
}, 500)
})
}
const isOverflow = textRect.width > containerRect.width - 10;
isWarnTextOverflow.value = isOverflow;
});
}, 500);
});
};
//
const viewIndexDetail = (item) => {
console.log("查看指数详情:", item.stockName);
// uni.showToast({
// title: ` ${item.stockName} `,
// icon: 'none',
// duration: 2000
// })
//
uni.navigateTo({
url: `/pages/marketSituation/marketCondition?stockInformation=${encodeURIComponent(JSON.stringify(item))}`,
});
};
//
const goToGlobalIndex = () => {
uni.navigateTo({
url: '/pages/marketSituation/globalIndex'
})
}
url: "/pages/marketSituation/globalIndex",
});
};
onMounted(() => {
//
@ -231,30 +251,34 @@ onMounted(() => {
// DOM
nextTick(() => {
// header
uni.createSelectorQuery().select('.header_fixed').boundingClientRect((rect) => {
uni
.createSelectorQuery()
.select(".header_fixed")
.boundingClientRect((rect) => {
if (rect) {
headerHeight.value = rect.height
console.log('Header实际高度:', headerHeight.value, 'px')
headerHeight.value = rect.height;
console.log("Header实际高度:", headerHeight.value, "px");
}
}).exec()
})
.exec();
// warn
checkWarnTextOverflow()
})
})
checkWarnTextOverflow();
});
});
// headerHeightcontentHeight
watch(headerHeight, (newHeight) => {
if (newHeight > 0) {
const systemInfo = uni.getSystemInfoSync()
const windowHeight = systemInfo.windowHeight
const statusBarHeight = systemInfo.statusBarHeight || 0
const footerHeight = 100
const systemInfo = uni.getSystemInfoSync();
const windowHeight = systemInfo.windowHeight;
const statusBarHeight = systemInfo.statusBarHeight || 0;
const footerHeight = 100;
contentHeight.value = windowHeight - statusBarHeight - newHeight - footerHeight
console.log('重新计算contentHeight:', contentHeight.value)
contentHeight.value = windowHeight - statusBarHeight - newHeight - footerHeight;
console.log("重新计算contentHeight:", contentHeight.value);
}
})
});
</script>
<style scoped>
@ -413,7 +437,7 @@ watch(headerHeight, (newHeight) => {
min-width: 40rpx;
max-width: 120rpx;
height: 8rpx;
background-image: url('/static/marketSituation-image/bg.png');
background-image: url("/static/marketSituation-image/bg.png");
background-size: cover;
background-position: center;
background-repeat: no-repeat;
@ -462,9 +486,9 @@ watch(headerHeight, (newHeight) => {
display: flex;
align-items: center;
justify-content: center;
background-color: #F3F3F3;
background-color: #f3f3f3;
border-radius: 30rpx;
border: 1rpx solid #E0E0E0;
border: 1rpx solid #e0e0e0;
padding: 30rpx 20rpx;
box-sizing: border-box;
/* 设置最小高度保护,但允许内容撑开 */

Loading…
Cancel
Save