forked from gxwebsoft/mp-10550
修复已知问题
This commit is contained in:
@@ -36,11 +36,11 @@ export function fileToBase64(filePath) {
|
||||
* @param htmlText
|
||||
*/
|
||||
export function wxParse(htmlText) {
|
||||
// Replace <img> tags with max-width and height styles
|
||||
htmlText = htmlText.replace(/\<img/gi, '<img style="max-width:100%;height:auto;"');
|
||||
// Replace <img> tags with max-width, height and margin styles to remove spacing
|
||||
htmlText = htmlText.replace(/\<img/gi, '<img style="max-width:100%;height:auto;margin:0;padding:0;display:block;"');
|
||||
|
||||
// Replace style attributes that do not contain text-align
|
||||
htmlText = htmlText.replace(/style\s*?=\s*?(['"])(?!.*?text-align)[\s\S]*?\1/ig, 'style="max-width:100%;height:auto;"');
|
||||
// Replace style attributes that do not contain text-align, add margin:0 to remove spacing
|
||||
htmlText = htmlText.replace(/style\s*?=\s*?(['"])(?!.*?text-align)[\s\S]*?\1/ig, 'style="max-width:100%;height:auto;margin:0;padding:0;display:block;"');
|
||||
|
||||
return htmlText;
|
||||
}
|
||||
@@ -65,3 +65,28 @@ export function copyText(text: string) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 分享商品链接
|
||||
* @param goodsId 商品ID
|
||||
* @param goodsName 商品名称
|
||||
*/
|
||||
export function shareGoodsLink(goodsId: string | number, goodsName?: string) {
|
||||
// 构建分享链接,这里需要根据你的实际域名调整
|
||||
const baseUrl = 'https://your-domain.com'; // 请替换为你的实际域名
|
||||
const shareUrl = `${baseUrl}/shop/goodsDetail/index?id=${goodsId}`;
|
||||
|
||||
copyText(shareUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示分享引导提示
|
||||
*/
|
||||
export function showShareGuide() {
|
||||
Taro.showModal({
|
||||
title: '分享提示',
|
||||
content: '请点击右上角的"..."按钮,然后选择"转发"来分享给好友,或选择"分享到朋友圈"',
|
||||
showCancel: false,
|
||||
confirmText: '知道了'
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user