|
|
/* eslint-disable indent */
|
|
|
import { get, first } from 'lodash';
|
|
|
import emojiRegex from 'emoji-regex';
|
|
|
|
|
|
function _version2num(version) {
|
|
|
if (!version) {
|
...
|
...
|
@@ -38,10 +40,16 @@ function handleProtocol(url) { |
|
|
return url.join('//');
|
|
|
}
|
|
|
|
|
|
const filterEmoji = text => {
|
|
|
|
|
|
text = text.replace(emojiRegex(), '');
|
|
|
text = text.replace(/\ud83c|\ud83d|\ud83e/gi, '');
|
|
|
return text;
|
|
|
};
|
|
|
|
|
|
// eslint-disable-next-line no-unused-vars
|
|
|
const getDetailShareData = (article, app_version = '6.9.11') => {
|
|
|
let shareImage = '';
|
|
|
|
|
|
let desc = '';
|
|
|
|
|
|
if (article.sort === 2) {
|
...
|
...
|
@@ -79,8 +87,18 @@ const getDetailShareData = (article, app_version = '6.9.11') => { |
|
|
hideType = ['8', '9'];
|
|
|
}
|
|
|
|
|
|
let authorName = article.authorName || '';
|
|
|
|
|
|
// 过滤掉换行
|
|
|
// desc = ClearBr(desc);
|
|
|
// authorName = ClearBr(article.authorName || '');
|
|
|
|
|
|
// 过滤掉emoji表情
|
|
|
desc = filterEmoji(desc);
|
|
|
authorName = filterEmoji(article.authorName || '');
|
|
|
|
|
|
return {
|
|
|
title: `@${article.authorName} 在有货社区上发了一篇内容,快点开看看!`,
|
|
|
title: `@${authorName} 在有货社区上发了一篇内容,快点开看看!`,
|
|
|
imgUrl: handleProtocol(
|
|
|
get(shareImage.split('?'), '[0]') || DEFAULT_SHARE_IMAGE,
|
|
|
),
|
...
|
...
|
@@ -89,13 +107,13 @@ const getDetailShareData = (article, app_version = '6.9.11') => { |
|
|
article.articleId
|
|
|
}?share=true`,
|
|
|
),
|
|
|
desc,
|
|
|
desc: `${desc}`,
|
|
|
hideType,
|
|
|
shareType: 'grassDetail',
|
|
|
userName: article.authorName,
|
|
|
userName: authorName,
|
|
|
userIcon: article.authorHeadIco,
|
|
|
articleId: article.articleId,
|
|
|
authGroupId: article.authGroupId
|
|
|
authGroupId: article.authGroupId,
|
|
|
};
|
|
|
};
|
|
|
|
...
|
...
|
|