2 lines
16 KiB
JavaScript
2 lines
16 KiB
JavaScript
import{s as ne,r as e,K as re,o as ue,L as f,w as ye,M as pe,c as W,d as w,m as $,h as I,F as de,e as ce,b as U,t as ve,u as me,J as xe}from"./index-BO9WyeNZ.js";import{u as fe,a as ge}from"./usethemestore-BOyyPoG1.js";import{c as he,a as be,b as q,d as Ae,e as Q,f as X}from"./computedInfo-DRxOaYt6.js";import{_ as Le}from"./_plugin-vue_export-helper-DlAUqK2U.js";const Se={class:"box"},we={class:"typelist"},Ie=["onClick"],ke={__name:"NewDesign",setup(Oe){const ee=me(),te=fe(),{theme:x}=ne(te);let o=null,s=e(4),g=e(null),r=null,J=e(0),h=e(null),u=null,N=e(0),b=e(null),y=null,R=e(0),A=e(null),p=null,j=e(0);e([]);let P=e([]),d=e([]),m=e([]),F=e(null),k=e(null),O=e(null),L=e(null),K=e(null),V=e(null),G=e(null),z=e(null),C=e(null),_=e(null),D=e(null),E=e(null),B=e(null),M=e(null);e();let le="http://localhost:8012/akshare";const ae=async()=>(await ge({url:le+"/kdata",method:"get"})).data.message,Z=e(null),H=e(null);let i=e([]);const Y=()=>{let t=Z.value.offsetHeight;console.log(Z.value.children.length),Z.value.children.length-1,s.value?(i.value=[],i.value.push(t*(1-s.value*.15)),H.value.style.height=`${i.value[0]-10}px`,i.value.push(t*.15),console.log(i.value)):(i.value=[],H.value.style.height=`${t}px`)};let v=e([{id:1,name:"MACD",attId:"charts1",status:!1,options:{animation:!1,tooltip:{trigger:"axis",axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}}},dataZoom:[{type:"inside"},{type:"slider",show:!1}],xAxis:{type:"category",boundaryGap:!1,data:[]},yAxis:{type:"value"},series:[{name:"DIF",type:"line",itemStyle:{normal:{color:"rgba(204,102,0,1)"}},symbol:"none",data:[]},{name:"DEA",type:"line",itemStyle:{normal:{color:"rgba(0,128,255,1)"}},symbol:"none",data:[]},{name:"MACD",type:"bar",barWidth:"1",data:[]}]}},{id:2,name:"VOL",attId:"charts2",status:!1,options:{animation:!1,tooltip:{trigger:"axis",axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}}},dataZoom:[{type:"inside"},{type:"slider",show:!1}],xAxis:{type:"category",data:[]},yAxis:{type:"value",interval:10},series:[{name:"VOL",type:"bar",data:[]}]}},{id:3,name:"KDJ",attId:"charts3",status:!1,options:{animation:!1,tooltip:{trigger:"axis",axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}}},dataZoom:[{type:"inside",xAxisIndex:[0,0],start:20,end:100},{type:"slider",show:!1}],xAxis:{type:"category",boundaryGap:!1,data:[]},series:[{name:"K",type:"line",data:[],symbol:"none",smooth:!0},{name:"D",type:"line",data:[],symbol:"none",smooth:!0},{name:"J",type:"line",data:[],symbol:"none",smooth:!0}]}},{id:4,name:"RSI",attId:"charts4",status:!1,options:{animation:!1,tooltip:{trigger:"axis",axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}}},dataZoom:[{type:"inside",xAxisIndex:[0,0],start:20,end:100},{type:"slider",show:!1}],xAxis:{type:"category",boundaryGap:!1,data:[]},series:[{name:"rsi1",type:"line",data:[],symbol:"none",smooth:!0},{name:"rsi2",type:"line",data:[],symbol:"none",smooth:!0},{name:"rsi3",type:"line",data:[],symbol:"none",smooth:!0}]}}]);e([]);const ie=t=>{if(t.attId=="charts1")if(!J.value)s.value=s.value-1,r.group="",window.removeEventListener("resize",function(){r.resize()}),r.dispose(),r=null,g.value.style.display="none",J.value=1;else{s.value=s.value+1,g.value.style.height=`${i.value[1]}px`,g.value.style.display="block",r=f(g.value);let a={animation:!1,tooltip:{trigger:"axis",axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}}},grid:{top:"10%",left:"3%",right:"3%",bottom:"20%"},dataZoom:[{type:"inside"},{type:"slider",show:!1}],xAxis:{type:"category",boundaryGap:!1,data:d.value},yAxis:{type:"value"},series:[{name:"DIF",type:"line",itemStyle:{normal:{color:"rgba(204,102,0,1)"}},symbol:"none",data:k.value},{name:"DEA",type:"line",itemStyle:{normal:{color:"rgba(0,128,255,1)"}},symbol:"none",data:O.value},{name:"MACD",type:"bar",barWidth:"1",data:L.value}]};r.setOption(a),r.group="group1",J.value=0}if(t.attId=="charts2")if(!N.value)s.value=s.value-1,u.group="",window.removeEventListener("resize",function(){u.resize()}),u.dispose(),u=null,h.value.style.display="none",N.value=1;else{s.value=s.value+1,h.value.style.height=`${i.value[1]}px`,h.value.style.display="block",u=f(h.value);let a={animation:!1,tooltip:{trigger:"axis",axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}}},grid:{top:"10%",left:"3%",right:"3%",bottom:"20%"},dataZoom:[{type:"inside"},{type:"slider",show:!1}],xAxis:{type:"category",data:d.value},yAxis:{type:"value",interval:10},series:[{name:"VOL",type:"bar",data:M.value}]};u.setOption(a),u.group="group1",N.value=0}if(t.attId=="charts3")if(!R.value)s.value=s.value-1,y.group="",window.removeEventListener("resize",function(){y.resize()}),y.dispose(),y=null,b.value.style.display="none",R.value=1;else{s.value=s.value+1,b.value.style.height=`${i.value[1]}px`,b.value.style.display="block",y=f(b.value);let a={animation:!1,tooltip:{trigger:"axis",axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}}},grid:{top:"10%",left:"3%",right:"3%",bottom:"20%"},dataZoom:[{type:"inside",xAxisIndex:[0,0],start:20,end:100},{type:"slider",show:!1}],xAxis:{type:"category",boundaryGap:!1,data:d.value},yAxis:{type:"value"},series:[{name:"K",type:"line",data:z.value,symbol:"none",smooth:!0},{name:"D",type:"line",data:C.value,symbol:"none",smooth:!0},{name:"J",type:"line",data:_.value,symbol:"none",smooth:!0}]};y.setOption(a),y.group="group1",R.value=0}if(t.attId=="charts4")if(!j.value)s.value=s.value-1,p.group="",window.removeEventListener("resize",function(){p.resize()}),p.dispose(),p=null,A.value.style.display="none",j.value=1;else{s.value=s.value+1,A.value.style.height=`${i.value[1]}px`,A.value.style.display="block",p=f(A.value);let a={animation:!1,tooltip:{trigger:"axis",axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}}},grid:{top:"10%",left:"3%",right:"3%",bottom:"20%"},dataZoom:[{type:"inside",xAxisIndex:[0,0],start:20,end:100},{type:"slider",show:!1}],xAxis:{type:"category",boundaryGap:!1,data:d.value},yAxis:{type:"value"},series:[{name:"rsi1",type:"line",data:D.value,symbol:"none",smooth:!0},{name:"rsi2",type:"line",data:E.value,symbol:"none",smooth:!0},{name:"rsi3",type:"line",data:B.value,symbol:"none",smooth:!0}]};p.setOption(a),p.group="group1",j.value=0}Y(),o.group="",window.removeEventListener("resize",function(){o.resize()}),o.dispose(),o=null,o=f(document.getElementById("main"));const n={animation:!1,tooltip:{trigger:"axis",axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"},animation:!1}},legend:{data:["KLine","MA5","BOLL1","BOLL2"]},grid:[{left:"3%",right:"3%",bottom:"5%"}],xAxis:[{type:"category",data:d.value,gridIndex:0,scale:!0,boundaryGap:!1,axisLine:{onZero:!1},splitLine:{show:!1},splitNumber:20,min:"dataMin",max:"dataMax",sampling:"lttb"}],yAxis:[{gridIndex:0,scale:!0,splitArea:{show:!1}}],dataZoom:[{type:"slider"},{type:"inside"}],series:[{name:"KLine",type:"candlestick",xAxisIndex:0,yAxisIndex:0,data:P.value,itemStyle:{normal:{color:"#ef232a",color0:"#14b143",borderColor:"#ef232a",borderColor0:"#14b143"}}},{name:"MA5",type:"line",xAxisIndex:0,yAxisIndex:0,data:F.value,symbol:"none",smooth:!0,lineStyle:{normal:{opacity:.5}}},{name:"BOLL1",type:"line",xAxisIndex:0,yAxisIndex:0,data:V.value,symbol:"none",smooth:!0,lineStyle:{normal:{opacity:.5,color:"red"}}},{name:"BOLL2",type:"line",xAxisIndex:0,yAxisIndex:0,data:G.value,symbol:"none",smooth:!0,lineStyle:{normal:{opacity:.5,color:"green"}}}]};o.setOption(n),o.group="group1",window.addEventListener("resize",function(){o.resize()}),console.log(Z.value.children.length)};re("group1");let S=e({});const oe=async()=>{try{if(S.value=await ae(),Object.keys(S.value.date).length==0){console.log("没有数据"),ee.push("/thenew/nodata");return}P.value=[],d.value=[],m.value=[],F.value=[],k.value=[],O.value=[],L.value=[],K.value=[],V.value=[],G.value=[],z.value=[],C.value=[],_.value=[],D.value=[],E.value=[],B.value=[],M.value=[],d.value=Object.values(S.value.date);let{open:t,close:n,low:a,high:c}=S.value;for(let l=0;l<Object.keys(t).length;l++)P.value.push([t[l],n[l],a[l],c[l]]),m.value.push(n[l]);F.value=he(m.value,5),K.value=be(m.value),V.value=m.value.map(l=>parseFloat((l+K.value).toFixed(2))),G.value=m.value.map(l=>parseFloat((l-K.value).toFixed(2))),k.value=q(m.value).dif,O.value=q(m.value).dea,L.value=q(m.value).macd,L.value=L.value.map(function(l){return{value:l,itemStyle:{color:l>=0?"#FF0000":"#00FF00"}}}),v.value[0].options.series[0].data=k.value,v.value[0].options.series[1].data=O.value,v.value[0].options.series[2].data=L.value,v.value[0].options.xAxis.data=d.value,M.value=Ae(n,c,a),v.value[1].options.xAxis.data=d.value,v.value[1].options.series[0].data=M.value,z.value=Q(S.value).kValues,C.value=Q(S.value).dValues,_.value=Q(S.value).jValues,v.value[2].options.series[0].data=z.value,v.value[2].options.series[1].data=C.value,v.value[2].options.series[2].data=_.value,v.value[2].options.xAxis.data=d.value,D.value=X(m.value),E.value=X(m.value,12),B.value=X(m.value,24),v.value[3].options.series[0].data=D.value,v.value[3].options.series[1].data=E.value,v.value[3].options.series[2].data=B.value,v.value[3].options.xAxis.data=d.value,Y()}catch(t){console.log(t)}};return ue(async()=>{await oe(),document.getElementById("main").removeAttribute("_echarts_instance_"),o=f(document.getElementById("main"));let t={animation:!1,tooltip:{trigger:"axis",axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"},animation:!1}},legend:{data:["KLine","MA5","BOLL1","BOLL2"],textStyle:{color:"#fff",fontSize:12}},grid:[{left:"3%",right:"3%",bottom:"10%",top:"12%"}],xAxis:[{type:"category",data:d.value,gridIndex:0,scale:!0,boundaryGap:!1,axisLine:{onZero:!1},splitLine:{show:!1},splitNumber:20,min:"dataMin",max:"dataMax",sampling:"lttb"}],yAxis:[{gridIndex:0,scale:!0,splitArea:{show:!1},splitLine:{lineStyle:{color:"white",opacity:.1}}}],dataZoom:[{type:"slider"},{type:"inside"}],series:[{name:"KLine",type:"candlestick",xAxisIndex:0,yAxisIndex:0,data:P.value,itemStyle:{normal:{color:"#ef232a",color0:"#14b143",borderColor:"#ef232a",borderColor0:"#14b143"}}},{name:"MA5",type:"line",xAxisIndex:0,yAxisIndex:0,data:F.value,symbol:"none",smooth:!0,lineStyle:{normal:{opacity:.8,width:2}}},{name:"BOLL1",type:"line",xAxisIndex:0,yAxisIndex:0,data:V.value,symbol:"none",smooth:!0,lineStyle:{normal:{opacity:.5,color:"red"}}},{name:"BOLL2",type:"line",xAxisIndex:0,yAxisIndex:0,data:G.value,symbol:"none",smooth:!0,lineStyle:{normal:{opacity:.5,color:"green"}}}]};x.value||(t.legend.textStyle.color="#fff",t.yAxis[0].splitLine.lineStyle.color="#fff",t.yAxis[0].splitLine.lineStyle.opacity=.1),x.value&&(t.legend.textStyle.color="#000",t.yAxis[0].splitLine.lineStyle.color="rgb(168, 168, 168)",t.yAxis[0].splitLine.lineStyle.opacity=.4),o.setOption(t),o.group="group1",window.addEventListener("resize",function(){o.resize()}),g.value.style.height=`${i.value[1]}px`,r=f(g.value);let n={animation:!1,tooltip:{trigger:"axis",axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}}},grid:{top:"10%",left:"3%",right:"3%",bottom:"20%"},dataZoom:[{type:"inside"},{type:"slider",show:!1}],xAxis:{type:"category",boundaryGap:!1,data:d.value},yAxis:[{type:"value",splitLine:{lineStyle:{color:"white",opacity:.1}}}],series:[{name:"DIF",type:"line",itemStyle:{normal:{color:"rgba(204,102,0,1)"}},symbol:"none",data:k.value},{name:"DEA",type:"line",itemStyle:{normal:{color:"rgba(0,128,255,1)"}},symbol:"none",data:O.value},{name:"MACD",type:"bar",barWidth:"1",data:L.value}]};x.value||(n.yAxis[0].splitLine.lineStyle.color="#fff",n.yAxis[0].splitLine.lineStyle.opacity=.1),x.value&&(n.yAxis[0].splitLine.lineStyle.color="rgb(168, 168, 168)",n.yAxis[0].splitLine.lineStyle.opacity=.4),r.setOption(n),r.group="group1",window.addEventListener("resize",function(){r.resize()}),h.value.style.height=`${i.value[1]}px`,u=f(h.value);let a={animation:!1,tooltip:{trigger:"axis",axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}}},grid:{top:"10%",left:"3%",right:"3%",bottom:"20%"},dataZoom:[{type:"inside"},{type:"slider",show:!1}],xAxis:{type:"category",data:d.value},yAxis:[{type:"value",interval:10,splitLine:{lineStyle:{color:"white",opacity:.1}}}],series:[{name:"VOL",type:"bar",data:M.value}]};x.value||(a.yAxis[0].splitLine.lineStyle.color="#fff",a.yAxis[0].splitLine.lineStyle.opacity=.1),x.value&&(a.yAxis[0].splitLine.lineStyle.color="rgb(168, 168, 168)",a.yAxis[0].splitLine.lineStyle.opacity=.4),u.setOption(a),u.group="group1",window.addEventListener("resize",function(){u.resize()}),b.value.style.height=`${i.value[1]}px`,y=f(b.value);let c={animation:!1,tooltip:{trigger:"axis",axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}}},grid:{top:"10%",left:"3%",right:"3%",bottom:"20%"},dataZoom:[{type:"inside",xAxisIndex:[0,0],start:20,end:100},{type:"slider",show:!1}],xAxis:{type:"category",boundaryGap:!1,data:d.value},yAxis:[{type:"value",splitLine:{lineStyle:{color:"white",opacity:.1}}}],series:[{name:"K",type:"line",data:z.value,symbol:"none",smooth:!0,lineStyle:{width:1}},{name:"D",type:"line",data:C.value,symbol:"none",smooth:!0,lineStyle:{width:1}},{name:"J",type:"line",data:_.value,symbol:"none",smooth:!0,lineStyle:{width:1}}]};x.value||(c.yAxis[0].splitLine.lineStyle.color="#fff",c.yAxis[0].splitLine.lineStyle.opacity=.1),x.value&&(c.yAxis[0].splitLine.lineStyle.color="rgb(168, 168, 168)",c.yAxis[0].splitLine.lineStyle.opacity=.4),y.setOption(c),y.group="group1",window.addEventListener("resize",function(){y.resize()}),A.value.style.height=`${i.value[1]}px`,p=f(A.value);let l={animation:!1,tooltip:{trigger:"axis",axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}}},grid:{top:"10%",left:"3%",right:"3%",bottom:"20%"},dataZoom:[{type:"inside",xAxisIndex:[0,0],start:20,end:100},{type:"slider",show:!1}],xAxis:{type:"category",boundaryGap:!1,data:d.value},yAxis:[{type:"value",splitLine:{lineStyle:{color:"white",opacity:.1}}}],series:[{name:"rsi1",type:"line",data:D.value,symbol:"none",smooth:!0,lineStyle:{width:1}},{name:"rsi2",type:"line",data:E.value,symbol:"none",smooth:!0,lineStyle:{width:1}},{name:"rsi3",type:"line",data:B.value,symbol:"none",smooth:!0,lineStyle:{width:1}}]};x.value||(l.yAxis[0].splitLine.lineStyle.color="#fff",l.yAxis[0].splitLine.lineStyle.opacity=.1),x.value&&(l.yAxis[0].splitLine.lineStyle.color="rgb(168, 168, 168)",l.yAxis[0].splitLine.lineStyle.opacity=.4),p.setOption(l),p.group="group1",window.addEventListener("resize",function(){p.resize()}),ye(()=>x.value,async(T,ze)=>{if(await xe(),console.log(T),T===!1)try{t.legend.textStyle.color="#fff",t.yAxis[0].splitLine.lineStyle.color="#fff",t.yAxis[0].splitLine.lineStyle.opacity=.1,n.yAxis[0].splitLine.lineStyle.color="#fff",n.yAxis[0].splitLine.lineStyle.opacity=.1,a.yAxis[0].splitLine.lineStyle.color="#fff",a.yAxis[0].splitLine.lineStyle.opacity=.1,c.yAxis[0].splitLine.lineStyle.color="#fff",c.yAxis[0].splitLine.lineStyle.opacity=.1,l.yAxis[0].splitLine.lineStyle.color="#fff",l.yAxis[0].splitLine.lineStyle.opacity=.1,o.setOption(t),r.setOption(n),u.setOption(a),y.setOption(c),p.setOption(l)}catch{}if(T===!0)try{t.legend.textStyle.color="#000",t.yAxis[0].splitLine.lineStyle.color="rgb(168, 168, 168)",t.yAxis[0].splitLine.lineStyle.opacity=.4,n.yAxis[0].splitLine.lineStyle.color="rgb(168, 168, 168)",n.yAxis[0].splitLine.lineStyle.opacity=.4,a.yAxis[0].splitLine.lineStyle.color="rgb(168, 168, 168)",a.yAxis[0].splitLine.lineStyle.opacity=.4,c.yAxis[0].splitLine.lineStyle.color="rgb(168, 168, 168)",c.yAxis[0].splitLine.lineStyle.opacity=.4,l.yAxis[0].splitLine.lineStyle.color="rgb(168, 168, 168)",l.yAxis[0].splitLine.lineStyle.opacity=.4,o.setOption(t),r.setOption(n),u.setOption(a),y.setOption(c),p.setOption(l)}catch{}})}),pe(()=>{o&&(window.removeEventListener("resize",function(){o.resize()}),o.dispose(),o=null),r&&(window.removeEventListener("resize",function(){r.resize()}),r.dispose(),r=null),u&&(window.removeEventListener("resize",function(){u.resize()}),u.dispose(),u=null),y&&(window.removeEventListener("resize",function(){y.resize()}),y.dispose(),y=null),p&&(window.removeEventListener("resize",function(){p.resize()}),p.dispose(),p=null)}),(t,n)=>(U(),W("div",Se,[w("div",{class:"chartsinfo",ref_key:"chartsInfo",ref:Z},[w("div",{id:"main",ref_key:"mKline",ref:H,class:"flex-item",style:$({height:`${I(i)[0]}px`})},null,4),w("div",{id:"charts1",ref_key:"charts1",ref:g,style:$({height:`${I(i)[1]}px`})},null,4),w("div",{id:"charts2",ref_key:"charts2",ref:h,style:$({height:`${I(i)[1]}px`})},null,4),w("div",{id:"charts3",ref_key:"charts3",ref:b,style:$({height:`${I(i)[1]}px`})},null,4),w("div",{id:"charts4",ref_key:"charts4",ref:A,style:$({height:`${I(i)[1]}px`})},null,4)],512),w("ul",we,[(U(!0),W(de,null,ce(I(v),(a,c)=>(U(),W("li",{key:c,onClick:l=>ie(a)},ve(a.name),9,Ie))),128))])]))}},Be=Le(ke,[["__scopeId","data-v-1c409f96"]]);export{Be as default};
|