resources.js 1.07 KB
import resourcesModel from '../../models/resources/index';

Component({
    properties: {
        contentCode: {
            type: String,
            value: ''
        },
        refresh: {
            type: Boolean,
            observer: '_contentCodeChange'
        }
    },
    data: {
        floors: []
    },
    ready: function() {
        this._contentCodeChange();
    },
    methods: {
        _contentCodeChange: function() {
            return resourcesModel.getContent(this.data.contentCode).then(floors => {

                if (floors.length && global.fashionFloors) { // 楼层信息存储,用于yas上报
                    global.fashionFloors.F_INDEX += floors.length;
                    if (floors[floors.length - 1].template_id) {
                        global.fashionFloors.F_ID = floors[floors.length - 1].template_id;
                        global.fashionFloors.F_NAME = floors[floors.length - 1].template_name;
                    }
                }

                this.setData({
                    floors
                });
            });
        }
    }
});