Files
2026-02-04 17:43:41 +08:00

2 lines
3.4 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";const t=require("../../common/vendor.js"),e=require("../../request/api.js"),a=require("../../common/assets.js"),s={data:()=>({navH:t.inject("navHeight"),contentTop:"",allStockData:[],filteredData:[],currentDate:"",searchResultTop:"",contentTop:"",keywords:"",searchShow:!1,searchResultList:[],selectSearchStockInfo:null,topLists:[{title:"超大盘股",value:">1000亿"},{title:"大盘股",value:"500-1000亿"},{title:"中盘股",value:"100-500亿"}],list2Index:0}),onLoad(e){this.currentDate=e.currentDate,this.searchResultTop=this.navH+.12*t.inject("windowWidth"),this.contentTop=this.navH+115/750*t.inject("windowWidth"),this.marketHeatmap()},methods:{clickSearch(){this.keywords?this.getSearchStockInfoListData():this.selectSearchStockInfo=null},clickSearchResultBg(){this.searchShow=!1},clickSearchResultListItem(t){this.selectSearchStockInfo=t,this.searchShow=!1,this.getStockBasicInfoData()},getSearchStockInfoListData(){let t={q:this.keywords,limit:10};e.searchStockInfo(t).then((t=>{this.searchResultList=t.data,this.searchShow=this.searchResultList.length>0})).catch((t=>{}))},getStockBasicInfoData(){let e=this.stockCode;this.selectSearchStockInfo&&(e=this.selectSearchStockInfo.stock_code),t.index.navigateTo({url:"/pagesStock/stockCenterDetails/stockCenterDetails?code="+e})},handleTypeClick(t){this.list2Index=t,this.marketHeatmap()},getTableItem(t){const e=t.market_cap?t.market_cap.toFixed(2):"0.00",a=t.amount?t.amount.toFixed(2):"0.00",s=t.change_percent?Number(t.change_percent):0;let c="",i="";return s>0?(c=`+${s}%`,i="positive"):s<0?(c=`${s}%`,i="negative"):(c="0%",i="zero"),[[t.stock_name,t.stock_code],[c,"",i],[`${e}亿元`],[`${a}亿元`],[t.industry||"暂无"]]},marketHeatmap(){let t={limit:500};this.currentDate&&"undefined"!==this.currentDate&&""!==this.currentDate.trim()&&(t.date=this.currentDate),e.marketHeatmap(t).then((t=>{this.allStockData=t.data||[],this.filterStockByMarketCap()})).catch((t=>{}))},filterStockByMarketCap(){const{list2Index:t,allStockData:e}=this;let a=[];switch(t){case 0:a=e.filter((t=>t.market_cap>1e3));break;case 1:a=e.filter((t=>t.market_cap>=500&&t.market_cap<=1e3));break;case 2:a=e.filter((t=>t.market_cap>=100&&t.market_cap<=500));break;default:a=e}this.filteredData=a},itemDetails(e){t.index.navigateTo({url:"/pagesStock/stockCenterDetails/stockCenterDetails?code="+e.stock_code})}}};if(!Array){t.resolveComponent("navBar")()}Math;const c=t._export_sfc(s,[["render",function(e,s,c,i,o,r){return t.e({a:t.p({leftText:"详情",hideNavBg:!0}),b:a._imports_0,c:a._imports_1,d:t.o([t=>o.keywords=t.detail.value,t=>r.clickSearch()]),e:o.keywords,f:t.s("top:"+o.navH+"px;"),g:o.searchShow},o.searchShow?{h:t.f(o.searchResultList,((e,a,s)=>({a:t.t(e.stock_code),b:t.t(e.stock_name),c:a,d:t.o((t=>r.clickSearchResultListItem(e)),a)}))),i:t.s("top:"+o.searchResultTop+"px;"),j:t.o((t=>r.clickSearchResultBg()))}:{},{k:t.f(o.topLists,((e,a,s)=>({a:t.t(e.title),b:o.list2Index==a?"#BB8520":"#070707",c:t.t(e.value),d:o.list2Index==a?"#BB8520":"#070707",e:t.o((t=>r.handleTypeClick(a)),a),f:a,g:o.list2Index==a?"1rpx solid #F2C369":"none"}))),l:t.f(["股票名称","涨跌幅","市值","成交额","行业"],((e,a,s)=>({a:t.t(e),b:a}))),m:t.f(o.filteredData,((e,a,s)=>({a:t.f(r.getTableItem(e),((e,a,s)=>t.e({a:t.t(e[0]),b:0==a},0==a?{c:t.t(e[1])}:{},{d:a,e:0==a?"#222222":1==a?"positive"===e[2]?"#EC3440":"#01AB5D":"#666666"}))),b:t.o((t=>r.itemDetails(e))),c:a%2==0?"#fff":"#FAFAFC"}))),n:t.s("top:"+o.contentTop+"px;")})}]]);wx.createPage(c);