8.28 修改事件详情相关概念模块样式,增加股票详情信息来源展示

This commit is contained in:
尚政杰
2025-08-28 17:42:22 +08:00
parent 58b3414bdd
commit bf2388c3ec
403 changed files with 19843 additions and 1602 deletions

View File

@@ -11,8 +11,16 @@ const _sfc_main = {
navH: common_vendor.inject("navHeight"),
windowWidth: common_vendor.inject("windowWidth"),
contentTop: "",
keywords: "",
//搜索关键字
todayDate: "",
//今日日期
calendarDateList: [],
//日历日期
selectMonth: "",
//选中月份
selectMonthIndex: 0,
//选中月份下标
weekList: ["一", "二", "三", "四", "五", "六", "日"],
weekDateList: [],
//当前周日期
@@ -34,66 +42,95 @@ const _sfc_main = {
//事件列表
dataList: [],
//数据列表
getLocaleHourMinute: utils_util.getLocaleHourMinute
page: 1,
loadAll: false,
getLocaleHourMinute: utils_util.getLocaleHourMinute,
replaceAnswerLabel: utils_util.replaceAnswerLabel
};
},
onLoad() {
let date = /* @__PURE__ */ new Date();
this.contentTop = this.navH + (75 + 20) / 750 * common_vendor.inject("windowWidth");
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
this.todayDate = this.selectDate = date.getFullYear() + "-" + (month > 9 ? month : "0" + month) + "-" + (day > 9 ? day : "0" + day);
let currentYear = date.getFullYear();
let currentMonth = date.getMonth() + 1;
let currentDay = date.getDate();
this.todayDate = this.selectDate = currentYear + "-" + (currentMonth > 9 ? currentMonth : "0" + currentMonth) + "-" + (currentDay > 9 ? currentDay : "0" + currentDay);
let week = date.getDay() || 7;
let diff = week - 1;
let daysOfWeek = [];
for (var i = 0; i < 7; i++) {
let newDate = /* @__PURE__ */ new Date();
newDate.setDate(day - diff + i);
newDate.setDate(currentDay - diff + i);
let newDay = newDate.getDate();
let date2 = year + "-" + (month > 9 ? month : "0" + month) + "-" + (newDay > 9 ? newDay : "0" + newDay);
daysOfWeek.push({ date: date2, day: newDay, isToday: newDay == day ? true : false });
let date2 = currentYear + "-" + (currentMonth > 9 ? currentMonth : "0" + currentMonth) + "-" + (newDay > 9 ? newDay : "0" + newDay);
daysOfWeek.push({ date: date2, day: newDay, isToday: newDay == currentDay ? true : false });
}
this.weekDateList = daysOfWeek;
let firstDayOfMonth = /* @__PURE__ */ new Date();
firstDayOfMonth.setDate(1);
let currentMonthDay = new Date(year, month, 0).getDate();
let firstDayWeek = firstDayOfMonth.getDay() || 7;
let daysOfMonth = [];
for (var i = 1; i <= currentMonthDay; i++) {
let newDate = /* @__PURE__ */ new Date();
newDate.setDate(i);
let newDay = newDate.getDate();
let date2 = year + "-" + (month > 9 ? month : "0" + month) + "-" + (newDay > 9 ? newDay : "0" + newDay);
daysOfMonth.push({ date: date2, day: newDay, isToday: newDay == day ? true : false, isCurrentMonth: true });
}
for (var i = 0; i < firstDayWeek - 1; i++) {
let lastMonthDay = new Date(year, month - 1, 0).getDate();
let newDate = new Date(year, month - 2, lastMonthDay - i);
let newMonth = newDate.getMonth() + 1;
let newDay = newDate.getDate();
let date2 = year + "-" + (newMonth > 9 ? newMonth : "0" + newMonth) + "-" + (newDay > 9 ? newDay : "0" + newDay);
daysOfMonth.unshift({ date: date2, day: newDay, isToday: false, isCurrentMonth: false });
}
let nextMonthFirstDay = new Date(year, month, 1);
let lastDayOfMonth = new Date(nextMonthFirstDay - 24 * 60 * 60 * 1e3);
let lastDayWeek = lastDayOfMonth.getDay() || 7;
for (var i = 1; i < 8 - lastDayWeek; i++) {
if (month > 11) {
month = -1;
year++;
let calendarDateList = [];
this.selectMonthIndex = 20 * 12 + currentMonth - 1;
this.selectMonth = currentYear + "-" + (currentMonth > 9 ? currentMonth : "0" + currentMonth);
for (var i = currentYear - 20; i < currentYear + 20; i++) {
for (var j = 0; j < 12; j++) {
let date2 = new Date(i, j + 1, 0);
let firstDayOfMonth = new Date(i, j + 1, 0);
firstDayOfMonth.setDate(1);
let currentMonthDay = date2.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 date3 = i + "-" + (newMonth > 9 ? newMonth : "0" + newMonth) + "-" + (newDay > 9 ? newDay : "0" + newDay);
daysOfMonth.push({ date: date3, year: i, month: newMonth, day: newDay, isToday: i == currentYear && newMonth == currentMonth && newDay == currentDay ? true : false, isCurrentMonth: true, 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 date3 = year + "-" + (newMonth > 9 ? newMonth : "0" + newMonth) + "-" + (newDay > 9 ? newDay : "0" + newDay);
daysOfMonth.unshift({ date: date3, year, month: newMonth, day: newDay, isToday: false, isCurrentMonth: 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 date3 = year + "-" + (newMonth > 9 ? newMonth : "0" + newMonth) + "-" + (newDay > 9 ? newDay : "0" + newDay);
daysOfMonth.push({ date: date3, year, month: newMonth, day: newDay, isToday: false, isCurrentMonth: false, timestamp: time });
}
calendarDateList.push(daysOfMonth);
}
let newDate = new Date(year, month + 1, i);
let newMonth = newDate.getMonth() + 1;
let newDay = newDate.getDate();
let date2 = year + "-" + (newMonth > 9 ? newMonth : "0" + newMonth) + "-" + (newDay > 9 ? newDay : "0" + newDay);
daysOfMonth.push({ date: date2, day: newDay, isToday: false, isCurrentMonth: false });
}
this.monthDateList = daysOfMonth;
this.calendarDateList = calendarDateList;
this.monthDateList = calendarDateList[this.selectMonthIndex];
this.listTop = this.contentTop + (68 + 40 + 96 + 74 + 70 + 74 + 22) / 750 * common_vendor.inject("windowWidth");
this.getStockCategoryListData();
this.getEventListData();
this.getCurrentMonthEventCountData();
Promise.all([this.getStockCategoryListData(), this.getCurrentMonthEventCountData()]).then((res) => {
this.getEventListData();
}).catch((error) => {
});
},
onPullDownRefresh() {
this.reloadData();
},
computed: {
circumference() {
@@ -101,16 +138,45 @@ const _sfc_main = {
}
},
methods: {
reloadData() {
this.page = 1;
this.loadAll = false;
if (this.selectTab == 0) {
this.getEventListData();
} else
this.getDataListData();
},
loadMoreData() {
if (!this.loadAll) {
this.page++;
if (this.selectTab == 0) {
this.getEventListData();
} else
this.getDataListData();
}
},
/**
* 点击搜索
*/
clickSearch() {
this.reloadData();
},
/**
* 点击选择月份
*/
clickSelectMonth() {
this.$refs["popup"].open();
},
/**
* 点击今日日期
*/
clickTodayDate() {
if (this.selectDate != this.todayDate) {
this.selectDate = this.todayDate;
if (this.selectTab == 0) {
this.getEventListData();
} else
this.getDataListData();
let date = /* @__PURE__ */ new Date();
let currentMonth = date.getMonth() + 1;
this.selectMonthIndex = 20 * 12 + currentMonth - 1;
this.reloadData();
}
},
/**
@@ -123,6 +189,40 @@ const _sfc_main = {
} else
this.listTop = this.contentTop + (68 + 40 + 96 + 74 + 70 + 74 + 22) / 750 * this.windowWidth;
},
/**
* 点击上个月
*/
clickPreMonth() {
if (this.selectMonthIndex > 0) {
this.selectMonthIndex--;
let monthList = this.calendarDateList[this.selectMonthIndex];
let month = "";
for (let item of monthList) {
if (item.isCurrentMonth) {
month = item.month;
break;
}
}
this.selectMonth = this.calendarDateList[this.selectMonthIndex][0].year + "-" + (month > 9 ? month : "0" + month);
}
},
/**
* 点击下个月
*/
clickNextMonth() {
if (this.selectMonthIndex < this.calendarDateList.length - 1) {
this.selectMonthIndex++;
let monthList = this.calendarDateList[this.selectMonthIndex];
let month = "";
for (let item of monthList) {
if (item.isCurrentMonth) {
month = item.month;
break;
}
}
this.selectMonth = this.calendarDateList[this.selectMonthIndex][0].year + "-" + (month > 9 ? month : "0" + month);
}
},
/**
* 选中日期
* @param {Object} item
@@ -130,10 +230,7 @@ const _sfc_main = {
clickSelectDate(item) {
if (this.selectDate != item.date) {
this.selectDate = item.date;
if (this.selectTab == 0) {
this.getEventListData();
} else
this.getDataListData();
this.reloadData();
}
},
/**
@@ -142,10 +239,7 @@ const _sfc_main = {
clickTabItem(index) {
if (this.selectTab != index) {
this.selectTab = index;
if (this.selectTab == 0) {
this.getEventListData();
} else
this.getDataListData();
this.reloadData();
}
},
/**
@@ -154,10 +248,7 @@ const _sfc_main = {
clickTopCategoryItem(index) {
if (this.selectTopCategory != index) {
this.selectTopCategory = index;
if (this.selectTab == 0) {
this.getEventListData();
} else
this.getDataListData();
this.reloadData();
}
},
/**
@@ -172,42 +263,59 @@ const _sfc_main = {
* 获取股票分类
*/
getStockCategoryListData() {
request_api.stockCategoryList().then((res) => {
if (res.code == 200) {
res.data.unshift({ primary_sector: "全部", sub_sectors: [] });
this.stockCategoryList = res.data;
} else
common_vendor.index.showToast({
title: res.message,
icon: "none"
});
}).catch((error) => {
return new Promise((resolve, reject) => {
request_api.stockCategoryList().then((res) => {
if (res.code == 200) {
res.data.unshift({ primary_sector: "全部", sub_sectors: [] });
this.stockCategoryList = res.data;
resolve(1);
} else {
common_vendor.index.showToast({
title: res.message,
icon: "none"
});
reject(1);
}
}).catch((error) => {
reject(1);
});
});
},
/**
* 获取事件列表数据
*/
getEventListData() {
let param = { start: this.selectDate };
let param = { start: this.selectDate, q: this.keywords, page: this.page };
if (this.selectTopCategory > 0) {
param.category = this.stockCategoryList[this.selectTopCategory].primary_sector;
}
request_api.calendarEventList(param).then((res) => {
common_vendor.index.stopPullDownRefresh();
if (res.code == 200) {
this.eventList = res.data.events;
if (res.data.page == 1) {
this.eventList = res.data.events;
} else
this.eventList = this.eventList.concat(res.data.events);
if (res.data.page == res.data.total_pages) {
this.loadAll = true;
}
} else
common_vendor.index.showToast({
title: res.message,
icon: "none"
});
}).catch((error) => {
common_vendor.index.stopPullDownRefresh();
});
},
/**
* 获取事件列表数据
*/
getDataListData() {
let param = { start: this.selectDate };
let param = { start: this.selectDate, q: this.keywords, page: this.page };
if (this.selectTopCategory > 0) {
param.category = this.stockCategoryList[this.selectTopCategory].primary_sector;
}
request_api.calendarDataList(param).then((res) => {
if (res.code == 200) {
this.dataList = res.data.data_list;
@@ -217,60 +325,72 @@ const _sfc_main = {
icon: "none"
});
}).catch((error) => {
common_vendor.index.stopPullDownRefresh();
});
},
/**
* 获取当前月份每一天的事件数量
*/
getCurrentMonthEventCountData() {
request_api.calendarEventCount().then((res) => {
for (let item of res) {
let date = item.start;
for (let s of this.weekDateList) {
if (s.date == date) {
s.eventCount = item.title;
s.className = item.className;
return new Promise((resolve, reject) => {
request_api.calendarEventCount().then((res) => {
for (let item of res) {
let date = item.start;
for (let s of this.weekDateList) {
if (s.date == date) {
s.eventCount = item.title;
s.className = item.className;
}
}
for (let s of this.monthDateList) {
if (s.date == date) {
s.eventCount = item.title;
s.className = item.className;
}
}
}
for (let s of this.monthDateList) {
if (s.date == date) {
s.eventCount = item.title;
s.className = item.className;
}
}
}
}).catch((error) => {
resolve(1);
}).catch((error) => {
reject(1);
});
});
}
}
};
if (!Array) {
const _easycom_ua_markdown2 = common_vendor.resolveComponent("ua-markdown");
const _easycom_zui_progress_circle2 = common_vendor.resolveComponent("zui-progress-circle");
_easycom_zui_progress_circle2();
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
(_easycom_ua_markdown2 + _easycom_zui_progress_circle2 + _easycom_uni_popup2)();
}
const _easycom_ua_markdown = () => "../../components/ua-markdown/ua-markdown.js";
const _easycom_zui_progress_circle = () => "../../uni_modules/zui-progress-circle/components/zui-progress-circle/zui-progress-circle.js";
const _easycom_uni_popup = () => "../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
if (!Math) {
_easycom_zui_progress_circle();
(_easycom_ua_markdown + _easycom_zui_progress_circle + _easycom_uni_popup)();
}
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return common_vendor.e({
a: common_assets._imports_0,
b: common_vendor.s("top:" + $data.menuTop + "px;line-height:" + $data.menuH + "px;"),
c: common_assets._imports_1,
d: common_vendor.s("top:" + $data.navH + "px;"),
e: common_vendor.t($data.selectDate),
f: common_assets._imports_2$3,
g: common_vendor.o(($event) => $options.clickExpandOrRetract()),
h: common_vendor.o(($event) => $options.clickTodayDate()),
i: common_vendor.f($data.weekList, (item, index, i0) => {
d: $data.keywords,
e: common_vendor.o(($event) => $data.keywords = $event.detail.value),
f: common_vendor.o(($event) => $options.clickSearch()),
g: common_vendor.s("top:" + $data.navH + "px;"),
h: common_vendor.t($data.selectDate),
i: common_assets._imports_2$3,
j: common_vendor.o(($event) => $options.clickSelectMonth()),
k: common_vendor.o(($event) => $options.clickTodayDate()),
l: common_vendor.f($data.weekList, (item, index, i0) => {
return {
a: common_vendor.t(item),
b: index
};
}),
j: $data.isExpand
m: $data.isExpand
}, $data.isExpand ? {
k: common_vendor.f($data.monthDateList, (item, index, i0) => {
n: common_vendor.f($data.monthDateList, (item, index, i0) => {
return common_vendor.e($data.selectDate != $data.todayDate ? common_vendor.e({
a: $data.selectDate == item.date
}, $data.selectDate == item.date ? {
@@ -304,9 +424,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
q: common_vendor.o(($event) => $options.clickSelectDate(item), index)
});
}),
l: $data.selectDate != $data.todayDate
o: $data.selectDate != $data.todayDate
} : {
m: common_vendor.f($data.weekDateList, (item, index, i0) => {
p: common_vendor.f($data.weekDateList, (item, index, i0) => {
return common_vendor.e($data.selectDate != $data.todayDate ? common_vendor.e({
a: $data.selectDate == item.date
}, $data.selectDate == item.date ? {
@@ -340,12 +460,17 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
q: index
});
}),
n: $data.selectDate != $data.todayDate
q: $data.selectDate != $data.todayDate
}, {
o: common_vendor.t($data.isExpand ? "收起" : "展开"),
p: common_assets._imports_3$2,
q: common_vendor.o(($event) => $options.clickExpandOrRetract()),
r: common_vendor.f($data.tabList, (item, index, i0) => {
r: common_vendor.t($data.isExpand ? "收起" : "展开"),
s: $data.isExpand
}, $data.isExpand ? {
t: common_assets._imports_3$2
} : {
v: common_assets._imports_4$1
}, {
w: common_vendor.o(($event) => $options.clickExpandOrRetract()),
x: common_vendor.f($data.tabList, (item, index, i0) => {
return {
a: common_vendor.t(item),
b: common_vendor.n("item " + ($data.selectTab == index ? "select" : "")),
@@ -353,7 +478,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
d: common_vendor.o(($event) => $options.clickTabItem(index), index)
};
}),
s: common_vendor.f($data.stockCategoryList, (item, index, i0) => {
y: common_vendor.f($data.stockCategoryList, (item, index, i0) => {
return common_vendor.e({
a: common_vendor.t(item.primary_sector),
b: $data.selectTopCategory == index
@@ -363,29 +488,38 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
e: common_vendor.o(($event) => $options.clickTopCategoryItem(index), index)
});
}),
t: $data.selectTab == 0
z: $data.selectTab == 0
}, $data.selectTab == 0 ? {
v: common_vendor.f($data.eventList, (item, index, i0) => {
A: common_vendor.f($data.eventList, (item, index, i0) => {
return common_vendor.e({
a: common_vendor.t($data.getLocaleHourMinute(item.start_time)),
b: common_vendor.f(5, (sitem, sindex, i1) => {
return {
a: sindex < item.star ? "/static/icon/invest/star_s.png" : "/static/icon/invest/star.png"
a: sindex < item.category.star_rating ? "/static/icon/invest/star_s.png" : "/static/icon/invest/star.png"
};
}),
c: index,
d: common_vendor.t(item.category.event_type),
e: common_vendor.t(item.title),
f: common_vendor.t(item.description),
g: item.concepts
}, item.concepts ? {
h: common_vendor.f(JSON.parse(item.concepts), (citem, cindex, i1) => {
f: common_vendor.f(item.tags, (titem, tindex, i1) => {
return {
a: common_vendor.t(citem[0]),
b: common_vendor.t(citem[2] * 100),
c: "2cf1ca64-0-" + i0 + "-" + i1,
a: common_vendor.t(titem),
b: tindex
};
}),
g: "2cf1ca64-0-" + i0,
h: common_vendor.p({
source: $data.replaceAnswerLabel(item.description)
}),
i: item.related_concepts
}, item.related_concepts ? {
j: common_vendor.f(item.related_concepts, (citem, cindex, i1) => {
return {
a: common_vendor.t(citem.name),
b: common_vendor.t(citem.score * 100),
c: "2cf1ca64-1-" + i0 + "-" + i1,
d: common_vendor.p({
position: citem[2],
position: citem.score,
range: [270, 630],
size: 26,
["ring-width"]: 2,
@@ -395,34 +529,64 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
};
})
} : {}, {
i: index,
j: common_vendor.o(($event) => $options.clickEventItem(item.id), index)
k: index,
l: common_vendor.o(($event) => $options.clickEventItem(item.id), index)
});
})
} : {}, {
w: $data.selectTab == 1
B: $data.selectTab == 1
}, $data.selectTab == 1 ? {
x: common_vendor.f($data.dataList, (item, index, i0) => {
C: common_vendor.f($data.dataList, (item, index, i0) => {
return {
a: common_vendor.t($data.getLocaleHourMinute(item.created_at)),
b: common_vendor.f(5, (item2, index2, i1) => {
b: common_vendor.f(5, (sitem, sindex, i1) => {
return {
a: index2
};
}),
c: common_vendor.f(5, (item2, index2, i1) => {
return {
a: index2
a: sindex < item.star ? "/static/icon/invest/star_s.png" : "/static/icon/invest/star.png"
};
}),
c: index,
d: common_vendor.t(item.title),
e: index
e: common_vendor.t(item.former),
f: common_vendor.t(item.forecast ? item.forecast : "--"),
g: common_vendor.t(item.fact ? item.fact : "--"),
h: index
};
})
} : {}, {
D: common_vendor.s("top:" + $data.contentTop + "px;"),
E: common_vendor.o(($event) => $options.loadMoreData()),
F: common_assets._imports_5,
G: common_vendor.o(($event) => $options.clickPreMonth()),
H: common_vendor.t($data.selectMonth),
I: common_assets._imports_6,
J: common_vendor.o(($event) => $options.clickNextMonth()),
K: common_vendor.f($data.weekList, (item, index, i0) => {
return {
a: common_vendor.t(item),
b: index
};
}),
y: common_assets._imports_4$1,
z: common_assets._imports_5
} : {}, {
A: common_vendor.s("top:" + $data.contentTop + "px;")
L: common_vendor.f($data.calendarDateList[$data.selectMonthIndex], (item, index, i0) => {
return common_vendor.e({
a: item.isToday || item.date == $data.selectDate
}, item.isToday || item.date == $data.selectDate ? {
b: common_vendor.t(item.day)
} : common_vendor.e({
c: !item.isCurrentMonth
}, !item.isCurrentMonth ? {
d: common_vendor.t(item.day)
} : {
e: common_vendor.t(item.day)
}), {
f: index,
g: common_vendor.o(($event) => $options.clickSelectDate(item), index)
});
}),
M: common_vendor.s("margin-top:" + $data.navH + "px;"),
N: common_vendor.sr("popup", "2cf1ca64-2"),
O: common_vendor.p({
type: "top"
})
});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);