12.12 页面风格改版,增加事件详情相关概念网页跳转,增加绑定手机号功能

This commit is contained in:
尚政杰
2025-12-12 19:35:08 +08:00
parent 44842120da
commit 13c783a0ad
256 changed files with 4046 additions and 2986 deletions

View File

@@ -0,0 +1,350 @@
"use strict";
const common_vendor = require("../../../common/vendor.js");
const request_api = require("../../../request/api.js");
const utils_util = require("../../../utils/util.js");
const common_assets = require("../../../common/assets.js");
const _sfc_main = {
data() {
return {
navH: common_vendor.inject("navHeight"),
contentTop: "",
conceptId: "",
//概念id
conceptName: "",
weekList: ["一", "二", "三", "四", "五", "六", "日"],
monthDateList: [],
selectMonthIndex: 0,
//选中月份下标
selectMonth: "",
//选中年月
selectDateStr: "",
//选中日期
startDateStr: "",
//开始日期
endDateStr: "",
//结束日期
chgStockData: null,
//涨跌幅和股票数据
newsList: [],
//新闻数据
reportList: [],
//研报数据
getRateUpOrDown: utils_util.getRateUpOrDown,
getChgRateStr: utils_util.getChgRateStr
};
},
onLoad(e) {
this.contentTop = this.navH + 70 / 750 * common_vendor.inject("windowWidth");
let currentDate = /* @__PURE__ */ new Date();
let currentYear = currentDate.getFullYear();
let currentMonth = currentDate.getMonth() + 1;
let currentDay = currentDate.getDate();
this.selectMonthIndex = 20 * 12 + currentMonth - 1;
this.selectMonth = currentYear + "年" + currentMonth + "月";
this.startDateStr = currentYear + "-" + currentMonth + "-01";
this.endDateStr = this.selectDateStr = currentYear + "-" + currentMonth + "-" + (currentDay > 9 ? currentDay : "0" + currentDay);
this.generateMonthDateListData();
if (e.id) {
this.conceptId = e.id;
this.getTimelineData();
}
},
methods: {
/**
* 获取当前时间前一天的数据
*/
getYesterdayDateData() {
let currentDate = /* @__PURE__ */ new Date();
let selectDate = new Date(currentDate);
selectDate.setDate(selectDate.getDate() - 1);
let selectYear = selectDate.getFullYear();
let selectMonth = selectDate.getMonth() + 1;
let selectDay = selectDate.getDate();
this.selectDateStr = selectYear + "-" + (selectMonth > 9 ? selectMonth : "0" + selectMonth) + "-" + (selectDay > 9 ? selectDay : "0" + selectDay);
},
/**
* 生成日期数组
*/
generateMonthDateListData() {
let currentDate = /* @__PURE__ */ new Date();
let currentYear = currentDate.getFullYear();
let currentMonth = currentDate.getMonth() + 1;
let currentDay = currentDate.getDate();
let monthDateList = [];
for (var i = currentYear - 20; i < currentYear + 20; i++) {
for (var j = 0; j < 12; j++) {
let date = new Date(i, j + 1, 0);
let firstDayOfMonth = new Date(i, j + 1, 0);
firstDayOfMonth.setDate(1);
let currentMonthDay = date.getDate();
let firstDayWeek = firstDayOfMonth.getDay() || 7;
let daysOfMonth = [];
for (var k = 1; k <= currentMonthDay; k++) {
let newDate = new Date(i, j + 1, 0);
newDate.setDate(k);
let newMonth = newDate.getMonth() + 1;
let newDay = newDate.getDate();
let time = newDate.getTime();
let date2 = i + "-" + (newMonth > 9 ? newMonth : "0" + newMonth) + "-" + (newDay > 9 ? newDay : "0" + newDay);
daysOfMonth.push({ date: date2, year: i, month: newMonth, day: newDay, isToday: i == currentYear && newMonth == currentMonth && newDay == currentDay ? true : false, isCurrentMonth: true, isLastDay: newDay == currentMonthDay ? true : false, timestamp: time });
}
for (var k = 0; k < firstDayWeek - 1; k++) {
let year = i;
let month = j;
if (j < 1) {
year = i - 1;
month = 12;
}
let lastMonthDay = new Date(year, month, 0).getDate();
let newDate = new Date(year, month - 1, lastMonthDay - k);
let newMonth = newDate.getMonth() + 1;
let newDay = newDate.getDate();
let time = newDate.getTime();
let date2 = year + "-" + (newMonth > 9 ? newMonth : "0" + newMonth) + "-" + (newDay > 9 ? newDay : "0" + newDay);
daysOfMonth.unshift({ date: date2, year, month: newMonth, day: newDay, isToday: false, isCurrentMonth: false, isLastDay: false, timestamp: time });
}
let nextMonthFirstDay = new Date(i, j + 1, 1);
let lastDayOfMonth = new Date(nextMonthFirstDay - 24 * 60 * 60 * 1e3);
let lastDayWeek = lastDayOfMonth.getDay() || 7;
for (var k = 1; k < 8 - lastDayWeek; k++) {
let year = i;
let month = j;
if (month > 11) {
month = 0;
year++;
}
let newDate = new Date(year, month + 1, k);
let newMonth = newDate.getMonth() + 1;
let newDay = newDate.getDate();
let time = newDate.getTime();
let date2 = year + "-" + (newMonth > 9 ? newMonth : "0" + newMonth) + "-" + (newDay > 9 ? newDay : "0" + newDay);
daysOfMonth.push({ date: date2, year, month: newMonth, day: newDay, isToday: false, isCurrentMonth: false, isLastDay: false, timestamp: time });
}
monthDateList.push(daysOfMonth);
}
}
this.monthDateList = monthDateList;
},
/**
* 点击上个月
*/
clickPreMonth() {
if (this.selectMonthIndex > 0) {
this.selectMonthIndex--;
let monthList = this.monthDateList[this.selectMonthIndex];
let year = "";
let month = "";
for (let item of monthList) {
if (item.isCurrentMonth) {
year = item.year;
month = item.month;
break;
}
}
let lastDay = "";
for (let item of monthList) {
if (item.isLastDay) {
lastDay = item.day;
break;
}
}
this.selectMonth = year + "年" + month + "月";
this.startDateStr = year + "-" + (month > 9 ? month : "0" + month) + "-01";
this.endDateStr = year + "-" + (month > 9 ? month : "0" + month) + "-" + lastDay;
this.getTimelineData();
}
},
/**
* 点击下个月
*/
clickNextMonth() {
if (this.selectMonthIndex < this.monthDateList.length - 1) {
this.selectMonthIndex++;
let monthList = this.monthDateList[this.selectMonthIndex];
let year = "";
let month = "";
for (let item of monthList) {
if (item.isCurrentMonth) {
year = item.year;
month = item.month;
break;
}
}
let lastDay = "";
for (let item of monthList) {
if (item.isLastDay) {
lastDay = item.day;
break;
}
}
this.selectMonth = year + "年" + month + "月";
this.startDateStr = year + "-" + (month > 9 ? month : "0" + month) + "-01";
this.endDateStr = year + "-" + (month > 9 ? month : "0" + month) + "-" + lastDay;
this.getTimelineData();
}
},
monthChange(e) {
let currentDate = /* @__PURE__ */ new Date();
let currentYear = currentDate.getFullYear();
let yearMonth = e.detail.value;
let selectYear = parseInt(yearMonth.split("-")[0]);
let selectMonth = parseInt(yearMonth.split("-")[1]);
this.selectMonthIndex = (selectYear - (currentYear - 20)) * 12 + selectMonth - 1;
this.selectMonth = selectYear + "年" + selectMonth + "月";
this.startDateStr = selectYear + "-" + (selectMonth > 9 ? selectMonth : "0" + selectMonth) + "-01";
let lastDayOfMonth = new Date(selectYear, selectMonth, 0);
this.endDateStr = selectYear + "-" + (selectMonth > 9 ? selectMonth : "0" + selectMonth) + "-" + lastDayOfMonth.getDate();
this.getTimelineData();
},
/**
* 点击选择开始日期和结束日期
* @param {Object} item
*/
clickSelectDate(item) {
if (this.selectDateStr != item.date) {
this.selectDateStr = item.date;
this.chgStockData = item;
this.getNewsData();
this.getReportData();
}
},
/**
* 获取时间序列数据
*/
getTimelineData() {
let param = { start_date: this.startDateStr, end_date: this.endDateStr };
request_api.priceTimeline(this.conceptId, param).then((res) => {
if (res.timeseries) {
this.conceptName = res.concept_name;
let timeseries = res.timeseries;
let monthList = this.monthDateList[this.selectMonthIndex];
for (let item of monthList) {
for (let item1 of timeseries) {
if (item.date == item1.trade_date) {
item.avg_change_pct = item1.avg_change_pct;
item.stock_count = item1.stock_count;
if (item.date == this.selectDateStr) {
this.chgStockData = item;
}
}
}
}
this.getNewsData();
this.getReportData();
}
}).catch((error) => {
});
},
/**
* 获取新闻数据
*/
getNewsData() {
let param = { query: this.conceptName, end_date: this.selectDateStr, exact_match: 1, top_k: 100 };
request_api.conceptNews(param).then((res) => {
this.newsList = res;
}).catch((error) => {
});
},
/**
* 获取时间序列数据
*/
getReportData() {
let param = { query: this.conceptName, start_date: this.selectDateStr, mode: "text", exact_match: 1 };
request_api.conceptReport(param).then((res) => {
this.reportList = res.data.results;
}).catch((error) => {
});
}
}
};
if (!Array) {
const _easycom_navBar2 = common_vendor.resolveComponent("navBar");
_easycom_navBar2();
}
const _easycom_navBar = () => "../../../components/navBar/navBar.js";
if (!Math) {
_easycom_navBar();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: common_vendor.p({
leftText: "历史时间轴",
hideNavBg: true
}),
b: common_assets._imports_0,
c: common_vendor.t($data.conceptName),
d: common_vendor.s("top: " + $data.navH + "px;"),
e: common_assets._imports_4$2,
f: common_vendor.o(($event) => $options.clickPreMonth()),
g: common_vendor.t($data.selectMonth),
h: common_vendor.o((...args) => $options.monthChange && $options.monthChange(...args)),
i: common_assets._imports_5$1,
j: common_vendor.o(($event) => $options.clickNextMonth()),
k: common_vendor.f($data.weekList, (item, index, i0) => {
return {
a: common_vendor.t(item),
b: index
};
}),
l: common_vendor.f($data.monthDateList[$data.selectMonthIndex], (item, index, i0) => {
return common_vendor.e({
a: item.date == $data.selectDateStr
}, item.date == $data.selectDateStr ? common_vendor.e({
b: common_vendor.t(item.day),
c: item.avg_change_pct
}, item.avg_change_pct ? {
d: common_vendor.t($data.getChgRateStr(item.avg_change_pct))
} : {}, {
e: common_vendor.n("date select " + (item.avg_change_pct ? $data.getRateUpOrDown(item.avg_change_pct) ? "down" : "up" : ""))
}) : common_vendor.e({
f: !item.isCurrentMonth
}, !item.isCurrentMonth ? {
g: common_vendor.t(item.day)
} : common_vendor.e({
h: common_vendor.t(item.day),
i: item.avg_change_pct
}, item.avg_change_pct ? {
j: common_vendor.t($data.getChgRateStr(item.avg_change_pct)),
k: common_vendor.n("chg " + ($data.getRateUpOrDown(item.avg_change_pct) ? "down" : "up"))
} : {}, {
l: common_vendor.n("date " + (item.avg_change_pct ? $data.getRateUpOrDown(item.avg_change_pct) ? "down" : "up" : ""))
})), {
m: index,
n: common_vendor.o(($event) => $options.clickSelectDate(item), index)
});
}),
m: common_vendor.t($data.selectDateStr),
n: $data.chgStockData && $data.chgStockData.avg_change_pct
}, $data.chgStockData && $data.chgStockData.avg_change_pct ? common_vendor.e({
o: $data.getRateUpOrDown($data.chgStockData.avg_change_pct)
}, $data.getRateUpOrDown($data.chgStockData.avg_change_pct) ? {
p: common_assets._imports_3$6
} : {
q: common_assets._imports_4$7
}, {
r: common_vendor.t($data.getChgRateStr($data.chgStockData.avg_change_pct)),
s: common_vendor.n("chg " + ($data.getRateUpOrDown($data.chgStockData.avg_change_pct) ? "down" : "up")),
t: common_vendor.t($data.chgStockData.stock_count)
}) : {}, {
v: common_assets._imports_5$4,
w: common_vendor.t($data.newsList.length),
x: common_vendor.t($data.reportList.length),
y: common_vendor.f($data.newsList, (item, index, i0) => {
return {
a: common_vendor.t(item.title),
b: common_vendor.t(item.detail),
c: index
};
}),
z: common_vendor.f($data.reportList, (item, index, i0) => {
return {
a: common_vendor.t(item.report_title),
b: index
};
}),
A: common_vendor.s("top: " + $data.contentTop + "px;")
});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/pages/concept/historicalTimeline/historicalTimeline.js.map

