7.10 增加登录页面,事件详情接口对接,我的点赞,关注收藏页面搭建,接口对接

This commit is contained in:
尚政杰
2025-07-10 18:08:16 +08:00
parent c4267a0e27
commit 58b3414bdd
356 changed files with 7710 additions and 978 deletions

View File

@@ -1,6 +1,7 @@
"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() {
@@ -21,14 +22,19 @@ const _sfc_main = {
//是否展开日期
tabList: ["事件", "数据"],
selectTab: 0,
topCategoryList: ["全部", "大周期", "大消费", "大金融地产", "TMT板块", "公共产业板块"],
stockCategoryList: [],
selectTopCategory: 0,
listTop: "",
todayDate: "",
//今日日期
selectDate: "",
//选择查看的日期
progress: 75,
eventList: []
eventList: [],
//事件列表
dataList: [],
//数据列表
getLocaleHourMinute: utils_util.getLocaleHourMinute
};
},
onLoad() {
@@ -37,7 +43,7 @@ const _sfc_main = {
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
this.selectDate = date.getFullYear() + "-" + (month > 9 ? month : "0" + month) + "-" + (day > 9 ? day : "0" + day);
this.todayDate = this.selectDate = date.getFullYear() + "-" + (month > 9 ? month : "0" + month) + "-" + (day > 9 ? day : "0" + day);
let week = date.getDay() || 7;
let diff = week - 1;
let daysOfWeek = [];
@@ -85,6 +91,7 @@ const _sfc_main = {
}
this.monthDateList = daysOfMonth;
this.listTop = this.contentTop + (68 + 40 + 96 + 74 + 70 + 74 + 22) / 750 * common_vendor.inject("windowWidth");
this.getStockCategoryListData();
this.getEventListData();
this.getCurrentMonthEventCountData();
},
@@ -94,6 +101,18 @@ const _sfc_main = {
}
},
methods: {
/**
* 点击今日日期
*/
clickTodayDate() {
if (this.selectDate != this.todayDate) {
this.selectDate = this.todayDate;
if (this.selectTab == 0) {
this.getEventListData();
} else
this.getDataListData();
}
},
/**
* 点击展开或收起
*/
@@ -111,7 +130,10 @@ const _sfc_main = {
clickSelectDate(item) {
if (this.selectDate != item.date) {
this.selectDate = item.date;
this.getEventListData();
if (this.selectTab == 0) {
this.getEventListData();
} else
this.getDataListData();
}
},
/**
@@ -120,6 +142,10 @@ const _sfc_main = {
clickTabItem(index) {
if (this.selectTab != index) {
this.selectTab = index;
if (this.selectTab == 0) {
this.getEventListData();
} else
this.getDataListData();
}
},
/**
@@ -128,28 +154,68 @@ const _sfc_main = {
clickTopCategoryItem(index) {
if (this.selectTopCategory != index) {
this.selectTopCategory = index;
if (this.selectTab == 0) {
this.getEventListData();
} else
this.getDataListData();
}
},
/**
* 点击查看事件详情
*/
clickEventItem() {
clickEventItem(id) {
common_vendor.index.navigateTo({
url: "/pages/invest/investDetails/investDetails"
url: "/pages/invest/investDetails/investDetails?id=" + id
});
},
/**
* 获取股票分类
*/
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) => {
});
},
/**
* 获取事件列表数据
*/
getEventListData() {
let param = { date: this.selectDate };
let param = { start: this.selectDate };
if (this.selectTopCategory > 0) {
param.category = this.stockCategoryList[this.selectTopCategory].primary_sector;
}
request_api.calendarEventList(param).then((res) => {
for (let item of res) {
let calendarTime = item.calendar_time;
let time = calendarTime.split("T")[1];
item.time = time.substr(0, 5);
}
this.eventList = res;
if (res.code == 200) {
this.eventList = res.data.events;
} else
common_vendor.index.showToast({
title: res.message,
icon: "none"
});
}).catch((error) => {
});
},
/**
* 获取事件列表数据
*/
getDataListData() {
let param = { start: this.selectDate };
request_api.calendarDataList(param).then((res) => {
if (res.code == 200) {
this.dataList = res.data.data_list;
} else
common_vendor.index.showToast({
title: res.message,
icon: "none"
});
}).catch((error) => {
});
},
@@ -195,72 +261,91 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
e: common_vendor.t($data.selectDate),
f: common_assets._imports_2$3,
g: common_vendor.o(($event) => $options.clickExpandOrRetract()),
h: common_vendor.f($data.weekList, (item, index, i0) => {
h: common_vendor.o(($event) => $options.clickTodayDate()),
i: common_vendor.f($data.weekList, (item, index, i0) => {
return {
a: common_vendor.t(item),
b: index
};
}),
i: $data.isExpand
j: $data.isExpand
}, $data.isExpand ? {
j: common_vendor.f($data.monthDateList, (item, index, i0) => {
return common_vendor.e({
a: common_vendor.t(item.day),
b: common_vendor.n("date " + (item.isToday ? "today" : item.isCurrentMonth ? "" : " notCurrentMonth")),
c: item.className
k: 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 ? {
b: common_vendor.t(item.day)
} : {
c: common_vendor.t(item.day),
d: common_vendor.n("date " + (item.isCurrentMonth ? "" : " notCurrentMonth"))
}) : {
e: common_vendor.t(item.day),
f: common_vendor.n("date " + (item.isToday ? "today" : item.isCurrentMonth ? "" : " notCurrentMonth"))
}, {
g: item.className
}, item.className ? common_vendor.e({
d: item.className == "bg-gradient-danger"
h: item.className == "bg-gradient-danger"
}, item.className == "bg-gradient-danger" ? {
e: common_vendor.t(item.eventCount)
} : {}, {
f: item.className == "bg-gradient-warning"
}, item.className == "bg-gradient-warning" ? {
g: common_vendor.t(item.eventCount)
} : {}, {
h: item.className == "bg-gradient-info"
}, item.className == "bg-gradient-info" ? {
i: common_vendor.t(item.eventCount)
} : {}, {
j: item.className == "bg-gradient-success"
}, item.className == "bg-gradient-success" ? {
j: item.className == "bg-gradient-warning"
}, item.className == "bg-gradient-warning" ? {
k: common_vendor.t(item.eventCount)
} : {}, {
l: item.className == "bg-gradient-info"
}, item.className == "bg-gradient-info" ? {
m: common_vendor.t(item.eventCount)
} : {}, {
n: item.className == "bg-gradient-success"
}, item.className == "bg-gradient-success" ? {
o: common_vendor.t(item.eventCount)
} : {}) : {}, {
l: index,
m: common_vendor.o(($event) => $options.clickSelectDate(item), index)
p: index,
q: common_vendor.o(($event) => $options.clickSelectDate(item), index)
});
})
}),
l: $data.selectDate != $data.todayDate
} : {
k: common_vendor.f($data.weekDateList, (item, index, i0) => {
return common_vendor.e({
a: common_vendor.t(item.day),
b: common_vendor.n("date " + (item.isToday ? "today" : "")),
c: item.className
m: 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 ? {
b: common_vendor.t(item.day)
} : {
c: common_vendor.t(item.day),
d: common_vendor.n("date " + (item.isCurrentMonth ? "" : " notCurrentMonth"))
}) : {
e: common_vendor.t(item.day),
f: common_vendor.n("date " + (item.isToday ? "today" : item.isCurrentMonth ? "" : " notCurrentMonth"))
}, {
g: item.className
}, item.className ? common_vendor.e({
d: item.className == "bg-gradient-danger"
h: item.className == "bg-gradient-danger"
}, item.className == "bg-gradient-danger" ? {
e: common_vendor.t(item.eventCount)
} : {}, {
f: item.className == "bg-gradient-warning"
}, item.className == "bg-gradient-warning" ? {
g: common_vendor.t(item.eventCount)
} : {}, {
h: item.className == "bg-gradient-info"
}, item.className == "bg-gradient-info" ? {
i: common_vendor.t(item.eventCount)
} : {}, {
j: item.className == "bg-gradient-success"
}, item.className == "bg-gradient-success" ? {
j: item.className == "bg-gradient-warning"
}, item.className == "bg-gradient-warning" ? {
k: common_vendor.t(item.eventCount)
} : {}, {
l: item.className == "bg-gradient-info"
}, item.className == "bg-gradient-info" ? {
m: common_vendor.t(item.eventCount)
} : {}, {
n: item.className == "bg-gradient-success"
}, item.className == "bg-gradient-success" ? {
o: common_vendor.t(item.eventCount)
} : {}) : {}, {
l: common_vendor.o(($event) => $options.clickSelectDate(item), index),
m: index
p: common_vendor.o(($event) => $options.clickSelectDate(item), index),
q: index
});
})
}),
n: $data.selectDate != $data.todayDate
}, {
l: common_vendor.t($data.isExpand ? "收起" : "展开"),
m: common_assets._imports_3$2,
n: common_vendor.o(($event) => $options.clickExpandOrRetract()),
o: common_vendor.f($data.tabList, (item, index, i0) => {
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) => {
return {
a: common_vendor.t(item),
b: common_vendor.n("item " + ($data.selectTab == index ? "select" : "")),
@@ -268,9 +353,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
d: common_vendor.o(($event) => $options.clickTabItem(index), index)
};
}),
p: common_vendor.f($data.topCategoryList, (item, index, i0) => {
s: common_vendor.f($data.stockCategoryList, (item, index, i0) => {
return common_vendor.e({
a: common_vendor.t(item),
a: common_vendor.t(item.primary_sector),
b: $data.selectTopCategory == index
}, $data.selectTopCategory == index ? {} : {}, {
c: common_vendor.n("item relative " + ($data.selectTopCategory == index ? "select" : "")),
@@ -278,20 +363,23 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
e: common_vendor.o(($event) => $options.clickTopCategoryItem(index), index)
});
}),
q: $data.selectTab == 0
t: $data.selectTab == 0
}, $data.selectTab == 0 ? {
r: common_vendor.f($data.eventList, (item, index, i0) => {
return {
a: common_vendor.t(item.time),
v: 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"
};
}),
c: index,
d: common_vendor.t(item.title),
e: common_vendor.t(item.forecast),
f: common_vendor.f(JSON.parse(item.concepts), (citem, cindex, i1) => {
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) => {
return {
a: common_vendor.t(citem[0]),
b: common_vendor.t(citem[2] * 100),
@@ -305,28 +393,36 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
}),
e: cindex
};
}),
g: index,
h: common_vendor.o(($event) => $options.clickEventItem(), index)
};
})
} : {}, {
i: index,
j: common_vendor.o(($event) => $options.clickEventItem(item.id), index)
});
})
} : {}, {
s: $data.selectTab == 1
w: $data.selectTab == 1
}, $data.selectTab == 1 ? {
t: common_vendor.f(5, (item, index, i0) => {
x: common_vendor.f($data.dataList, (item, index, i0) => {
return {
a: index
a: common_vendor.t($data.getLocaleHourMinute(item.created_at)),
b: common_vendor.f(5, (item2, index2, i1) => {
return {
a: index2
};
}),
c: common_vendor.f(5, (item2, index2, i1) => {
return {
a: index2
};
}),
d: common_vendor.t(item.title),
e: index
};
}),
v: common_assets._imports_4$1,
w: common_vendor.f(5, (item, index, i0) => {
return {
a: index
};
}),
x: common_assets._imports_5$1
y: common_assets._imports_4$1,
z: common_assets._imports_5
} : {}, {
y: common_vendor.s("top:" + $data.contentTop + "px;")
A: common_vendor.s("top:" + $data.contentTop + "px;")
});
}
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);