7.10 增加登录页面,事件详情接口对接,我的点赞,关注收藏页面搭建,接口对接
This commit is contained in:
@@ -1,22 +1,43 @@
|
||||
"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: ["名称代码", "分时图", "开盘价", "最新价", "涨跌幅"]
|
||||
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.getEventDetailsData();
|
||||
this.getEventRelatedStockData();
|
||||
this.getEventCommentListData();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -26,14 +47,21 @@ const _sfc_main = {
|
||||
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() {
|
||||
clickStockItem(code) {
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pages/index/stockDetails/stockDetails"
|
||||
url: "/pages/index/stockDetails/stockDetails?code=" + code
|
||||
});
|
||||
},
|
||||
/**
|
||||
@@ -44,21 +72,125 @@ const _sfc_main = {
|
||||
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();
|
||||
},
|
||||
/**
|
||||
* 获取事件详情数据
|
||||
* 点击关注
|
||||
*/
|
||||
getEventDetailsData() {
|
||||
clickFollow() {
|
||||
let eventId = this.eventId;
|
||||
request_api.eventDetails(eventId).then((res) => {
|
||||
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) => {
|
||||
});
|
||||
}
|
||||
@@ -80,7 +212,13 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
leftText: "事件详情"
|
||||
}),
|
||||
b: common_assets._imports_0,
|
||||
c: common_vendor.f($data.categoryList, (item, index, i0) => {
|
||||
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
|
||||
@@ -90,33 +228,129 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
e: common_vendor.o(($event) => $options.clickCategoryItem(index), index)
|
||||
});
|
||||
}),
|
||||
d: $data.selectCategory == 0
|
||||
i: $data.selectCategory == 0
|
||||
}, $data.selectCategory == 0 ? {
|
||||
e: common_vendor.f($data.headingList, (item, index, i0) => {
|
||||
j: common_vendor.f($data.headingList, (item, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(item),
|
||||
b: index
|
||||
};
|
||||
})
|
||||
} : {}, {
|
||||
f: $data.selectCategory == 0
|
||||
}, $data.selectCategory == 0 ? {} : {}, {
|
||||
g: $data.selectCategory == 1
|
||||
}, $data.selectCategory == 1 ? {
|
||||
h: common_vendor.o(($event) => $options.clickConceptItem())
|
||||
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)
|
||||
};
|
||||
})
|
||||
} : {}, {
|
||||
i: common_vendor.s("top:" + $data.navH + "px;"),
|
||||
j: common_assets._imports_1$1,
|
||||
k: common_assets._imports_2$1,
|
||||
l: common_vendor.o(($event) => $options.clickComment()),
|
||||
m: common_assets._imports_3$1,
|
||||
n: common_assets._imports_4$2,
|
||||
o: common_vendor.o(($event) => $options.closeCommentPopup()),
|
||||
p: common_assets._imports_5$2,
|
||||
q: common_assets._imports_6,
|
||||
r: common_assets._imports_5$2,
|
||||
s: common_vendor.sr("popup", "6e1a61f1-1"),
|
||||
t: common_vendor.p({
|
||||
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"
|
||||
})
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user