import Magix from 'magix' import View from '../../../../view' Magix.applyStyle('@./crowd-scene.less') export default View.extend({ tmpl: '@crowd-scene.html', init(options) { this.options = options }, async render() { const crowdScenes = await this.getData() const markConfigs = await this.getMarkConfig() const MARK_MAP = Magix.toMap(markConfigs, 'type') this.updater.digest({ MARK_MAP, markConfigs, crowdScenes }) }, async getData() { try { const { crowdId, deliverType } = this.options const params = { crowdId, deliverType } const models = [ { name: 'api_report_channel_crowdScene_get', params } ] const [model] = await this.fetch(models) const data = model.get('data', { items: [] }) return data } catch (error) { this.alert('错误提示', error.msg || error.message || error) } }, async getMarkConfig() { try { const models = [ { name: 'alp_dmp_item_rank_mark_get' } ] const [model] = await this.fetch(models) const data = model.get('data.markConfigs', []) return data } catch (error) { this.alert('错误提示', error.msg || error.message || error, null, { mask: true }) } } })