import Magix from 'magix' import * as View from '../../../../view' Magix.applyStyle('@./channel-optimize.less') export default View.extend({ tmpl: '@channel-optimize.html', init (options) { this.options = options }, async render () { const type = this.updater.get('type') || 1 this.updater.digest({ loading: true }) const crowds = await this.getData(type) this.updater.digest({ channelName: this.options.channelName, crowds, type, loading: false }) }, async getData (type) { try { const models = [{ name: 'api_report_channel_crowdlist_get', params: { type, deliverType: this.options.deliverType } }] const [model] = await this.fetch(models) const data = model.get('data', []) return data } catch (error) { this.alert('错误提示', error.msg || error.message || error, null, { mask: true }) } }, 'changeType' (e) { this.render() }, async check () { return { ok: true } } })