Files
JiaZhiQianYan/unpackage/dist/build/mp-weixin/pagesStock/stockCenterDetails/bkydmx.js
2026-02-04 17:43:41 +08:00

2 lines
2.2 KiB
JavaScript
Raw 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/http.js"),a=require("../../common/assets.js"),n={data:()=>({navH:t.inject("navHeight"),contentTop:"",activeIndex:0,bkList:[],bkFilters:["按涨幅","按连板数","只看龙头"],filterIndex:0,selectedFullDate:""}),onLoad(e){this.activeIndex=e.index,this.selectedFullDate=e.data,this.contentTop=this.navH+20/750*t.inject("windowWidth"),this.fetchData()},methods:{getPreviousDayDate(t){if(!/^\d{4}-\d{2}-\d{2}$/.test(t))return console.error("日期格式错误,请传入 YYYY-MM-DD 格式的日期"),"";const[e,a,n]=t.split("-").map(Number),i=new Date(e,a-1,n);i.setDate(i.getDate()-2);return`${i.getFullYear()}${String(i.getMonth()+1).padStart(2,"0")}${String(i.getDate()).padStart(2,"0")}`},async fetchData(){try{const a=(new Date).getTime(),n=this.getPreviousDayDate(this.selectedFullDate),i=`${e.getBaseURL1()}/data/zt/daily/${n}.json?t=${a}`;console.log("请求URL",i);const s=await t.index.request({url:i,method:"GET"});if(200===s.statusCode&&s.data){this.originData=s.data;const t=this.originData.chart_data||{},e=t.labels||[],a=t.counts||[];a.length>0&&Math.max(...a);let n=[];const i=Math.min(e.length,a.length);for(let s=0;s<i;s++){const t=e[s],i=a[s]||0;n.push({title:t,count:i})}this.bkList=n}else t.index.showToast({title:"数据请求失败",icon:"none"})}catch(a){console.error("请求异常:",a),t.index.showToast({title:"网络异常",icon:"none"})}}}};if(!Array){t.resolveComponent("navBar")()}Math;const i=t._export_sfc(n,[["render",function(e,n,i,s,o,r){return{a:t.p({leftText:"板块异动明细",hideNavBg:!0}),b:a._imports_0,c:t.f(o.bkList,((e,a,n)=>({a:t.t(e.title),b:"tab-"+a,c:t.o((t=>o.activeIndex=a),a),d:a,e:o.activeIndex==a?"#2B2B2B":"#999999",f:o.activeIndex==a?"1rpx solid #F2C369":"none",g:o.activeIndex==a?"28rpx":"26rpx"}))),d:"tab-"+o.activeIndex,e:t.f(o.bkFilters,((e,a,n)=>({a:t.t(e),b:t.o((t=>o.filterIndex=a),a),c:o.filterIndex==a?"#070707":"#939393",d:o.filterIndex==a?"1rpx solid #F2C369":"1rpx solid #E5E5E5",e:o.filterIndex==a?"#F2C369":"#fff",f:a}))),f:t.f(["名称","涨幅","连板","板块"],((e,a,n)=>({a:t.t(e),b:a,c:0==a?"left":"center"}))),g:t.f(30,((t,e,a)=>({a:e%2==0?"#fff":"#FAFAFC"}))),h:a._imports_1$12,i:t.s("top:"+o.contentTop+"px;")}}]]);wx.createPage(i);