import './style.scss';
import BaseFormControl from '../../baseFormControl';
import { JDHotTpl } from './tpl';
import HotspotEditor from '../../../hotspotEditor';
import { IsYhdF, ShopType, getShopType } from '../../../../util/channelUtil';
class JDHot extends BaseFormControl {
    constructor(config) {
        super();
        let _this = this;
        _this.config = _this._getConfig(config);
        _this.hotData = null;
        _this.render();
    }
    
    _getConfig(config) {
        return $.extend(
            true,
            {},
            {
                domData: {},
                moduleData: {}
            },
            config
        );
    }
    render() {
        this.appendFormControl(JDHotTpl);
        this.hotInstance = new HotspotEditor({
            node: this.element.find('.J_hotWrap')[0],
            data: this.config.moduleData,
            config: {
                platformId: page_data.clientType == 'PC' ? 0 : 1, 
                shopType: getShopType(),
                crmActivityType: page_data.clientType == 'PC' ? null : this.config.module.crmActivityType
            }
            
        });
    }
    getData() {
        let result = {};
        result[this.config.domData.name] = this.hotInstance.getData();
        return result;
    }
}
export default JDHot;