View File

@@ -0,0 +1,6 @@
{
"navigationBarTitleText": "",
"usingComponents": {
"nav-bar": "../../../components/navBar/navBar"
}
}

View File

@@ -0,0 +1 @@
<view><nav-bar wx:if="{{a}}" u-i="adc20db2-0" bind:__l="__l" u-p="{{a}}"></nav-bar><image class="topBg absolute" src="{{b}}" mode="widthFix"></image><view class="timelineTitle fixed" style="{{d}}">{{c}}- 历史时间轴</view><view class="dateStatisticsC fixed" style="{{A}}"><view class="dateC"><view class="yearMonthC flex"><view class="btn" bindtap="{{f}}"><image class="icon" src="{{e}}" mode="widthFix"></image></view><view class="yearMonth flex1"><picker mode="date" fields="month" bindchange="{{h}}">{{g}}</picker></view><view class="btn" bindtap="{{j}}"><image class="icon" src="{{i}}" mode="widthFix"></image></view></view><view class="weekList flex"><view wx:for="{{k}}" wx:for-item="item" wx:key="b" class="item flex1">{{item.a}}</view></view><view class="monthDateList flexWrap"><view wx:for="{{l}}" wx:for-item="item" wx:key="m" class="item flexColumnCenter" bindtap="{{item.n}}"><block wx:if="{{item.a}}"><view class="{{item.e}}">{{item.b}} <view wx:if="{{item.c}}" class="chg">{{item.d}}%</view></view></block><block wx:else><block wx:if="{{item.f}}"><view class="date notCurrentMonth">{{item.g}}</view></block><block wx:else><view class="{{item.l}}">{{item.h}} <view wx:if="{{item.i}}" class="{{item.k}}">{{item.j}}%</view></view></block></block></view></view></view><view class="statisticsC"><view class="date">{{m}}统计</view><view wx:if="{{n}}" class="chgStockNumC flex"><view class="chgC flex flex1"><view class="title">涨跌幅</view><image wx:if="{{o}}" class="icon" src="{{p}}" mode="widthFix"></image><image wx:else class="icon" src="{{q}}" mode="widthFix"></image><view class="{{s}}">{{r}}%</view></view><view class="stockNumC flex flex1"><view class="title">统计股票</view><view class="stockNum">{{t}} 只股票</view></view></view><view class="newsReportC flex"><image class="icon" src="{{v}}" mode="widthFix"></image><text class="news">{{w}} 条新闻 · </text><text class="report" decode> {{x}} 份研报</text></view><view class="list"><view wx:for="{{y}}" wx:for-item="item" wx:key="c" class="item"><view class="flex"><view class="type news">新闻</view><view class="title flex1">{{item.a}}</view></view><view class="content">{{item.b}}</view></view><view wx:for="{{z}}" wx:for-item="item" wx:key="b" class="item"><view class="flex"><view class="type report">研报</view><view class="title flex1">{{item.a}}</view></view><view class="content">坚定看好锂电材料,建议继续加配坚定六氟、添加剂,关注隔膜更加坚定的看好六氟:下游传导如期</view></view></view></view></view></view>

