"use strict";const t=require("../../common/vendor.js"),e=require("../../request/http.js"),a=require("../../common/assets.js"),o=require("../../uni_modules/lime-echart/static/echarts.min.js"),s={categories:[{name:"板块"},{name:"概念"},{name:"个股"}],nodes:[{name:"科技板块",symbolSize:50,category:0},{name:"人工智能",symbolSize:30,category:1},{name:"大数据",symbolSize:25,category:1},{name:"科大讯飞",symbolSize:20,category:2},{name:"百度",symbolSize:20,category:2},{name:"金融板块",symbolSize:50,category:0},{name:"数字货币",symbolSize:30,category:1},{name:"招商银行",symbolSize:20,category:2},{name:"平安银行",symbolSize:20,category:2}],links:[{source:"科技板块",target:"人工智能",value:10},{source:"科技板块",target:"大数据",value:8},{source:"人工智能",target:"科大讯飞",value:6},{source:"人工智能",target:"百度",value:6},{source:"金融板块",target:"数字货币",value:9},{source:"数字货币",target:"招商银行",value:5},{source:"数字货币",target:"平安银行",value:5}]},i={components:{WordCloud:()=>"../../components/WordCloud/WordCloud2.js"},data:()=>({navH:t.inject("navHeight"),contentTop:"",selectedYearMonth:"",selectedFullDate:"",selectedItem:null,tabTypes:[{data:"",change:0,title:"当前日期"},{data:"",change:3,title:"涨停家数"},{data:"22%",change:0,title:"炸板率"}],wordData:[],bkList:[],number_limit_stocks:"",HEAT_LEVELS:[{threshold:.7,color:"#EF4444",level:"高热度"},{threshold:.4,color:"#F97316",level:"中热度"},{threshold:.2,color:"#F3B800",level:"低热度"},{threshold:0,color:"#01AB5D",level:"无热度"}],bkTypes:["板块分布","热门概念词云"],activeType:0,pieOption:{tooltip:{trigger:"item"},animation:!1,legend:{top:"5%",left:"center",show:!1},series:[{name:"Access From",type:"pie",radius:["40%","70%"],avoidLabelOverlap:!1,padAngle:2,itemStyle:{borderRadius:8},emphasis:{label:{show:!0,fontSize:10}},labelLine:{length:1,length2:5},data:[]}]},graphOption:{tooltip:{},legend:[],series:[{name:"板块关联",type:"graph",layout:"none",data:[],links:[],categories:[],roam:!0,label:{show:!0,position:"right",formatter:"{b}"},labelLayout:{hideOverlap:!0},scaleLimit:{min:.4,max:2},lineStyle:{color:"source",curveness:.3}}]}}),onLoad(e){this.activeIndex=e.index,this.contentTop=this.navH+20/750*t.inject("windowWidth")},onReady(){},methods:{getHeatColor(t,e){if(0===e)return"#01AB5D";const a=t/e,o=this.HEAT_LEVELS.find((t=>a>t.threshold));return o?o.color:"#01AB5D"},async switchTab(t){switch(this.activeType=t,t){case 0:this.$refs.chartRef&&this.initPieChart();break;case 1:case 2:this.initWordCloud()}},getPreviousDayDate(){const t=new Date,e=`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`;if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return console.error("日期格式错误,请传入 YYYY-MM-DD 格式的日期"),"";const[a,o,s]=e.split("-").map(Number),i=new Date(a,o-1,s);i.setDate(i.getDate()-1);return`${i.getFullYear()}${String(i.getMonth()+1).padStart(2,"0")}${String(i.getDate()).padStart(2,"0")}`},async fetchData(){try{const a=(new Date).getTime(),o=this.selectedFullDate,s=`${e.getBaseURL1()}/data/zt/daily/${o}.json?t=${a}`;console.log("请求URL:",s);const i=await t.index.request({url:s,method:"GET"});if(200===i.statusCode&&i.data){this.originData=i.data;const t=this.originData.chart_data||{},e=t.labels||[],a=t.counts||[],o=a.length>0?Math.max(...a):0;let s=[];const n=Math.min(e.length,a.length);for(let i=0;it.name))}],this.graphOption.series[0].data=s.nodes,this.graphOption.series[0].links=s.links,this.graphOption.series[0].categories=s.categories,t.setOption(this.graphOption)},async initPieChart(){try{let t=[];const e=this.originData.chart_data||{},a=e.labels||[],s=e.counts||[],i=Math.min(a.length,s.length);for(let o=0;o0?t:[{value:10,name:"科技板块"},{value:8,name:"人脑工程"},{value:9,name:"商业航天"}],this.$refs.chartRef){const t=await this.$refs.chartRef.init(o);console.log("Piechart实例创建成功",t),t.setOption(this.pieOption)}}catch(t){console.error("饼图初始化失败:",t)}},initWordCloud(){this.originData.word_freq_data&&Array.isArray(this.originData.word_freq_data)?(this.wordData=this.originData.word_freq_data,console.log("词云数据赋值完成",this.wordData)):this.wordData=[{name:"脑机",value:1e4},{name:"航天",value:3428}]},handleDateChange(t){var e,a,o,s;if(console.log("从日历组件接收的参数:",{currentZtCount:null==(e=t.item)?void 0:e.zt_count,prevZtCount:null==(a=t.prevItem)?void 0:a.zt_count}),this.selectedYearMonth=t.yearMonth,this.selectedFullDate=t.fullDate?t.fullDate.replace(/-/g,""):"",this.selectedItem=t.item,t.fullDate){const[e,a,o]=t.fullDate.split("-").map(Number);this.tabTypes[0].data=`${a}月${o}日`}const i=(null==(o=t.item)?void 0:o.zt_count)??0;this.tabTypes[1].data=i.toString(),this.number_limit_stocks=i.toString();const n=(null==(s=t.prevItem)?void 0:s.zt_count)??0,r=0===i||0===n?0:i-n;if(this.tabTypes[1].change=r,this.selectedFullDate){const t=new Date,e=`${t.getFullYear()}${String(t.getMonth()+1).padStart(2,"0")}${String(t.getDate()).padStart(2,"0")}`;if(this.selectedFullDate===e){const t=new Date(parseInt(this.selectedFullDate.substring(0,4)),parseInt(this.selectedFullDate.substring(4,6))-1,parseInt(this.selectedFullDate.substring(6,8)));t.setDate(t.getDate()-1);const a=`${t.getFullYear()}${String(t.getMonth()+1).padStart(2,"0")}${String(t.getDate()).padStart(2,"0")}`;this.selectedFullDate=a,console.log(`选中日期为当天(${e}),已自动调整为前一天:`,a)}}this.fetchData()},bkydAction(e){t.index.navigateTo({url:`/pagesStock/stockCenterDetails/bkydmx?index=${e}&data=${this.selectedFullDate}`})}}};if(!Array){(t.resolveComponent("navBar")+t.resolveComponent("LCCalendar")+t.resolveComponent("l-echart")+t.resolveComponent("WordCloud"))()}Math||((()=>"../../components/navBar/navBar.js")+(()=>"../../components/LCCalendar/LCCalendar.js")+(()=>"../../uni_modules/lime-echart/components/l-echart/l-echart.js")+(()=>"../../components/WordCloud/WordCloud2.js"))();const n=t._export_sfc(i,[["render",function(e,o,s,i,n,r){return{a:t.p({leftText:"涨停分析",hideNavBg:!0,hideBack:!0}),b:a._imports_0,c:a._imports_1$9,d:a._imports_2$9,e:t.f(n.tabTypes,((e,a,o)=>t.e({a:t.t(e.data),b:0!==e.change},0!==e.change?{c:t.t(e.change>0?"+"+e.change:e.change),d:t.s({marginLeft:"10rpx",borderRadius:"5rpx",color:"white",padding:"0 5rpx",fontSize:"24rpx",fontWeight:"bold"}),e:t.s(e.change>0?{backgroundColor:"#F59B38"}:{backgroundColor:"#EF4444"})}:{},{f:t.t(e.title),g:a}))),f:t.o(r.handleDateChange),g:a._imports_3$8,h:t.t(n.bkList.length),i:t.t(n.number_limit_stocks),j:t.f(n.bkList,((e,a,o)=>({a:t.t(e.title),b:t.t(e.count),c:a,d:e.bgColor}))),k:t.f(n.bkTypes,((e,a,o)=>({a:t.t(e),b:t.o((t=>r.switchTab(a))),c:n.activeType==a?"#BB8520":"#999999",d:"1rpx solid "+(n.activeType==a?"#F2C369":"#D2D2D2"),e:n.activeType==a?"#FFFAF1":"#FFF"}))),l:t.sr("chartRef","06b829a4-2"),m:0===n.activeType,n:1===n.activeType,o:t.p({wordData:n.wordData,width:330,height:330}),p:t.s("top:"+n.contentTop+"px;")}}]]);wx.createPage(n);