"use strict";
const common_vendor = require("../../../../../common/vendor.js");
const _sfc_main = {
  props: {
    // 视频ID
    videoId: {
      type: [String, null],
      default: null
    }
  },
  data() {
    return {
      url: "",
      loadingText: "视频解码中",
      loadingClass: "aliyun-video-loading-text"
    };
  },
  methods: {
    async doPost(url, data, options) {
      let resp = common_vendor.handle.promistHandleNew(await common_vendor.request.doPost(url, data, options));
      return common_vendor.handle.catchPromiseNew(resp, () => resp, options);
    },
    async getVideoUrlByIdasync(id) {
      if (!id)
        return;
      const { resp } = await this.doPost(`${common_vendor.BASE_URL}wsgw/article/video/GetVideoUrl/callApiJSON.do`, { ID: id });
      const url = resp && resp.length ? resp[0].Url : "";
      if (!url) {
        this.loadingClass = "aliyun-video-loading-fail-text";
        this.loadingText = "视频未完成解码，请刷新页面或稍后再试";
      } else {
        this.url = url;
      }
    }
  },
  mounted() {
    this.getVideoUrlByIdasync(this.videoId);
  }
};
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  return common_vendor.e({
    a: !$data.url
  }, !$data.url ? {
    b: common_vendor.t($data.loadingText),
    c: common_vendor.n($data.loadingClass)
  } : {
    d: $data.url
  });
}
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render]]);
wx.createComponent(Component);
//# sourceMappingURL=../../../../../../.sourcemap/mp-weixin/uni_modules/mp-html/components/mp-html/aliyun-video/aliyun-video.js.map
