2.4 组件结构调整,调整会员权限判断
This commit is contained in:
@@ -11,6 +11,17 @@ const _sfc_main = {
|
||||
filteredData: [],
|
||||
currentDate: "",
|
||||
// 最终要赋值的日期
|
||||
searchResultTop: "",
|
||||
//搜索结果
|
||||
contentTop: "",
|
||||
keywords: "",
|
||||
//搜索关键字
|
||||
searchShow: false,
|
||||
//是否展示搜索结果
|
||||
searchResultList: [],
|
||||
//搜索结果
|
||||
selectSearchStockInfo: null,
|
||||
//选中的搜索股票信息
|
||||
topLists: [
|
||||
{
|
||||
title: "超大盘股",
|
||||
@@ -30,10 +41,57 @@ const _sfc_main = {
|
||||
},
|
||||
onLoad(e) {
|
||||
this.currentDate = e.currentDate;
|
||||
this.searchResultTop = this.navH + (20 + 70) / 750 * common_vendor.inject("windowWidth");
|
||||
this.contentTop = this.navH + (20 + 70 + 25) / 750 * common_vendor.inject("windowWidth");
|
||||
this.marketHeatmap();
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 点击搜索
|
||||
*/
|
||||
clickSearch() {
|
||||
if (this.keywords) {
|
||||
this.getSearchStockInfoListData();
|
||||
} else
|
||||
this.selectSearchStockInfo = null;
|
||||
},
|
||||
/**
|
||||
* 点击搜索结果背景
|
||||
*/
|
||||
clickSearchResultBg() {
|
||||
this.searchShow = false;
|
||||
},
|
||||
/**
|
||||
* 点击搜索结果列表项
|
||||
*/
|
||||
clickSearchResultListItem(item) {
|
||||
this.selectSearchStockInfo = item;
|
||||
this.searchShow = false;
|
||||
this.getStockBasicInfoData();
|
||||
},
|
||||
/**
|
||||
* 根据输入内容获取搜索列表项
|
||||
*/
|
||||
getSearchStockInfoListData() {
|
||||
let param = { q: this.keywords, limit: 10 };
|
||||
request_api.searchStockInfo(param).then((res) => {
|
||||
this.searchResultList = res.data;
|
||||
this.searchShow = this.searchResultList.length > 0;
|
||||
}).catch((error) => {
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 获取股票基本信息
|
||||
*/
|
||||
getStockBasicInfoData() {
|
||||
let code = this.stockCode;
|
||||
if (this.selectSearchStockInfo) {
|
||||
code = this.selectSearchStockInfo.stock_code;
|
||||
}
|
||||
common_vendor.index.navigateTo({
|
||||
url: "/pagesStock/stockCenterDetails/stockCenterDetails?code=" + code
|
||||
});
|
||||
},
|
||||
handleTypeClick(index) {
|
||||
this.list2Index = index;
|
||||
this.marketHeatmap();
|
||||
@@ -66,9 +124,11 @@ const _sfc_main = {
|
||||
},
|
||||
marketHeatmap() {
|
||||
let param = {
|
||||
limit: 500,
|
||||
date: this.currentDate
|
||||
limit: 500
|
||||
};
|
||||
if (this.currentDate && this.currentDate !== "undefined" && this.currentDate.trim() !== "") {
|
||||
param.date = this.currentDate;
|
||||
}
|
||||
request_api.marketHeatmap(param).then((res) => {
|
||||
this.allStockData = res.data || [];
|
||||
this.filterStockByMarketCap();
|
||||
@@ -113,18 +173,30 @@ if (!Math) {
|
||||
_easycom_navBar();
|
||||
}
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
return common_vendor.e({
|
||||
a: common_vendor.p({
|
||||
leftText: "详情",
|
||||
hideNavBg: true
|
||||
}),
|
||||
b: common_assets._imports_0,
|
||||
c: common_assets._imports_1,
|
||||
d: common_vendor.o(($event) => _ctx.clickSearch()),
|
||||
e: _ctx.keywords,
|
||||
f: common_vendor.o(($event) => _ctx.keywords = $event.detail.value),
|
||||
g: common_vendor.s("top:" + $data.navH + "px;"),
|
||||
h: common_vendor.f($data.topLists, (item, index, i0) => {
|
||||
d: common_vendor.o([($event) => $data.keywords = $event.detail.value, ($event) => $options.clickSearch()]),
|
||||
e: $data.keywords,
|
||||
f: common_vendor.s("top:" + $data.navH + "px;"),
|
||||
g: $data.searchShow
|
||||
}, $data.searchShow ? {
|
||||
h: common_vendor.f($data.searchResultList, (item, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(item.stock_code),
|
||||
b: common_vendor.t(item.stock_name),
|
||||
c: index,
|
||||
d: common_vendor.o(($event) => $options.clickSearchResultListItem(item), index)
|
||||
};
|
||||
}),
|
||||
i: common_vendor.s("top:" + $data.searchResultTop + "px;"),
|
||||
j: common_vendor.o(($event) => $options.clickSearchResultBg())
|
||||
} : {}, {
|
||||
k: common_vendor.f($data.topLists, (item, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(item.title),
|
||||
b: $data.list2Index == index ? "#BB8520" : "#070707",
|
||||
@@ -135,13 +207,13 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
g: $data.list2Index == index ? "1rpx solid #F2C369" : "none"
|
||||
};
|
||||
}),
|
||||
i: common_vendor.f(["股票名称", "涨跌幅", "市值", "成交额", "行业"], (item, index, i0) => {
|
||||
l: common_vendor.f(["股票名称", "涨跌幅", "市值", "成交额", "行业"], (item, index, i0) => {
|
||||
return {
|
||||
a: common_vendor.t(item),
|
||||
b: index
|
||||
};
|
||||
}),
|
||||
j: common_vendor.f($data.filteredData, (obj, j, i0) => {
|
||||
m: common_vendor.f($data.filteredData, (obj, j, i0) => {
|
||||
return {
|
||||
a: common_vendor.f($options.getTableItem(obj), (item, index, i1) => {
|
||||
return common_vendor.e({
|
||||
@@ -158,8 +230,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
c: j % 2 == 0 ? "#fff" : "#FAFAFC"
|
||||
};
|
||||
}),
|
||||
k: common_vendor.s("top:" + $data.contentTop + "px;")
|
||||
};
|
||||
n: common_vendor.s("top:" + $data.contentTop + "px;")
|
||||
});
|
||||
}
|
||||
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
|
||||
wx.createPage(MiniProgramPage);
|
||||
|
||||
Reference in New Issue
Block a user