const Magix = require('magix'); const View = require('dmp-new/view') Magix.applyStyle('@../crowds.less') Magix.applyStyle('@./index.less') const viewMaps = { '1': 'channel-zuanshi', '49': 'channel-zuanshi', '34': 'channel-danpin', '44': 'channel-danpin', '32': 'channel-danpin', '105': 'channel-zuanshi' //超级推荐 } module.exports = View.extend({ tmpl: '@custom.html', init(options) { this.options = options }, render() { const channels = this.options.channels this.updater.digest({ viewMaps, coverageApi: this.options.coverageApi, channels, selected: channels[0].deliverProductId, params: this.options.params }); }, check() { const me = this return new Promise(async resolve => { const channels = me.options.channels for (const channel of channels) { let subVframe = Magix.Vframe.get(`channel_${channel.deliverProductId}`) let selectedList = subVframe.invoke('getSelected') if (typeof selectedList !== 'string') { channel.configDetail = JSON.stringify(selectedList) } } let ok this.confirm({ title: '保存提示', content: '保存后,各渠道可触达人数会根据您在各渠道添加到右侧的条件进行预估', async enterCallback() { try { //保存配置 let models = [{ name: 'api_deliverpredict_config_post', params: channels, isJson: true }] await me.fetch(models) ok = true } catch (error) { ok = false me.alert('错误提示', error.msg || error.message) } resolve({ ok }) }, cancelCallback() { resolve({ ok: false }) } }) }) } });