Commit e2befc53 by 匡雅琴

接口联调

1 parent c58f87ec
...@@ -81,7 +81,7 @@ export default { ...@@ -81,7 +81,7 @@ export default {
}, },
drawBar(dataList) { drawBar(dataList) {
if (dataList && dataList.length) { if (dataList && dataList.length) {
console.log(this.dataList) console.log(dataList)
this.barOptions.xAxis.data = dataList.map(item => item[this.label]) this.barOptions.xAxis.data = dataList.map(item => item[this.label])
this.barOptions.series[0].data = dataList.map(item => item[this.valueName]) this.barOptions.series[0].data = dataList.map(item => item[this.valueName])
this[this.domId].setOption(this.barOptions) this[this.domId].setOption(this.barOptions)
......
...@@ -2,19 +2,22 @@ ...@@ -2,19 +2,22 @@
<div class="marketing-left"> <div class="marketing-left">
<PullDownSelect ref="leftDownSelect" :selectList="selectList" @selectVal="selectVal"></PullDownSelect> <PullDownSelect ref="leftDownSelect" :selectList="selectList" @selectVal="selectVal"></PullDownSelect>
<inner-tab class="inner-tab" v-if="tabShow" :list="tabList" :width="6.4" :itemPadding="0.5" @changeTab="changeTab"></inner-tab> <inner-tab class="inner-tab" v-if="tabShow" :list="tabList" :width="6.4" :itemPadding="0.5" @changeTab="changeTab"></inner-tab>
<BarChart ref="trendChartRef" domId="trendChart" :label="'statMonth'" :height="'16vh'" :colorList="colorList" :valueName="valueName"></BarChart> <BarChart v-show="chartShow" ref="trendChartRef" domId="trendChart" :label="'statMonth'" :height="'16vh'" :colorList="colorList" :valueName="valueName"></BarChart>
<LineChart v-show="!chartShow" ref="monthIncomeLineChartRef" domId="monthIncomeLineChart" :height="'16vh'" :valName="valName"></LineChart>
</div> </div>
</template> </template>
<script> <script>
import BarChart from './BarChart.vue' import BarChart from './BarChart.vue'
import LineChart from './LineCharts.vue'
import PullDownSelect from './PullDownSelect.vue' import PullDownSelect from './PullDownSelect.vue'
import { digitalMarketingLeftSelectList } from './constant' import { digitalMarketingLeftSelectList } from './constant'
export default { export default {
name: 'DigitalMarketingLeft', name: 'DigitalMarketingLeft',
components: { components: {
PullDownSelect, PullDownSelect,
BarChart BarChart,
LineChart
}, },
data() { data() {
return { return {
...@@ -24,7 +27,10 @@ export default { ...@@ -24,7 +27,10 @@ export default {
valueName: 'registerNum', valueName: 'registerNum',
tabShow: false, tabShow: false,
marketingTrendList: [], marketingTrendList: [],
marketingCrowdFundingTrendList: [] marketingCrowdFundingTrendList: [],
chartShow: true,
valName: 'orderNum',
tabActive: 0
} }
}, },
...@@ -38,17 +44,23 @@ export default { ...@@ -38,17 +44,23 @@ export default {
this.$bus.$on('digitalMarketingTabChange', data => { this.$bus.$on('digitalMarketingTabChange', data => {
// console.log(data) // console.log(data)
// this.$refs.leftDownSelect.selectType = '' this.$refs.leftDownSelect.selectType = ''
this.tabActive - data
this.tabShow = false this.tabShow = false
this.chartShow = true
this.selectList = digitalMarketingLeftSelectList[data] this.selectList = digitalMarketingLeftSelectList[data]
switch (data) { switch (data) {
case 0: case 0:
this.valueName = 'registerNum' this.valueName = 'registerNum'
this.$nextTick(() => {
this.$refs.trendChartRef.drawBar(this.marketingTrendList) this.$refs.trendChartRef.drawBar(this.marketingTrendList)
})
break break
case 1: case 1:
this.valueName = 'activityNum' this.valueName = 'activityNum'
this.$nextTick(() => {
this.$refs.trendChartRef.drawBar(this.marketingCrowdFundingTrendList) this.$refs.trendChartRef.drawBar(this.marketingCrowdFundingTrendList)
})
break break
} }
}) })
...@@ -60,30 +72,61 @@ export default { ...@@ -60,30 +72,61 @@ export default {
// this.tabShow = false // this.tabShow = false
switch (val.val) { switch (val.val) {
case 'registerNum': case 'registerNum':
this.chartShow = true
this.valueName = 'registerNum' this.valueName = 'registerNum'
this.$refs.trendChartRef.drawBar(this.marketingTrendList) this.$refs.trendChartRef.drawBar(this.marketingTrendList)
break break
case 'activeNum': case 'activeNum':
this.chartShow = true
this.valueName = 'activeNum' this.valueName = 'activeNum'
this.$nextTick(() => {
this.$refs.trendChartRef.drawBar(this.marketingTrendList) this.$refs.trendChartRef.drawBar(this.marketingTrendList)
})
break break
case 'output': case 'output':
this.valueName = 'output' this.valName = 'output'
this.$refs.trendChartRef.drawBar(this.marketingTrendList) this.chartShow = false
// this.tabShow = true this.tabShow = true
this.$refs.monthIncomeLineChartRef.drawLine(this.marketingTrendList)
break break
case 'activityNum': case 'activityNum':
this.chartShow = true
this.valueName = 'activityNum' this.valueName = 'activityNum'
this.$refs.trendChartRef.drawBar(this.marketingCrowdFundingTrendList) this.$refs.trendChartRef.drawBar(this.marketingCrowdFundingTrendList)
break break
case 'orderNum': case 'orderNum':
this.valueName = 'orderNum' this.chartShow = true
// this.valueName = 'orderNum'
this.$refs.trendChartRef.drawBar(this.marketingCrowdFundingTrendList) this.$refs.trendChartRef.drawBar(this.marketingCrowdFundingTrendList)
break break
case 'avgPrice': case 'avgPrice':
this.chartShow = true
this.valueName = 'avgPrice' this.valueName = 'avgPrice'
this.$refs.trendChartRef.drawBar(this.marketingCrowdFundingTrendList) this.$refs.trendChartRef.drawBar(this.marketingCrowdFundingTrendList)
this.tabShow = true // this.tabShow = true
break
}
},
changeTab(val) {
console.log(val)
switch (val) {
case 0:
if (this.tabActive === 0) {
this.valName = 'orderNum'
console.log(111)
this.$nextTick(() => {
this.$refs.monthIncomeLineChartRef.drawLine(this.marketingTrendList)
})
}
break
case 1:
if (this.tabActive === 0) {
this.valName = 'output'
this.$nextTick(() => {
this.$refs.monthIncomeLineChartRef.drawLine(this.marketingTrendList)
})
}
break break
} }
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!