1 |
- import{d as _,aI as v,r as x,E as g,j as w,Y as C,ai as r,o as i,M as l,O as S,P as b,V as A,u as c,a as R,R as L}from"./vue.1RczIYhx.js";import{i as M,L as k}from"./echarts.DoXO02ct.js";import{g as B}from"./api.C3JZYvte.js";import{u as D}from"./useResponse.DqThFJSa.js";import{_ as E}from"./_plugin-vue_export-helper.DlAUqK2U.js";import"./index.DYFzjhQc.js";import"./elementPlus.CXoFsoPv.js";const I=_({__name:"AverageMonthly",props:{asin:String},setup(p){const d=p,{asin:u}=d;let o=v("chartRef"),e=null,a=null,n=x([]);g(()=>{m()}),w(()=>{f()}),C(()=>{a==null||a.disconnect(),e==null||e.dispose()});function s(){if(!e||n.value.length===0)return;const t={title:{text:"每月平均评分"},tooltip:{trigger:"axis"},legend:{data:["总量","平均分"]},grid:{top:"20%",left:"10%",right:"10%",bottom:"10%"},dataset:{dimensions:["month","total","avg_score"],source:n.value},xAxis:{type:"category"},yAxis:[{id:0,type:"value",name:"总量",nameTextStyle:{fontSize:14,color:"#3480CE"},splitLine:{show:!0},axisLine:{show:!0,lineStyle:{color:"#3480CE",width:1}}},{id:1,type:"value",name:"平均分",nameTextStyle:{fontSize:14,color:"#F19A38"},splitLine:{show:!1},axisLine:{show:!0,lineStyle:{color:"#F19A38",width:1}}}],series:[{yAxisIndex:0,color:"#3480CE",name:"总量",type:"bar",barWidth:"18px",itemStyle:{borderRadius:[4,4,4,4]}},{yAxisIndex:1,color:"#F19A38",name:"平均分",type:"line",areaStyle:{color:new k(0,0,0,1,[{offset:0,color:"rgba(241,154,56, 0.1)"},{offset:1,color:"rgba(241,154,56, 0)"}])}}]};e.setOption(t)}function f(){o.value&&(e=M(o.value),s(),a=new ResizeObserver(()=>{e==null||e.resize()}),o.value&&a.observe(o.value))}async function m(){const t=await D(B,{asin:u});t.code===2e3&&t.data&&(n.value=t.data,s())}return(t,z)=>{const h=r("el-empty"),y=r("el-card");return i(),l(y,{class:"border-none",shadow:"hover"},{default:S(()=>[b(R("div",{ref_key:"chartRef",ref:o,class:"chart"},null,512),[[A,c(n).length>0]]),c(n).length==0?(i(),l(h,{key:0,description:"暂无数据",class:"chart"})):L("",!0)]),_:1})}}}),P=E(I,[["__scopeId","data-v-45124fb6"]]);export{P as default};
|