ActivityTrends.vue 1.78 KB
<!--
 * @Description: 
 * @Author: huyue
 * @Date: 2023-08-03 15:31:53
 * @LastEditors: huyue
 * @LastEditTime: 2023-08-03 16:43:18
-->
<!-- 近一年活动场次趋势图 -->
<template>
  <div class="activity-box">
    <box-title title="近一年活动场次趋势图"></box-title>
    <BarChart
      v-if="!isEmpty"
      ref="activityTrendChartRef"
      class="bar-chart"
      isMultiple
      :barWidth="'24'"
      domId="activityTrendChart"
      height="26.22vh"
      :dataList.sync="dataList"
      :colorList="colorList"
      :tooltipFormatterObj="tooltips.amountTooltip"
    ></BarChart>
    <div v-else class="empty">
      <Empty></Empty>
    </div>
  </div>
</template>

<script>
import BarChart from './BarChart.vue'
export default {
  name: 'ActivityTrends',
  components: {
    BarChart
  },
  data() {
    return {
      isEmpty: false,
      dataList: [],
      tooltips: {
        amountTooltip: {
          label: '场次',
          attrName: 'actiNum'
        }
      },
      colorList: [
        ['#2AD191', '#00A89E', '#061422'],
        ['#22D8FF', '#223FA9', '#061422']
      ]
    }
  },
  created() {
    // this.getActivityTrend()
  },

  mounted() {
    // this.$refs.activityTrendChartRef.drawBar()
    this.getActivityTrend()
  },

  methods: {
    async getActivityTrend() {
      const _result = await this.api.crowdFunding.getActivityTrend()
      const _data = _result.data.dataList
      if (!_data.length) {
        this.isEmpty = true
        return
      }
      this.dataList = _data
      this.$nextTick(() => {
        this.$refs.activityTrendChartRef.drawBar()
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.activity-box {
  width: 36.94vw;
  height: 34vh;
  box-shadow: inset 0 0 20px 0 #3d57ff69;
  .bar-chart {
    padding-left: 1.39vw;
  }
}
</style>