335 lines
12 KiB
JavaScript
335 lines
12 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const request_api = require("../../request/api.js");
|
|
const common_assets = require("../../common/assets.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: "",
|
|
todayDate: "",
|
|
//今日日期
|
|
weekList: ["一", "二", "三", "四", "五", "六", "日"],
|
|
weekDateList: [],
|
|
//当前周日期
|
|
monthDateList: [],
|
|
//当前月日期
|
|
isExpand: false,
|
|
//是否展开日期
|
|
tabList: ["事件", "数据"],
|
|
selectTab: 0,
|
|
topCategoryList: ["全部", "大周期", "大消费", "大金融地产", "TMT板块", "公共产业板块"],
|
|
selectTopCategory: 0,
|
|
listTop: "",
|
|
selectDate: "",
|
|
//选择查看的日期
|
|
progress: 75,
|
|
eventList: []
|
|
//事件列表
|
|
};
|
|
},
|
|
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.selectDate = date.getFullYear() + "-" + (month > 9 ? month : "0" + month) + "-" + (day > 9 ? day : "0" + day);
|
|
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);
|
|
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 });
|
|
}
|
|
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 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.listTop = this.contentTop + (68 + 40 + 96 + 74 + 70 + 74 + 22) / 750 * common_vendor.inject("windowWidth");
|
|
this.getEventListData();
|
|
this.getCurrentMonthEventCountData();
|
|
},
|
|
computed: {
|
|
circumference() {
|
|
return Math.PI * 100;
|
|
}
|
|
},
|
|
methods: {
|
|
/**
|
|
* 点击展开或收起
|
|
*/
|
|
clickExpandOrRetract() {
|
|
this.isExpand = !this.isExpand;
|
|
if (this.isExpand) {
|
|
this.listTop = this.contentTop + (68 + 40 + 96 * 6 + 74 + 70 + 74 + 22) / 750 * this.windowWidth;
|
|
} else
|
|
this.listTop = this.contentTop + (68 + 40 + 96 + 74 + 70 + 74 + 22) / 750 * this.windowWidth;
|
|
},
|
|
/**
|
|
* 选中日期
|
|
* @param {Object} item
|
|
*/
|
|
clickSelectDate(item) {
|
|
if (this.selectDate != item.date) {
|
|
this.selectDate = item.date;
|
|
this.getEventListData();
|
|
}
|
|
},
|
|
/**
|
|
* 点击切换事件或者数据
|
|
*/
|
|
clickTabItem(index) {
|
|
if (this.selectTab != index) {
|
|
this.selectTab = index;
|
|
}
|
|
},
|
|
/**
|
|
* 选择一级分类
|
|
*/
|
|
clickTopCategoryItem(index) {
|
|
if (this.selectTopCategory != index) {
|
|
this.selectTopCategory = index;
|
|
}
|
|
},
|
|
/**
|
|
* 点击查看事件详情
|
|
*/
|
|
clickEventItem() {
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/invest/investDetails/investDetails"
|
|
});
|
|
},
|
|
/**
|
|
* 获取事件列表数据
|
|
*/
|
|
getEventListData() {
|
|
let param = { date: this.selectDate };
|
|
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;
|
|
}).catch((error) => {
|
|
});
|
|
},
|
|
/**
|
|
* 获取当前月份每一天的事件数量
|
|
*/
|
|
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;
|
|
}
|
|
}
|
|
for (let s of this.monthDateList) {
|
|
if (s.date == date) {
|
|
s.eventCount = item.title;
|
|
s.className = item.className;
|
|
}
|
|
}
|
|
}
|
|
}).catch((error) => {
|
|
});
|
|
}
|
|
}
|
|
};
|
|
if (!Array) {
|
|
const _easycom_zui_progress_circle2 = common_vendor.resolveComponent("zui-progress-circle");
|
|
_easycom_zui_progress_circle2();
|
|
}
|
|
const _easycom_zui_progress_circle = () => "../../uni_modules/zui-progress-circle/components/zui-progress-circle/zui-progress-circle.js";
|
|
if (!Math) {
|
|
_easycom_zui_progress_circle();
|
|
}
|
|
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.f($data.weekList, (item, index, i0) => {
|
|
return {
|
|
a: common_vendor.t(item),
|
|
b: index
|
|
};
|
|
}),
|
|
i: $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
|
|
}, item.className ? common_vendor.e({
|
|
d: 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" ? {
|
|
k: common_vendor.t(item.eventCount)
|
|
} : {}) : {}, {
|
|
l: index,
|
|
m: common_vendor.o(($event) => $options.clickSelectDate(item), index)
|
|
});
|
|
})
|
|
} : {
|
|
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
|
|
}, item.className ? common_vendor.e({
|
|
d: 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" ? {
|
|
k: common_vendor.t(item.eventCount)
|
|
} : {}) : {}, {
|
|
l: common_vendor.o(($event) => $options.clickSelectDate(item), index),
|
|
m: index
|
|
});
|
|
})
|
|
}, {
|
|
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) => {
|
|
return {
|
|
a: common_vendor.t(item),
|
|
b: common_vendor.n("item " + ($data.selectTab == index ? "select" : "")),
|
|
c: index,
|
|
d: common_vendor.o(($event) => $options.clickTabItem(index), index)
|
|
};
|
|
}),
|
|
p: common_vendor.f($data.topCategoryList, (item, index, i0) => {
|
|
return common_vendor.e({
|
|
a: common_vendor.t(item),
|
|
b: $data.selectTopCategory == index
|
|
}, $data.selectTopCategory == index ? {} : {}, {
|
|
c: common_vendor.n("item relative " + ($data.selectTopCategory == index ? "select" : "")),
|
|
d: index,
|
|
e: common_vendor.o(($event) => $options.clickTopCategoryItem(index), index)
|
|
});
|
|
}),
|
|
q: $data.selectTab == 0
|
|
}, $data.selectTab == 0 ? {
|
|
r: common_vendor.f($data.eventList, (item, index, i0) => {
|
|
return {
|
|
a: common_vendor.t(item.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) => {
|
|
return {
|
|
a: common_vendor.t(citem[0]),
|
|
b: common_vendor.t(citem[2] * 100),
|
|
c: "2cf1ca64-0-" + i0 + "-" + i1,
|
|
d: common_vendor.p({
|
|
position: citem[2],
|
|
range: [270, 630],
|
|
size: 26,
|
|
["ring-width"]: 2,
|
|
texture: ["#F97316", "#E3E3E3"]
|
|
}),
|
|
e: cindex
|
|
};
|
|
}),
|
|
g: index,
|
|
h: common_vendor.o(($event) => $options.clickEventItem(), index)
|
|
};
|
|
})
|
|
} : {}, {
|
|
s: $data.selectTab == 1
|
|
}, $data.selectTab == 1 ? {
|
|
t: common_vendor.f(5, (item, index, i0) => {
|
|
return {
|
|
a: 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_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/invest/invest.js.map
|