zyejMAll-mobile/sheep/components/s-share-modal/canvas-poster/poster/index.js
2024-08-07 10:31:42 +08:00

40 lines
1002 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import user from './user';
import goods from './goods';
import groupon from './groupon';
import third from '@/sheep/api/migration/third';
export function getPosterData(options) {
switch (options.shareInfo.poster.type) {
case 'user':
return user(options);
case 'goods':
return goods(options);
case 'groupon':
return groupon(options);
}
}
export function formatImageUrlProtocol(url) {
// #ifdef H5
// H5平台 https协议下需要转换
if (window.location.protocol === 'https:' && url.indexOf('http:') === 0) {
url = url.replace('http:', 'https:');
}
// #endif
// #ifdef MP-WEIXIN
// 小程序平台 需要强制转换为https协议
if (url.indexOf('http:') === 0) {
url = url.replace('http:', 'https:');
}
// #endif
return url;
}
// 获得微信小程序码 Base64 image
export async function getWxaQrcode(path, query) {
const res = await third.wechat.getWxacode(path, query);
return 'data:image/png;base64,' + res.data;
}