exports.ids = [4];
exports.modules = {

/***/ 169:
/***/ (function(module, exports) {

// Exports
module.exports = {

};


/***/ }),

/***/ 197:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _node_modules_css_loader_dist_cjs_js_ref_3_oneOf_1_0_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_dist_cjs_js_ref_3_oneOf_1_1_node_modules_nuxt_components_dist_loader_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Bxh_vue_vue_type_style_index_0_id_500dc45e_prod_scoped_true_lang_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(169);
/* harmony import */ var _node_modules_css_loader_dist_cjs_js_ref_3_oneOf_1_0_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_dist_cjs_js_ref_3_oneOf_1_1_node_modules_nuxt_components_dist_loader_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Bxh_vue_vue_type_style_index_0_id_500dc45e_prod_scoped_true_lang_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_cjs_js_ref_3_oneOf_1_0_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_dist_cjs_js_ref_3_oneOf_1_1_node_modules_nuxt_components_dist_loader_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Bxh_vue_vue_type_style_index_0_id_500dc45e_prod_scoped_true_lang_css__WEBPACK_IMPORTED_MODULE_0__);
/* harmony reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in _node_modules_css_loader_dist_cjs_js_ref_3_oneOf_1_0_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_dist_cjs_js_ref_3_oneOf_1_1_node_modules_nuxt_components_dist_loader_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Bxh_vue_vue_type_style_index_0_id_500dc45e_prod_scoped_true_lang_css__WEBPACK_IMPORTED_MODULE_0__) if(["default"].indexOf(__WEBPACK_IMPORT_KEY__) < 0) (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return _node_modules_css_loader_dist_cjs_js_ref_3_oneOf_1_0_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_dist_cjs_js_ref_3_oneOf_1_1_node_modules_nuxt_components_dist_loader_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Bxh_vue_vue_type_style_index_0_id_500dc45e_prod_scoped_true_lang_css__WEBPACK_IMPORTED_MODULE_0__[key]; }) }(__WEBPACK_IMPORT_KEY__));


/***/ }),

/***/ 206:
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// CONCATENATED MODULE: ./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/@nuxt/components/dist/loader.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./components/Bxh.vue?vue&type=template&id=500dc45e&scoped=true
var render = function render() {
  var _vm = this,
    _c = _vm._self._c;
  return _c('div', {
    staticClass: "iframe-main"
  }, [_vm._ssrNode("<div class=\"iframe-dom\"" + _vm._ssrStyle(null, {
    height: _vm.height
  }, null) + " data-v-500dc45e></div>")]);
};
var staticRenderFns = [];

// CONCATENATED MODULE: ./components/Bxh.vue?vue&type=template&id=500dc45e&scoped=true

// CONCATENATED MODULE: ./node_modules/babel-loader/lib??ref--2-0!./node_modules/@nuxt/components/dist/loader.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./components/Bxh.vue?vue&type=script&lang=js
/* harmony default export */ var Bxhvue_type_script_lang_js = ({
  head() {
    return {
      link: [{
        rel: 'stylesheet',
        href: '//yun.baoxiaohe.com/openflatform/css/v1.0/sdk.css'
      }]
    };
  },
  props: {
    bxhType: String,
    design: Number,
    height: {
      type: String,
      default: '99vh'
    },
    link: String,
    templateArr: {
      type: Array,
      default: () => {
        return [];
      }
    }
  },
  data() {
    return {
      iframe: null
    };
  },
  watch: {},
  mounted() {
    this.$nextTick(() => {
      this.createBxh();
    });
    window.addEventListener("message", this.receiveData);
  },
  beforeDestroy() {
    window.removeEventListener("message", this.receiveData);
  },
  methods: {
    async createBxh() {
      if (this.bxhType == '3D') {
        let companyToken = await this.$axios.get("/bxh/company/token");
        let design = this.design || this.link;
        this.init(design, companyToken.result, this.bxhType);
      } else if (this.bxhType == 'design') {
        let token = await this.$axios.get("/bxh/token");
        this.init(this.design, token.result, this.bxhType);
      } else if (this.bxhType == 'render') {
        let token = await this.$axios.get("/bxh/token");
        this.init(this.design, token.result, this.bxhType);
      }
    },
    init(id, token, bxhType) {
      this.iframe = new window.BXHIframe({
        // production: false,
        // env:true,
        elCls: 'iframe-dom',
        prefixCls: 'detail-iframe-sdk',
        locale: "en-US",
        params: {
          id,
          token3D: token,
          token,
          project_id: id,
          isShowRotate: false,
          //右下角的旋转按钮
          isShowFold: false,
          //右下角的折叠按钮
          locale: "en-US"
        },
        name: bxhType
      });
    },
    receiveData(event) {
      if (event) {
        try {
          if (typeof event.data === "string") {
            const {
              event: e,
              name,
              params,
              preDesignParams
            } = JSON.parse(event.data);
            if (e === "needLogin") {
              this.iframe.preDesign({
                ...preDesignParams,
                token: ''
              });
            } else if (e === "viewDetails") {
              this.iframe.render({
                name,
                params
              });
            } else if (e === "viewDetails") {
              this.iframe.render({
                name,
                params
              });
            } else if (e === "startDesign") {
              this.iframe.render({
                params: {
                  id: params.id,
                  token: ''
                },
                name: "design"
              });
            } else if (e === "logoutSuccess") {
              console.log("logoutSuccess");
            } else if (e === "reloadParams") {
              console.log("reloadParams");
            } else if (e === "saveSuccess") {
              console.log("saveSuccess");
            } else if (e === "saveFail") {
              console.log("saveFail");
            } else if (e === "loadSuccess") {
              console.log("loadSuccess");
            } else if (e === "toPreview3d") {
              console.log("手机端编辑器进入3d页面回调");
            } else if (e === "toEditor") {
              console.log("手机端从3d页面进入编辑器回调");
            }
          }
        } catch (error) {
          console.log(error);
        }
      }
    }
  }
});
// CONCATENATED MODULE: ./components/Bxh.vue?vue&type=script&lang=js
 /* harmony default export */ var components_Bxhvue_type_script_lang_js = (Bxhvue_type_script_lang_js); 
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__(2);

// CONCATENATED MODULE: ./components/Bxh.vue



function injectStyles (context) {
  
  var style0 = __webpack_require__(197)
if (style0.__inject__) style0.__inject__(context)

}

/* normalize component */

var component = Object(componentNormalizer["a" /* default */])(
  components_Bxhvue_type_script_lang_js,
  render,
  staticRenderFns,
  false,
  injectStyles,
  "500dc45e",
  "6ec49534"
  
)

/* harmony default export */ var Bxh = __webpack_exports__["default"] = (component.exports);

/***/ })

};;
//# sourceMappingURL=bxh.js.map