涨停分析修改
This commit is contained in:
@@ -94,14 +94,14 @@
|
||||
</view>
|
||||
</view>
|
||||
<view style="display: grid; grid-template-columns: repeat(4, 1fr); gap: 7rpx; margin-top: 25rpx;">
|
||||
<view v-for="(item, index) in bkList" :key="index" :style="{
|
||||
<view v-for="(item, index) in bkList" :key="index" :style="{
|
||||
backgroundColor: item.bgColor,
|
||||
borderRadius: '5rpx',
|
||||
padding: '15rpx',
|
||||
color: 'white',
|
||||
fontSize: '24rpx',
|
||||
fontWeight: '500'
|
||||
}">
|
||||
}" >
|
||||
<view class="single-line-ellipsis">{{item.title}}</view>
|
||||
<view class="count-text">{{item.count}}只</view>
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
style="width: 100%; height: 500rpx; display: flex; align-items: center; justify-content: center; color: #999;">
|
||||
板块关联图内容区域
|
||||
</view> -->
|
||||
<!-- <view v-show="activeType === 0" style="width: 100%; height: 500rpx;">
|
||||
<!-- <view v-show="activeType === 0" style="width: 100%; height: 500rpx;">
|
||||
<l-echart ref="graphChartRef"></l-echart>
|
||||
</view> -->
|
||||
<view v-show="activeType === 0" style="width: 100%; height: 500rpx;">
|
||||
@@ -361,7 +361,7 @@
|
||||
// '热门概念词云'
|
||||
// ],
|
||||
bkTypes: [
|
||||
|
||||
|
||||
'板块分布',
|
||||
'热门概念词云'
|
||||
],
|
||||
@@ -442,13 +442,17 @@
|
||||
this.activeIndex = e.index
|
||||
this.contentTop = this.navH + 20 / 750 * inject('windowWidth')
|
||||
|
||||
|
||||
|
||||
//this.selectedFullDate = this.getPreviousDayDate();
|
||||
//console.log("selectedFullDate", this.selectedFullDate)
|
||||
//this.fetchData()
|
||||
|
||||
},
|
||||
|
||||
onReady() {
|
||||
this.fetchData()
|
||||
|
||||
|
||||
|
||||
|
||||
// 页面就绪后,若默认选中的是板块分布,初始化饼图
|
||||
//if (this.activeType === 0) {
|
||||
//this.initPieChart(); // 初始化关系图
|
||||
@@ -473,18 +477,29 @@
|
||||
switch (index) {
|
||||
case 0:
|
||||
//this.$refs.graphChartRef && this.initGraphChart(); // 增加存在性判断
|
||||
this.$refs.chartRef && this.initPieChart(); // 增加存在性判断
|
||||
this.$refs.chartRef && this.initPieChart(); // 增加存在性判断
|
||||
break;
|
||||
case 1:
|
||||
//this.$refs.chartRef && this.initPieChart(); // 增加存在性判断
|
||||
this.initWordCloud();
|
||||
this.initWordCloud();
|
||||
break;
|
||||
case 2:
|
||||
this.initWordCloud();
|
||||
break;
|
||||
}
|
||||
},
|
||||
getPreviousDayDate(dateStr) {
|
||||
|
||||
|
||||
getPreviousDayDate() {
|
||||
const now = new Date();
|
||||
|
||||
// 步骤2:将系统时间格式化为 YYYY-MM-DD 格式(适配后续校验逻辑)
|
||||
const currentYear = now.getFullYear();
|
||||
const currentMonth = String(now.getMonth() + 1).padStart(2, '0');
|
||||
const currentDay = String(now.getDate()).padStart(2, '0');
|
||||
const dateStr = `${currentYear}-${currentMonth}-${currentDay}`; // 示例:2026-02-04
|
||||
|
||||
|
||||
// 校验输入日期格式是否正确
|
||||
if (!/^\d{4}-\d{2}-\d{2}$/.test(dateStr)) {
|
||||
console.error('日期格式错误,请传入 YYYY-MM-DD 格式的日期');
|
||||
@@ -496,7 +511,7 @@
|
||||
const date = new Date(year, month - 1, day);
|
||||
|
||||
// 将日期减一天
|
||||
date.setDate(date.getDate() - 2);
|
||||
date.setDate(date.getDate() - 1);
|
||||
|
||||
// 格式化前一天的日期为 YYYYMMDD 格式(补零处理)
|
||||
const prevYear = date.getFullYear();
|
||||
@@ -515,7 +530,8 @@
|
||||
|
||||
|
||||
// 调用上面的函数,获取前一天的格式化日期(YYYYMMDD)
|
||||
const formattedDate = this.getPreviousDayDate(this.selectedFullDate);
|
||||
// const formattedDate = this.getPreviousDayDate(this.selectedFullDate);
|
||||
const formattedDate = this.selectedFullDate;
|
||||
const baseURL = getBaseURL1();
|
||||
const requestUrl = `${baseURL}/data/zt/daily/${formattedDate}.json?t=${timestamp}`;
|
||||
|
||||
@@ -664,7 +680,7 @@
|
||||
});
|
||||
// 赋值到父页面的变量中
|
||||
this.selectedYearMonth = data.yearMonth;
|
||||
this.selectedFullDate = data.fullDate;
|
||||
this.selectedFullDate = data.fullDate ? data.fullDate.replace(/-/g, '') : '';
|
||||
this.selectedItem = data.item;
|
||||
|
||||
// 2. 格式化日期:年-月-日 → 月日(如 2026-01-14 → 1月14日)
|
||||
@@ -686,27 +702,49 @@
|
||||
ztCount - prevZtCount;
|
||||
this.tabTypes[1].change = changeValue;
|
||||
// =======================================
|
||||
// ===== 新增:判断选中日期是否为系统当天,若是则日期减一天 =====
|
||||
if (this.selectedFullDate) {
|
||||
// 获取系统当前日期并格式化为 YYYYMMDD
|
||||
const today = new Date();
|
||||
const todayYear = today.getFullYear();
|
||||
const todayMonth = String(today.getMonth() + 1).padStart(2, '0');
|
||||
const todayDay = String(today.getDate()).padStart(2, '0');
|
||||
const todayFormatted = `${todayYear}${todayMonth}${todayDay}`;
|
||||
|
||||
// 判断选中日期是否等于系统当天
|
||||
if (this.selectedFullDate === todayFormatted) {
|
||||
// 创建选中日期的Date对象
|
||||
const selectedDate = new Date(
|
||||
parseInt(this.selectedFullDate.substring(0, 4)), // 年
|
||||
parseInt(this.selectedFullDate.substring(4, 6)) - 1, // 月(月份从0开始)
|
||||
parseInt(this.selectedFullDate.substring(6, 8)) // 日
|
||||
);
|
||||
|
||||
// 将日期减一天
|
||||
selectedDate.setDate(selectedDate.getDate() - 1);
|
||||
|
||||
// 格式化前一天的日期为 YYYYMMDD 格式(补零处理)
|
||||
const prevYear = selectedDate.getFullYear();
|
||||
const prevMonth = String(selectedDate.getMonth() + 1).padStart(2, '0');
|
||||
const prevDay = String(selectedDate.getDate()).padStart(2, '0');
|
||||
const prevDateFormatted = `${prevYear}${prevMonth}${prevDay}`;
|
||||
|
||||
// 更新选中的日期为前一天
|
||||
this.selectedFullDate = prevDateFormatted;
|
||||
|
||||
console.log(`选中日期为当天(${todayFormatted}),已自动调整为前一天:`, prevDateFormatted);
|
||||
}
|
||||
}
|
||||
this.fetchData()
|
||||
// this.analyseHighStocks()
|
||||
|
||||
},
|
||||
analyseHighStocks() {
|
||||
|
||||
const formatDate = this.getPreviousDayDate(this.selectedFullDate);
|
||||
let param = {
|
||||
date: formatDate
|
||||
}
|
||||
analyseHighStocks(param).then(res => {
|
||||
|
||||
}).catch(error => {
|
||||
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
|
||||
bkydAction(index) {
|
||||
uni.navigateTo({
|
||||
url: `/pagesStock/stockCenterDetails/bkydmx?index=${index}`
|
||||
url: `/pagesStock/stockCenterDetails/bkydmx?index=${index}&data=${this.selectedFullDate}`
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user