fashion-news.js 1023 Bytes
import cmsModel from '../../models/cms/index';
import event from '../../common/event';
import config from '../../common/config';

Component({
    properties: {
        refresh: {
            type: Boolean,
            observer: 'refresh'
        }
    },
    data: {
        fashionNews: []
    },
    ready: function() {
        this.refresh();
    },
    methods: {
        goDetail: function(e) {
            let url = `${config.MINI_APP_DOMAIN}/pages/cms/newsDetail?id=${e.currentTarget.id}`;
            let reportParams = Object.assign(global.fashionFloors, {
                F_URL: url || '',
                I_INDEX: (e.currentTarget.dataset.index + 1) || 1
            });

            event.emit('anchor-click', reportParams); // 点击资讯 埋点上报

            global.router.goUrl(url);
        },
        refresh: function() {
            cmsModel.getList().then((result) => {
                this.setData({
                    fashionNews: result
                });
            });
        }
    }
});