361 lines
12 KiB
JavaScript
361 lines
12 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 common_assets = require("../../../common/assets.js");
|
|
const _sfc_main = {
|
|
data() {
|
|
return {
|
|
navH: common_vendor.inject("navHeight"),
|
|
windowWidth: common_vendor.inject("windowWidth"),
|
|
eventId: "",
|
|
//事件id
|
|
eventDetails: null,
|
|
//事件详情
|
|
categoryList: ["相关标的", "相关概念", "历史事件", "时间传导链分析", "关联数据"],
|
|
targetList: [],
|
|
//相关标的
|
|
conceptList: [],
|
|
//相关概念
|
|
historyEventList: [],
|
|
//历史事件
|
|
historyEventRelatedStockList: [],
|
|
//历史事件相关股票
|
|
selectCategory: 0,
|
|
headingList: ["名称代码", "分时图", "开盘价", "最新价", "涨跌幅"],
|
|
getLocaleTime: utils_util.getLocaleTime,
|
|
getRateUpOrDown: utils_util.getRateUpOrDown,
|
|
getRateStr: utils_util.getRateStr,
|
|
scoreTop: "",
|
|
eventComment: "",
|
|
//事件评论
|
|
expectScore: 0
|
|
//预期得分
|
|
};
|
|
},
|
|
onLoad(e) {
|
|
if (e.id) {
|
|
this.eventId = e.id;
|
|
this.getEventRelatedStockData();
|
|
this.getEventCommentListData();
|
|
}
|
|
},
|
|
methods: {
|
|
/**
|
|
* 点击切换分类
|
|
*/
|
|
clickCategoryItem(index) {
|
|
if (this.selectCategory != index) {
|
|
this.selectCategory = index;
|
|
if (index == 0) {
|
|
this.getEventRelatedStockData();
|
|
} else if (index == 1) {
|
|
this.getEventRelatedConceptData();
|
|
} else if (index == 2) {
|
|
this.getEventHistoryEventData();
|
|
}
|
|
}
|
|
},
|
|
/**
|
|
* 点击查看股票详情
|
|
*/
|
|
clickStockItem(code) {
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/index/stockDetails/stockDetails?code=" + code
|
|
});
|
|
},
|
|
/**
|
|
* 点击查看相关概念
|
|
*/
|
|
clickConceptItem() {
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/index/conceptDetails/conceptDetails"
|
|
});
|
|
},
|
|
/**
|
|
* 点击查看历史事件的相关股票
|
|
*/
|
|
clickLookHistoricalEventRelatedStock(item) {
|
|
this.historyEventRelatedStockList = item.related_stocks;
|
|
this.$refs["stockPopup"].open();
|
|
},
|
|
/**
|
|
* 点击关闭相关股票弹窗
|
|
*/
|
|
closeRelatedStockPopup() {
|
|
this.$refs["stockPopup"].close();
|
|
},
|
|
/**
|
|
* 点击查看超预期得分
|
|
*/
|
|
clickExpectScore(e) {
|
|
this.scoreTop = e.currentTarget.offsetTop + this.navH + (70 + 10 + 20) / 750 * this.windowWidth;
|
|
this.$refs["expectScorePopup"].open();
|
|
},
|
|
/**
|
|
* 点击发送事件评论
|
|
*/
|
|
sendEventComment() {
|
|
if (!this.eventComment) {
|
|
common_vendor.index.showToast({
|
|
title: "请输入评论内容",
|
|
icon: "none"
|
|
});
|
|
return;
|
|
}
|
|
let eventId = this.eventId;
|
|
let param = { content: this.eventComment };
|
|
request_api.commentEvent(eventId, param).then((res) => {
|
|
}).catch((error) => {
|
|
});
|
|
},
|
|
/**
|
|
* 点击评论
|
|
*/
|
|
clickComment() {
|
|
this.$refs["popup"].open();
|
|
},
|
|
/**
|
|
* 点击关闭评论弹窗
|
|
*/
|
|
closeCommentPopup() {
|
|
this.$refs["popup"].close();
|
|
},
|
|
/**
|
|
* 点击关注
|
|
*/
|
|
clickFollow() {
|
|
let eventId = this.eventId;
|
|
followEvent(eventId).then((res) => {
|
|
common_vendor.index.showToast({
|
|
title: res.message,
|
|
icon: "none"
|
|
});
|
|
}).catch((error) => {
|
|
});
|
|
},
|
|
/**
|
|
* 获取事件相关标的数据
|
|
*/
|
|
getEventRelatedStockData() {
|
|
let eventId = this.eventId;
|
|
request_api.eventRelatedStock(eventId).then((res) => {
|
|
if (res.code == 200) {
|
|
this.eventDetails = res.data;
|
|
this.targetList = res.data.related_stocks;
|
|
} else
|
|
common_vendor.index.showToast({
|
|
title: res.message,
|
|
icon: "none"
|
|
});
|
|
}).catch((error) => {
|
|
});
|
|
},
|
|
/**
|
|
* 获取事件相关概念数据
|
|
*/
|
|
getEventRelatedConceptData() {
|
|
let eventId = this.eventId;
|
|
request_api.eventRelatedConcept(eventId).then((res) => {
|
|
if (res.code == 200) {
|
|
this.conceptList = res.data.related_concepts;
|
|
} else
|
|
common_vendor.index.showToast({
|
|
title: res.message,
|
|
icon: "none"
|
|
});
|
|
}).catch((error) => {
|
|
});
|
|
},
|
|
/**
|
|
* 获取事件历史事件数据
|
|
*/
|
|
getEventHistoryEventData() {
|
|
let eventId = this.eventId;
|
|
request_api.eventHistoryEvent(eventId).then((res) => {
|
|
if (res.code == 200) {
|
|
this.expectScore = res.data.invest_score;
|
|
this.historyEventList = res.data.historical_events;
|
|
} else
|
|
common_vendor.index.showToast({
|
|
title: res.message,
|
|
icon: "none"
|
|
});
|
|
}).catch((error) => {
|
|
});
|
|
},
|
|
/**
|
|
* 获取事件评论列表
|
|
*/
|
|
getEventCommentListData() {
|
|
let eventId = this.eventId;
|
|
request_api.eventCommentList(eventId).then((res) => {
|
|
this.commentList = res.data.comments;
|
|
}).catch((error) => {
|
|
});
|
|
}
|
|
}
|
|
};
|
|
if (!Array) {
|
|
const _easycom_navBar2 = common_vendor.resolveComponent("navBar");
|
|
const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
|
|
(_easycom_navBar2 + _easycom_uni_popup2)();
|
|
}
|
|
const _easycom_navBar = () => "../../../components/navBar/navBar.js";
|
|
const _easycom_uni_popup = () => "../../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
|
|
if (!Math) {
|
|
(_easycom_navBar + _easycom_uni_popup)();
|
|
}
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return common_vendor.e({
|
|
a: common_vendor.p({
|
|
leftText: "事件详情"
|
|
}),
|
|
b: common_assets._imports_0,
|
|
c: $data.eventDetails
|
|
}, $data.eventDetails ? common_vendor.e({
|
|
d: common_vendor.t($data.eventDetails.event_type),
|
|
e: common_vendor.t($data.eventDetails.event_title),
|
|
f: common_vendor.t($data.eventDetails.event_created_at.substr(0, 16)),
|
|
g: common_vendor.t($data.eventDetails.event_desc),
|
|
h: common_vendor.f($data.categoryList, (item, index, i0) => {
|
|
return common_vendor.e({
|
|
a: common_vendor.t(item),
|
|
b: $data.selectCategory == index
|
|
}, $data.selectCategory == index ? {} : {}, {
|
|
c: common_vendor.n("item relative " + ($data.selectCategory == index ? "select" : "")),
|
|
d: index,
|
|
e: common_vendor.o(($event) => $options.clickCategoryItem(index), index)
|
|
});
|
|
}),
|
|
i: $data.selectCategory == 0
|
|
}, $data.selectCategory == 0 ? {
|
|
j: common_vendor.f($data.headingList, (item, index, i0) => {
|
|
return {
|
|
a: common_vendor.t(item),
|
|
b: index
|
|
};
|
|
})
|
|
} : {}, {
|
|
k: $data.selectCategory == 0
|
|
}, $data.selectCategory == 0 ? {
|
|
l: common_vendor.f($data.targetList, (item, index, i0) => {
|
|
return {
|
|
a: common_vendor.t(item.stock_name),
|
|
b: common_vendor.t(item.stock_code),
|
|
c: common_vendor.t(item.trade_data.open_price),
|
|
d: common_vendor.t(item.trade_data.latest_price),
|
|
e: common_vendor.t(item.trade_data.change_pct),
|
|
f: common_vendor.n("chg flex1 " + ($data.getRateUpOrDown(item.trade_data.change_pct) ? "down" : "up")),
|
|
g: common_vendor.t(item.relation_desc),
|
|
h: index,
|
|
i: common_vendor.o(($event) => $options.clickStockItem(item.stock_code), index)
|
|
};
|
|
})
|
|
} : {}, {
|
|
m: $data.selectCategory == 1
|
|
}, $data.selectCategory == 1 ? {
|
|
n: common_vendor.f($data.conceptList, (item, index, i0) => {
|
|
return {
|
|
a: item.first_image,
|
|
b: common_vendor.t(item.concept),
|
|
c: common_vendor.t(item.reason),
|
|
d: index,
|
|
e: common_vendor.o(($event) => $options.clickConceptItem(), index)
|
|
};
|
|
})
|
|
} : {}, {
|
|
o: $data.selectCategory == 2
|
|
}, $data.selectCategory == 2 ? {
|
|
p: common_assets._imports_1$4,
|
|
q: common_vendor.t($data.expectScore),
|
|
r: common_assets._imports_2$6,
|
|
s: common_vendor.o(($event) => $options.clickExpectScore($event)),
|
|
t: common_vendor.f($data.historyEventList, (item, index, i0) => {
|
|
return common_vendor.e({
|
|
a: common_vendor.t(item.title),
|
|
b: common_vendor.t(item.content),
|
|
c: $data.getRateUpOrDown(item.related_avg_chg)
|
|
}, $data.getRateUpOrDown(item.related_avg_chg) ? {
|
|
d: common_assets._imports_1$1
|
|
} : {
|
|
e: common_assets._imports_2$2
|
|
}, {
|
|
f: common_vendor.t($data.getRateStr(item.related_avg_chg)),
|
|
g: common_vendor.n("rateItem " + ($data.getRateUpOrDown(item.related_avg_chg) ? "down" : "up")),
|
|
h: $data.getRateUpOrDown(item.related_max_chg)
|
|
}, $data.getRateUpOrDown(item.related_max_chg) ? {
|
|
i: common_assets._imports_1$1
|
|
} : {
|
|
j: common_assets._imports_2$2
|
|
}, {
|
|
k: common_vendor.t($data.getRateStr(item.related_max_chg)),
|
|
l: common_vendor.n("rateItem " + ($data.getRateUpOrDown(item.related_max_chg) ? "down" : "up")),
|
|
m: common_vendor.o(($event) => $options.clickLookHistoricalEventRelatedStock(item), index),
|
|
n: common_vendor.t($data.getLocaleTime(item.event_date)),
|
|
o: index
|
|
});
|
|
}),
|
|
v: common_assets._imports_1$4
|
|
} : {}, {
|
|
w: common_vendor.s("top:" + $data.navH + "px;")
|
|
}) : {}, {
|
|
x: $data.eventDetails
|
|
}, $data.eventDetails ? {
|
|
y: common_vendor.o(($event) => $options.sendEventComment()),
|
|
z: $data.eventComment,
|
|
A: common_vendor.o(($event) => $data.eventComment = $event.detail.value),
|
|
B: common_assets._imports_3,
|
|
C: common_vendor.t($data.eventDetails.view_count),
|
|
D: common_assets._imports_4,
|
|
E: common_vendor.t($data.eventDetails.post_count),
|
|
F: common_vendor.o(($event) => $options.clickComment()),
|
|
G: common_assets._imports_7,
|
|
H: common_vendor.t($data.eventDetails.follower_count),
|
|
I: common_vendor.o(($event) => $options.clickFollow())
|
|
} : {}, {
|
|
J: common_assets._imports_8,
|
|
K: common_vendor.o(($event) => $options.closeCommentPopup()),
|
|
L: common_assets._imports_9,
|
|
M: common_assets._imports_10,
|
|
N: common_assets._imports_9,
|
|
O: common_vendor.sr("popup", "6e1a61f1-1"),
|
|
P: common_vendor.p({
|
|
type: "bottom"
|
|
}),
|
|
Q: common_assets._imports_11$1,
|
|
R: common_vendor.s("margin-top:" + $data.scoreTop + "px;"),
|
|
S: common_vendor.sr("expectScorePopup", "6e1a61f1-2"),
|
|
T: common_vendor.p({
|
|
type: "top",
|
|
["mask-background-color"]: "transparent"
|
|
}),
|
|
U: common_assets._imports_8,
|
|
V: common_vendor.o(($event) => $options.closeRelatedStockPopup()),
|
|
W: common_vendor.f($data.historyEventRelatedStockList, (item, index, i0) => {
|
|
return common_vendor.e({
|
|
a: common_vendor.t(item.stock_name + "(" + item.stock_code + ")"),
|
|
b: common_vendor.t(item.correlation * 100),
|
|
c: common_vendor.t(item.sector),
|
|
d: $data.getRateUpOrDown(item.daily_change)
|
|
}, $data.getRateUpOrDown(item.daily_change) ? {
|
|
e: common_assets._imports_1$1
|
|
} : {
|
|
f: common_assets._imports_2$2
|
|
}, {
|
|
g: common_vendor.t($data.getRateStr(item.daily_change)),
|
|
h: common_vendor.t(item.relation_desc),
|
|
i: index,
|
|
j: common_vendor.o(($event) => $options.clickStockItem(item.stock_code), index)
|
|
});
|
|
}),
|
|
X: common_vendor.sr("stockPopup", "6e1a61f1-3"),
|
|
Y: common_vendor.p({
|
|
type: "bottom"
|
|
})
|
|
});
|
|
}
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
wx.createPage(MiniProgramPage);
|
|
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/pages/index/eventDetails/eventDetails.js.map
|