// import jumpMixin from '../crowds-new/tag-recommend/jump-mixin' // import * as Helper from 'dmp-new/views/mixins/helper' import Mixins from './mixins' import * as Loading from 'dmp-new/gallery/mx-loading/mask' const Magix = require('magix') const View = require('dmp-new/view') Magix.applyStyle('@./rank.less') // TAG_RECOMMEND_TOP_RANK module.exports = View.extend({ tmpl: '@rank.html', mixins: [Mixins, Loading], init (options) { this.options = options this.observeLocation(['cateId', 'channelId']) }, async render () { const loc = Magix.Router.parse() const { cateId: _cateId, rankType, rankPeriod, channelId: _channelId, selectedCombinationKeys = [] } = this.options const cateId = loc.get('cateId') || _cateId const channelId = loc.get('channelId') || _channelId // spmc字段埋点 const spmcMap = { 1: 'tag_rec_rank_tgi_', 2: 'tag_rec_rank_ctr_', 3: 'tag_rec_rank_cvr_', 4: 'tag_rec_rank_ppc_', 5: 'tag_rec_rank_wcvr_' } const sortTypes = [{ text: '竞争热度', value: '1' }, { text: '点击效果', value: '2' }, { text: '转化效率', value: '3' }] const sortTypesMap = Magix.toMap(sortTypes, 'value') const sortType = this.updater.get('sortType') || sortTypes[0].value this.updater.set({ extraKey: 'TAG_RECOMMEND_TOP_RANK', selectedCombinationKeys, sortTypesMap, sortTypes, sortType, spmcMap, rankPeriod, cateId, rankType, channelId }) const tags = await this._getTags() this.updater.digest({ list: tags.list }) }, 'changeSortType' (e) { this.render() }, // 获取标签列表 async _getTags () { const { filterUsed, rankType } = this.options const { channelId, cateId, sortType } = this.updater.get() const params = { cateId, queryBizId: 17, targetType: rankType.value, rankType: sortType, channelId, rankPeriod: '3', filterUsed } return await this.getTags(params) } })