import BaseFormControl from "../../baseFormControl";
import JDImage from "../../formType/image/image";
class HospitalHead extends BaseFormControl {
    constructor(config) {
        super();
        this.config = this._getConfig(config);
        this.render();
    }
    
    _getConfig(config) {
        return $.extend(true, {}, {
            domData: {},
            moduleData: {},
            minDate: ''
        }, config);
    }
    
    render() {
        let defaultImage = '';
        try{
            defaultImage = this.config.containerData.children["0"].editProperty.dataDefines["0"].nodeText.data.latestBanner;
        }catch (e){
            console.log(e);
        }
        let JDImageConfig = {
            domData: {
                name: "imgUrl",
                title: "医院背景图设置",
                formType: {
                    type: "image"
                },
                tips: `建议图片宽度为1125px，高度为462px；大小不超过${window.page_config.chooseSizeLimit}KB，格式为JPG、PNG。`
            },
            format: '1125,462',
            defaultImage,
        };
        this.instanceImage = new JDImage(JDImageConfig);
    }
    
    getData() {
        let result = {},
            imgData = this.instanceImage.getData(),
            imgUrl = imgData? imgData.imgUrl: null,
            obj = {imgUrl, picWidth:imgData.picWidth, picHeight: imgData.picHeight};
        result['hospitalHead'] = $.extend({}, obj);
        return result;
    }
    
    validateData() {
    }
}
export default HospitalHead;