"use strict";

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _getPrototypeOf = require("babel-runtime/core-js/object/get-prototype-of");

var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);

var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _createClass2 = require("babel-runtime/helpers/createClass");

var _createClass3 = _interopRequireDefault(_createClass2);

var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _inherits2 = require("babel-runtime/helpers/inherits");

var _inherits3 = _interopRequireDefault(_inherits2);

var _react = require("react");

var _react2 = _interopRequireDefault(_react);

var _basic_img = require("./style/basic_img.less");

var _basic_img2 = _interopRequireDefault(_basic_img);

var _UploadImg = require("./UploadImg/UploadImg");

var _UploadImg2 = _interopRequireDefault(_UploadImg);

var _UploadVideo = require("./UploadVideo/UploadVideo");

var _UploadVideo2 = _interopRequireDefault(_UploadVideo);

var _Upload3D = require("./Upload3D/Upload3D");

var _Upload3D2 = _interopRequireDefault(_Upload3D);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var GoodImageShop = function (_Component) {
    (0, _inherits3.default)(GoodImageShop, _Component);

    function GoodImageShop(props) {
        (0, _classCallCheck3.default)(this, GoodImageShop);

        var _this = (0, _possibleConstructorReturn3.default)(this, (GoodImageShop.__proto__ || (0, _getPrototypeOf2.default)(GoodImageShop)).call(this, props));

        _this.tempPicVoList = _this.props.itemTmplPublishVo.itemPicVoList;
        // pic arr
        _this.itemImgInfos = [];
        // video arr
        _this.itemVideoInfos = [];
        // 3d arr
        _this.item3DInfos = [];

        return _this;
    }
    /**
    * 更新数据
    *@param item 
    *@type {1: pic ,3:video , 4: 3d}
    */


    (0, _createClass3.default)(GoodImageShop, [{
        key: "onCallBackData",
        value: function onCallBackData(item, type) {
            switch (type) {
                case 1:
                    this.itemImgInfos = item;
                    break;
                case 4:
                    this.itemVideoInfos = item;
                    console.log('this.itemVideoInfos----》', this.itemVideoInfos);
                    break;
                case 5:
                    this.item3DInfos = item;
                    break;
            }

            console.log('upload callback in ', item.length, type);

            this.props.itemTmplPublishVo.itemPicVoList = [].concat(this.itemImgInfos, this.itemVideoInfos, this.item3DInfos);
            this.props.updateItemTmplAction(this.props.itemTmplPublishVo);
        }
    }, {
        key: "initData",
        value: function initData() {
            var _this2 = this;

            console.log('from ......shops............................dsfsdfdsflkjdflsdfsdfdsf');
            this.itemImgVideo3DInfos = this.props.itemTmplPublishVo && this.props.itemTmplPublishVo.itemPicVoList ? this.props.itemTmplPublishVo.itemPicVoList : [];
            if (this.itemImgVideo3DInfos.length > 0) {
                this.itemImgVideo3DInfos.forEach(function (i, index) {
                    if (i.type == 1) {
                        _this2.itemImgInfos.push(i);
                    } else if (i.type == 4) {
                        _this2.itemVideoInfos.push(i);
                    } else if (i.type == 5) {
                        _this2.item3DInfos.push(i);
                    }
                });
            }
        }
    }, {
        key: "componentWillMount",
        value: function componentWillMount() {
            this.initData();
        }
    }, {
        key: "render",
        value: function render() {

            return _react2.default.createElement(
                "div",
                null,
                _react2.default.createElement(
                    "div",
                    { className: _basic_img2.default.basicImg },
                    _react2.default.createElement(
                        "span",
                        { className: "f-fs14 f-fwn f-fl" },
                        _react2.default.createElement(
                            "i",
                            { className: "text-red mr5" },
                            "*"
                        ),
                        "\u5546\u54C1\u56FE\u7247"
                    ),
                    _react2.default.createElement(
                        "p",
                        { className: _basic_img2.default.ml88 },
                        "\u56FE\u7247\u8981\u6C42\uFF1A\u81F3\u5C11\u6DFB\u52A0\u4E00\u5F20\uFF0C\u6700\u591A\u5141\u8BB8\u5341\u5F20\uFF1B\u5355\u5F20\u56FE\u7247\u4E0D\u80FD\u5927\u4E8E5M\uFF1B\u5141\u8BB8\u7684\u56FE\u7247\u683C\u5F0F\u6709jpg\u3001jpeg\u3001png\u3001JPG\u3001JPEG\u3001PNG ; \u56FE\u7247\u6700\u4F73\u5C3A\u5BF8\u4E3A800x800"
                    ),
                    _react2.default.createElement(
                        "p",
                        { className: _basic_img2.default.ml88 },
                        "\u89C6\u9891\u8981\u6C42\uFF1A\u53EF\u4E3A\u5546\u54C1\u6DFB\u52A0\u4E00\u6761\u89C6\u9891\u5C55\u793A\uFF0C\u89C6\u9891\u5C3A\u5BF8\u8981\u6C4250M\uFF0C\u683C\u5F0F\u8981\u6C42mp4;"
                    ),
                    _react2.default.createElement(
                        "p",
                        { className: _basic_img2.default.ml88 },
                        "3D\u6A21\u578B\u8981\u6C42\uFF1A 3D\u5C55\u793A\u683C\u5F0F\u8981\u6C42\u4E3Azip\uFF0C\u5EFA\u8BAE\u4ECE",
                        _react2.default.createElement(
                            "a",
                            { href: "//ar.jd.com/arpages/market.html" },
                            "AR\u5929\u5DE5\u5E73\u53F0"
                        ),
                        "\u4E0B\u8F7D\u6A21\u578B"
                    )
                ),
                _react2.default.createElement(
                    "div",
                    { className: _basic_img2.default.UploadSelect },
                    _react2.default.createElement(_UploadImg2.default, {
                        onCallBackData: this.onCallBackData.bind(this),
                        itemImgInfos: this.itemImgInfos,
                        num: 10
                    }),
                    _react2.default.createElement(_UploadVideo2.default, {
                        onCallBackData: this.onCallBackData.bind(this),
                        itemVideoInfos: this.itemVideoInfos,
                        num: 1
                    }),
                    _react2.default.createElement(_Upload3D2.default, {
                        onCallBackData: this.onCallBackData.bind(this),
                        item3DInfos: this.item3DInfos,
                        num: 1
                    })
                )
            );
        }
    }]);
    return GoodImageShop;
}(_react.Component); /**
                      * @file 发布商品-商品图片
                      */

exports.default = GoodImageShop;
module.exports = exports["default"];
//# sourceMappingURL=GoodImageShop.js.map