|
|
@@ -1582,6 +1582,9 @@
|
|
|
}
|
|
|
|
|
|
function parseOptionsItem() {
|
|
|
+ /** 微信/App 分享仅带顶层 item=(双重编码 JSON)时,无 options=;与 parseShareDynamicItemBlob 合并读取 */
|
|
|
+ var fromItem = parseShareDynamicItemBlob();
|
|
|
+ if (fromItem) return fromItem;
|
|
|
var raw = getMergedParam('options');
|
|
|
if (!raw) return null;
|
|
|
var opts;
|
|
|
@@ -2366,35 +2369,78 @@
|
|
|
}
|
|
|
|
|
|
function applyQueryContent() {
|
|
|
- /** 优先展示分享者昵称(App 传 shareUserName);否则动态作者 userName、店铺名 */
|
|
|
+ var it = null;
|
|
|
+ try {
|
|
|
+ it = parseOptionsItem();
|
|
|
+ } catch (eIt) {
|
|
|
+ it = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ /** 优先展示分享者昵称(App 传 shareUserName);否则动态作者 userName、店铺名;仅 item= 时从 JSON 取 */
|
|
|
var name =
|
|
|
getMergedParam('shareUserName') ||
|
|
|
q('shareUserName') ||
|
|
|
+ getMergedParam('userName') ||
|
|
|
q('userName') ||
|
|
|
+ getMergedParam('storeName') ||
|
|
|
q('storeName');
|
|
|
- if (name) document.getElementById('userName').textContent = decodeURIComponent(name);
|
|
|
+ if (!name && it) {
|
|
|
+ if (it.userName != null && String(it.userName).trim() !== '') name = String(it.userName).trim();
|
|
|
+ else if (it.storeName != null && String(it.storeName).trim() !== '') name = String(it.storeName).trim();
|
|
|
+ }
|
|
|
+ if (name) {
|
|
|
+ try {
|
|
|
+ document.getElementById('userName').textContent = decodeURIComponent(String(name));
|
|
|
+ } catch (eN) {
|
|
|
+ document.getElementById('userName').textContent = String(name);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
var avatarUrl = resolveUserAvatarUrl();
|
|
|
if (avatarUrl) {
|
|
|
document.getElementById('userAvatar').src = avatarUrl;
|
|
|
}
|
|
|
|
|
|
- var desc = q('content') || q('desc') || q('text');
|
|
|
+ var desc =
|
|
|
+ getMergedParam('desc') ||
|
|
|
+ q('content') ||
|
|
|
+ q('desc') ||
|
|
|
+ q('text');
|
|
|
+ if (!desc && it) {
|
|
|
+ if (it.context != null && String(it.context).trim() !== '') desc = String(it.context).trim();
|
|
|
+ else if (it.title != null && String(it.title).trim() !== '') desc = String(it.title).trim();
|
|
|
+ else if (it.storeBlurb != null && String(it.storeBlurb).trim() !== '') desc = String(it.storeBlurb).trim();
|
|
|
+ }
|
|
|
if (desc) {
|
|
|
- document.getElementById('userDesc').textContent = decodeURIComponent(desc);
|
|
|
+ try {
|
|
|
+ document.getElementById('userDesc').textContent = decodeURIComponent(String(desc));
|
|
|
+ } catch (eD) {
|
|
|
+ document.getElementById('userDesc').textContent = String(desc);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
var storeNameParam = getMergedParam('storeName') || q('storeName');
|
|
|
+ if (!storeNameParam && it && it.storeName != null && String(it.storeName).trim() !== '') {
|
|
|
+ storeNameParam = String(it.storeName).trim();
|
|
|
+ }
|
|
|
if (storeNameParam) {
|
|
|
try {
|
|
|
- document.getElementById('storeTitle').textContent = decodeURIComponent(storeNameParam);
|
|
|
+ document.getElementById('storeTitle').textContent = decodeURIComponent(String(storeNameParam));
|
|
|
} catch (e) {
|
|
|
- document.getElementById('storeTitle').textContent = storeNameParam;
|
|
|
+ document.getElementById('storeTitle').textContent = String(storeNameParam);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var scoreAvgParam = getMergedParam('scoreAvg') || q('scoreAvg');
|
|
|
- if (scoreAvgParam !== '') {
|
|
|
+ if (
|
|
|
+ (scoreAvgParam === '' || scoreAvgParam == null) &&
|
|
|
+ it &&
|
|
|
+ it.scoreAvg != null &&
|
|
|
+ String(it.scoreAvg).trim() !== ''
|
|
|
+ ) {
|
|
|
+ scoreAvgParam = String(it.scoreAvg).trim();
|
|
|
+ }
|
|
|
+ if (scoreAvgParam !== '' && scoreAvgParam != null) {
|
|
|
var scNum = parseFloat(scoreAvgParam, 10);
|
|
|
document.getElementById('storeScore').textContent =
|
|
|
!isNaN(scNum) ? scNum.toFixed(1) : String(scoreAvgParam);
|
|
|
@@ -2404,7 +2450,10 @@
|
|
|
|
|
|
if (!resolveCommentRequestParams()) {
|
|
|
var cc = getMergedParam('commentCount') || q('commentCount');
|
|
|
- if (cc !== '') {
|
|
|
+ if ((!cc || String(cc).trim() === '') && it && it.commentCount != null) {
|
|
|
+ cc = String(it.commentCount);
|
|
|
+ }
|
|
|
+ if (cc !== '' && cc != null) {
|
|
|
var n = parseInt(cc, 10);
|
|
|
if (!isNaN(n)) {
|
|
|
document.getElementById('commentCount').textContent = formatCommentCountParens(n);
|
|
|
@@ -2414,11 +2463,29 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- var tag = q('tagline');
|
|
|
- if (tag) document.getElementById('storeTagline').textContent = decodeURIComponent(tag);
|
|
|
+ var tag = getMergedParam('tagline') || q('tagline');
|
|
|
+ if (!tag && it && it.storeBlurb != null && String(it.storeBlurb).trim() !== '') {
|
|
|
+ tag = String(it.storeBlurb).trim();
|
|
|
+ }
|
|
|
+ if (tag) {
|
|
|
+ try {
|
|
|
+ document.getElementById('storeTagline').textContent = decodeURIComponent(String(tag));
|
|
|
+ } catch (eT) {
|
|
|
+ document.getElementById('storeTagline').textContent = String(tag);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- var cat = q('category') || q('storeCat');
|
|
|
- if (cat) document.getElementById('storeCat').textContent = decodeURIComponent(cat);
|
|
|
+ var cat = getMergedParam('category') || getMergedParam('storeCat') || q('category') || q('storeCat');
|
|
|
+ if (!cat && it && it.businessTypeName != null && String(it.businessTypeName).trim() !== '') {
|
|
|
+ cat = String(it.businessTypeName).trim();
|
|
|
+ }
|
|
|
+ if (cat) {
|
|
|
+ try {
|
|
|
+ document.getElementById('storeCat').textContent = decodeURIComponent(String(cat));
|
|
|
+ } catch (eC) {
|
|
|
+ document.getElementById('storeCat').textContent = String(cat);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
function boot() {
|