import Magix from 'magix' import View from 'dmp-new/view' Magix.applyStyle('@./item.less') export default View.extend({ tmpl: '@item.html', init(options) { this.options = options }, async render() { const loc = Magix.Router.parse() const { report, taskId, transferType, top20, statusIds, brandsMap, competeBrandId, statusId, isInflow } = this.options const { competeStatusId = statusIds[0].id } = this.updater.get() this.updater.digest({ loading: true, isInflow, brandsMap, competeStatusId, report, competeBrandId, statusId, taskId, transferType, top20, statusIds }) const items = await this.getItems() this.updater.digest({ items, loading: false }) }, async getItems() { try { const { taskId, competeBrandId, statusId, transferType, competeStatusId } = this.updater.get() const params = { taskId, competeBrandId, statusId, transferType, competeStatusId } const models = [ { name: 'api_deeplink_compete_item_list_get', params } ] const [model] = await this.fetch(models) const data = model.get('data.list', []) return data } catch (error) { console.error(error) } }, 'changeFilter'(e) { this.render() }, 'createCrowd'(e) { const { report, taskId, transferType, top20, brandsMap, isInflow } = this.options if (isInflow) { // 流入时直接跳转到圈人页,并选中宝贝标签 return window.open('#!/crowds-new/create?tagId=160639&isRemarket=true') } const { competeBrandId, statusIds, statusId, competeStatusId, items } = this.updater.get() const viewPath = '@./dialog/create-crowd-item' const viewOptions = { items, competeStatusId, report, taskId, statusId, transferType, top20, brandsMap, isInflow, competeBrandId, statusIds } const dialogOptions = { header: { title: '圈选竞争品牌流入流出DEEPLINK人群' }, footer: { enter: false, cancel: false }, width: 780 } this.mxModal(viewPath, viewOptions, dialogOptions) } })