"use strict"; const common_vendor = require("../../../../../common/vendor.js"); const sheep_components_sShareModal_canvasPoster_poster_user = require("./user.js"); const sheep_components_sShareModal_canvasPoster_poster_goods = require("./goods.js"); const sheep_components_sShareModal_canvasPoster_poster_groupon = require("./groupon.js"); const sheep_index = require("../../../../index.js"); const sheep_api_infra_file = require("../../../../api/infra/file.js"); let locaImage = common_vendor.ref(""); async function getFileURL(file) { await sheep_api_infra_file.FileApi.getFileIO(file).then((res) => { locaImage.value = `data:image/png;base64,${res}`; console.log(locaImage.value); }); } async function getPosterData(options) { const userInfo = sheep_index.sheep.$store("user").userInfo; console.log(JSON.parse(common_vendor.index.getStorageSync("user-store")).userInfo); let avatar = userInfo.avatar; switch (options.shareInfo.poster.type) { case "user": await getFileURL(avatar); options.avatar = locaImage.value; return sheep_components_sShareModal_canvasPoster_poster_user.user(options); case "goods": await getFileURL(avatar); options.avatar = locaImage.value; await getFileURL(options.shareInfo.poster.image); options.shareInfo.poster.image = locaImage.value; return sheep_components_sShareModal_canvasPoster_poster_goods.goods(options); case "groupon": return sheep_components_sShareModal_canvasPoster_poster_groupon.groupon(options); } } function formatImageUrlProtocol(url) { if (url.indexOf("http:") === 0) { url = url.replace("http:", "https:"); } return url; } exports.formatImageUrlProtocol = formatImageUrlProtocol; exports.getPosterData = getPosterData;