1034 lines
38 KiB
JavaScript
1034 lines
38 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const request_api = require("../../request/api.js");
|
|
const utils_util = require("../../utils/util.js");
|
|
const utils_posthog = require("../../utils/posthog.js");
|
|
const common_assets = require("../../common/assets.js");
|
|
const echarts = require("../../uni_modules/lime-echart/static/echarts.min.js");
|
|
const _sfc_main = {
|
|
data() {
|
|
return {
|
|
menuTop: common_vendor.inject("menuTop"),
|
|
menuH: common_vendor.inject("menuHeight"),
|
|
navH: common_vendor.inject("navHeight"),
|
|
windowWidth: common_vendor.inject("windowWidth"),
|
|
contentTop: "",
|
|
listTop: "",
|
|
sortListTop: "",
|
|
isRefreshing: false,
|
|
keywords: "",
|
|
//关键词
|
|
sortList: [],
|
|
selectSortKey: "",
|
|
//选中排序key
|
|
timeCategoryList: [],
|
|
selectTimeCategory: 0,
|
|
stockCategoryList: [],
|
|
topScrollWidth: 0,
|
|
secondScrollWidth: 0,
|
|
selectTopCategory: 0,
|
|
topScrollLeft: 0,
|
|
selectSecondCategory: 0,
|
|
secondScrollLeft: 0,
|
|
screenCategoryList: ["日期范围", "行业分类", "重要性"],
|
|
selectYearMonth: "",
|
|
//选择的年月日
|
|
startDate: "",
|
|
//选择开始日期
|
|
startTimeStamp: "",
|
|
//开始日期时间戳
|
|
endDate: "",
|
|
//选择结束日期
|
|
endTimeStamp: "",
|
|
//结束日期时间戳
|
|
weekList: ["一", "二", "三", "四", "五", "六", "日"],
|
|
monthDateList: [],
|
|
selectMonthIndex: 0,
|
|
//选中月份下标
|
|
selectMonth: "",
|
|
//选中年月
|
|
industryCategoryList: [],
|
|
//行业分类数组
|
|
industryKeywords: "",
|
|
//行业分类搜索关键词
|
|
searchResultList: [],
|
|
//行业分类搜索结果数组
|
|
selectIndustryTopCategory: 0,
|
|
//选中行业一级分类
|
|
selectIndustrySecondCategory: -1,
|
|
//选中行业二级分类
|
|
selectIndustryThirdCategory: -1,
|
|
//选中行业三级分类
|
|
selectIndustryForthCategory: -1,
|
|
//选中行业四级分类
|
|
selectScreenCategory: 0,
|
|
importanceList: [],
|
|
//重要性数组
|
|
selectImportanceIndex: 0,
|
|
//选择重要性下标
|
|
option: {
|
|
tooltip: {
|
|
trigger: "axis",
|
|
axisPointer: {
|
|
type: "shadow"
|
|
},
|
|
confine: true
|
|
},
|
|
grid: {
|
|
left: "0%",
|
|
right: "0%",
|
|
top: "10%",
|
|
bottom: "20%"
|
|
},
|
|
xAxis: [
|
|
{
|
|
type: "category",
|
|
data: ["跌停", "跌停~5%", "5~1%", "1~0%", "平盘", "0~1%", "1~5%", "5%~涨停", "涨停"],
|
|
axisTick: {
|
|
show: false
|
|
},
|
|
axisLine: {
|
|
show: false
|
|
},
|
|
axisLabel: {
|
|
fontSize: 10,
|
|
interval: "0",
|
|
textStyle: {
|
|
color: function(value, index) {
|
|
return index == 0 ? "#355422" : index == 8 ? "#C00000" : "#515151";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
],
|
|
yAxis: [
|
|
{
|
|
type: "value",
|
|
show: false,
|
|
axisTick: { show: false }
|
|
}
|
|
],
|
|
series: [
|
|
{
|
|
name: "热度",
|
|
type: "bar",
|
|
label: {
|
|
show: true,
|
|
position: "top",
|
|
fontSize: 12
|
|
},
|
|
itemStyle: {
|
|
borderRadius: [5, 5, 0, 0]
|
|
},
|
|
data: []
|
|
}
|
|
]
|
|
},
|
|
eventList: [],
|
|
page: 1,
|
|
loadAll: false,
|
|
getRateStr: utils_util.getRateStr,
|
|
getRateUpOrDown: utils_util.getRateUpOrDown,
|
|
getLocaleTime: utils_util.getLocaleTime
|
|
};
|
|
},
|
|
onLoad() {
|
|
this.contentTop = this.navH + (74 + 20) / 750 * this.windowWidth;
|
|
this.listTop = this.contentTop + (22 + 80 + 72) / 750 * this.windowWidth;
|
|
this.sortListTop = this.navH + (22 + 80 + 80) / 750 * this.windowWidth;
|
|
Promise.all([this.getEventFilterListData(), this.getIndustryCategoryListData(), this.getStockCategoryListData()]).then((res) => {
|
|
this.getEventListData();
|
|
}).catch((error) => {
|
|
});
|
|
let currentDate = /* @__PURE__ */ new Date();
|
|
let currentYear = currentDate.getFullYear();
|
|
let currentMonth = currentDate.getMonth() + 1;
|
|
let currentDay = currentDate.getDate();
|
|
let monthDateList = [];
|
|
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 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, 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, 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, timestamp: time });
|
|
}
|
|
monthDateList.push(daysOfMonth);
|
|
}
|
|
}
|
|
this.monthDateList = monthDateList;
|
|
utils_posthog.posthog.capture("首页");
|
|
},
|
|
onReady() {
|
|
common_vendor.index.createSelectorQuery().select("#topCategory").boundingClientRect((rect) => {
|
|
this.topScrollWidth = Math.round(rect.width);
|
|
}).exec();
|
|
common_vendor.index.createSelectorQuery().select("#secondCategory").boundingClientRect((rect) => {
|
|
if (rect) {
|
|
this.secondScrollWidth = Math.round(rect.width);
|
|
}
|
|
}).exec();
|
|
},
|
|
methods: {
|
|
/**
|
|
* 下拉刷新
|
|
*/
|
|
pullDownRefresh() {
|
|
this.isRefreshing = true;
|
|
this.clickSearch();
|
|
},
|
|
/**
|
|
* 上拉加载
|
|
*/
|
|
loadMoreData() {
|
|
if (!this.loadAll) {
|
|
this.page++;
|
|
if (this.selectScreenCategory == 0) {
|
|
this.getEventListData();
|
|
} else
|
|
this.getHotEventListData();
|
|
}
|
|
},
|
|
async init() {
|
|
const chart = await this.$refs.chartRef.init(echarts);
|
|
chart.setOption(this.option);
|
|
},
|
|
/**
|
|
* 点击搜索
|
|
*/
|
|
clickSearch() {
|
|
this.page = 1;
|
|
if (this.selectTimeCategory == 0) {
|
|
this.getEventListData();
|
|
} else
|
|
this.getHotEventListData();
|
|
},
|
|
/**
|
|
* 点击事件筛选
|
|
* @param {Object} index
|
|
*/
|
|
clickTimeCategoryItem(index) {
|
|
if (this.selectTimeCategory != index) {
|
|
this.selectTimeCategory = index;
|
|
if (index == 0) {
|
|
this.getEventListData();
|
|
} else
|
|
this.getHotEventListData();
|
|
}
|
|
},
|
|
/**
|
|
* 点击排序
|
|
*/
|
|
clickSort() {
|
|
this.$refs["sortPopup"].open();
|
|
},
|
|
/**
|
|
* 点击排序选项
|
|
*/
|
|
clickSortListItem(item) {
|
|
this.selectSortKey = item.key;
|
|
this.$refs["sortPopup"].close();
|
|
if (this.selectTimeCategory == 0) {
|
|
this.getEventListData();
|
|
} else
|
|
this.getHotEventListData();
|
|
},
|
|
/**
|
|
* 点击筛选
|
|
*/
|
|
clickScreenItem() {
|
|
this.$refs["screenPopup"].open();
|
|
},
|
|
/**
|
|
* 点击筛选弹窗取消
|
|
*/
|
|
clickCancel() {
|
|
this.$refs["screenPopup"].close();
|
|
},
|
|
/**
|
|
* 点击筛选弹窗确定
|
|
*/
|
|
clickCertain() {
|
|
this.clickCancel();
|
|
this.clickSearch();
|
|
},
|
|
/**
|
|
* 点击筛选分类
|
|
* @param {Object} index
|
|
*/
|
|
clickScreenCategoryItem(index) {
|
|
if (this.selectScreenCategory != index) {
|
|
this.selectScreenCategory = index;
|
|
}
|
|
},
|
|
/**
|
|
* 点击选择一级分类
|
|
* @param {Object} index
|
|
*/
|
|
clickTopCategoryItem(event, index) {
|
|
if (this.selectTopCategory != index) {
|
|
this.selectTopCategory = index;
|
|
this.selectSecondCategory = 0;
|
|
let offsetLeft = event.currentTarget.offsetLeft;
|
|
this.topScrollLeft = offsetLeft - this.topScrollWidth / 2;
|
|
if (index == 0) {
|
|
this.listTop = this.contentTop + (22 + 80 + 72) / 750 * this.windowWidth;
|
|
} else
|
|
this.listTop = this.contentTop + (22 + 80 + 72 + 42 + 42) / 750 * this.windowWidth;
|
|
if (this.selectTimeCategory == 0) {
|
|
this.getEventListData();
|
|
} else
|
|
this.getHotEventListData();
|
|
}
|
|
},
|
|
/**
|
|
* 点击选择二级分类
|
|
* @param {Object} index
|
|
*/
|
|
clickSecondCategoryItem(event, index) {
|
|
if (this.selectSecondCategory != index) {
|
|
this.selectSecondCategory = index;
|
|
let offsetLeft = event.currentTarget.offsetLeft;
|
|
this.secondScrollLeft = offsetLeft - this.secondScrollWidth / 2;
|
|
if (this.selectTimeCategory == 0) {
|
|
this.getEventListData();
|
|
} else
|
|
this.getHotEventListData();
|
|
}
|
|
},
|
|
/**
|
|
* 点击上个月
|
|
*/
|
|
clickPreMonth() {
|
|
if (this.selectMonthIndex > 0) {
|
|
this.selectMonthIndex--;
|
|
let monthList = this.monthDateList[this.selectMonthIndex];
|
|
let month = "";
|
|
for (let item of monthList) {
|
|
if (item.isCurrentMonth) {
|
|
month = item.month;
|
|
break;
|
|
}
|
|
}
|
|
this.selectMonth = this.monthDateList[this.selectMonthIndex][0].year + "-" + (month > 9 ? month : "0" + month);
|
|
}
|
|
},
|
|
/**
|
|
* 点击下个月
|
|
*/
|
|
clickNextMonth() {
|
|
if (this.selectMonthIndex < this.monthDateList.length - 1) {
|
|
this.selectMonthIndex++;
|
|
let monthList = this.monthDateList[this.selectMonthIndex];
|
|
let month = "";
|
|
for (let item of monthList) {
|
|
if (item.isCurrentMonth) {
|
|
month = item.month;
|
|
break;
|
|
}
|
|
}
|
|
this.selectMonth = this.monthDateList[this.selectMonthIndex][0].year + "-" + (month > 9 ? month : "0" + month);
|
|
}
|
|
},
|
|
/**
|
|
* 点击选择开始日期和结束日期
|
|
* @param {Object} item
|
|
*/
|
|
clickSelectDate(item) {
|
|
if (this.startDate) {
|
|
if (this.endDate) {
|
|
this.startDate = item.date;
|
|
this.startTimeStamp = item.timestamp;
|
|
this.endDate = null;
|
|
this.endTimeStamp = null;
|
|
} else {
|
|
let date1 = new Date(this.startDate);
|
|
let date2 = new Date(item.date);
|
|
if (date1 > date2) {
|
|
this.endDate = this.startDate;
|
|
this.endTimeStamp = this.startTimeStamp;
|
|
this.startDate = item.date;
|
|
this.startTimeStamp = item.timestamp;
|
|
} else {
|
|
this.endDate = item.date;
|
|
this.endTimeStamp = item.timestamp;
|
|
}
|
|
}
|
|
} else {
|
|
this.startDate = item.date;
|
|
this.startTimeStamp = item.timestamp;
|
|
}
|
|
},
|
|
/**
|
|
* 选择行业分类一级分类
|
|
*/
|
|
clickIndustryTopCategoryItem(index) {
|
|
if (this.selectIndustryTopCategory != index) {
|
|
this.selectIndustryTopCategory = index;
|
|
}
|
|
},
|
|
/**
|
|
* 行业分类搜索
|
|
*/
|
|
industrySearch(e) {
|
|
let keywords = e.detail.value;
|
|
this.industryKeywords = keywords;
|
|
let arr = [];
|
|
for (let item of this.industryCategoryList) {
|
|
let index = this.industryCategoryList.indexOf(item);
|
|
for (let item1 of item.hierarchy) {
|
|
let index1 = item.hierarchy.indexOf(item1);
|
|
let arr1 = [];
|
|
if (item1.level1_sector.indexOf(keywords) > -1) {
|
|
arr1.push(item1);
|
|
arr.push({ classification_name: item.classification_name, hierarchy: arr1 });
|
|
}
|
|
for (let item2 of item1.level2_sectors) {
|
|
let index2 = item1.level2_sectors.indexOf(item2);
|
|
let arr2 = [];
|
|
if (item2.level2_sector.indexOf(keywords) > -1) {
|
|
arr2.push(item2);
|
|
arr1.push({ level1_sector: item1.level1_sector, level2_sectors: arr2 });
|
|
arr.push({ classification_name: item.classification_name, hierarchy: arr1 });
|
|
}
|
|
for (let item3 of item2.level3_sectors) {
|
|
let index3 = item2.level3_sectors.indexOf(item3);
|
|
let arr3 = [];
|
|
if (item3.level3_sector.indexOf(keywords) > -1) {
|
|
item3.index = index;
|
|
item3.index1 = index1;
|
|
item3.index2 = index2;
|
|
item3.index3 = index3;
|
|
arr3.push(item3);
|
|
arr2.push({ level2_sector: item2.level2_sector, level3_sectors: arr3 });
|
|
arr1.push({ level1_sector: item1.level1_sector, level2_sectors: arr2 });
|
|
arr.push({ classification_name: item.classification_name, hierarchy: arr1 });
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.searchResultList = arr;
|
|
},
|
|
/**
|
|
* 点击选择搜索结果
|
|
* @param {Object} item
|
|
*/
|
|
clickIndustrySearchItem(item) {
|
|
this.industryKeywords = "";
|
|
this.selectIndustryTopCategory = item.index;
|
|
this.selectIndustrySecondCategory = item.index1;
|
|
this.selectIndustryThirdCategory = item.index2;
|
|
this.selectIndustryForthCategory = item.index3;
|
|
},
|
|
/**
|
|
* 选择行业分类二级分类
|
|
*/
|
|
clickIndustrySecondCategoryItem(index) {
|
|
if (this.selectIndustrySecondCategory != index) {
|
|
this.selectIndustrySecondCategory = index;
|
|
}
|
|
this.industryCategoryList[this.selectIndustryTopCategory].hierarchy[index].isSpread = !this.industryCategoryList[this.selectIndustryTopCategory].hierarchy[index].isSpread;
|
|
},
|
|
/**
|
|
* 选择行业分类三级分类
|
|
*/
|
|
clickIndustryThirdCategoryItem(sindex, index) {
|
|
if (this.selectIndustrySecondCategory != sindex) {
|
|
this.selectIndustrySecondCategory = sindex;
|
|
}
|
|
if (this.selectIndustryThirdCategory != index) {
|
|
this.selectIndustryThirdCategory = index;
|
|
}
|
|
this.industryCategoryList[this.selectIndustryTopCategory].hierarchy[sindex].level2_sectors[index].isSpread = !this.industryCategoryList[this.selectIndustryTopCategory].hierarchy[sindex].level2_sectors[index].isSpread;
|
|
},
|
|
/**
|
|
* 选择行业分类四级分类
|
|
*/
|
|
clickIndustryForthCategoryItem(sindex, tindex, index) {
|
|
if (this.selectIndustrySecondCategory != sindex) {
|
|
this.selectIndustrySecondCategory = sindex;
|
|
}
|
|
if (this.selectIndustryThirdCategory != tindex) {
|
|
this.selectIndustryThirdCategory = tindex;
|
|
}
|
|
if (this.selectIndustryForthCategory != index) {
|
|
this.selectIndustryForthCategory = index;
|
|
}
|
|
},
|
|
/**
|
|
* 删除选中的行业二级分类
|
|
*/
|
|
deleteIndustrySecondCategoryItem() {
|
|
this.selectIndustrySecondCategory = -1;
|
|
this.selectIndustryThirdCategory = -1;
|
|
this.selectIndustryForthCategory = -1;
|
|
},
|
|
/**
|
|
* 删除选中的行业三级分类
|
|
*/
|
|
deleteIndustryThirdCategoryItem() {
|
|
this.selectIndustryThirdCategory = -1;
|
|
this.selectIndustryForthCategory = -1;
|
|
},
|
|
/**
|
|
* 删除选中的行业四级分类
|
|
*/
|
|
deleteIndustryForthCategoryItem() {
|
|
this.selectIndustryForthCategory = -1;
|
|
},
|
|
/**
|
|
* 点击选择重要性
|
|
*/
|
|
clickImportanceItem(index) {
|
|
if (this.selectImportanceIndex != index) {
|
|
this.selectImportanceIndex = index;
|
|
}
|
|
},
|
|
/**
|
|
* 点击展开收起内容
|
|
* @param {Object} index
|
|
*/
|
|
clickExpandOrRetract(index) {
|
|
this.eventList[index].isExpand = !this.eventList[index].isExpand;
|
|
},
|
|
/**
|
|
* 点击相关股票
|
|
* @param {Object} id 事件id
|
|
* @param {Object} code 股票代码
|
|
*/
|
|
clickLookRelatedStockItem(id, code) {
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/index/stockDetails/stockDetails?type=1&code=" + code + "&id=" + id
|
|
});
|
|
},
|
|
/**
|
|
* 点击关注事件
|
|
* @param {Object} id
|
|
*/
|
|
clickFollowEvent(id) {
|
|
request_api.followEvent(id).then((res) => {
|
|
common_vendor.index.showToast({
|
|
title: res.message,
|
|
icon: "none"
|
|
});
|
|
this.clickSearch();
|
|
}).catch((error) => {
|
|
});
|
|
},
|
|
/**
|
|
* 查看事件详情
|
|
*/
|
|
clickEventItem(id) {
|
|
let that = this;
|
|
common_vendor.index.$on("editSuccess", (res) => {
|
|
that.clickSearch();
|
|
common_vendor.index.$off("editSuccess");
|
|
});
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/index/eventDetails/eventDetails?id=" + id
|
|
});
|
|
},
|
|
/**
|
|
* 获取事件筛选项
|
|
*/
|
|
getEventFilterListData() {
|
|
return new Promise((resolve, reject) => {
|
|
request_api.filterOptions().then((res) => {
|
|
if (res.code == 200) {
|
|
resolve(1);
|
|
let timeList = [...res.data.sort_options];
|
|
this.timeCategoryList = timeList.splice(0, 2);
|
|
let sortList = [...res.data.sort_options];
|
|
for (let item of sortList) {
|
|
if (item.name == "最新") {
|
|
item.icon = "/static/icon/home/new.png";
|
|
}
|
|
if (item.name == "热门") {
|
|
item.icon = "/static/icon/home/hot.png";
|
|
}
|
|
if (item.name == "收益率") {
|
|
item.icon = "/static/icon/home/yield.png";
|
|
}
|
|
}
|
|
this.sortList = res.data.sort_options.splice(0, 3);
|
|
this.importanceList = res.data.importance_options;
|
|
this.importanceList.unshift({ desc: "全部", key: "all", name: "全部" });
|
|
} else {
|
|
resolve(1);
|
|
common_vendor.index.showToast({
|
|
title: res.message,
|
|
icon: "none"
|
|
});
|
|
}
|
|
}).catch((error) => {
|
|
reject(1);
|
|
});
|
|
});
|
|
},
|
|
/**
|
|
* 获取行业分类
|
|
*/
|
|
getIndustryCategoryListData() {
|
|
return new Promise((resolve, reject) => {
|
|
request_api.industryCategoryList().then((res) => {
|
|
this.industryCategoryList = res.data;
|
|
resolve(1);
|
|
}).catch((error) => {
|
|
reject(1);
|
|
});
|
|
});
|
|
},
|
|
/**
|
|
* 获取股票分类
|
|
*/
|
|
getStockCategoryListData() {
|
|
return new Promise((resolve, reject) => {
|
|
request_api.stockCategoryList().then((res) => {
|
|
if (res.code == 200) {
|
|
for (let item of res.data) {
|
|
item.sub_sectors.unshift("全部");
|
|
}
|
|
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 = { page: this.page, q: this.keywords };
|
|
if (this.selectTopCategory > 0) {
|
|
param.stock_sector = this.stockCategoryList[this.selectTopCategory].primary_sector;
|
|
}
|
|
if (this.selectSecondCategory > 0) {
|
|
param.secondary_sector = this.stockCategoryList[this.selectTopCategory].sub_sectors[this.selectSecondCategory];
|
|
}
|
|
if (this.startDate) {
|
|
param.start_date = this.startDate;
|
|
}
|
|
if (this.endDate) {
|
|
param.end_date = this.endDate;
|
|
}
|
|
if (this.selectImportanceIndex > 0) {
|
|
param.importance = this.importanceList[this.selectImportanceIndex].key;
|
|
}
|
|
if (this.selectSortKey) {
|
|
param.sort = this.selectSortKey;
|
|
}
|
|
if (this.selectIndustryForthCategory > -1) {
|
|
param.industry_level = 4;
|
|
param.industry_classification = this.industryCategoryList[this.selectIndustryTopCategory].hierarchy[this.selectIndustrySecondCategory].level2_sectors[this.selectIndustryThirdCategory].level3_sectors[this.selectIndustryForthCategory].level3_sector;
|
|
} else {
|
|
if (this.selectIndustryThirdCategory > -1) {
|
|
param.industry_level = 3;
|
|
param.industry_classification = this.industryCategoryList[this.selectIndustryTopCategory].hierarchy[this.selectIndustrySecondCategory].level2_sectors[this.selectIndustryThirdCategory].level2_sector;
|
|
} else {
|
|
if (this.selectIndustrySecondCategory > -1) {
|
|
param.industry_level = 2;
|
|
param.industry_classification = this.industryCategoryList[this.selectIndustryTopCategory].hierarchy[this.selectIndustrySecondCategory].level1_sector;
|
|
} else {
|
|
param.industry_level = 1;
|
|
param.industry_classification = this.industryCategoryList[this.selectIndustryTopCategory].classification_name;
|
|
}
|
|
}
|
|
}
|
|
request_api.eventList(param).then((res) => {
|
|
this.isRefreshing = false;
|
|
if (res.success) {
|
|
if (this.page == 1) {
|
|
this.eventList = res.data.events;
|
|
} else
|
|
this.eventList = this.eventList.concat(res.data.events);
|
|
this.loadAll = !res.data.pagination.has_next;
|
|
}
|
|
}).catch((error) => {
|
|
this.isRefreshing = false;
|
|
});
|
|
},
|
|
/**
|
|
* 获取热门事件数据
|
|
*/
|
|
getHotEventListData() {
|
|
let param = { page: this.page, q: this.keywords };
|
|
if (this.selectTopCategory > 0) {
|
|
param.stock_sector = this.stockCategoryList[this.selectTopCategory].primary_sector;
|
|
}
|
|
if (this.selectSecondCategory > 0) {
|
|
param.secondary_sector = this.stockCategoryList[this.selectTopCategory].sub_sectors[this.selectSecondCategory];
|
|
}
|
|
if (this.startDate) {
|
|
param.start_date = this.startDate;
|
|
}
|
|
if (this.endDate) {
|
|
param.end_date = this.endDate;
|
|
}
|
|
if (this.selectImportanceIndex > 0) {
|
|
param.importance = this.importanceList[this.selectImportanceIndex].key;
|
|
}
|
|
if (this.selectSortKey) {
|
|
param.sort = this.selectSortKey;
|
|
}
|
|
request_api.homeData(param).then((res) => {
|
|
if (res.code == 200) {
|
|
if (this.page == 1) {
|
|
this.eventList = res.data.events;
|
|
} else
|
|
this.eventList = this.eventList.concat(res.data.events);
|
|
} else
|
|
common_vendor.index.showToast({
|
|
title: res.message,
|
|
icon: "none"
|
|
});
|
|
}).catch((error) => {
|
|
});
|
|
}
|
|
}
|
|
};
|
|
if (!Array) {
|
|
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
|
|
_easycom_uni_popup2();
|
|
}
|
|
const _easycom_uni_popup = () => "../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
|
|
if (!Math) {
|
|
_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: $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.f($data.timeCategoryList, (item, index, i0) => {
|
|
return {
|
|
a: common_vendor.t(item.name),
|
|
b: common_vendor.n("item " + ($data.selectTimeCategory == index ? "select" : "")),
|
|
c: index,
|
|
d: common_vendor.o(($event) => $options.clickTimeCategoryItem(index), index)
|
|
};
|
|
}),
|
|
i: common_assets._imports_2$1,
|
|
j: common_vendor.o(($event) => $options.clickSort()),
|
|
k: common_assets._imports_3$1,
|
|
l: common_vendor.o(($event) => $options.clickScreenItem()),
|
|
m: common_vendor.f($data.stockCategoryList, (item, index, i0) => {
|
|
return {
|
|
a: common_vendor.t(item.primary_sector),
|
|
b: common_vendor.n("item relative " + ($data.selectTopCategory == index ? "select" : "")),
|
|
c: index,
|
|
d: common_vendor.o(($event) => $options.clickTopCategoryItem($event, index), index)
|
|
};
|
|
}),
|
|
n: $data.topScrollLeft,
|
|
o: $data.stockCategoryList.length > 0 && $data.stockCategoryList[$data.selectTopCategory].sub_sectors.length > 0
|
|
}, $data.stockCategoryList.length > 0 && $data.stockCategoryList[$data.selectTopCategory].sub_sectors.length > 0 ? {
|
|
p: common_vendor.f($data.stockCategoryList[$data.selectTopCategory].sub_sectors, (item, index, i0) => {
|
|
return {
|
|
a: common_vendor.t(item),
|
|
b: common_vendor.n("item " + ($data.selectSecondCategory == index ? "select" : "")),
|
|
c: index,
|
|
d: common_vendor.o(($event) => $options.clickSecondCategoryItem($event, index), index)
|
|
};
|
|
}),
|
|
q: $data.secondScrollLeft
|
|
} : {}, {
|
|
r: common_vendor.s("top:" + $data.contentTop + "px"),
|
|
s: common_vendor.f($data.eventList, (item, index, i0) => {
|
|
return common_vendor.e({
|
|
a: common_vendor.t(item.importance),
|
|
b: common_vendor.n("level " + item.importance),
|
|
c: common_vendor.t(item.title),
|
|
d: common_vendor.t(item.description),
|
|
e: common_vendor.n("content " + (item.isExpand ? "" : "retract")),
|
|
f: common_vendor.o(($event) => $options.clickExpandOrRetract(index), index),
|
|
g: $data.getRateUpOrDown(item.related_avg_chg)
|
|
}, $data.getRateUpOrDown(item.related_avg_chg) ? {
|
|
h: common_assets._imports_1$1
|
|
} : {
|
|
i: common_assets._imports_2$2
|
|
}, {
|
|
j: common_vendor.t($data.getRateStr(item.related_avg_chg)),
|
|
k: common_vendor.n("rateItem " + ($data.getRateUpOrDown(item.related_avg_chg) ? "down" : "up")),
|
|
l: $data.getRateUpOrDown(item.related_max_chg)
|
|
}, $data.getRateUpOrDown(item.related_max_chg) ? {
|
|
m: common_assets._imports_1$1
|
|
} : {
|
|
n: common_assets._imports_2$2
|
|
}, {
|
|
o: common_vendor.t($data.getRateStr(item.related_max_chg)),
|
|
p: common_vendor.n("rateItem " + ($data.getRateUpOrDown(item.related_max_chg) ? "down" : "up")),
|
|
q: $data.getRateUpOrDown(item.related_week_chg)
|
|
}, $data.getRateUpOrDown(item.related_week_chg) ? {
|
|
r: common_assets._imports_1$1
|
|
} : {
|
|
s: common_assets._imports_2$2
|
|
}, {
|
|
t: common_vendor.t($data.getRateStr(item.related_week_chg)),
|
|
v: common_vendor.n("rateItem " + ($data.getRateUpOrDown(item.related_week_chg) ? "down" : "up")),
|
|
w: common_vendor.t($data.getLocaleTime(item.created_at)),
|
|
x: common_vendor.t(item.view_count),
|
|
y: common_vendor.t(item.post_count),
|
|
z: common_vendor.t(item.follower_count),
|
|
A: common_vendor.o(($event) => $options.clickFollowEvent(item.id), index),
|
|
B: common_vendor.o(($event) => $options.clickEventItem(item.id), index),
|
|
C: index
|
|
});
|
|
}),
|
|
t: common_assets._imports_3,
|
|
v: common_assets._imports_4,
|
|
w: common_assets._imports_10,
|
|
x: common_vendor.s("top:" + $data.listTop + "px"),
|
|
y: $data.isRefreshing,
|
|
z: common_vendor.o(($event) => $options.pullDownRefresh()),
|
|
A: common_vendor.o(($event) => $options.loadMoreData()),
|
|
B: common_assets._imports_13$1,
|
|
C: common_vendor.f($data.sortList, (item, index, i0) => {
|
|
return {
|
|
a: item.icon,
|
|
b: common_vendor.t(item.name),
|
|
c: index,
|
|
d: common_vendor.o(($event) => $options.clickSortListItem(item), index)
|
|
};
|
|
}),
|
|
D: common_vendor.s("margin-top:" + $data.sortListTop + "px;"),
|
|
E: common_vendor.sr("sortPopup", "eb4215a0-0"),
|
|
F: common_vendor.p({
|
|
type: "top",
|
|
["mask-background-color"]: "transparent",
|
|
animation: false
|
|
}),
|
|
G: common_assets._imports_2,
|
|
H: common_vendor.s("height:" + $data.menuH + "px;"),
|
|
I: common_vendor.f($data.screenCategoryList, (item, index, i0) => {
|
|
return common_vendor.e({
|
|
a: common_vendor.t(item),
|
|
b: $data.selectScreenCategory == index
|
|
}, $data.selectScreenCategory == index ? {} : {}, {
|
|
c: common_vendor.n("item relative " + ($data.selectScreenCategory == index ? "select" : "")),
|
|
d: index,
|
|
e: common_vendor.o(($event) => $options.clickScreenCategoryItem(index), index)
|
|
});
|
|
}),
|
|
J: $data.selectScreenCategory == 0
|
|
}, $data.selectScreenCategory == 0 ? {
|
|
K: common_vendor.t($data.startDate),
|
|
L: common_vendor.t($data.endDate),
|
|
M: common_assets._imports_5,
|
|
N: common_vendor.o(($event) => $options.clickPreMonth()),
|
|
O: common_vendor.t($data.selectMonth),
|
|
P: common_assets._imports_6,
|
|
Q: common_vendor.o(($event) => $options.clickNextMonth()),
|
|
R: common_vendor.f($data.weekList, (item, index, i0) => {
|
|
return {
|
|
a: common_vendor.t(item),
|
|
b: index
|
|
};
|
|
}),
|
|
S: common_vendor.f($data.monthDateList[$data.selectMonthIndex], (item, index, i0) => {
|
|
return common_vendor.e({
|
|
a: item.isToday
|
|
}, item.isToday ? {
|
|
b: common_vendor.t(item.day)
|
|
} : common_vendor.e({
|
|
c: item.date == $data.startDate || item.date == $data.endDate
|
|
}, item.date == $data.startDate || item.date == $data.endDate ? {
|
|
d: common_vendor.t(item.day)
|
|
} : item.timestamp > $data.startTimeStamp && item.timestamp < $data.endTimeStamp ? {
|
|
f: common_vendor.t(item.day)
|
|
} : common_vendor.e({
|
|
g: !item.isCurrentMonth
|
|
}, !item.isCurrentMonth ? {
|
|
h: common_vendor.t(item.day)
|
|
} : {
|
|
i: common_vendor.t(item.day)
|
|
}), {
|
|
e: item.timestamp > $data.startTimeStamp && item.timestamp < $data.endTimeStamp
|
|
}), {
|
|
j: index,
|
|
k: common_vendor.o(($event) => $options.clickSelectDate(item), index)
|
|
});
|
|
})
|
|
} : {}, {
|
|
T: $data.selectScreenCategory == 1
|
|
}, $data.selectScreenCategory == 1 ? common_vendor.e({
|
|
U: common_vendor.f($data.industryCategoryList, (item, index, i0) => {
|
|
return {
|
|
a: common_vendor.t(item.classification_name),
|
|
b: common_vendor.n("item " + ($data.selectIndustryTopCategory == index ? "select" : "")),
|
|
c: index,
|
|
d: common_vendor.o(($event) => $options.clickIndustryTopCategoryItem(index), index)
|
|
};
|
|
}),
|
|
V: common_assets._imports_1,
|
|
W: common_vendor.o([($event) => $data.industryKeywords = $event.detail.value, (...args) => $options.industrySearch && $options.industrySearch(...args)]),
|
|
X: $data.industryKeywords,
|
|
Y: $data.industryKeywords.length > 0
|
|
}, $data.industryKeywords.length > 0 ? {
|
|
Z: common_vendor.f($data.searchResultList, (item, index, i0) => {
|
|
return {
|
|
a: common_vendor.f(item.hierarchy, (sitem, sindex, i1) => {
|
|
return {
|
|
a: common_vendor.f(sitem.level2_sectors, (titem, tindex, i2) => {
|
|
return {
|
|
a: common_vendor.f(titem.level3_sectors, (fitem, findex, i3) => {
|
|
return {
|
|
a: common_vendor.f(fitem.level3_sector + "/" + titem.level2_sector + "/" + sitem.level1_sector, (citem, cindex, i4) => {
|
|
return {
|
|
a: common_vendor.t(citem),
|
|
b: common_vendor.n($data.industryKeywords.indexOf(citem) > -1 ? "key" : ""),
|
|
c: cindex
|
|
};
|
|
}),
|
|
b: common_vendor.o(($event) => $options.clickIndustrySearchItem(fitem), findex),
|
|
c: findex
|
|
};
|
|
}),
|
|
b: tindex
|
|
};
|
|
}),
|
|
b: sindex
|
|
};
|
|
}),
|
|
b: index
|
|
};
|
|
})
|
|
} : common_vendor.e({
|
|
aa: $data.selectIndustrySecondCategory > -1
|
|
}, $data.selectIndustrySecondCategory > -1 ? common_vendor.e({
|
|
ab: $data.selectIndustrySecondCategory > -1
|
|
}, $data.selectIndustrySecondCategory > -1 ? {
|
|
ac: common_vendor.t($data.industryCategoryList[$data.selectIndustryTopCategory].hierarchy[$data.selectIndustrySecondCategory].level1_sector),
|
|
ad: common_assets._imports_13,
|
|
ae: common_vendor.o(($event) => $options.deleteIndustrySecondCategoryItem())
|
|
} : {}, {
|
|
af: $data.selectIndustryThirdCategory > -1
|
|
}, $data.selectIndustryThirdCategory > -1 ? {
|
|
ag: common_vendor.t($data.industryCategoryList[$data.selectIndustryTopCategory].hierarchy[$data.selectIndustrySecondCategory].level2_sectors[$data.selectIndustryThirdCategory].level2_sector),
|
|
ah: common_assets._imports_13,
|
|
ai: common_vendor.o(($event) => $options.deleteIndustryThirdCategoryItem())
|
|
} : {}, {
|
|
aj: $data.selectIndustryForthCategory > -1
|
|
}, $data.selectIndustryForthCategory > -1 ? {
|
|
ak: common_vendor.t($data.industryCategoryList[$data.selectIndustryTopCategory].hierarchy[$data.selectIndustrySecondCategory].level2_sectors[$data.selectIndustryThirdCategory].level3_sectors[$data.selectIndustryForthCategory].level3_sector),
|
|
al: common_assets._imports_13,
|
|
am: common_vendor.o(($event) => $options.deleteIndustryForthCategoryItem())
|
|
} : {}) : {}, {
|
|
an: common_vendor.t($data.industryCategoryList[$data.selectIndustryTopCategory].classification_name),
|
|
ao: common_vendor.f($data.industryCategoryList[$data.selectIndustryTopCategory].hierarchy, (sitem, sindex, i0) => {
|
|
return common_vendor.e({
|
|
a: common_vendor.t($data.selectIndustrySecondCategory == sindex && sitem.isSpread ? "-" : "+"),
|
|
b: common_vendor.t(sitem.level1_sector),
|
|
c: common_vendor.n("categoryC flex " + ($data.selectIndustrySecondCategory == sindex ? "select" : "")),
|
|
d: common_vendor.o(($event) => $options.clickIndustrySecondCategoryItem(sindex), sindex),
|
|
e: sitem.isSpread
|
|
}, sitem.isSpread ? {
|
|
f: common_vendor.f($data.industryCategoryList[$data.selectIndustryTopCategory].hierarchy[sindex].level2_sectors, (titem, tindex, i1) => {
|
|
return common_vendor.e({
|
|
a: common_vendor.t($data.selectIndustrySecondCategory == sindex && $data.selectIndustryThirdCategory == tindex && titem.isSpread ? "-" : "+"),
|
|
b: common_vendor.t(titem.level2_sector),
|
|
c: common_vendor.n("categoryC flex " + ($data.selectIndustrySecondCategory == sindex && $data.selectIndustryThirdCategory == tindex ? "select" : "")),
|
|
d: common_vendor.o(($event) => $options.clickIndustryThirdCategoryItem(sindex, tindex), tindex),
|
|
e: titem.isSpread
|
|
}, titem.isSpread ? {
|
|
f: common_vendor.f($data.industryCategoryList[$data.selectIndustryTopCategory].hierarchy[sindex].level2_sectors[tindex].level3_sectors, (fitem, findex, i2) => {
|
|
return common_vendor.e({
|
|
a: common_vendor.t(fitem.level3_sector),
|
|
b: $data.selectIndustrySecondCategory == sindex && $data.selectIndustryThirdCategory == tindex && $data.selectIndustryForthCategory == findex
|
|
}, $data.selectIndustrySecondCategory == sindex && $data.selectIndustryThirdCategory == tindex && $data.selectIndustryForthCategory == findex ? {
|
|
c: common_assets._imports_14
|
|
} : {}, {
|
|
d: common_vendor.n("categoryC flex " + ($data.selectIndustrySecondCategory == sindex && $data.selectIndustryThirdCategory == tindex && $data.selectIndustryForthCategory == findex ? "select" : "")),
|
|
e: common_vendor.o(($event) => $options.clickIndustryForthCategoryItem(sindex, tindex, findex), findex),
|
|
f: findex
|
|
});
|
|
})
|
|
} : {}, {
|
|
g: tindex
|
|
});
|
|
})
|
|
} : {}, {
|
|
g: sindex
|
|
});
|
|
})
|
|
})) : {}, {
|
|
ap: $data.selectScreenCategory == 2
|
|
}, $data.selectScreenCategory == 2 ? {
|
|
aq: common_vendor.f($data.importanceList, (item, index, i0) => {
|
|
return {
|
|
a: common_vendor.t(item.name),
|
|
b: common_vendor.n("item " + ($data.selectImportanceIndex == index ? "select" : "")),
|
|
c: index,
|
|
d: common_vendor.o(($event) => $options.clickImportanceItem(index), index)
|
|
};
|
|
})
|
|
} : {}, {
|
|
ar: common_vendor.o(($event) => $options.clickCancel()),
|
|
as: common_vendor.o(($event) => $options.clickCertain()),
|
|
at: common_vendor.s("padding-top:" + $data.menuTop + "px;"),
|
|
av: common_vendor.sr("screenPopup", "eb4215a0-1"),
|
|
aw: common_vendor.p({
|
|
type: "top"
|
|
})
|
|
});
|
|
}
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
wx.createPage(MiniProgramPage);
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/index/index.js.map
|