2.5 主营业务明细与历史对比表完善,增加非会员弹窗跳转,调整会员页面文字,财务数据模块单季度增加总值展示

This commit is contained in:
尚政杰
2026-02-05 17:47:47 +08:00
parent c4cbd5a11f
commit 21e16f543f
86 changed files with 1661 additions and 376 deletions

View File

@@ -166,6 +166,83 @@ const _sfc_main = {
// '板块分布',
// '热门概念词云'
// ],
highPositionStats: {
total_count: 0,
// 高位股数量
avg_continuous_days: 0,
// 平均连板数
max_continuous_days: 0
// 最高连板数
},
riskAssessment: {
// 风险评估结果
level: "正常",
color: "#22c55e"
},
highPositionStockList: [],
// 新增:存储筛选后的高位股列表
// 风险阈值常量(对应参考代码)
RISK_THRESHOLDS: {
CRITICAL: 7,
HIGH: 5,
MEDIUM: 3,
LOW: 2
},
// 风险颜色常量
RISK_COLORS: {
critical: {
color: "#ef4444",
bg: "rgba(239, 68, 68, 0.2)",
border: "rgba(239, 68, 68, 0.4)"
},
high: {
color: "#f97316",
bg: "rgba(249, 115, 22, 0.2)",
border: "rgba(249, 115, 22, 0.4)"
},
medium: {
color: "#eab308",
bg: "rgba(234, 179, 8, 0.2)",
border: "rgba(234, 179, 8, 0.4)"
},
low: {
color: "#22c55e",
bg: "rgba(34, 197, 94, 0.2)",
border: "rgba(34, 197, 94, 0.4)"
}
},
heatIconMap: {
high: {
icon4: "/pagesStock/static/icon/all-icon-4.png",
icon4Color: "#EF4444",
// 高热度图标颜色
icon5: "/pagesStock/static/icon/all-icon-5.png"
// 高热度右侧图标
},
medium: {
icon4: "/pagesStock/static/icon/all-icon-9.png",
icon4Color: "#F97316",
// 中热度图标颜色
icon5: "/pagesStock/static/icon/all-icon-6.png"
// 中热度右侧图标
},
low: {
icon4: "",
// 低热度不显示icon4
icon4Color: "#F3B800",
icon5: "/pagesStock/static/icon/all-icon-7.png"
// 低热度右侧图标
},
none: {
icon4: "",
// 冷门
icon4Color: "#01AB5D",
icon5: "/pagesStock/static/icon/all-icon-8.png"
// 无热度右侧图标
}
},
originData: null,
// 原始接口数据
bkTypes: [
"板块分布",
"热门概念词云"
@@ -245,6 +322,131 @@ const _sfc_main = {
onReady() {
},
methods: {
getStockHeatType(stock) {
const days = stock.continuous_days_num || 0;
if (days >= this.RISK_THRESHOLDS.CRITICAL) {
return "high";
} else if (days >= this.RISK_THRESHOLDS.HIGH) {
return "medium";
} else if (days >= this.RISK_THRESHOLDS.MEDIUM) {
return "low";
} else {
return "none";
}
},
//解析连板数(从"2天2板"格式中提取数字)
parseContinuousDays(continuousDaysStr) {
if (!continuousDaysStr)
return 0;
const match = continuousDaysStr.match(/(\d+)天/);
return match ? Number(match[1]) : 0;
},
// 风险等级判断函数
getRiskLevel(days) {
const {
RISK_THRESHOLDS,
RISK_COLORS
} = this;
if (days >= RISK_THRESHOLDS.CRITICAL) {
return {
level: "极高",
color: RISK_COLORS.critical.color,
bg: RISK_COLORS.critical.bg,
border: RISK_COLORS.critical.border,
status: "缩量一字,高风险"
};
}
if (days >= RISK_THRESHOLDS.HIGH) {
return {
level: "高",
color: RISK_COLORS.high.color,
bg: RISK_COLORS.high.bg,
border: RISK_COLORS.high.border,
status: "放量分歧,需观察"
};
}
if (days >= RISK_THRESHOLDS.MEDIUM) {
return {
level: "中",
color: RISK_COLORS.medium.color,
bg: RISK_COLORS.medium.bg,
border: RISK_COLORS.medium.border,
status: "正常波动"
};
}
return {
level: "低",
color: RISK_COLORS.low.color,
bg: RISK_COLORS.low.bg,
border: RISK_COLORS.low.border,
status: "健康"
};
},
// 计算高位股统计数据
calculateHighPositionStats() {
if (!this.originData || !this.originData.stocks)
return;
const highPositionStocks = this.originData.stocks.filter((stock) => {
const days = this.parseContinuousDays(stock.continuous_days);
return days >= 2;
}).map((stock) => {
const days = this.parseContinuousDays(stock.continuous_days);
const riskInfo = this.getRiskLevel(days);
return {
...stock,
continuous_days_num: days,
// 提取纯数字的连板数
risk_info: riskInfo
// 风险等级信息
};
}).sort((a, b) => b.continuous_days_num - a.continuous_days_num);
this.highPositionStockList = highPositionStocks;
const totalCount = highPositionStocks.length;
const maxDays = highPositionStocks.length ? Math.max(...highPositionStocks.map((s) => this.parseContinuousDays(s.continuous_days))) : 0;
const totalDays = highPositionStocks.reduce((sum, stock) => {
return sum + this.parseContinuousDays(stock.continuous_days);
}, 0);
const avgDays = totalCount > 0 ? (totalDays / totalCount).toFixed(1) : 0;
this.highPositionStats = {
total_count: totalCount,
avg_continuous_days: avgDays,
max_continuous_days: maxDays
};
this.calculateRiskAssessment();
},
// 计算风险评估
calculateRiskAssessment() {
const {
avg_continuous_days,
max_continuous_days,
total_count
} = this.highPositionStats;
const avgDays = Number(avg_continuous_days) || 0;
const maxDays = Number(max_continuous_days) || 0;
const totalCount = Number(total_count) || 0;
const score = avgDays * 2 + maxDays * 0.5 + totalCount * 0.3;
if (score >= 20) {
this.riskAssessment = {
level: "高风险",
color: "#ef4444"
};
} else if (score >= 12) {
this.riskAssessment = {
level: "中风险",
color: "#f97316"
};
} else if (score >= 6) {
this.riskAssessment = {
level: "偏高",
color: "#eab308"
};
} else {
this.riskAssessment = {
level: "正常",
color: "#22c55e"
};
}
},
getHeatColor(value, max) {
if (max === 0)
return "#01AB5D";
@@ -274,7 +476,7 @@ const _sfc_main = {
const currentDay = String(now.getDate()).padStart(2, "0");
const dateStr = `${currentYear}-${currentMonth}-${currentDay}`;
if (!/^\d{4}-\d{2}-\d{2}$/.test(dateStr)) {
common_vendor.index.__f__("error", "at pages/ztfx/ztfx.vue:505", "日期格式错误,请传入 YYYY-MM-DD 格式的日期");
common_vendor.index.__f__("error", "at pages/ztfx/ztfx.vue:749", "日期格式错误,请传入 YYYY-MM-DD 格式的日期");
return "";
}
const [year, month, day] = dateStr.split("-").map(Number);
@@ -294,7 +496,7 @@ const _sfc_main = {
const formattedDate = 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:538", "请求URL", requestUrl);
common_vendor.index.__f__("log", "at pages/ztfx/ztfx.vue:782", "请求URL", requestUrl);
const res = await common_vendor.index.request({
url: requestUrl,
method: "GET"
@@ -325,6 +527,7 @@ const _sfc_main = {
}
this.bkList = bkList.slice(0, 16);
this.initPieChart();
this.calculateHighPositionStats();
} else {
common_vendor.index.showToast({
title: "数据请求失败",
@@ -332,7 +535,7 @@ const _sfc_main = {
});
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/ztfx/ztfx.vue:585", "请求异常:", error);
common_vendor.index.__f__("error", "at pages/ztfx/ztfx.vue:832", "请求异常:", error);
common_vendor.index.showToast({
title: "网络异常",
icon: "none"
@@ -382,18 +585,18 @@ const _sfc_main = {
];
if (this.$refs.chartRef) {
const Piechart = await this.$refs.chartRef.init(echarts);
common_vendor.index.__f__("log", "at pages/ztfx/ztfx.vue:646", "Piechart实例创建成功", Piechart);
common_vendor.index.__f__("log", "at pages/ztfx/ztfx.vue:893", "Piechart实例创建成功", Piechart);
Piechart.setOption(this.pieOption);
}
} catch (error) {
common_vendor.index.__f__("error", "at pages/ztfx/ztfx.vue:650", "饼图初始化失败:", error);
common_vendor.index.__f__("error", "at pages/ztfx/ztfx.vue:897", "饼图初始化失败:", 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:659", "词云数据赋值完成", this.wordData);
common_vendor.index.__f__("log", "at pages/ztfx/ztfx.vue:906", "词云数据赋值完成", this.wordData);
} else {
this.wordData = [{
name: "脑机",
@@ -406,7 +609,7 @@ const _sfc_main = {
},
handleDateChange(data) {
var _a, _b, _c, _d;
common_vendor.index.__f__("log", "at pages/ztfx/ztfx.vue:677", "从日历组件接收的参数:", {
common_vendor.index.__f__("log", "at pages/ztfx/ztfx.vue:924", "从日历组件接收的参数:", {
currentZtCount: (_a = data.item) == null ? void 0 : _a.zt_count,
prevZtCount: (_b = data.prevItem) == null ? void 0 : _b.zt_count
});
@@ -444,7 +647,7 @@ const _sfc_main = {
const prevDay = String(selectedDate.getDate()).padStart(2, "0");
const prevDateFormatted = `${prevYear}${prevMonth}${prevDay}`;
this.selectedFullDate = prevDateFormatted;
common_vendor.index.__f__("log", "at pages/ztfx/ztfx.vue:735", `选中日期为当天(${todayFormatted}),已自动调整为前一天:`, prevDateFormatted);
common_vendor.index.__f__("log", "at pages/ztfx/ztfx.vue:982", `选中日期为当天(${todayFormatted}),已自动调整为前一天:`, prevDateFormatted);
}
}
this.fetchData();
@@ -533,7 +736,31 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
width: 330,
height: 330
}),
p: common_vendor.s("top:" + $data.contentTop + "px;")
p: common_assets._imports_3$8,
q: common_vendor.t($data.highPositionStats.total_count),
r: common_vendor.t($data.highPositionStats.avg_continuous_days),
s: common_vendor.t($data.highPositionStats.max_continuous_days),
t: common_vendor.t($data.riskAssessment.level),
v: $data.riskAssessment.color,
w: common_vendor.f($data.highPositionStockList, (stock, index, i0) => {
return common_vendor.e({
a: common_vendor.t(stock.sname),
b: common_vendor.t(stock.risk_info.status),
c: ["high", "medium"].includes($options.getStockHeatType(stock))
}, ["high", "medium"].includes($options.getStockHeatType(stock)) ? {
d: $data.heatIconMap[$options.getStockHeatType(stock)].icon4Color,
e: $data.heatIconMap[$options.getStockHeatType(stock)].icon4
} : {}, {
f: common_vendor.t(stock.continuous_days_num),
g: stock.risk_info.bg,
h: `1rpx solid ${stock.risk_info.border}`,
i: stock.risk_info.color,
j: $data.heatIconMap[$options.getStockHeatType(stock)].icon5,
k: index
});
}),
x: common_assets._imports_5$4,
y: common_vendor.s("top:" + $data.contentTop + "px;")
};
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);