"use strict";
const common_vendor = require("../../common/vendor.js");
const sheep_index = require("../../sheep/index.js");
const sheep_components_sShareModal_canvasPoster_useCanvas = require("../../sheep/components/s-share-modal/canvas-poster/useCanvas.js");
require("../../sheep/store/index.js");
require("../../sheep/helper/index.js");
require("../../sheep/request/index.js");
const sheep_api_distri_share = require("../../sheep/api/distri/share.js");
require("../../sheep/api/index.js");
require("../../sheep/api/distri/score.js");
require("../../sheep/api/distri/team.js");
require("../../sheep/api/infra/file.js");
require("../../sheep/config/index.js");
require("../../sheep/api/member/address.js");
require("../../sheep/api/member/auth.js");
require("../../sheep/api/member/point.js");
require("../../sheep/api/member/signin.js");
require("../../sheep/api/member/social.js");
require("../../sheep/api/member/user.js");
require("../../sheep/api/migration/app.js");
require("../../sheep/api/migration/chat.js");
require("../../sheep/api/migration/index.js");
require("../../sheep/api/migration/third.js");
require("../../sheep/api/pay/channel.js");
require("../../sheep/api/pay/order.js");
require("../../sheep/api/pay/wallet.js");
require("../../sheep/api/product/category.js");
require("../../sheep/api/product/comment.js");
require("../../sheep/api/product/favorite.js");
require("../../sheep/api/product/history.js");
require("../../sheep/api/product/spu.js");
require("../../sheep/api/promotion/activity.js");
require("../../sheep/api/promotion/article.js");
require("../../sheep/api/promotion/bargain.js");
require("../../sheep/api/promotion/combination.js");
require("../../sheep/api/promotion/coupon.js");
require("../../sheep/api/promotion/diy.js");
require("../../sheep/api/promotion/rewardActivity.js");
require("../../sheep/api/promotion/seckill.js");
require("../../sheep/api/system/area.js");
require("../../sheep/api/system/voice.js");
require("../../sheep/api/trade/afterSale.js");
require("../../sheep/api/trade/brokerage.js");
require("../../sheep/api/trade/cart.js");
require("../../sheep/api/trade/config.js");
require("../../sheep/api/trade/delivery.js");
require("../../sheep/api/trade/order.js");
require("../../sheep/url/index.js");
require("../../sheep/router/index.js");
require("../../sheep/hooks/useModal.js");
require("../../sheep/helper/test.js");
require("../../sheep/helper/throttle.js");
require("../../sheep/platform/index.js");
require("../../sheep/platform/provider/wechat/index.js");
require("../../sheep/platform/provider/wechat/miniProgram.js");
require("../../sheep/platform/provider/apple/index.js");
require("../../sheep/platform/share.js");
require("../../sheep/platform/pay.js");
require("../../sheep/config/zIndex.js");
require("../../sheep/components/s-share-modal/canvas-poster/poster/index.js");
require("../../sheep/components/s-share-modal/canvas-poster/poster/user.js");
require("../../sheep/components/s-share-modal/canvas-poster/poster/goods.js");
require("../../sheep/components/s-share-modal/canvas-poster/poster/groupon.js");
require("../../sheep/store/app.js");
require("../../sheep/store/user.js");
require("../../sheep/store/cart.js");
require("../../sheep/store/sys.js");
require("../../sheep/store/modal.js");
require("../../sheep/helper/digit.js");
if (!Array) {
  const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  _easycom_s_layout2();
}
const _easycom_s_layout = () => "../../sheep/components/s-layout/s-layout.js";
if (!Math) {
  _easycom_s_layout();
}
const _sfc_main = {
  __name: "qrcode-share",
  setup(__props) {
    const state = common_vendor.reactive({
      linkId: 0
    });
    const poster = common_vendor.reactive({
      canvasId: "canvasId",
      width: sheep_index.sheep.$platform.device.windowWidth * 0.9,
      height: 600,
      src: ""
    });
    const vm = common_vendor.getCurrentInstance();
    async function getPoster(params) {
      poster.src = "";
      poster.shareInfo = {
        "title": "",
        "desc": "",
        "image": "",
        "path": "",
        "link": "https://zxgz.newfeifan.cn/#/pages/index/user?linkId=" + state.linkId,
        "poster": {
          "type": "user"
        }
      };
      const canvas = await sheep_components_sShareModal_canvasPoster_useCanvas.useCanvas(poster, vm);
      return canvas;
    }
    async function getLink() {
      sheep_api_distri_share.ShareApi.getLinkId(1).then((res) => {
        if (res.code !== 0) {
          return;
        }
        state.linkId = res.data.linkId;
        getPoster();
      });
    }
    const onSavePoster = () => {
      if (["WechatOfficialAccount", "H5"].includes(sheep_index.sheep.$platform.name)) {
        sheep_index.sheep.$helper.toast("请长按图片保存");
        return;
      }
      common_vendor.index.saveImageToPhotosAlbum({
        filePath: poster.src,
        success: (res) => {
          onClosePoster();
          sheep_index.sheep.$helper.toast("保存成功");
        },
        fail: (err) => {
          sheep_index.sheep.$helper.toast("保存失败");
          console.log("图片保存失败:", err);
        }
      });
    };
    common_vendor.onLoad(async () => {
      await getLink();
    });
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: poster.src === ""
      }, poster.src === "" ? {
        b: poster.height + "px",
        c: poster.width + "px"
      } : {
        d: poster.src,
        e: poster.height + "px",
        f: poster.width + "px"
      }, {
        g: poster.canvasId,
        h: poster.canvasId,
        i: poster.height + "px",
        j: poster.width + "px",
        k: common_vendor.t(["wechatOfficialAccount", "H5"].includes(common_vendor.unref(sheep_index.sheep).$platform.name) ? "长按图片保存" : "长按图片保存"),
        l: common_vendor.o(onSavePoster),
        m: common_vendor.p({
          title: "我的二维码/分享页"
        })
      });
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-845d3787"], ["__file", "D:/zx/mall-front-app/pages/user/qrcode-share.vue"]]);
wx.createPage(MiniProgramPage);
