186 lines
5.6 KiB
JavaScript
186 lines
5.6 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"),
|
|
eventId: "",
|
|
//事件id
|
|
contentTop: "",
|
|
investDetails: null,
|
|
former: "",
|
|
//背景
|
|
categoryList: ["背景", "推演", "相关股票"],
|
|
selectCategory: 0,
|
|
stockCategoryList: [
|
|
{
|
|
title: "全部股票",
|
|
num: 0,
|
|
bgColor: "#C00000",
|
|
color: "white"
|
|
},
|
|
{
|
|
title: "大周期",
|
|
num: 0,
|
|
bgColor: "#305496",
|
|
color: "white"
|
|
},
|
|
{
|
|
title: "TMT板块",
|
|
num: 0,
|
|
bgColor: "#FFBF00",
|
|
color: "white"
|
|
},
|
|
{
|
|
title: "大金融地产",
|
|
num: 0,
|
|
bgColor: "#FFF4D3"
|
|
},
|
|
{
|
|
title: "大消费",
|
|
num: 0,
|
|
bgColor: "#CDEEEE"
|
|
},
|
|
{
|
|
title: "公共产业板块",
|
|
num: 0,
|
|
bgColor: "#DEEBF7"
|
|
}
|
|
],
|
|
accMul: utils_util.accMul
|
|
};
|
|
},
|
|
onLoad(e) {
|
|
this.contentTop = this.navH + (30 + 72) / 750 * common_vendor.inject("windowWidth");
|
|
if (e.id) {
|
|
this.eventId = e.id;
|
|
this.getEventDetailsData();
|
|
}
|
|
},
|
|
methods: {
|
|
/**
|
|
* 点击切换栏目
|
|
*/
|
|
clickCategoryItem(index) {
|
|
if (this.selectCategory != index) {
|
|
this.selectCategory = index;
|
|
}
|
|
},
|
|
/**
|
|
* 点击相关股票
|
|
* @param {Object} item 股票数据
|
|
*/
|
|
clickLookRelatedStockItem(item) {
|
|
common_vendor.index.navigateTo({
|
|
url: "/pages/index/stockDetails/stockDetails?type=2&code=" + item.code + "&des=" + item.description + "&name=" + item.name
|
|
});
|
|
},
|
|
/**
|
|
* 获取事件详情数据
|
|
*/
|
|
getEventDetailsData() {
|
|
request_api.investEventDetails(this.eventId).then((res) => {
|
|
if (res.code == 200) {
|
|
let detail = res.data.detail;
|
|
for (let item of this.stockCategoryList) {
|
|
item.num = detail.sector_stats[item.title];
|
|
}
|
|
this.investDetails = detail;
|
|
this.former = detail.former.replace("<answer>", "").replace("</answer>", "");
|
|
} else
|
|
common_vendor.index.showToast({
|
|
title: res.message,
|
|
icon: "none"
|
|
});
|
|
}).catch((error) => {
|
|
});
|
|
}
|
|
}
|
|
};
|
|
if (!Array) {
|
|
const _easycom_navBar2 = common_vendor.resolveComponent("navBar");
|
|
const _easycom_ua_markdown2 = common_vendor.resolveComponent("ua-markdown");
|
|
(_easycom_navBar2 + _easycom_ua_markdown2)();
|
|
}
|
|
const _easycom_navBar = () => "../../../components/navBar/navBar.js";
|
|
const _easycom_ua_markdown = () => "../../../components/ua-markdown/ua-markdown.js";
|
|
if (!Math) {
|
|
(_easycom_navBar + _easycom_ua_markdown)();
|
|
}
|
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
return common_vendor.e({
|
|
a: common_vendor.p({
|
|
leftText: "详情"
|
|
}),
|
|
b: common_assets._imports_0,
|
|
c: 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)
|
|
});
|
|
}),
|
|
d: common_vendor.s("top:" + $data.navH + "px;"),
|
|
e: $data.investDetails
|
|
}, $data.investDetails ? common_vendor.e({
|
|
f: $data.selectCategory == 0
|
|
}, $data.selectCategory == 0 ? {
|
|
g: common_vendor.p({
|
|
source: $data.former
|
|
})
|
|
} : {}, {
|
|
h: $data.selectCategory == 1
|
|
}, $data.selectCategory == 1 ? {
|
|
i: common_vendor.p({
|
|
source: $data.investDetails.forecast
|
|
})
|
|
} : {}, {
|
|
j: $data.selectCategory == 2
|
|
}, $data.selectCategory == 2 ? {
|
|
k: common_vendor.f($data.stockCategoryList, (item, index, i0) => {
|
|
return {
|
|
a: common_vendor.t(item.num),
|
|
b: common_vendor.t(item.title),
|
|
c: common_vendor.s("background-color:" + item.bgColor + ";color:" + item.color + ";"),
|
|
d: index
|
|
};
|
|
}),
|
|
l: common_vendor.f($data.investDetails.related_stocks, (item, index, i0) => {
|
|
return common_vendor.e({
|
|
a: common_vendor.t(item.code + " " + item.name),
|
|
b: common_vendor.t($data.accMul(item.score, 100)),
|
|
c: item.sw_primary_sector
|
|
}, item.sw_primary_sector ? {
|
|
d: common_vendor.t(item.sw_primary_sector)
|
|
} : {}, {
|
|
e: common_vendor.t(item.description),
|
|
f: index,
|
|
g: common_vendor.o(($event) => $options.clickLookRelatedStockItem(item), index)
|
|
});
|
|
})
|
|
} : {}, {
|
|
m: $data.selectCategory == 4
|
|
}, $data.selectCategory == 4 ? {
|
|
n: common_vendor.f($data.investDetails.extracted_concepts, (item, index, i0) => {
|
|
return {
|
|
a: item.first_image,
|
|
b: common_vendor.t(item.name),
|
|
c: common_vendor.t(item.reason),
|
|
d: index,
|
|
e: common_vendor.o(($event) => _ctx.clickConceptItem(), index)
|
|
};
|
|
})
|
|
} : {}, {
|
|
o: 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/investDetails/investDetails.js.map
|