fix:海报图片协议转换,自动识别https协议

This commit is contained in:
ldh
2023-04-04 13:43:21 +08:00
parent 90d6f8594d
commit e7c6c55786
4 changed files with 30 additions and 9 deletions
@@ -12,3 +12,21 @@ export function getPosterData(options) {
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;
}