Browse Source

Merge branch 'refs/heads/milestone-20251031-简版功能开发' into lihuilin/feature-20251024095243-我的

lihuilin/feature-20251024095243-我的
lihui 3 weeks ago
parent
commit
c29ba759ee
  1. 13
      components/IndexCard.vue
  2. 3
      pages/deepExploration/MainForceActions.vue
  3. 25
      pages/marketSituation/countryMarket.vue
  4. 15
      pages/marketSituation/marketCondition.vue
  5. 16
      pages/marketSituation/marketOverview.vue
  6. 9
      pages/marketSituation/marketSituation.vue
  7. 2
      stores/modules/marketSituation.js
  8. 10
      utils/http.js

13
components/IndexCard.vue

@ -63,7 +63,18 @@ const props = defineProps({
}); });
const judgeSymbol = (num) => { const judgeSymbol = (num) => {
return num[0] === "-" ? num : "+" + num;
// undefined/null//
if (num === null || num === undefined) return '';
const n = Number(num);
if (!isNaN(n)) {
// '+'
return (n < 0 ? '' : '+') + n;
}
//
const s = String(num).trim();
if (s.startsWith('-')) return s;
if (s.startsWith('+')) return s;
return '+' + s;
}; };
const getMarketFlag = (market) => { const getMarketFlag = (market) => {

3
pages/deepExploration/MainForceActions.vue

@ -213,7 +213,7 @@
const recordId = ref('') const recordId = ref('')
const parentId = ref('') const parentId = ref('')
const stockId = ref('') const stockId = ref('')
const market = ref('')
const market = ref('usa')
const stockTime = ref('2025/10/24') const stockTime = ref('2025/10/24')
const loading = ref(true); const loading = ref(true);
@ -258,6 +258,7 @@
if (searchName.value == '') { if (searchName.value == '') {
console.log('没有搜索', searchName.value); console.log('没有搜索', searchName.value);
handleDefault() handleDefault()
getServerData()
} else { } else {
if (currentIndex.value == 0) { if (currentIndex.value == 0) {
console.log('搜索', searchName.value); console.log('搜索', searchName.value);

25
pages/marketSituation/countryMarket.vue

@ -17,7 +17,7 @@
</view> </view>
<view class="indices_grid"> <view class="indices_grid">
<view v-for="(index, i) in countryInfo" :key="i" class="index_item"> <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>
</view> </view>
@ -95,6 +95,8 @@
import { ref, computed, onMounted, watch } from "vue"; import { ref, computed, onMounted, watch } from "vue";
import IndexCard from "../../components/IndexCard.vue"; import IndexCard from "../../components/IndexCard.vue";
import { queryStockDataAPI } from "@/api/marketSituation/marketSituation"; import { queryStockDataAPI } from "@/api/marketSituation/marketSituation";
import { useMarketSituationStore } from "../../stores/modules/marketSituation.js";
const marketSituationStore = useMarketSituationStore();
onMounted(() => { onMounted(() => {
switchTab(0); switchTab(0);
@ -111,6 +113,11 @@ const switchTab = (i) => {
}).then((res) => { }).then((res) => {
if (res.code === 200) { if (res.code === 200) {
countryInfo.value = res.data.dataPage.records; 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)
console.log(res.data.dataPage.records) console.log(res.data.dataPage.records)
console.log(countryInfo.value); console.log(countryInfo.value);
@ -149,12 +156,23 @@ const props = defineProps({
// //
const countryInfo = ref('') 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) => { const handleTabData = (tabData) => {
if (tabData && tabData.type === 'country' && tabData.data) { if (tabData && tabData.type === 'country' && tabData.data) {
if (tabData.data.dataPage && tabData.data.dataPage.records) { if (tabData.data.dataPage && tabData.data.dataPage.records) {
countryInfo.value = 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); console.log('countryMarket接收到数据:', countryInfo.value);
} }
} }
@ -169,9 +187,6 @@ watch(() => props.tabData, (newTabData) => {
// //
const viewMore = (type) => { const viewMore = (type) => {
// type
// indices/sectors/stocks
// uni.navigateTo({ url: `/pages/marketSituation/${type}List` })
}; };
</script> </script>

15
pages/marketSituation/marketCondition.vue

@ -660,6 +660,8 @@ const toLeftPage = () => {
nextStockInformation = marketSituationStore.marketDetailCardData[currentStockIndex.value]; nextStockInformation = marketSituationStore.marketDetailCardData[currentStockIndex.value];
} else if (currentStockFrom.value == "globalIndex") { } else if (currentStockFrom.value == "globalIndex") {
nextStockInformation = marketSituationStore.gloablCardData[currentStockParentIndex.value].list[currentStockIndex.value]; nextStockInformation = marketSituationStore.gloablCardData[currentStockParentIndex.value].list[currentStockIndex.value];
} else if (currentStockFrom.value == "countryMarket") {
nextStockInformation = marketSituationStore.countryMarketCardData[currentStockIndex.value];
} else { } else {
uni.showToast({ uni.showToast({
title: "没有更多股票了", title: "没有更多股票了",
@ -713,6 +715,19 @@ const toRightPage = () => {
nextStockInformation = marketSituationStore.gloablCardData[currentStockParentIndex.value].list[currentStockIndex.value]; nextStockInformation = marketSituationStore.gloablCardData[currentStockParentIndex.value].list[currentStockIndex.value];
updateStockInformation(nextStockInformation); updateStockInformation(nextStockInformation);
} }
} else if (currentStockFrom.value == "countryMarket") {
if (currentStockIndex.value == marketSituationStore.countryMarketCardData.length) {
uni.showToast({
title: "没有更多股票了",
icon: "none",
duration: 1000,
});
return;
} else {
currentStockIndex.value++;
nextStockInformation = marketSituationStore.countryMarketCardData[currentStockIndex.value];
updateStockInformation(nextStockInformation);
}
} else { } else {
uni.showToast({ uni.showToast({
title: "没有更多股票了", title: "没有更多股票了",

16
pages/marketSituation/marketOverview.vue

@ -800,8 +800,8 @@ watch(headerHeight, (newHeight) => {
.NDX { .NDX {
position: absolute; position: absolute;
top: 30%;
left: 17%;
top: 23vh;
left: 17vw;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
font-size: 11rpx; font-size: 11rpx;
color: #000000; color: #000000;
@ -815,8 +815,8 @@ watch(headerHeight, (newHeight) => {
} }
.INDU { .INDU {
position: absolute; position: absolute;
top: 22%;
left: 35%;
top: 15vh;
left: 35vw;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
font-size: 11rpx; font-size: 11rpx;
color: #000000; color: #000000;
@ -830,8 +830,8 @@ watch(headerHeight, (newHeight) => {
} }
.HSI { .HSI {
position: absolute; position: absolute;
top: 30%;
right: 4%;
top: 23vh;
right: 4vw;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
font-size: 11rpx; font-size: 11rpx;
color: #000000; color: #000000;
@ -845,8 +845,8 @@ watch(headerHeight, (newHeight) => {
} }
.CN { .CN {
position: absolute; position: absolute;
top: 23%;
right: 8%;
top: 16vh;
right: 8vw;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
font-size: 11rpx; font-size: 11rpx;
color: #000000; color: #000000;

9
pages/marketSituation/marketSituation.vue

@ -177,11 +177,10 @@ const selected = () => {
// //
const history = () => { const history = () => {
uni.showToast({
title: "历史记录",
icon: "none",
});
//
//
uni.navigateTo({
url: '/pages/customStockList/customStockList'
})
}; };
// Tab // Tab

2
stores/modules/marketSituation.js

@ -9,11 +9,13 @@ export const useMarketSituationStore = defineStore(
const cardData = ref([]); const cardData = ref([]);
const gloablCardData = ref([]); const gloablCardData = ref([]);
const marketDetailCardData = ref([]); const marketDetailCardData = ref([]);
const countryMarketCardData = ref([]);
// 记得 return // 记得 return
return { return {
cardData, cardData,
gloablCardData, gloablCardData,
marketDetailCardData, marketDetailCardData,
countryMarketCardData,
}; };
}, },
// TODO: 持久化 // TODO: 持久化

10
utils/http.js

@ -79,16 +79,18 @@ export const http = (options) => {
} }
if (result.data.code === 400) { if (result.data.code === 400) {
const userStore = useUserStore() const userStore = useUserStore()
userStore.clearUserInfo()
uni.showModal({ uni.showModal({
title: "登录失效", title: "登录失效",
content: "点击确定跳转登录页面", content: "点击确定跳转登录页面",
confirmText: "确定", confirmText: "确定",
cancelText: "取消", cancelText: "取消",
success: (res) => { success: (res) => {
uni.navigateTo({
url: '/pages/start/login/login'
})
if (res.confirm) {
userStore.clearUserInfo()
uni.navigateTo({
url: '/pages/start/login/login'
})
}
}, },
}); });
} }

Loading…
Cancel
Save