View File

@@ -0,0 +1,202 @@
page {
background-color: #070707;
}
.topBg {
top: 0;
left: 0;
width: 100%;
height: auto;
}
.timelineTitle {
background-color: #FFF9F5;
left: 0;
right: 0;
margin: 0 25rpx;
padding: 30rpx 27rpx 0;
border-radius: 10rpx 10rpx 0 0;
font-size: 28rpx;
font-weight: bold;
color: #2B2B2B;
}
.dateStatisticsC {
background-color: #FFF9F5;
left: 0;
right: 0;
bottom: 86rpx;
margin: 0 25rpx;
padding: 24rpx 25rpx 0;
border-radius: 0 0 10rpx 10rpx;
overflow-y: scroll;
}
.dateStatisticsC .dateC {
background-color: white;
box-shadow: 0 5rpx 10rpx 0 rgba(127, 127, 127, 0.1);
border-radius: 10rpx;
padding: 30rpx 25rpx 0;
}
.dateStatisticsC .dateC .yearMonthC {
background-color: #F7F7F7;
height: 70rpx;
border-radius: 35rpx;
}
.dateStatisticsC .dateC .yearMonthC .btn {
padding: 0 52rpx;
}
.dateStatisticsC .dateC .yearMonthC .btn .icon {
width: 13rpx;
height: auto;
}
.dateStatisticsC .dateC .yearMonthC .yearMonth {
font-size: 32rpx;
font-weight: 500;
color: #070707;
text-align: center;
}
.dateStatisticsC .dateC .weekList .item {
margin-right: 13rpx;
line-height: 72rpx;
font-size: 26rpx;
font-weight: 500;
color: #A7A7A7;
text-align: center;
}
.dateStatisticsC .dateC .monthDateList .item {
margin-bottom: 12rpx;
width: calc(100%/7);
}
.dateStatisticsC .dateC .monthDateList .item .date {
background-color: #f8f8f8;
padding: 4rpx 0;
width: calc(100% - 10rpx);
height: 72rpx;
border-radius: 10rpx;
font-size: 26rpx;
font-weight: bold;
color: #2A2A2A;
text-align: center;
}
.dateStatisticsC .dateC .monthDateList .item .date .chg {
font-size: 18rpx;
}
.dateStatisticsC .dateC .monthDateList .item .date .chg.up {
color: #EC3440;
}
.dateStatisticsC .dateC .monthDateList .item .date .chg.down {
color: #38A169;
}
.dateStatisticsC .dateC .monthDateList .item .date.up {
background-color: #FFD6D9;
}
.dateStatisticsC .dateC .monthDateList .item .date.down {
background-color: #CEF1DE;
}
.dateStatisticsC .dateC .monthDateList .item .date.select.up {
background-color: #EC3440;
color: white;
}
.dateStatisticsC .dateC .monthDateList .item .date.select.up .chg {
color: white;
}
.dateStatisticsC .dateC .monthDateList .item .date.select.down {
background-color: #38A169;
color: white;
}
.dateStatisticsC .dateC .monthDateList .item .date.select.down .chg {
color: white;
}
.dateStatisticsC .dateC .monthDateList .item .date.notCurrentMonth {
background-color: #FCFCFC;
color: #999;
}
.dateStatisticsC .statisticsC {
background-color: white;
margin-top: 20rpx;
padding: 28rpx 20rpx 0;
border-radius: 10rpx;
}
.dateStatisticsC .statisticsC .date {
font-size: 30rpx;
font-weight: 500;
text-align: center;
}
.dateStatisticsC .statisticsC .chgStockNumC {
margin-top: 36rpx;
padding: 0 13rpx 28rpx;
border-bottom: solid 1rpx #EDEDED;
font-size: 26rpx;
}
.dateStatisticsC .statisticsC .chgStockNumC .title {
margin-right: 18rpx;
font-weight: 500;
color: #94979C;
}
.dateStatisticsC .statisticsC .chgStockNumC .chgC .icon {
margin-right: 9rpx;
width: 17rpx;
height: auto;
}
.dateStatisticsC .statisticsC .chgStockNumC .chgC .chg {
font-weight: bold;
}
.dateStatisticsC .statisticsC .chgStockNumC .chgC .chg.up {
color: #EC3440;
}
.dateStatisticsC .statisticsC .chgStockNumC .chgC .chg.down {
color: #38A169;
}
.dateStatisticsC .statisticsC .chgStockNumC .stockNum {
font-weight: bold;
color: #070707;
}
.dateStatisticsC .statisticsC .newsReportC {
padding-top: 20rpx;
font-size: 28rpx;
font-weight: bold;
}
.dateStatisticsC .statisticsC .newsReportC .icon {
margin-right: 20rpx;
width: 24rpx;
height: auto;
}
.dateStatisticsC .statisticsC .newsReportC .news {
color: #FF7723;
}
.dateStatisticsC .statisticsC .newsReportC .report {
color: #333;
}
.dateStatisticsC .statisticsC .list .item {
padding: 30rpx 0;
border-bottom: solid 1rpx #EDEDED;
}
.dateStatisticsC .statisticsC .list .item .type {
margin-right: 18rpx;
padding: 0 9rpx;
line-height: 40rpx;
border-radius: 5rpx;
font-size: 22rpx;
font-weight: 500;
}
.dateStatisticsC .statisticsC .list .item .type.news {
background-color: #F2C367;
color: #070707;
}
.dateStatisticsC .statisticsC .list .item .type.report {
background-color: #3D3F3C;
color: #F2C367;
}
.dateStatisticsC .statisticsC .list .item .title {
font-size: 26rpx;
font-weight: bold;
color: #070707;
}
.dateStatisticsC .statisticsC .list .item .content {
margin-top: 20rpx;
font-size: 24rpx;
font-weight: 500;
color: #333;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
text-overflow: ellipsis;
}