import Magix from 'magix' import * as View from '../../../view' Magix.applyStyle('@./crowds-custom.less') Magix.applyStyle('@./include-tags.less') Magix.applyStyle('@./effect.less') export default View.extend({ tmpl: '@effect.html', init (options) { this.options = options }, async render () { const loc = Magix.Router.parse() const { group } = this.options const chartData = [ { bizDate: '2017-03-21', 本店铺触达用户数: 10, 行业标杆触达用户数: 111 }, { bizDate: '2017-03-22', 本店铺触达用户数: 20, 行业标杆触达用户数: 32 }, { bizDate: '2017-03-23', 本店铺触达用户数: 30, 行业标杆触达用户数: 15 }, { bizDate: '2017-03-24', 本店铺触达用户数: 15, 行业标杆触达用户数: 23 }, { bizDate: '2017-03-25', 本店铺触达用户数: 28, 行业标杆触达用户数: 15 } ] const effects = await this.getEffects() const curMetric = effects.metric[0] || {} this.updater.digest({ curMetric, effects, chartData, group }) this.renderChart() }, // 趋势数据图 async renderChart () { this.updater.digest({ loading: true }) const { Accounting, curMetric } = this.updater.get() const trendData = await this.getEffectsTrend(curMetric.key) const text = curMetric.name || '' const selfKey = `本店${text}` const benmarkKey = `行业标杆${text}` for (const d of trendData) { d[selfKey] = d.value d[benmarkKey] = d.benchmark } const chartOptions = this.getChartOptions(14) chartOptions.graphs[0].field = selfKey chartOptions.graphs[1].field = benmarkKey chartOptions.tips.content = (data, e) => { return `