const Magix = require('magix') const View = require('dmp-new/view') Magix.applyStyle('@./list.less') module.exports = View.extend({ tmpl: '@list.html', init(options) { this.options = options }, async render() { const { listType } = this.options const chances = [ { name: '溢价机会', desc: '提升出价,对好的人群加强优质流量获取', chanceType: 'premium' }, { name: '扩量机会', desc: '提升人群规模,发现扩量机会', chanceType: 'expand' }, { name: '场景机会', desc: '跨渠道投放,提升人群覆盖面', chanceType: 'scene' } ] // const advice = await this.getSuggests() this.updater.digest({ showSuggest: true, chances, listType // advice }) }, // async getSuggests () { // try { // const params = { // queryType: 'TOTAL' // } // const models = [{ // name: 'api_crowd_advice_tip_get', // params // }] // const [model] = await this.fetch(models) // const channelAdvice = model.get('data.channelAdvice', []) // return channelAdvice[0] || {} // } catch (error) { // console.error(error) // return { // mock // advice_cnt: 99999 // } // // this.alert('错误提示', error.msg || error.message || error) // } // }, 'showHideSuggest'(e) { const { showSuggest } = this.updater.get() this.updater.digest({ showSuggest: !showSuggest }) }, // 出价建议浮层 'priceSuggest'(e) { const viewPath = 'dmp-new/xsite-proxy' const viewOptions = { xview: 'dmp-new/views/pages/crowds-bp/price-suggest/index', params: { bizCode: 'subway', // subway, feedFlow, zszw queryParam: { campaignId: 11111, adgroupId: 22222, adgroupName: 'xxxx单元名称' } } } const dialogOptions = { width: 1100, header: { title: '自定义人群机会洞察' // tip: '通过已投放...' }, footer: { enter: false, cancel: false } } this.mxModal(viewPath, viewOptions, dialogOptions) }, // dmp出价建议浮层 'dmpPriceSuggest'(e) { const viewPath = 'dmp-new/xsite-proxy' const { chanceType } = e.params const viewOptions = { xview: 'dmp-new/views/pages/crowds-new/dmp-price-suggest', params: { chanceType } } const dialogOptions = { width: 1100, header: { title: '自定义人群机会洞察' // tip: '通过已投放...' }, footer: { enter: false, cancel: false } } this.mxModal(viewPath, viewOptions, dialogOptions) }, 'createDialog'(e) { const viewPath = 'dmp-new/views/pages/crowds-new/create' const selectTagOptionSet = { leaf: false, operator: 4, selectTagOptionSet: [ { leaf: false, operator: 1, selectTagOptionSet: [ { leaf: true, operator: 1, selectTagOptionSet: [], selects: [] }, { leaf: false, operator: 2, selectTagOptionSet: [ { leaf: true, operator: 1, selectTagOptionSet: [], selects: [ { adapterType: null, key: '150666_33046', names: '', optionGroupId: 33046, optionType: null, price: null, tagId: 150666, tagName: '内容渠道行为人群', values: '12' }, { adapterType: null, key: '150666_33047', names: '', optionGroupId: 33047, optionType: null, price: null, tagId: 150666, tagName: '内容渠道行为人群', values: '' }, { adapterType: null, key: '150666_33048', names: '', optionGroupId: 33048, optionType: null, price: null, tagId: 150666, tagName: '内容渠道行为人群', values: '' }, { adapterType: null, key: '150666_33049', names: '', optionGroupId: 33049, optionType: null, price: null, tagId: 150666, tagName: '内容渠道行为人群', values: '' } ] } ], selects: [] } ], selects: [] }, { leaf: true, operator: 2, selectTagOptionSet: [], selects: [] } ], selects: [] } // 标签组合逻辑,此数据由UD后端提供 const viewOptions = { // crowdId: 123123, //修改人群时传 crowdId, 不需要 selectTagOptionSet selectTagOptionSet: JSON.stringify(selectTagOptionSet), createCallback: crowd => { // 创建人群完成时的回调,crowd 为人群详情对象,用来做界面展示 // crowdId: 人群包ID // crowdName: 人群包名称 // coverage: 人群规模 // providerName: 提供方 // validDate: 有效期 } } const dialogOptions = { footer: { enter: false, cancel: false }, width: $(window).width() } this.mxModal(viewPath, viewOptions, dialogOptions) } })