diff --git a/api/member.js b/api/member.js index 58dd7fc..9ff6717 100644 --- a/api/member.js +++ b/api/member.js @@ -29,9 +29,14 @@ export const getUserInfo = (data) => { return http({ method: 'POST', url: '/api/my/userInfo', - data: data, - header:{ - token:'014de5283d2930af6481ede591afd087' - } + data: data + }) +} + +export const updateUserInfo = (data) => { + return http({ + method: 'POST', + url: '/api/my/updateUserInfo', + data: data }) } \ No newline at end of file diff --git a/components/IndexCard.vue b/components/IndexCard.vue index 176fc6a..ac5447a 100644 --- a/components/IndexCard.vue +++ b/components/IndexCard.vue @@ -18,9 +18,8 @@ - - - + + @@ -64,7 +63,18 @@ const props = defineProps({ }); 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) => { @@ -97,10 +107,14 @@ const priceColor = computed(() => { return props.isRising ? "#00C853" : "#FF1744"; }); -// 计算图表背景色 -const chartBgColor = computed(() => { - return props.isRising ? "#E8F5E8" : "#FFEBEE"; +const timeChart = computed(() => { + return props.isRising ? "/static/marketSituation-image/upTimeChart.png" : "/static/marketSituation-image/downTimeChart.png"; }); + +// 计算图表背景色 +// const chartBgColor = computed(() => { +// return props.isRising ? "#E8F5E8" : "#FFEBEE"; +// }); diff --git a/components/h-loading.vue b/components/h-loading.vue new file mode 100644 index 0000000..8bf1873 --- /dev/null +++ b/components/h-loading.vue @@ -0,0 +1,54 @@ + + + + + + + diff --git a/package.json b/package.json index 14c932c..6bf25b1 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,8 @@ { + "scripts": { + "dev:h5": "cross-env NODE_OPTIONS=\"--max-old-space-size=4096\" uni build --watch", + "build:h5": "cross-env NODE_OPTIONS=\"--max-old-space-size=4096\" uni build" + }, "dependencies": { "@dcloudio/uni-ui": "^1.5.11", "@element-plus/icons-vue": "^2.3.2", @@ -8,5 +12,8 @@ "pinia": "^3.0.3", "pinia-plugin-persistedstate": "^4.5.0", "vue-i18n": "^9.14.5" + }, + "devDependencies": { + "cross-env": "^7.0.3" } } diff --git a/pages/deepExploration/MainForceActions.vue b/pages/deepExploration/MainForceActions.vue index 752495d..d4378c8 100644 --- a/pages/deepExploration/MainForceActions.vue +++ b/pages/deepExploration/MainForceActions.vue @@ -41,7 +41,30 @@ - + + + + + + + + + + + + + + + + + + + + + + @@ -107,6 +130,37 @@ //登录弹窗提示ref const loginPrompt = ref(null) + // 全屏相关状态 + const isFullscreen = ref(false); // 是否显示全屏弹窗 + const isLandscape = ref(true); // 是否横屏模式 + const fullscreenChartKey = ref(0); // 全屏图表重绘标识 + + + + // 显示全屏K线 + const showFullscreenKline = () => { + isFullscreen.value = true; + isLandscape.value = true; // 默认横屏 + // 强制重绘图表 + setTimeout(() => { + fullscreenChartKey.value++; + }, 100); + }; + + // 关闭全屏 + const closeFullscreen = () => { + isFullscreen.value = false; + }; + + // 切换横竖屏 + const toggleOrientation = () => { + isLandscape.value = !isLandscape.value; + // 旋转后重绘图表 + setTimeout(() => { + fullscreenChartKey.value++; + }, 300); + }; + // 响应式变量定义 const type = ref('deepExploration') const iSMT = ref(0) @@ -159,7 +213,7 @@ const recordId = ref('') const parentId = ref('') const stockId = ref('') - const market = ref('') + const market = ref('usa') const stockTime = ref('2025/10/24') const loading = ref(true); @@ -204,6 +258,7 @@ if (searchName.value == '') { console.log('没有搜索', searchName.value); handleDefault() + getServerData() } else { if (currentIndex.value == 0) { console.log('搜索', searchName.value); @@ -494,6 +549,28 @@ } } }) + + // 全屏图表配置(继承原有配置并优化) + const fullscreenOpts = ref({ + ...opts.value, // 复用原有配置 + padding: [30, 30, 30, 30], + xAxis: { + ...opts.value.xAxis, + labelCount: 8, // 横屏显示更多标签 + fontSize: 12 + }, + yAxis: { + ...opts.value.yAxis, + fontSize: 12 + }, + extra: { + ...opts.value.extra, + candle: { + ...opts.value.extra.candle, + width: 12 // 横屏时K线宽度增加 + } + } + }); // 2. K线图数据(响应式定义) const chartData = ref({ @@ -548,6 +625,7 @@ let unwatch = null; // 生命周期钩子:组件挂载后执行(替代onReady) onMounted(async () => { + iSMT.value = uni.getSystemInfoSync().statusBarHeight getUserInfo() await handleModels() @@ -571,7 +649,8 @@ //k线 if (historyData.value.stockData.chartData.categories.length > 1) { // 确保至少保留一个日期 - historyData.value.stockData.chartData.categories[historyData.value.stockData.chartData.categories.length - 1] = ''; // 删除最后一个日期 + historyData.value.stockData.chartData.categories[historyData.value.stockData.chartData + .categories.length - 1] = ''; // 删除最后一个日期 } chartData.value = { ...JSON.parse(JSON.stringify(historyData.value.stockData.chartData)) @@ -585,7 +664,7 @@ stockChange.value = historyData.value.stockData.StockInformation.Zhang || '5.120%' stockAdd.value = historyData.value.stockData.StockInformation.ZhangFu || '22.410' stockPrice.value = historyData.value.stockData.StockInformation.Price || '435.900' - currentIndex.value = historyData.value.model-1 + currentIndex.value = historyData.value.model - 1 }, { deep: true, immediate: true @@ -597,7 +676,7 @@ // 页面加载时执行 onLoad((e) => { if (e.index) { - // currentIndex.value = e.index - 1 + currentIndex.value = e.index - 1 console.log('模块:', currentIndex.value) } if (e.stockName) { @@ -770,8 +849,8 @@ .graph_content { position: relative; min-height: 500rpx; - - image{ + + image { position: absolute; bottom: 20rpx; right: 30rpx; @@ -786,6 +865,79 @@ } } } + + /* 横屏按钮样式 */ + .rotate-btn { + background: transparent; + padding: 0 10rpx; + margin-left: 15rpx; + + .btn-icon { + width: 36rpx; + height: 36rpx; + vertical-align: middle; + } + } + + /* 全屏遮罩 */ + .fullscreen-mask { + position: fixed; + top: 0; + left: 0; + width: 100vw; + height: 100vh; + background-color: #000; + z-index: 9999; + display: flex; + justify-content: center; + align-items: center; + } + + /* 全屏容器 */ + .fullscreen-container { + width: 100vh; /* 横屏时宽度等于屏幕高度 */ + height: 100vw; /* 横屏时高度等于屏幕宽度 */ + transition: transform 0.3s ease; + position: relative; + } + + /* 关闭按钮 */ + .fullscreen-close { + position: absolute; + top: 20rpx; + right: 20rpx; + z-index: 10; + + image { + width: 48rpx; + height: 48rpx; + } + } + + /* 旋转按钮 */ + .fullscreen-rotate { + position: absolute; + top: 20rpx; + left: 20rpx; + z-index: 10; + + image { + width: 48rpx; + height: 48rpx; + } + } + + /* 全屏图表容器 */ + .fullscreen-chart { + width: 100%; + height: 100%; + } + + /* 竖屏模式适配 */ + :deep(.fullscreen-container:not([style*="rotate(90deg)"])) { + width: 100vw; + height: 100vh; + } .txt { background-color: #F3F3F3; diff --git a/pages/home/member.vue b/pages/home/member.vue index 3c02820..2ea2bb9 100644 --- a/pages/home/member.vue +++ b/pages/home/member.vue @@ -1,317 +1,367 @@ \ No newline at end of file diff --git a/pages/marketSituation/countryMarket.vue b/pages/marketSituation/countryMarket.vue index a31933e..7f23c1c 100644 --- a/pages/marketSituation/countryMarket.vue +++ b/pages/marketSituation/countryMarket.vue @@ -17,7 +17,7 @@ - + @@ -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` }) }; diff --git a/pages/marketSituation/globalIndex.vue b/pages/marketSituation/globalIndex.vue index 43e573e..40fff44 100644 --- a/pages/marketSituation/globalIndex.vue +++ b/pages/marketSituation/globalIndex.vue @@ -2,6 +2,8 @@