1.31 财务分析,财务数据模块完善,产业链桑基图展示
This commit is contained in:
@@ -660,7 +660,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
t: $data.isRefreshing,
|
||||
v: common_vendor.o(($event) => $options.pullDownRefresh()),
|
||||
w: common_vendor.o(($event) => $options.loadMoreData()),
|
||||
x: common_assets._imports_9$1,
|
||||
x: common_assets._imports_8,
|
||||
y: common_vendor.o(($event) => $options.clickRankClose()),
|
||||
z: common_assets._imports_7$1,
|
||||
A: common_vendor.t($data.startDateStr),
|
||||
@@ -699,11 +699,11 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return common_vendor.e({
|
||||
a: index == 0
|
||||
}, index == 0 ? {
|
||||
b: common_assets._imports_8
|
||||
b: common_assets._imports_8$1
|
||||
} : {}, {
|
||||
c: index == 1
|
||||
}, index == 1 ? {
|
||||
d: common_assets._imports_9$2
|
||||
d: common_assets._imports_9$1
|
||||
} : {}, {
|
||||
e: index == 2
|
||||
}, index == 2 ? {
|
||||
|
||||
@@ -1,11 +1,16 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const request_api = require("../../request/api.js");
|
||||
const common_assets = require("../../common/assets.js");
|
||||
const _sfc_main = {
|
||||
data() {
|
||||
return {
|
||||
navH: common_vendor.inject("navHeight"),
|
||||
contentTop: "",
|
||||
allStockData: [],
|
||||
filteredData: [],
|
||||
currentDate: "",
|
||||
// 最终要赋值的日期
|
||||
topLists: [
|
||||
{
|
||||
title: "超大盘股",
|
||||
@@ -24,10 +29,80 @@ const _sfc_main = {
|
||||
};
|
||||
},
|
||||
onLoad(e) {
|
||||
this.activeIndex = e.index;
|
||||
this.currentDate = e.currentDate;
|
||||
this.contentTop = this.navH + (20 + 70 + 25) / 750 * common_vendor.inject("windowWidth");
|
||||
this.marketHeatmap();
|
||||
},
|
||||
methods: {}
|
||||
methods: {
|
||||
handleTypeClick(index) {
|
||||
this.list2Index = index;
|
||||
this.marketHeatmap();
|
||||
},
|
||||
getTableItem(obj) {
|
||||
const marketCap = obj.market_cap ? obj.market_cap.toFixed(2) : "0.00";
|
||||
const amount = obj.amount ? obj.amount.toFixed(2) : "0.00";
|
||||
const changePercent = obj.change_percent ? Number(obj.change_percent) : 0;
|
||||
let changePercentStr = "";
|
||||
let changeType = "";
|
||||
if (changePercent > 0) {
|
||||
changePercentStr = `+${changePercent}%`;
|
||||
changeType = "positive";
|
||||
} else if (changePercent < 0) {
|
||||
changePercentStr = `${changePercent}%`;
|
||||
changeType = "negative";
|
||||
} else {
|
||||
changePercentStr = "0%";
|
||||
changeType = "zero";
|
||||
}
|
||||
return [
|
||||
[obj.stock_name, obj.stock_code],
|
||||
[changePercentStr, "", changeType],
|
||||
// 第三个元素存类型标记
|
||||
[`${marketCap}亿元`],
|
||||
[`${amount}亿元`],
|
||||
[obj.industry || "暂无"]
|
||||
// 处理行业为空的情况
|
||||
];
|
||||
},
|
||||
marketHeatmap() {
|
||||
let param = {
|
||||
limit: 500,
|
||||
date: this.currentDate
|
||||
};
|
||||
request_api.marketHeatmap(param).then((res) => {
|
||||
this.allStockData = res.data || [];
|
||||
this.filterStockByMarketCap();
|
||||
}).catch((error) => {
|
||||
});
|
||||
},
|
||||
// 根据市值区间筛选数据
|
||||
filterStockByMarketCap() {
|
||||
const {
|
||||
list2Index,
|
||||
allStockData
|
||||
} = this;
|
||||
let filtered = [];
|
||||
switch (list2Index) {
|
||||
case 0:
|
||||
filtered = allStockData.filter((item) => item.market_cap > 1e3);
|
||||
break;
|
||||
case 1:
|
||||
filtered = allStockData.filter((item) => item.market_cap >= 500 && item.market_cap <= 1e3);
|
||||
break;
|
||||
case 2:
|
||||
filtered = allStockData.filter((item) => item.market_cap >= 100 && item.market_cap <= 500);
|
||||
break;
|
||||
default:
|
||||
filtered = allStockData;
|
||||
}
|
||||
this.filteredData = filtered;
|
||||
},
|
||||
itemDetails(item) {
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pagesStock/stockCenterDetails/stockCenterDetails?code=" + item.stock_code
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
if (!Array) {
|
||||
const _easycom_navBar2 = common_vendor.resolveComponent("navBar");
|
||||
@@ -55,7 +130,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
b: $data.list2Index == index ? "#BB8520" : "#070707",
|
||||
c: common_vendor.t(item.value),
|
||||
d: $data.list2Index == index ? "#BB8520" : "#070707",
|
||||
e: common_vendor.o(($event) => $data.list2Index = index, index),
|
||||
e: common_vendor.o(($event) => $options.handleTypeClick(index), index),
|
||||
f: index,
|
||||
g: $data.list2Index == index ? "1rpx solid #F2C369" : "none"
|
||||
};
|
||||
@@ -66,18 +141,21 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
b: index
|
||||
};
|
||||
}),
|
||||
j: common_vendor.f(10, (obj, j, i0) => {
|
||||
j: common_vendor.f($data.filteredData, (obj, j, i0) => {
|
||||
return {
|
||||
a: common_vendor.f(["云南白药", "+0.04%", "996.85 亿元", "4.44 亿元", "医药生物"], (item, index, i1) => {
|
||||
a: common_vendor.f($options.getTableItem(obj), (item, index, i1) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.t(item),
|
||||
a: common_vendor.t(item[0]),
|
||||
b: index == 0
|
||||
}, index == 0 ? {} : {}, {
|
||||
c: index,
|
||||
d: index == 0 ? "#222222" : index == 1 ? "#EC3440" : "#666666"
|
||||
}, index == 0 ? {
|
||||
c: common_vendor.t(item[1])
|
||||
} : {}, {
|
||||
d: index,
|
||||
e: index == 0 ? "#222222" : index == 1 ? item[2] === "positive" ? "#EC3440" : "#01AB5D" : "#666666"
|
||||
});
|
||||
}),
|
||||
b: j % 2 == 0 ? "#fff" : "#FAFAFC"
|
||||
b: common_vendor.o(($event) => $options.itemDetails(obj)),
|
||||
c: j % 2 == 0 ? "#fff" : "#FAFAFC"
|
||||
};
|
||||
}),
|
||||
k: common_vendor.s("top:" + $data.contentTop + "px;")
|
||||
|
||||
@@ -1 +1 @@
|
||||
<view><nav-bar wx:if="{{a}}" u-i="1d94e03e-0" bind:__l="__l" u-p="{{a}}"></nav-bar><image class="topBg absolute" src="{{b}}" mode="widthFix"></image><view class="searchC fixed flex" style="{{g}}"><image class="icon" src="{{c}}" mode="widthFix"></image><input class="flex1" type="text" placeholder="输入股票代码或名称" placeholder-style="color:#eeeeee" confirm-type="search" bindconfirm="{{d}}" value="{{e}}" bindinput="{{f}}"/></view><scroll-view scroll-y class="stockDetailsC fixed" style="{{k}}"><view><view style="display:grid;grid-template-columns:repeat(3, 1fr);gap:16rpx;margin:0 20rpx"><view wx:for="{{h}}" wx:for-item="item" wx:key="f" bindtap="{{item.e}}" style="{{'padding:12rpx' + ';' + ('border-bottom:' + item.g)}}"><view style="{{'font-size:24rpx;color:#070707;font-weight:bold;text-align:center' + ';' + ('color:' + item.b)}}">{{item.a}}</view><view style="{{'font-size:20rpx;font-weight:400;text-align:center' + ';' + ('color:' + item.d)}}">{{item.c}}</view></view></view><view style="height:1rpx;margin:0 20rpx;background-color:#E7E7E7"></view><view style="display:grid;grid-template-columns:repeat(5, 1fr);gap:10rpx;background-color:#FAFAFC;line-height:60rpx;margin:0 20rpx;margin-top:20rpx"><view wx:for="{{i}}" wx:for-item="item" wx:key="b" style="color:#666666;font-size:20rpx;font-weight:500;text-align:center">{{item.a}}</view></view><view wx:for="{{j}}" wx:for-item="obj" style="{{'display:grid;grid-template-columns:repeat(5, 1fr);gap:10rpx;min-height:60rpx;margin:0 20rpx' + ';' + ('background-color:' + obj.b)}}"><view wx:for="{{obj.a}}" wx:for-item="item" wx:key="c" style="{{'padding:10rpx 0;color:#666666;font-size:20rpx;font-weight:500;text-align:center;display:flex;justify-content:center;align-items:center;flex-direction:column' + ';' + ('color:' + item.d)}}"><view>{{item.a}}</view><view wx:if="{{item.b}}" style="color:#666666;font-size:20rpx;font-weight:500">000768</view></view></view><view style="height:25rpx"></view></view></scroll-view></view>
|
||||
<view><nav-bar wx:if="{{a}}" u-i="1d94e03e-0" bind:__l="__l" u-p="{{a}}"></nav-bar><image class="topBg absolute" src="{{b}}" mode="widthFix"></image><view class="searchC fixed flex" style="{{g}}"><image class="icon" src="{{c}}" mode="widthFix"></image><input class="flex1" type="text" placeholder="输入股票代码或名称" placeholder-style="color:#eeeeee" confirm-type="search" bindconfirm="{{d}}" value="{{e}}" bindinput="{{f}}"/></view><scroll-view scroll-y class="stockDetailsC fixed" style="{{k}}"><view><view style="display:grid;grid-template-columns:repeat(3, 1fr);gap:16rpx;margin:0 20rpx"><view wx:for="{{h}}" wx:for-item="item" wx:key="f" bindtap="{{item.e}}" style="{{'padding:12rpx' + ';' + ('border-bottom:' + item.g)}}"><view style="{{'font-size:24rpx;color:#070707;font-weight:bold;text-align:center' + ';' + ('color:' + item.b)}}">{{item.a}}</view><view style="{{'font-size:20rpx;font-weight:400;text-align:center' + ';' + ('color:' + item.d)}}">{{item.c}}</view></view></view><view style="height:1rpx;margin:0 20rpx;background-color:#E7E7E7"></view><view style="display:grid;grid-template-columns:repeat(5, 1fr);gap:10rpx;background-color:#FAFAFC;line-height:60rpx;margin:0 20rpx;margin-top:20rpx"><view wx:for="{{i}}" wx:for-item="item" wx:key="b" style="color:#666666;font-size:20rpx;font-weight:500;text-align:center">{{item.a}}</view></view><view wx:for="{{j}}" wx:for-item="obj" bindtap="{{obj.b}}" style="{{'display:grid;grid-template-columns:repeat(5, 1fr);gap:10rpx;min-height:60rpx;margin:0 20rpx' + ';' + ('background-color:' + obj.c)}}"><view wx:for="{{obj.a}}" wx:for-item="item" wx:key="d" style="{{'padding:10rpx 0;color:#666666;font-size:20rpx;font-weight:500;text-align:center;display:flex;justify-content:center;align-items:center;flex-direction:column' + ';' + ('color:' + item.e)}}"><view>{{item.a}}</view><view wx:if="{{item.b}}" style="color:#666666;font-size:20rpx;font-weight:500">{{item.c}}</view></view></view><view style="height:25rpx"></view></view></scroll-view></view>
|
||||
@@ -7,40 +7,91 @@ const _sfc_main = {
|
||||
return {
|
||||
navH: common_vendor.inject("navHeight"),
|
||||
contentTop: "",
|
||||
currentDate: "",
|
||||
// 最终要赋值的日期
|
||||
selectedDate: "",
|
||||
// 临时存储选中的日期
|
||||
allStockData: [],
|
||||
filteredData: [],
|
||||
conceptStocksList: [],
|
||||
alertTypeConfig: {
|
||||
"surge": {
|
||||
text: "异动",
|
||||
color: "#FF7A45",
|
||||
// rgb(255, 122, 69)
|
||||
filter: "brightness(0) saturate(100%) invert(54%) sepia(60%) saturate(467%) hue-rotate(344deg) brightness(102%) contrast(101%)"
|
||||
},
|
||||
"shrink_surge_up": {
|
||||
text: "缩量急涨",
|
||||
color: "#722ED1",
|
||||
// rgb(114, 46, 209)
|
||||
filter: "brightness(0) saturate(100%) invert(24%) sepia(90%) saturate(2865%) hue-rotate(266deg) brightness(87%) contrast(98%)"
|
||||
},
|
||||
"volume_surge_up": {
|
||||
text: "放量急涨",
|
||||
color: "#EB2F96",
|
||||
// rgb(235, 47, 150)
|
||||
filter: "brightness(0) saturate(100%) invert(34%) sepia(82%) saturate(1970%) hue-rotate(313deg) brightness(91%) contrast(94%)"
|
||||
},
|
||||
"volume_oscillation": {
|
||||
text: "放量震荡",
|
||||
color: "#13C2C2",
|
||||
// rgb(19, 194, 194)
|
||||
filter: "brightness(0) saturate(100%) invert(71%) sepia(62%) saturate(487%) hue-rotate(142deg) brightness(91%) contrast(93%)"
|
||||
},
|
||||
"surge_up": {
|
||||
text: "急涨",
|
||||
color: "#FF4D4F",
|
||||
// rgb(255, 77, 79)
|
||||
filter: "brightness(0) saturate(100%) invert(42%) sepia(93%) saturate(727%) hue-rotate(346deg) brightness(102%) contrast(104%)"
|
||||
},
|
||||
"surge_down": {
|
||||
text: "急跌",
|
||||
color: "#52C41A",
|
||||
// rgb(82, 196, 26)
|
||||
filter: "brightness(0) saturate(100%) invert(68%) sepia(65%) saturate(456%) hue-rotate(71deg) brightness(91%) contrast(86%)"
|
||||
},
|
||||
"shrink_surge_down": {
|
||||
text: "缩量急跌",
|
||||
color: "#FF7A45",
|
||||
// rgb(255, 122, 69)
|
||||
filter: "brightness(0) saturate(100%) invert(54%) sepia(60%) saturate(467%) hue-rotate(344deg) brightness(102%) contrast(101%)"
|
||||
}
|
||||
},
|
||||
topLists: [
|
||||
{
|
||||
title: "大盘涨跌幅",
|
||||
value: "+0.31%",
|
||||
value: "+0.00%",
|
||||
color: "#EC3440",
|
||||
backIcon: "/static/icon/gegu/gg-top-0.png"
|
||||
},
|
||||
{
|
||||
title: "涨停/跌停",
|
||||
value: "+0.31%",
|
||||
value: "+0.00%",
|
||||
color: "#070707",
|
||||
backIcon: "/static/icon/gegu/gg-top-1.png"
|
||||
},
|
||||
{
|
||||
title: "多空对比",
|
||||
value: "3572/1855",
|
||||
value: "0/0",
|
||||
color: "#070707",
|
||||
backIcon: "/static/icon/gegu/gg-top-2.png"
|
||||
},
|
||||
{
|
||||
title: "今日成交额",
|
||||
value: "1.5万亿",
|
||||
value: "0万亿",
|
||||
color: "#070707",
|
||||
backIcon: "/static/icon/gegu/gg-top-3.png"
|
||||
},
|
||||
{
|
||||
title: "A股总市值",
|
||||
value: "113.8万亿",
|
||||
value: "0万亿",
|
||||
color: "#070707",
|
||||
backIcon: "/static/icon/gegu/gg-top-4.png"
|
||||
},
|
||||
{
|
||||
title: "连板龙头",
|
||||
value: "10只",
|
||||
value: "0只",
|
||||
color: "#F59B38",
|
||||
backIcon: "/static/icon/gegu/gg-top-5.png"
|
||||
}
|
||||
@@ -81,41 +132,208 @@ const _sfc_main = {
|
||||
title: "放量震荡",
|
||||
backIcon: "/static/icon/gegu/cate-4.png"
|
||||
}
|
||||
]
|
||||
],
|
||||
marketAlertsList: [],
|
||||
formattedAvg: 0,
|
||||
upCount: 0,
|
||||
downCount: 0,
|
||||
limit_up_ratio: 0
|
||||
};
|
||||
},
|
||||
onLoad(e) {
|
||||
this.activeIndex = e.index;
|
||||
this.contentTop = this.navH + (20 + 70 + 25) / 750 * common_vendor.inject("windowWidth");
|
||||
this.conceptsDailyTop();
|
||||
const now = /* @__PURE__ */ new Date();
|
||||
const year = now.getFullYear();
|
||||
const month = (now.getMonth() + 1).toString().padStart(2, "0");
|
||||
const day = now.getDate().toString().padStart(2, "0");
|
||||
this.currentDate = `${year}-${month}-${day}`;
|
||||
},
|
||||
onShow() {
|
||||
this.marketHeatmap();
|
||||
this.marketStatistics();
|
||||
this.marketHotspotOverview();
|
||||
this.marketHotspotListOverview();
|
||||
},
|
||||
methods: {
|
||||
formatAlpha(value) {
|
||||
if (value === null || value === void 0 || isNaN(Number(value))) {
|
||||
return "0.0";
|
||||
}
|
||||
return Number(value).toFixed(1);
|
||||
},
|
||||
handleTypeClick(index) {
|
||||
this.list2Index = index;
|
||||
this.marketHeatmap(this.currentDate);
|
||||
},
|
||||
getTableItem(obj) {
|
||||
const marketCap = obj.market_cap ? obj.market_cap.toFixed(2) : "0.00";
|
||||
const amount = obj.amount ? obj.amount.toFixed(2) : "0.00";
|
||||
const changePercent = obj.change_percent ? Number(obj.change_percent) : 0;
|
||||
let changePercentStr = "";
|
||||
let changeType = "";
|
||||
if (changePercent > 0) {
|
||||
changePercentStr = `+${changePercent}%`;
|
||||
changeType = "positive";
|
||||
} else if (changePercent < 0) {
|
||||
changePercentStr = `${changePercent}%`;
|
||||
changeType = "negative";
|
||||
} else {
|
||||
changePercentStr = "0%";
|
||||
changeType = "zero";
|
||||
}
|
||||
return [
|
||||
[obj.stock_name, obj.stock_code],
|
||||
[changePercentStr, "", changeType],
|
||||
// 第三个元素存类型标记
|
||||
[`${marketCap}亿元`],
|
||||
[`${amount}亿元`],
|
||||
[obj.industry || "暂无"]
|
||||
// 处理行业为空的情况
|
||||
];
|
||||
},
|
||||
// 处理涨停比:转百分比 + 四舍五入(可指定保留小数位数)
|
||||
formatLimitUpRatio(value, decimalPlaces = 0) {
|
||||
if (!value || isNaN(Number(value))) {
|
||||
return "0%";
|
||||
}
|
||||
const percentValue = Number(value) * 100;
|
||||
const result = decimalPlaces === 0 ? Math.round(percentValue) : percentValue.toFixed(decimalPlaces);
|
||||
return `${result}%`;
|
||||
},
|
||||
conceptsDailyTop() {
|
||||
request_api.conceptsDailyTop().then((res) => {
|
||||
}).catch((error) => {
|
||||
});
|
||||
},
|
||||
marketHeatmap() {
|
||||
request_api.marketHeatmap().then((res) => {
|
||||
marketHeatmap(currentDate) {
|
||||
let param = {
|
||||
limit: 500
|
||||
};
|
||||
if (currentDate && currentDate !== "undefined" && currentDate.trim() !== "") {
|
||||
param.date = currentDate;
|
||||
}
|
||||
request_api.marketHeatmap(param).then((res) => {
|
||||
this.topLists[2].value = res.statistics.rising_count + "/" + res.statistics.falling_count;
|
||||
this.allStockData = res.data || [];
|
||||
const limitUpCount = this.allStockData.filter((s) => {
|
||||
const changePercent = Number(s.change_percent);
|
||||
return !isNaN(changePercent) && changePercent >= 9.9;
|
||||
}).length;
|
||||
const limitDownCount = this.allStockData.filter((s) => {
|
||||
const changePercent = Number(s.change_percent);
|
||||
return !isNaN(changePercent) && changePercent <= -9.9;
|
||||
}).length;
|
||||
this.topLists[1].value = limitUpCount + "/" + limitDownCount;
|
||||
this.topLists[5].value = limitUpCount + "只";
|
||||
this.filterStockByMarketCap();
|
||||
}).catch((error) => {
|
||||
});
|
||||
},
|
||||
// 根据市值区间筛选数据
|
||||
filterStockByMarketCap() {
|
||||
const {
|
||||
list2Index,
|
||||
allStockData
|
||||
} = this;
|
||||
let filtered = [];
|
||||
switch (list2Index) {
|
||||
case 0:
|
||||
filtered = allStockData.filter((item) => item.market_cap > 1e3);
|
||||
break;
|
||||
case 1:
|
||||
filtered = allStockData.filter((item) => item.market_cap >= 500 && item.market_cap <= 1e3);
|
||||
break;
|
||||
case 2:
|
||||
filtered = allStockData.filter((item) => item.market_cap >= 100 && item.market_cap <= 500);
|
||||
break;
|
||||
default:
|
||||
filtered = allStockData;
|
||||
}
|
||||
this.filteredData = filtered.slice(0, 10);
|
||||
},
|
||||
marketStatistics() {
|
||||
request_api.marketStatistics().then((res) => {
|
||||
this.topLists[3].value = this.formatToTrillion(res.summary.total_amount);
|
||||
this.topLists[4].value = this.formatToTrillion(res.summary.total_market_cap);
|
||||
}).catch((error) => {
|
||||
this.topLists[3].value = "0.0 万亿";
|
||||
this.topLists[4].value = "0.0 万亿";
|
||||
});
|
||||
},
|
||||
formatToTrillion(num) {
|
||||
if (typeof num !== "number" || isNaN(num)) {
|
||||
return "0.0 万亿";
|
||||
}
|
||||
const trillionValue = (num / 1e4).toFixed(1);
|
||||
return `${trillionValue} 万亿`;
|
||||
},
|
||||
marketHotspotListOverview() {
|
||||
let param = {
|
||||
date: this.currentDate
|
||||
};
|
||||
request_api.marketHotspotOverview(param).then((res) => {
|
||||
var _a;
|
||||
const alerts = ((_a = res == null ? void 0 : res.data) == null ? void 0 : _a.alerts) || [];
|
||||
const changePct = res.data.index.change_pct;
|
||||
let numPct = 0;
|
||||
if (changePct && !isNaN(Number(changePct))) {
|
||||
numPct = Number(changePct);
|
||||
}
|
||||
const roundedPct = Math.round(numPct * 100) / 100;
|
||||
const fixedPct = roundedPct.toFixed(2);
|
||||
let formattedPct = "";
|
||||
if (roundedPct > 0) {
|
||||
formattedPct = `+${fixedPct}%`;
|
||||
} else if (roundedPct < 0) {
|
||||
formattedPct = `${fixedPct}%`;
|
||||
} else {
|
||||
formattedPct = "0.00%";
|
||||
}
|
||||
const color = roundedPct > 0 ? "#EC3440" : roundedPct < 0 ? "#01AB5D" : "#666666";
|
||||
this.topLists[0].value = formattedPct;
|
||||
this.topLists[0].color = color;
|
||||
const processedAlerts = alerts.map((alertItem) => {
|
||||
const stocks = alertItem.stocks || [];
|
||||
const validStocks = stocks.filter((s) => s.change_pct != null && !isNaN(Number(s.change_pct)));
|
||||
const avgChange = validStocks.length > 0 ? validStocks.reduce((sum, s) => sum + Number(s.change_pct), 0) / validStocks.length : 0;
|
||||
const upCount = validStocks.filter((s) => Number(s.change_pct) > 0).length;
|
||||
const downCount = validStocks.filter((s) => Number(s.change_pct) < 0).length;
|
||||
const roundedAvg = Math.round(avgChange * 100) / 100;
|
||||
const formattedAvg = roundedAvg > 0 ? `+${roundedAvg.toFixed(2)}` : roundedAvg.toFixed(2);
|
||||
return {
|
||||
...alertItem,
|
||||
alpha: avgChange,
|
||||
// 供模板中判断颜色和显示数值
|
||||
upCount,
|
||||
// 上涨股票数
|
||||
downCount,
|
||||
// 下跌股票数
|
||||
formattedAvg
|
||||
// 格式化后的均涨值(带正负号)
|
||||
};
|
||||
});
|
||||
const sortByTimeDesc = (a, b) => {
|
||||
const timeToMinutes = (timeStr) => {
|
||||
const [hours, minutes] = timeStr.split(":").map(Number);
|
||||
return hours * 60 + minutes;
|
||||
};
|
||||
const minutesA = timeToMinutes(a.time);
|
||||
const minutesB = timeToMinutes(b.time);
|
||||
return minutesB - minutesA;
|
||||
};
|
||||
const sortedAlerts = processedAlerts.sort(sortByTimeDesc);
|
||||
this.marketAlertsList = sortedAlerts;
|
||||
}).catch((error) => {
|
||||
});
|
||||
},
|
||||
marketHotspotOverview() {
|
||||
request_api.marketHotspotOverview().then((res) => {
|
||||
}).catch((error) => {
|
||||
itemDetails(item) {
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pagesStock/stockCenterDetails/stockCenterDetails?code=" + item.stock_code
|
||||
});
|
||||
},
|
||||
moreAction() {
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/geGuCenter/detail"
|
||||
url: "/pages/geGuCenter/detail?currentDate=" + this.currentDate
|
||||
});
|
||||
},
|
||||
allAction(index) {
|
||||
@@ -134,15 +352,66 @@ const _sfc_main = {
|
||||
this.$refs["detailPopup"].close();
|
||||
}
|
||||
},
|
||||
handleDateChange(date) {
|
||||
this.selectedDate = date;
|
||||
common_vendor.index.__f__("log", "at pages/geGuCenter/geGuCenter.vue:719", "选中的日期:", date);
|
||||
},
|
||||
confirmAction(index) {
|
||||
if (index == 1) {
|
||||
this.$refs["typePopup"].close();
|
||||
} else if (index == 2) {
|
||||
if (this.selectedDate) {
|
||||
this.currentDate = this.selectedDate;
|
||||
common_vendor.index.__f__("log", "at pages/geGuCenter/geGuCenter.vue:728", "最终确认的日期:", this.currentDate);
|
||||
} else {
|
||||
const now = /* @__PURE__ */ new Date();
|
||||
const year = now.getFullYear();
|
||||
const month = (now.getMonth() + 1).toString().padStart(2, "0");
|
||||
const day = now.getDate().toString().padStart(2, "0");
|
||||
this.currentDate = `${year}-${month}-${day}`;
|
||||
}
|
||||
this.marketHeatmap(this.currentDate);
|
||||
this.marketStatistics();
|
||||
this.marketHotspotListOverview();
|
||||
this.$refs["datePopup"].close();
|
||||
}
|
||||
},
|
||||
bkydAction(item) {
|
||||
this.$refs["detailPopup"].open();
|
||||
this.formattedAvg = item.formattedAvg, this.upCount = item.upCount, this.downCount = item.downCount, this.limit_up_ratio = item.limit_up_ratio, this.conceptStocksDetails(item.concept_id);
|
||||
},
|
||||
conceptStocksDetails(concept_id) {
|
||||
common_vendor.index.__f__("log", "at pages/geGuCenter/geGuCenter.vue:754", "concept_id", concept_id);
|
||||
request_api.conceptStocks(concept_id, {}).then((res) => {
|
||||
if (res.data && res.data.stocks) {
|
||||
let rawData = res.data.stocks;
|
||||
this.conceptStocksList = rawData.sort((a, b) => {
|
||||
const aValue = a.change_pct === null || a.change_pct === void 0 ? -999 : Number(a.change_pct);
|
||||
const bValue = b.change_pct === null || b.change_pct === void 0 ? -999 : Number(b.change_pct);
|
||||
return bValue - aValue;
|
||||
});
|
||||
} else {
|
||||
common_vendor.index.__f__("warn", "at pages/geGuCenter/geGuCenter.vue:773", "接口返回数据格式异常", res);
|
||||
}
|
||||
}).catch((error) => {
|
||||
});
|
||||
},
|
||||
// 格式化涨跌幅显示(处理正负号、保留两位小数)
|
||||
formatChangePct(change_pct) {
|
||||
if (typeof change_pct !== "number")
|
||||
return "0.00%";
|
||||
const symbol = change_pct >= 0 ? "+" : "";
|
||||
return `${symbol}${change_pct.toFixed(2)}%`;
|
||||
},
|
||||
// 获取涨跌幅文字颜色(涨红跌绿,平盘灰色)
|
||||
getChangeColor(change_pct) {
|
||||
if (typeof change_pct !== "number")
|
||||
return "#888888";
|
||||
if (change_pct > 0)
|
||||
return "#EC3440";
|
||||
if (change_pct < 0)
|
||||
return "#00B42A";
|
||||
return "#888888";
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -187,7 +456,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
c: $data.list2Index == index ? "#FFFAF1" : "#FFFFFF",
|
||||
d: common_vendor.t(item.value),
|
||||
e: $data.list2Index == index ? "#BB8520" : "#070707",
|
||||
f: common_vendor.o(($event) => $data.list2Index = index, index),
|
||||
f: common_vendor.o(($event) => $options.handleTypeClick(index), index),
|
||||
g: index,
|
||||
h: `1rpx solid ${$data.list2Index == index ? "#F2C369" : "#D2D2D2"}`
|
||||
};
|
||||
@@ -198,18 +467,21 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
b: index
|
||||
};
|
||||
}),
|
||||
k: common_vendor.f(10, (obj, j, i0) => {
|
||||
k: common_vendor.f($data.filteredData, (obj, j, i0) => {
|
||||
return {
|
||||
a: common_vendor.f(["云南白药", "+0.04%", "996.85 亿元", "4.44 亿元", "医药生物"], (item, index, i1) => {
|
||||
a: common_vendor.f($options.getTableItem(obj), (item, index, i1) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.t(item),
|
||||
a: common_vendor.t(item[0]),
|
||||
b: index == 0
|
||||
}, index == 0 ? {} : {}, {
|
||||
c: index,
|
||||
d: index == 0 ? "#222222" : index == 1 ? "#EC3440" : "#666666"
|
||||
}, index == 0 ? {
|
||||
c: common_vendor.t(item[1])
|
||||
} : {}, {
|
||||
d: index,
|
||||
e: index == 0 ? "#222222" : index == 1 ? item[2] === "positive" ? "#EC3440" : "#01AB5D" : "#666666"
|
||||
});
|
||||
}),
|
||||
b: j % 2 == 0 ? "#fff" : "#FAFAFC"
|
||||
b: common_vendor.o(($event) => $options.itemDetails(obj)),
|
||||
c: j % 2 == 0 ? "#fff" : "#FAFAFC"
|
||||
};
|
||||
}),
|
||||
l: common_assets._imports_1$2,
|
||||
@@ -217,47 +489,79 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
n: common_assets._imports_3$7,
|
||||
o: common_assets._imports_4$1,
|
||||
p: common_vendor.o(($event) => $options.allAction(1)),
|
||||
q: common_assets._imports_4$1,
|
||||
r: common_vendor.o(($event) => $options.allAction(2)),
|
||||
s: common_assets._imports_3$7,
|
||||
t: common_vendor.f(10, (item, index, i0) => {
|
||||
return {
|
||||
a: index,
|
||||
b: common_vendor.o(($event) => $options.bkydAction(item), index)
|
||||
};
|
||||
q: common_vendor.t($data.currentDate),
|
||||
r: common_assets._imports_4$1,
|
||||
s: common_vendor.o(($event) => $options.allAction(2)),
|
||||
t: common_assets._imports_3$7,
|
||||
v: common_vendor.f($data.marketAlertsList, (item, index, i0) => {
|
||||
var _a, _b, _c, _d;
|
||||
return common_vendor.e({
|
||||
a: common_vendor.t(item.time),
|
||||
b: common_vendor.t(item.concept_name),
|
||||
c: ((_a = $data.alertTypeConfig[item.alert_type]) == null ? void 0 : _a.filter) || "",
|
||||
d: common_vendor.t(((_b = $data.alertTypeConfig[item.alert_type]) == null ? void 0 : _b.text) || "异动"),
|
||||
e: ((_c = $data.alertTypeConfig[item.alert_type]) == null ? void 0 : _c.color) || "#FF7A45",
|
||||
f: "1rpx solid " + (((_d = $data.alertTypeConfig[item.alert_type]) == null ? void 0 : _d.color) || "#FF7A45"),
|
||||
g: common_vendor.t(item.formattedAvg),
|
||||
h: Number(item.alpha) > 0 ? "#EC3440" : "#01AB5D",
|
||||
i: common_vendor.t(item.upCount),
|
||||
j: item.upCount > 0 ? "#EC3440" : "#888888",
|
||||
k: common_vendor.t(item.downCount),
|
||||
l: item.downCount > 0 ? "#01AB5D" : "#888888",
|
||||
m: common_vendor.t(Math.round(item.final_score)),
|
||||
n: item && Number(item.limit_up_ratio) > 0 && !isNaN(Number(item.limit_up_ratio))
|
||||
}, item && Number(item.limit_up_ratio) > 0 && !isNaN(Number(item.limit_up_ratio)) ? {
|
||||
o: common_vendor.t($options.formatLimitUpRatio(item.limit_up_ratio, 0))
|
||||
} : {}, {
|
||||
p: index,
|
||||
q: common_vendor.o(($event) => $options.bkydAction(item), index)
|
||||
});
|
||||
}),
|
||||
v: common_assets._imports_5$3,
|
||||
w: common_vendor.s("top:" + $data.contentTop + "px;"),
|
||||
x: common_vendor.o(($event) => $options.closeAction(1)),
|
||||
y: common_vendor.o(($event) => $options.confirmAction(1)),
|
||||
z: common_vendor.f($data.typeList, (item, index, i0) => {
|
||||
w: common_assets._imports_5$3,
|
||||
x: common_vendor.s("top:" + $data.contentTop + "px;"),
|
||||
y: common_vendor.o(($event) => $options.closeAction(1)),
|
||||
z: common_vendor.o(($event) => $options.confirmAction(1)),
|
||||
A: common_vendor.f($data.typeList, (item, index, i0) => {
|
||||
return {
|
||||
a: item.backIcon,
|
||||
b: common_vendor.t(item.title),
|
||||
c: index
|
||||
};
|
||||
}),
|
||||
A: common_vendor.sr("typePopup", "c7f5c964-1"),
|
||||
B: common_vendor.p({
|
||||
B: common_vendor.sr("typePopup", "c7f5c964-1"),
|
||||
C: common_vendor.p({
|
||||
type: "bottom",
|
||||
safeArea: false
|
||||
}),
|
||||
C: common_vendor.o(($event) => $options.closeAction(2)),
|
||||
D: common_vendor.o(($event) => $options.confirmAction(2)),
|
||||
E: common_vendor.sr("datePopup", "c7f5c964-2"),
|
||||
F: common_vendor.p({
|
||||
D: common_vendor.o(($event) => $options.closeAction(2)),
|
||||
E: common_vendor.o(($event) => $options.confirmAction(2)),
|
||||
F: common_vendor.o($options.handleDateChange),
|
||||
G: common_vendor.sr("datePopup", "c7f5c964-2"),
|
||||
H: common_vendor.p({
|
||||
type: "bottom",
|
||||
safeArea: false
|
||||
}),
|
||||
G: common_assets._imports_9$1,
|
||||
H: common_vendor.o(($event) => $options.closeAction(3)),
|
||||
I: common_vendor.f(10, (item, index, i0) => {
|
||||
I: common_assets._imports_8,
|
||||
J: common_vendor.o(($event) => $options.closeAction(3)),
|
||||
K: common_vendor.t($data.formattedAvg),
|
||||
L: Number($data.formattedAvg) > 0 ? "#EC3440" : "#01AB5D",
|
||||
M: common_vendor.t($data.upCount),
|
||||
N: $data.upCount > 0 ? "#EC3440" : "#888888",
|
||||
O: common_vendor.t($data.downCount),
|
||||
P: $data.downCount > 0 ? "#01AB5D" : "#888888",
|
||||
Q: common_vendor.t($options.formatLimitUpRatio($data.limit_up_ratio, 0)),
|
||||
R: common_vendor.f($data.conceptStocksList, (item, index, i0) => {
|
||||
return {
|
||||
a: index % 2 == 0 ? "#fff" : "#FAFAFC"
|
||||
a: common_vendor.t(item.name),
|
||||
b: common_vendor.t(item.code),
|
||||
c: common_vendor.t($options.formatChangePct(item.change_pct)),
|
||||
d: $options.getChangeColor(item.change_pct),
|
||||
e: index,
|
||||
f: index % 2 == 0 ? "#fff" : "#FAFAFC"
|
||||
};
|
||||
}),
|
||||
J: common_vendor.sr("detailPopup", "c7f5c964-4"),
|
||||
K: common_vendor.p({
|
||||
S: common_vendor.sr("detailPopup", "c7f5c964-4"),
|
||||
T: common_vendor.p({
|
||||
type: "bottom",
|
||||
safeArea: false
|
||||
})
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -569,13 +569,13 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
}) : {}, {
|
||||
C: $data.eventDetails
|
||||
}, $data.eventDetails ? {
|
||||
D: common_assets._imports_8$1,
|
||||
D: common_assets._imports_8$2,
|
||||
E: common_vendor.t($data.eventDetails.view_count),
|
||||
F: common_assets._imports_9$3,
|
||||
F: common_assets._imports_9$2,
|
||||
G: common_vendor.t($data.eventDetails.follower_count),
|
||||
H: common_vendor.o(($event) => $options.clickFollow())
|
||||
} : {}, {
|
||||
I: common_assets._imports_9$1,
|
||||
I: common_assets._imports_8,
|
||||
J: common_vendor.o(($event) => $options.closeCommentPopup()),
|
||||
K: common_vendor.f($data.commentList, (item, index, i0) => {
|
||||
return {
|
||||
@@ -602,7 +602,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
["mask-background-color"]: "transparent",
|
||||
animation: false
|
||||
}),
|
||||
S: common_assets._imports_9$1,
|
||||
S: common_assets._imports_8,
|
||||
T: common_vendor.o(($event) => $options.closeRelatedStockPopup()),
|
||||
U: common_vendor.f($data.historyEventRelatedStockList, (item, index, i0) => {
|
||||
return common_vendor.e({
|
||||
|
||||
551
unpackage/dist/dev/mp-weixin/pages/ztfx/ztfx.js
vendored
551
unpackage/dist/dev/mp-weixin/pages/ztfx/ztfx.js
vendored
@@ -1,9 +1,111 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const request_http = require("../../request/http.js");
|
||||
const request_api = require("../../request/api.js");
|
||||
const common_assets = require("../../common/assets.js");
|
||||
const echarts = require("../../uni_modules/lime-echart/static/echarts.min.js");
|
||||
const WordCloud = () => "../../components/WordCloud/WordCloud2.js";
|
||||
const mockGraphData = {
|
||||
categories: [
|
||||
{
|
||||
name: "板块"
|
||||
},
|
||||
{
|
||||
name: "概念"
|
||||
},
|
||||
{
|
||||
name: "个股"
|
||||
}
|
||||
],
|
||||
nodes: [
|
||||
{
|
||||
name: "科技板块",
|
||||
symbolSize: 50,
|
||||
category: 0
|
||||
},
|
||||
{
|
||||
name: "人工智能",
|
||||
symbolSize: 30,
|
||||
category: 1
|
||||
},
|
||||
{
|
||||
name: "大数据",
|
||||
symbolSize: 25,
|
||||
category: 1
|
||||
},
|
||||
{
|
||||
name: "科大讯飞",
|
||||
symbolSize: 20,
|
||||
category: 2
|
||||
},
|
||||
{
|
||||
name: "百度",
|
||||
symbolSize: 20,
|
||||
category: 2
|
||||
},
|
||||
{
|
||||
name: "金融板块",
|
||||
symbolSize: 50,
|
||||
category: 0
|
||||
},
|
||||
{
|
||||
name: "数字货币",
|
||||
symbolSize: 30,
|
||||
category: 1
|
||||
},
|
||||
{
|
||||
name: "招商银行",
|
||||
symbolSize: 20,
|
||||
category: 2
|
||||
},
|
||||
{
|
||||
name: "平安银行",
|
||||
symbolSize: 20,
|
||||
category: 2
|
||||
}
|
||||
],
|
||||
links: [
|
||||
{
|
||||
source: "科技板块",
|
||||
target: "人工智能",
|
||||
value: 10
|
||||
},
|
||||
{
|
||||
source: "科技板块",
|
||||
target: "大数据",
|
||||
value: 8
|
||||
},
|
||||
{
|
||||
source: "人工智能",
|
||||
target: "科大讯飞",
|
||||
value: 6
|
||||
},
|
||||
{
|
||||
source: "人工智能",
|
||||
target: "百度",
|
||||
value: 6
|
||||
},
|
||||
{
|
||||
source: "金融板块",
|
||||
target: "数字货币",
|
||||
value: 9
|
||||
},
|
||||
{
|
||||
source: "数字货币",
|
||||
target: "招商银行",
|
||||
value: 5
|
||||
},
|
||||
{
|
||||
source: "数字货币",
|
||||
target: "平安银行",
|
||||
value: 5
|
||||
}
|
||||
]
|
||||
};
|
||||
const _sfc_main = {
|
||||
components: {
|
||||
WordCloud
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
navH: common_vendor.inject("navHeight"),
|
||||
@@ -31,161 +133,277 @@ const _sfc_main = {
|
||||
title: "炸板率"
|
||||
}
|
||||
],
|
||||
bkList: [
|
||||
wordData: [],
|
||||
bkList: [],
|
||||
number_limit_stocks: "",
|
||||
HEAT_LEVELS: [
|
||||
{
|
||||
title: "存储芯片",
|
||||
count: 8
|
||||
threshold: 0.7,
|
||||
color: "#EF4444",
|
||||
level: "高热度"
|
||||
},
|
||||
// >70%
|
||||
{
|
||||
title: "存储芯片",
|
||||
count: 8
|
||||
threshold: 0.4,
|
||||
color: "#F97316",
|
||||
level: "中热度"
|
||||
},
|
||||
// 40%~70%
|
||||
{
|
||||
title: "存储芯片",
|
||||
count: 8
|
||||
threshold: 0.2,
|
||||
color: "#F3B800",
|
||||
level: "低热度"
|
||||
},
|
||||
// 20%~40%
|
||||
{
|
||||
title: "存储芯片",
|
||||
count: 8
|
||||
},
|
||||
{
|
||||
title: "存储芯片",
|
||||
count: 8
|
||||
},
|
||||
{
|
||||
title: "存储芯片",
|
||||
count: 8
|
||||
},
|
||||
{
|
||||
title: "存储芯片",
|
||||
count: 8
|
||||
},
|
||||
{
|
||||
title: "存储芯片",
|
||||
count: 8
|
||||
},
|
||||
{
|
||||
title: "存储芯片",
|
||||
count: 8
|
||||
},
|
||||
{
|
||||
title: "存储芯片",
|
||||
count: 8
|
||||
},
|
||||
{
|
||||
title: "存储芯片",
|
||||
count: 8
|
||||
},
|
||||
{
|
||||
title: "存储芯片",
|
||||
count: 8
|
||||
},
|
||||
{
|
||||
title: "存储芯片",
|
||||
count: 8
|
||||
},
|
||||
{
|
||||
title: "存储芯片",
|
||||
count: 8
|
||||
},
|
||||
{
|
||||
title: "存储芯片",
|
||||
count: 8
|
||||
},
|
||||
{
|
||||
title: "存储芯片",
|
||||
count: 8
|
||||
threshold: 0,
|
||||
color: "#01AB5D",
|
||||
level: "无热度"
|
||||
}
|
||||
// ≤20%
|
||||
],
|
||||
bkTypes: [
|
||||
"板块关联图",
|
||||
"板块分布",
|
||||
"热门概念词云"
|
||||
],
|
||||
option2: {
|
||||
title: {
|
||||
show: false
|
||||
},
|
||||
legend: {
|
||||
show: false
|
||||
},
|
||||
activeType: 0,
|
||||
// 默认选中第一个标签
|
||||
// 饼图配置项
|
||||
pieOption: {
|
||||
tooltip: {
|
||||
show: true,
|
||||
triggerOn: "mousemove"
|
||||
trigger: "item"
|
||||
},
|
||||
radar: {
|
||||
indicator: [
|
||||
{ name: "市场地位", max: 100 },
|
||||
{ name: "技术实力", max: 100 },
|
||||
{ name: "品牌价值", max: 100 },
|
||||
{ name: "运营效率", max: 100 },
|
||||
{ name: "财务健康", max: 100 },
|
||||
{ name: "创新能力", max: 100 },
|
||||
{ name: "风险控制", max: 100 },
|
||||
{ name: "成长潜力", max: 100 }
|
||||
],
|
||||
shape: "polygon",
|
||||
splitNumber: 5,
|
||||
axisName: {
|
||||
color: "#54555A"
|
||||
},
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
color: ["#CFD2D7"]
|
||||
}
|
||||
},
|
||||
splitArea: {
|
||||
areaStyle: {
|
||||
color: ["#F4F6FA", "white"]
|
||||
}
|
||||
},
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: "#CFD2D7"
|
||||
}
|
||||
}
|
||||
animation: false,
|
||||
legend: {
|
||||
top: "5%",
|
||||
left: "center",
|
||||
show: false
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: "Beijing",
|
||||
type: "radar",
|
||||
lineStyle: {
|
||||
width: 1
|
||||
},
|
||||
data: [],
|
||||
symbol: "circle",
|
||||
symbolSize: 4,
|
||||
series: [{
|
||||
name: "Access From",
|
||||
type: "pie",
|
||||
radius: ["40%", "70%"],
|
||||
avoidLabelOverlap: false,
|
||||
padAngle: 2,
|
||||
itemStyle: {
|
||||
borderRadius: 8
|
||||
},
|
||||
emphasis: {
|
||||
label: {
|
||||
show: true
|
||||
},
|
||||
itemStyle: {
|
||||
color: "#5070DD"
|
||||
},
|
||||
areaStyle: {
|
||||
opacity: 0.1
|
||||
show: true,
|
||||
fontSize: 10
|
||||
}
|
||||
},
|
||||
labelLine: {
|
||||
length: 1,
|
||||
length2: 5
|
||||
},
|
||||
data: []
|
||||
}]
|
||||
},
|
||||
// 关系图配置项
|
||||
graphOption: {
|
||||
tooltip: {},
|
||||
legend: [],
|
||||
series: [{
|
||||
name: "板块关联",
|
||||
type: "graph",
|
||||
layout: "none",
|
||||
data: [],
|
||||
links: [],
|
||||
categories: [],
|
||||
roam: true,
|
||||
// 允许拖拽和缩放
|
||||
label: {
|
||||
show: true,
|
||||
position: "right",
|
||||
formatter: "{b}"
|
||||
},
|
||||
labelLayout: {
|
||||
hideOverlap: true
|
||||
},
|
||||
scaleLimit: {
|
||||
min: 0.4,
|
||||
max: 2
|
||||
},
|
||||
lineStyle: {
|
||||
color: "source",
|
||||
curveness: 0.3
|
||||
}
|
||||
]
|
||||
}]
|
||||
}
|
||||
};
|
||||
},
|
||||
onLoad(e) {
|
||||
this.activeIndex = e.index;
|
||||
this.contentTop = this.navH + 20 / 750 * common_vendor.inject("windowWidth");
|
||||
this.analyseHighStocks();
|
||||
},
|
||||
// mounted() {
|
||||
// // 初始化当天日期格式(防止日历组件事件未及时触发)
|
||||
// const today = new Date();
|
||||
// const month = today.getMonth() + 1;
|
||||
// const day = today.getDate();
|
||||
// this.tabTypes[0].data = `${month}月${day}日`;
|
||||
// this.tabTypes[1].data = '0'; // 默认涨停家数为0,后续会被日历数据覆盖
|
||||
// },
|
||||
onReady() {
|
||||
this.fetchData();
|
||||
this.initGraphChart();
|
||||
},
|
||||
methods: {
|
||||
getHeatColor(value, max) {
|
||||
if (max === 0)
|
||||
return "#01AB5D";
|
||||
const ratio = value / max;
|
||||
const matchedLevel = this.HEAT_LEVELS.find((level) => ratio > level.threshold);
|
||||
return matchedLevel ? matchedLevel.color : "#01AB5D";
|
||||
},
|
||||
// 切换标签
|
||||
async switchTab(index) {
|
||||
this.activeType = index;
|
||||
switch (index) {
|
||||
case 0:
|
||||
this.$refs.graphChartRef && this.initGraphChart();
|
||||
break;
|
||||
case 1:
|
||||
this.$refs.chartRef && this.initPieChart();
|
||||
break;
|
||||
case 2:
|
||||
this.initWordCloud();
|
||||
break;
|
||||
}
|
||||
},
|
||||
getPreviousDayDate(dateStr) {
|
||||
if (!/^\d{4}-\d{2}-\d{2}$/.test(dateStr)) {
|
||||
common_vendor.index.__f__("error", "at pages/ztfx/ztfx.vue:483", "日期格式错误,请传入 YYYY-MM-DD 格式的日期");
|
||||
return "";
|
||||
}
|
||||
const [year, month, day] = dateStr.split("-").map(Number);
|
||||
const date = new Date(year, month - 1, day);
|
||||
date.setDate(date.getDate() - 2);
|
||||
const prevYear = date.getFullYear();
|
||||
const prevMonth = String(date.getMonth() + 1).padStart(2, "0");
|
||||
const prevDay = String(date.getDate()).padStart(2, "0");
|
||||
return `${prevYear}${prevMonth}${prevDay}`;
|
||||
},
|
||||
/**
|
||||
* 请求接口数据(优化:动态日期+自动时间戳)
|
||||
*/
|
||||
async fetchData() {
|
||||
try {
|
||||
const timestamp = (/* @__PURE__ */ new Date()).getTime();
|
||||
const formattedDate = this.getPreviousDayDate(this.selectedFullDate);
|
||||
const baseURL = request_http.getBaseURL1();
|
||||
const requestUrl = `${baseURL}/data/zt/daily/${formattedDate}.json?t=${timestamp}`;
|
||||
common_vendor.index.__f__("log", "at pages/ztfx/ztfx.vue:515", "请求URL:", requestUrl);
|
||||
const res = await common_vendor.index.request({
|
||||
url: requestUrl,
|
||||
method: "GET"
|
||||
});
|
||||
if (res.statusCode === 200 && res.data) {
|
||||
this.originData = res.data;
|
||||
const chartData = this.originData.chart_data || {};
|
||||
const labels = chartData.labels || [];
|
||||
const counts = chartData.counts || [];
|
||||
const maxCount = counts.length > 0 ? Math.max(...counts) : 0;
|
||||
let bkList = [];
|
||||
const maxLen = Math.min(labels.length, counts.length);
|
||||
for (let i = 0; i < maxLen; i++) {
|
||||
const title = labels[i];
|
||||
const count = counts[i] || 0;
|
||||
const bgColor = this.getHeatColor(count, maxCount);
|
||||
const ratio = maxCount === 0 ? 0 : (count / maxCount * 100).toFixed(2);
|
||||
bkList.push({
|
||||
title,
|
||||
// 板块名称
|
||||
count,
|
||||
// 数量
|
||||
bgColor,
|
||||
// 背景色
|
||||
ratio
|
||||
// 占比(百分比,可选)
|
||||
});
|
||||
}
|
||||
this.bkList = bkList.slice(0, 16);
|
||||
this.initPieChart();
|
||||
} else {
|
||||
common_vendor.index.showToast({
|
||||
title: "数据请求失败",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/ztfx/ztfx.vue:562", "请求异常:", error);
|
||||
common_vendor.index.showToast({
|
||||
title: "网络异常",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
},
|
||||
// 初始化关系图(增加容错)
|
||||
async initGraphChart() {
|
||||
const chart = await this.$refs.graphChartRef.init(echarts);
|
||||
this.graphOption.legend = [{
|
||||
data: mockGraphData.categories.map((a) => a.name)
|
||||
}];
|
||||
this.graphOption.series[0].data = mockGraphData.nodes;
|
||||
this.graphOption.series[0].links = mockGraphData.links;
|
||||
this.graphOption.series[0].categories = mockGraphData.categories;
|
||||
chart.setOption(this.graphOption);
|
||||
},
|
||||
// 初始化饼图(核心修复)
|
||||
async initPieChart() {
|
||||
try {
|
||||
let pieData = [];
|
||||
const chartData = this.originData.chart_data || {};
|
||||
const labels = chartData.labels || [];
|
||||
const counts = chartData.counts || [];
|
||||
const maxLen = Math.min(labels.length, counts.length);
|
||||
for (let i = 0; i < maxLen; i++) {
|
||||
pieData.push({
|
||||
name: labels[i],
|
||||
// 板块名称
|
||||
value: counts[i]
|
||||
// 对应数量
|
||||
});
|
||||
}
|
||||
this.pieOption.series[0].data = pieData.length > 0 ? pieData : [
|
||||
{
|
||||
value: 10,
|
||||
name: "科技板块"
|
||||
},
|
||||
{
|
||||
value: 8,
|
||||
name: "人脑工程"
|
||||
},
|
||||
{
|
||||
value: 9,
|
||||
name: "商业航天"
|
||||
}
|
||||
];
|
||||
if (this.$refs.chartRef) {
|
||||
const Piechart = await this.$refs.chartRef.init(echarts);
|
||||
common_vendor.index.__f__("log", "at pages/ztfx/ztfx.vue:623", "Piechart实例创建成功", Piechart);
|
||||
Piechart.setOption(this.pieOption);
|
||||
}
|
||||
} catch (error) {
|
||||
common_vendor.index.__f__("error", "at pages/ztfx/ztfx.vue:627", "饼图初始化失败:", error);
|
||||
}
|
||||
},
|
||||
// 初始化词云
|
||||
initWordCloud() {
|
||||
if (this.originData.word_freq_data && Array.isArray(this.originData.word_freq_data)) {
|
||||
this.wordData = this.originData.word_freq_data;
|
||||
common_vendor.index.__f__("log", "at pages/ztfx/ztfx.vue:636", "词云数据赋值完成", this.wordData);
|
||||
} else {
|
||||
this.wordData = [{
|
||||
name: "脑机",
|
||||
value: 1e4
|
||||
}, {
|
||||
name: "航天",
|
||||
value: 3428
|
||||
}];
|
||||
}
|
||||
},
|
||||
handleDateChange(data) {
|
||||
var _a, _b;
|
||||
common_vendor.index.__f__("log", "at pages/ztfx/ztfx.vue:345", "从日历组件接收的参数:", (_a = data.item) == null ? void 0 : _a.zt_count);
|
||||
var _a, _b, _c, _d;
|
||||
common_vendor.index.__f__("log", "at pages/ztfx/ztfx.vue:654", "从日历组件接收的参数:", {
|
||||
currentZtCount: (_a = data.item) == null ? void 0 : _a.zt_count,
|
||||
prevZtCount: (_b = data.prevItem) == null ? void 0 : _b.zt_count
|
||||
});
|
||||
this.selectedYearMonth = data.yearMonth;
|
||||
this.selectedFullDate = data.fullDate;
|
||||
this.selectedItem = data.item;
|
||||
@@ -193,11 +411,16 @@ const _sfc_main = {
|
||||
const [year, month, day] = data.fullDate.split("-").map(Number);
|
||||
this.tabTypes[0].data = `${month}月${day}日`;
|
||||
}
|
||||
const ztCount = ((_b = data.item) == null ? void 0 : _b.zt_count) ?? 0;
|
||||
const ztCount = ((_c = data.item) == null ? void 0 : _c.zt_count) ?? 0;
|
||||
this.tabTypes[1].data = ztCount.toString();
|
||||
this.number_limit_stocks = ztCount.toString();
|
||||
const prevZtCount = ((_d = data.prevItem) == null ? void 0 : _d.zt_count) ?? 0;
|
||||
const changeValue = ztCount === 0 || prevZtCount === 0 ? 0 : ztCount - prevZtCount;
|
||||
this.tabTypes[1].change = changeValue;
|
||||
this.fetchData();
|
||||
},
|
||||
analyseHighStocks() {
|
||||
const formatDate = this.selectedFullDate.replace(/-/g, "");
|
||||
const formatDate = this.getPreviousDayDate(this.selectedFullDate);
|
||||
let param = {
|
||||
date: formatDate
|
||||
};
|
||||
@@ -205,10 +428,6 @@ const _sfc_main = {
|
||||
}).catch((error) => {
|
||||
});
|
||||
},
|
||||
async init() {
|
||||
const chart = await this.$refs.chartRef.init(echarts);
|
||||
chart.setOption(this.option2);
|
||||
},
|
||||
bkydAction(index) {
|
||||
common_vendor.index.navigateTo({
|
||||
url: `/pagesStock/stockCenterDetails/bkydmx?index=${index}`
|
||||
@@ -220,13 +439,15 @@ if (!Array) {
|
||||
const _easycom_navBar2 = common_vendor.resolveComponent("navBar");
|
||||
const _easycom_LCCalendar2 = common_vendor.resolveComponent("LCCalendar");
|
||||
const _easycom_l_echart2 = common_vendor.resolveComponent("l-echart");
|
||||
(_easycom_navBar2 + _easycom_LCCalendar2 + _easycom_l_echart2)();
|
||||
const _easycom_WordCloud2 = common_vendor.resolveComponent("WordCloud");
|
||||
(_easycom_navBar2 + _easycom_LCCalendar2 + _easycom_l_echart2 + _easycom_WordCloud2)();
|
||||
}
|
||||
const _easycom_navBar = () => "../../components/navBar/navBar.js";
|
||||
const _easycom_LCCalendar = () => "../../components/LCCalendar/LCCalendar.js";
|
||||
const _easycom_l_echart = () => "../../uni_modules/lime-echart/components/l-echart/l-echart.js";
|
||||
const _easycom_WordCloud = () => "../../components/WordCloud/WordCloud2.js";
|
||||
if (!Math) {
|
||||
(_easycom_navBar + _easycom_LCCalendar + _easycom_l_echart)();
|
||||
(_easycom_navBar + _easycom_LCCalendar + _easycom_l_echart + _easycom_WordCloud)();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
@@ -241,43 +462,69 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
e: common_vendor.f($data.tabTypes, (item, index, i0) => {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.t(item.data),
|
||||
b: item.change > 0
|
||||
}, item.change > 0 ? {
|
||||
c: common_vendor.t(item.change)
|
||||
b: item.change !== 0
|
||||
}, item.change !== 0 ? {
|
||||
c: common_vendor.t(item.change > 0 ? "+" + item.change : item.change),
|
||||
d: common_vendor.s({
|
||||
marginLeft: "10rpx",
|
||||
borderRadius: "5rpx",
|
||||
color: "white",
|
||||
padding: "0 5rpx",
|
||||
fontSize: "24rpx",
|
||||
fontWeight: "bold"
|
||||
}),
|
||||
e: common_vendor.s(item.change > 0 ? {
|
||||
backgroundColor: "#F59B38"
|
||||
} : {
|
||||
backgroundColor: "#EF4444"
|
||||
})
|
||||
} : {}, {
|
||||
d: common_vendor.t(item.title),
|
||||
e: index
|
||||
f: common_vendor.t(item.title),
|
||||
g: index
|
||||
});
|
||||
}),
|
||||
f: common_vendor.o($options.handleDateChange),
|
||||
g: common_assets._imports_3$8,
|
||||
h: common_vendor.f($data.bkList, (item, index, i0) => {
|
||||
h: common_vendor.t($data.bkList.length),
|
||||
i: common_vendor.t($data.number_limit_stocks),
|
||||
j: common_vendor.f($data.bkList, (item, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(item.title),
|
||||
b: common_vendor.t(item.count),
|
||||
c: index,
|
||||
d: common_vendor.o(($event) => $options.bkydAction(index), index)
|
||||
d: common_vendor.o(($event) => $options.bkydAction(index), index),
|
||||
e: item.bgColor
|
||||
};
|
||||
}),
|
||||
i: common_vendor.f($data.bkTypes, (item, index, i0) => {
|
||||
k: common_vendor.f($data.bkTypes, (item, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(item),
|
||||
b: index == 0 ? "#BB8520" : "#999999",
|
||||
c: `1rpx solid ${index == 0 ? "#F2C369" : "#D2D2D2"}`,
|
||||
d: index == 0 ? "#FFFAF1" : "#FFF"
|
||||
b: common_vendor.o(($event) => $options.switchTab(index)),
|
||||
c: $data.activeType == index ? "#BB8520" : "#999999",
|
||||
d: `1rpx solid ${$data.activeType == index ? "#F2C369" : "#D2D2D2"}`,
|
||||
e: $data.activeType == index ? "#FFFAF1" : "#FFF"
|
||||
};
|
||||
}),
|
||||
j: common_vendor.sr("chartRef", "06b829a4-2"),
|
||||
k: common_assets._imports_3$8,
|
||||
l: common_vendor.f(10, (item, index, i0) => {
|
||||
l: common_vendor.sr("graphChartRef", "06b829a4-2"),
|
||||
m: $data.activeType === 0,
|
||||
n: common_vendor.sr("chartRef", "06b829a4-3"),
|
||||
o: $data.activeType === 1,
|
||||
p: $data.activeType === 2,
|
||||
q: common_vendor.p({
|
||||
wordData: $data.wordData,
|
||||
width: 330,
|
||||
height: 330
|
||||
}),
|
||||
r: common_assets._imports_3$8,
|
||||
s: common_vendor.f(10, (item, index, i0) => {
|
||||
return {
|
||||
a: index
|
||||
};
|
||||
}),
|
||||
m: common_assets._imports_1$11,
|
||||
n: common_assets._imports_5$4,
|
||||
o: common_assets._imports_5$4,
|
||||
p: common_vendor.s("top:" + $data.contentTop + "px;")
|
||||
t: common_assets._imports_1$11,
|
||||
v: common_assets._imports_5$4,
|
||||
w: common_assets._imports_5$4,
|
||||
x: common_vendor.s("top:" + $data.contentTop + "px;")
|
||||
};
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"navigationBarTitleText": "涨停分析",
|
||||
"usingComponents": {
|
||||
"word-cloud": "../../components/WordCloud/WordCloud",
|
||||
"nav-bar": "../../components/navBar/navBar",
|
||||
"l-c-calendar": "../../components/LCCalendar/LCCalendar",
|
||||
"l-echart": "../../uni_modules/lime-echart/components/l-echart/l-echart"
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -12,3 +12,18 @@ page {
|
||||
right: 0;
|
||||
bottom: calc(55px + env(safe-area-inset-bottom));
|
||||
}
|
||||
/* 单行省略样式类 */
|
||||
.single-line-ellipsis {
|
||||
max-width: 100%;
|
||||
width: 120rpx;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
text-align: center;
|
||||
}
|
||||
/* 数量行样式(可选抽离) */
|
||||
.count-text {
|
||||
font-size: 22rpx;
|
||||
margin-top: 4rpx;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user