sunshibo 1 неделя назад
Родитель
Сommit
8b8c041d75

+ 30 - 49
HBuilderProjects/secondShareGoods.html

@@ -73,12 +73,11 @@
 			opacity: 1;
 		}
 
-		/* 仅分享卡片等场景展示开放标签;复制链接进入见 .wx-copy-link-entry */
-		body.is-wechat.wx-jssdk-ready.wx-open-tag-scene #launch-btn {
+		body.is-wechat.wx-jssdk-ready #launch-btn {
 			display: block;
 		}
 
-		body.is-wechat.wx-jssdk-ready.wx-open-tag-scene #openApp {
+		body.is-wechat.wx-jssdk-ready #openApp {
 			display: none !important;
 		}
 
@@ -799,48 +798,31 @@
 
 		function getWxShareEntryFrom() {
 			var from = q('from');
-			return from ? String(from).trim().toLowerCase() : '';
-		}
-
-		/**
-		 * wx-open-launch-app 仅在分享卡片等场景可用;复制链接打开会 launch:fail。
-		 * 勿在 getWxConfig 前改地址栏(iOS 微信按进入时 url 验签,replaceState 会导致签名无效)。
-		 */
-		function isWxOpenLaunchAppSceneSupported() {
-			if (!isWeChatInAppBrowser()) return false;
-			if (readQueryParam('wxOpenTag') === '1' || readQueryParam('wxForceOpenTag') === '1') {
-				return true;
-			}
-			var from = getWxShareEntryFrom();
-			return (
-				from === 'singlemessage' ||
-				from === 'groupmessage' ||
-				from === 'timeline'
-			);
-		}
-
-		function applyWxOpenLaunchSceneBodyClass() {
-			if (!isWeChatInAppBrowser()) return;
-			var ok = isWxOpenLaunchAppSceneSupported();
-			document.body.classList.toggle('wx-open-tag-scene', ok);
-			document.body.classList.toggle('wx-copy-link-entry', !ok);
+			if (from) return String(from).trim().toLowerCase();
+			try {
+				var h = location.hash || '';
+				var qi = h.indexOf('?');
+				if (qi >= 0) {
+					var hf = new URLSearchParams(h.slice(qi + 1)).get('from');
+					if (hf) return String(hf).trim().toLowerCase();
+				}
+			} catch (eH) {}
+			try {
+				var sf = new URLSearchParams(location.search || '').get('from');
+				if (sf) return String(sf).trim().toLowerCase();
+			} catch (eS) {}
+			return '';
 		}
 
 		function logWxEntryDiagnostics() {
 			if (!isWeChatInAppBrowser()) return;
 			console.log('[wx-entry]', {
-				entryFrom: getWxShareEntryFrom() || '(无,多为复制链接进入)',
-				openLaunchTagScene: isWxOpenLaunchAppSceneSupported(),
+				entryFrom: getWxShareEntryFrom() || '(无)',
+				wxJssdkReady: weChatJssdkConfigured,
 				signUrl: getWxConfigSignUrl()
 			});
 		}
 
-		function showWxCopyLinkEntryTip() {
-			showFabToast(
-				'当前为复制链接进入,微信不支持直接打开 App。请使用 App「分享到微信」发送卡片后,点卡片进入。'
-			);
-		}
-
 		function isIOSWeChatBrowser() {
 			var ua = navigator.userAgent || '';
 			return /MicroMessenger/i.test(ua) && /iPhone|iPad|iPod/i.test(ua);
@@ -1091,10 +1073,7 @@
 				wx.ready(function () {
 					weChatJssdkConfigured = true;
 					document.body.classList.add('wx-jssdk-ready');
-					applyWxOpenLaunchSceneBodyClass();
-					if (isWxOpenLaunchAppSceneSupported()) {
-						refreshWxLaunchTagAttrs();
-					}
+					refreshWxLaunchTagAttrs();
 					console.log('[wx.config] ready, htmlUrl=', htmlUrl);
 					resolve(true);
 				});
@@ -1150,9 +1129,17 @@
 							? String(detail.errmsg)
 							: '';
 				console.warn('[wx-open-launch-app]', detail);
-				showAppOpenFailTip(	
-						'请确复制链接进入U店在哪'
-				);
+				if (/launch:fail/i.test(errMsg) && !getWxShareEntryFrom()) {
+					showAppOpenFailTip(
+						'当前环境无法直接打开 App,请使用 App「分享到微信」后点分享卡片进入'
+					);
+				} else {
+					showAppOpenFailTip(
+						errMsg
+							? '未能打开 App:' + errMsg
+							: '未能打开 App,请确认已安装最新版「U店在哪」'
+					);
+				}
 			});
 		}
 
@@ -2130,7 +2117,6 @@
 			bindWeChatLaunchTagEvents();
 			if (isWeChatInAppBrowser()) {
 				document.body.classList.add('is-wechat');
-				applyWxOpenLaunchSceneBodyClass();
 				logWxEntryDiagnostics();
 			}
 			if (shouldInitWeChatJssdkOnLoad()) {
@@ -2142,7 +2128,6 @@
 
 			document.addEventListener('WeixinOpenTagsError', function (e) {
 				console.warn('[WeixinOpenTagsError]', e && e.detail);
-				applyWxOpenLaunchSceneBodyClass();
 			});
 
 			if (isWeChatInAppBrowser()) {
@@ -2153,10 +2138,6 @@
 							showFabToast(
 								wxInitLastError || '微信 SDK 初始化中,请稍候再点底部按钮'
 							);
-							return;
-						}
-						if (!isWxOpenLaunchAppSceneSupported()) {
-							showWxCopyLinkEntryTip();
 						}
 					});
 				}

+ 30 - 43
HBuilderProjects/shareCheckIn.html

@@ -322,11 +322,11 @@
 			opacity: 1;
 		}
 
-		body.is-wechat.wx-jssdk-ready.wx-open-tag-scene #launch-btn {
+		body.is-wechat.wx-jssdk-ready #launch-btn {
 			display: block;
 		}
 
-		body.is-wechat.wx-jssdk-ready.wx-open-tag-scene #openApp {
+		body.is-wechat.wx-jssdk-ready #openApp {
 			display: none !important;
 		}
 
@@ -797,27 +797,20 @@
 
 		function getWxShareEntryFrom() {
 			var from = q('from');
-			return from ? String(from).trim().toLowerCase() : '';
-		}
-
-		function isWxOpenLaunchAppSceneSupported() {
-			if (!isWeChatInAppBrowser()) return false;
-			if (readQueryParam('wxOpenTag') === '1' || readQueryParam('wxForceOpenTag') === '1') {
-				return true;
-			}
-			var from = getWxShareEntryFrom();
-			return (
-				from === 'singlemessage' ||
-				from === 'groupmessage' ||
-				from === 'timeline'
-			);
-		}
-
-		function applyWxOpenLaunchSceneBodyClass() {
-			if (!isWeChatInAppBrowser()) return;
-			var ok = isWxOpenLaunchAppSceneSupported();
-			document.body.classList.toggle('wx-open-tag-scene', ok);
-			document.body.classList.toggle('wx-copy-link-entry', !ok);
+			if (from) return String(from).trim().toLowerCase();
+			try {
+				var h = location.hash || '';
+				var qi = h.indexOf('?');
+				if (qi >= 0) {
+					var hf = new URLSearchParams(h.slice(qi + 1)).get('from');
+					if (hf) return String(hf).trim().toLowerCase();
+				}
+			} catch (eH) {}
+			try {
+				var sf = new URLSearchParams(location.search || '').get('from');
+				if (sf) return String(sf).trim().toLowerCase();
+			} catch (eS) {}
+			return '';
 		}
 
 		function isIOSWeChatBrowser() {
@@ -828,18 +821,12 @@
 		function logWxEntryDiagnostics() {
 			if (!isWeChatInAppBrowser()) return;
 			console.log('[wx-entry]', {
-				entryFrom: getWxShareEntryFrom() || '(无,多为复制链接进入)',
-				openLaunchTagScene: isWxOpenLaunchAppSceneSupported(),
+				entryFrom: getWxShareEntryFrom() || '(无)',
+				wxJssdkReady: weChatJssdkConfigured,
 				signUrl: getWxConfigSignUrl()
 			});
 		}
 
-		function showWxCopyLinkEntryTip() {
-			showFabToast(
-				'当前为复制链接进入,微信不支持直接打开 App。请使用 App「分享到微信」发送卡片后,点卡片进入。'
-			);
-		}
-
 		function readQueryParam(name) {
 			return q(name);
 		}
@@ -1085,10 +1072,7 @@
 				wx.ready(function () {
 					weChatJssdkConfigured = true;
 					document.body.classList.add('wx-jssdk-ready');
-					applyWxOpenLaunchSceneBodyClass();
-					if (isWxOpenLaunchAppSceneSupported()) {
-						refreshWxLaunchTagAttrs();
-					}
+					refreshWxLaunchTagAttrs();
 					console.log('[wx.config] ready, htmlUrl=', htmlUrl);
 					resolve(true);
 				});
@@ -1144,9 +1128,17 @@
 							? String(detail.errmsg)
 							: '';
 				console.warn('[wx-open-launch-app]', detail);
-				showAppOpenFailTip(
-					'请确复制链接进入U店在哪'
-				);
+				if (/launch:fail/i.test(errMsg) && !getWxShareEntryFrom()) {
+					showAppOpenFailTip(
+						'当前环境无法直接打开 App,请使用 App「分享到微信」后点分享卡片进入'
+					);
+				} else {
+					showAppOpenFailTip(
+						errMsg
+							? '未能打开 App:' + errMsg
+							: '未能打开 App,请确认已安装最新版「U店在哪」'
+					);
+				}
 			});
 		}
 
@@ -2457,7 +2449,6 @@
 			bindWeChatLaunchTagEvents();
 			if (isWeChatInAppBrowser()) {
 				document.body.classList.add('is-wechat');
-				applyWxOpenLaunchSceneBodyClass();
 				logWxEntryDiagnostics();
 			}
 			if (shouldInitWeChatJssdkOnLoad()) {
@@ -2469,7 +2460,6 @@
 
 			document.addEventListener('WeixinOpenTagsError', function (e) {
 				console.warn('[WeixinOpenTagsError]', e && e.detail);
-				applyWxOpenLaunchSceneBodyClass();
 			});
 
 			fetchGetDeleteFlagByIdIfId().then(function (res) {
@@ -2495,9 +2485,6 @@
 							);
 							return;
 						}
-						if (!isWxOpenLaunchAppSceneSupported()) {
-							showWxCopyLinkEntryTip();
-						}
 					});
 				}
 			} else {

+ 30 - 43
HBuilderProjects/shareCheckInUndefined.html

@@ -211,11 +211,11 @@
 			opacity: 1;
 		}
 
-		body.is-wechat.wx-jssdk-ready.wx-open-tag-scene #launch-btn {
+		body.is-wechat.wx-jssdk-ready #launch-btn {
 			display: block;
 		}
 
-		body.is-wechat.wx-jssdk-ready.wx-open-tag-scene #openApp {
+		body.is-wechat.wx-jssdk-ready #openApp {
 			display: none !important;
 		}
 
@@ -552,27 +552,20 @@
 
 		function getWxShareEntryFrom() {
 			var from = q('from');
-			return from ? String(from).trim().toLowerCase() : '';
-		}
-
-		function isWxOpenLaunchAppSceneSupported() {
-			if (!isWeChatInAppBrowser()) return false;
-			if (readQueryParam('wxOpenTag') === '1' || readQueryParam('wxForceOpenTag') === '1') {
-				return true;
-			}
-			var from = getWxShareEntryFrom();
-			return (
-				from === 'singlemessage' ||
-				from === 'groupmessage' ||
-				from === 'timeline'
-			);
-		}
-
-		function applyWxOpenLaunchSceneBodyClass() {
-			if (!isWeChatInAppBrowser()) return;
-			var ok = isWxOpenLaunchAppSceneSupported();
-			document.body.classList.toggle('wx-open-tag-scene', ok);
-			document.body.classList.toggle('wx-copy-link-entry', !ok);
+			if (from) return String(from).trim().toLowerCase();
+			try {
+				var h = location.hash || '';
+				var qi = h.indexOf('?');
+				if (qi >= 0) {
+					var hf = new URLSearchParams(h.slice(qi + 1)).get('from');
+					if (hf) return String(hf).trim().toLowerCase();
+				}
+			} catch (eH) {}
+			try {
+				var sf = new URLSearchParams(location.search || '').get('from');
+				if (sf) return String(sf).trim().toLowerCase();
+			} catch (eS) {}
+			return '';
 		}
 
 		function isIOSWeChatBrowser() {
@@ -583,18 +576,12 @@
 		function logWxEntryDiagnostics() {
 			if (!isWeChatInAppBrowser()) return;
 			console.log('[wx-entry]', {
-				entryFrom: getWxShareEntryFrom() || '(无,多为复制链接进入)',
-				openLaunchTagScene: isWxOpenLaunchAppSceneSupported(),
+				entryFrom: getWxShareEntryFrom() || '(无)',
+				wxJssdkReady: weChatJssdkConfigured,
 				signUrl: getWxConfigSignUrl()
 			});
 		}
 
-		function showWxCopyLinkEntryTip() {
-			showFabToast(
-				'当前为复制链接进入,微信不支持直接打开 App。请使用 App「分享到微信」发送卡片后,点卡片进入。'
-			);
-		}
-
 		function readQueryParam(name) {
 			return q(name);
 		}
@@ -840,10 +827,7 @@
 				wx.ready(function () {
 					weChatJssdkConfigured = true;
 					document.body.classList.add('wx-jssdk-ready');
-					applyWxOpenLaunchSceneBodyClass();
-					if (isWxOpenLaunchAppSceneSupported()) {
-						refreshWxLaunchTagAttrs();
-					}
+					refreshWxLaunchTagAttrs();
 					console.log('[wx.config] ready, htmlUrl=', htmlUrl);
 					resolve(true);
 				});
@@ -899,9 +883,17 @@
 							? String(detail.errmsg)
 							: '';
 				console.warn('[wx-open-launch-app]', detail);
-				showAppOpenFailTip(
-					'请确复制链接进入U店在哪'
-				);
+				if (/launch:fail/i.test(errMsg) && !getWxShareEntryFrom()) {
+					showAppOpenFailTip(
+						'当前环境无法直接打开 App,请使用 App「分享到微信」后点分享卡片进入'
+					);
+				} else {
+					showAppOpenFailTip(
+						errMsg
+							? '未能打开 App:' + errMsg
+							: '未能打开 App,请确认已安装最新版「U店在哪」'
+					);
+				}
 			});
 		}
 
@@ -1328,7 +1320,6 @@
 			bindWeChatLaunchTagEvents();
 			if (isWeChatInAppBrowser()) {
 				document.body.classList.add('is-wechat');
-				applyWxOpenLaunchSceneBodyClass();
 				logWxEntryDiagnostics();
 			}
 			if (shouldInitWeChatJssdkOnLoad()) {
@@ -1340,7 +1331,6 @@
 
 			document.addEventListener('WeixinOpenTagsError', function (e) {
 				console.warn('[WeixinOpenTagsError]', e && e.detail);
-				applyWxOpenLaunchSceneBodyClass();
 			});
 
 			applyEmptyHeroState();
@@ -1356,9 +1346,6 @@
 							);
 							return;
 						}
-						if (!isWxOpenLaunchAppSceneSupported()) {
-							showWxCopyLinkEntryTip();
-						}
 					});
 				}
 			} else {

+ 30 - 43
HBuilderProjects/shareDynamic.html

@@ -512,11 +512,11 @@
 			opacity: 1;
 		}
 
-		body.is-wechat.wx-jssdk-ready.wx-open-tag-scene #launch-btn {
+		body.is-wechat.wx-jssdk-ready #launch-btn {
 			display: block;
 		}
 
-		body.is-wechat.wx-jssdk-ready.wx-open-tag-scene #openApp {
+		body.is-wechat.wx-jssdk-ready #openApp {
 			display: none !important;
 		}
 
@@ -1359,10 +1359,7 @@
 				wx.ready(function () {
 					weChatJssdkConfigured = true;
 					document.body.classList.add('wx-jssdk-ready');
-					applyWxOpenLaunchSceneBodyClass();
-					if (isWxOpenLaunchAppSceneSupported()) {
-						refreshWxLaunchTagAttrs();
-					}
+					refreshWxLaunchTagAttrs();
 					console.log('[wx.config] ready, htmlUrl=', htmlUrl);
 					resolve(true);
 				});
@@ -1418,9 +1415,17 @@
 							? String(detail.errmsg)
 							: '';
 				console.warn('[wx-open-launch-app]', detail);
-				showAppOpenFailTip(
-					'请确复制链接进入U店在哪'
-				);
+				if (/launch:fail/i.test(errMsg) && !getWxShareEntryFrom()) {
+					showAppOpenFailTip(
+						'当前环境无法直接打开 App,请使用 App「分享到微信」后点分享卡片进入'
+					);
+				} else {
+					showAppOpenFailTip(
+						errMsg
+							? '未能打开 App:' + errMsg
+							: '未能打开 App,请确认已安装最新版「U店在哪」'
+					);
+				}
 			});
 		}
 
@@ -1530,27 +1535,20 @@
 
 		function getWxShareEntryFrom() {
 			var from = q('from');
-			return from ? String(from).trim().toLowerCase() : '';
-		}
-
-		function isWxOpenLaunchAppSceneSupported() {
-			if (!isWeChatInAppBrowser()) return false;
-			if (readQueryParam('wxOpenTag') === '1' || readQueryParam('wxForceOpenTag') === '1') {
-				return true;
-			}
-			var from = getWxShareEntryFrom();
-			return (
-				from === 'singlemessage' ||
-				from === 'groupmessage' ||
-				from === 'timeline'
-			);
-		}
-
-		function applyWxOpenLaunchSceneBodyClass() {
-			if (!isWeChatInAppBrowser()) return;
-			var ok = isWxOpenLaunchAppSceneSupported();
-			document.body.classList.toggle('wx-open-tag-scene', ok);
-			document.body.classList.toggle('wx-copy-link-entry', !ok);
+			if (from) return String(from).trim().toLowerCase();
+			try {
+				var h = location.hash || '';
+				var qi = h.indexOf('?');
+				if (qi >= 0) {
+					var hf = new URLSearchParams(h.slice(qi + 1)).get('from');
+					if (hf) return String(hf).trim().toLowerCase();
+				}
+			} catch (eH) {}
+			try {
+				var sf = new URLSearchParams(location.search || '').get('from');
+				if (sf) return String(sf).trim().toLowerCase();
+			} catch (eS) {}
+			return '';
 		}
 
 		function isIOSWeChatBrowser() {
@@ -1561,18 +1559,12 @@
 		function logWxEntryDiagnostics() {
 			if (!isWeChatInAppBrowser()) return;
 			console.log('[wx-entry]', {
-				entryFrom: getWxShareEntryFrom() || '(无,多为复制链接进入)',
-				openLaunchTagScene: isWxOpenLaunchAppSceneSupported(),
+				entryFrom: getWxShareEntryFrom() || '(无)',
+				wxJssdkReady: weChatJssdkConfigured,
 				signUrl: getWxConfigSignUrl()
 			});
 		}
 
-		function showWxCopyLinkEntryTip() {
-			showFabToast(
-				'当前为复制链接进入,微信不支持直接打开 App。请使用 App「分享到微信」发送卡片后,点卡片进入。'
-			);
-		}
-
 		/** 微信内置浏览器、iOS:OSS 截图/封面易因 Referer 被拒;video 首帧不可靠 */
 		function preferStaticStillOverVideo() {
 			return isIOSVideoEnv() || isWeChatInAppBrowser();
@@ -3149,7 +3141,6 @@
 			bindWeChatLaunchTagEvents();
 			if (isWeChatInAppBrowser()) {
 				document.body.classList.add('is-wechat');
-				applyWxOpenLaunchSceneBodyClass();
 				logWxEntryDiagnostics();
 			}
 			if (shouldInitWeChatJssdkOnLoad()) {
@@ -3161,7 +3152,6 @@
 
 			document.addEventListener('WeixinOpenTagsError', function (e) {
 				console.warn('[WeixinOpenTagsError]', e && e.detail);
-				applyWxOpenLaunchSceneBodyClass();
 			});
 
 			fetchGetDeleteFlagByIdIfId().then(function (res) {
@@ -3189,9 +3179,6 @@
 							);
 							return;
 						}
-						if (!isWxOpenLaunchAppSceneSupported()) {
-							showWxCopyLinkEntryTip();
-						}
 					});
 				}
 			} else {

+ 26 - 44
HBuilderProjects/shareIndex.html

@@ -496,11 +496,11 @@
 			opacity: 1;
 		}
 
-		body.is-wechat.wx-jssdk-ready.wx-open-tag-scene #launch-btn {
+		body.is-wechat.wx-jssdk-ready #launch-btn {
 			display: block;
 		}
 
-		body.is-wechat.wx-jssdk-ready.wx-open-tag-scene #openApp {
+		body.is-wechat.wx-jssdk-ready #openApp {
 			display: none !important;
 		}
 
@@ -1239,27 +1239,16 @@
 
 		function getWxShareEntryFrom() {
 			var from = readQueryParam('from');
-			return from ? String(from).trim().toLowerCase() : '';
-		}
-
-		function isWxOpenLaunchAppSceneSupported() {
-			if (!isWeChatInAppBrowser()) return false;
-			if (readQueryParam('wxOpenTag') === '1' || readQueryParam('wxForceOpenTag') === '1') {
-				return true;
-			}
-			var from = getWxShareEntryFrom();
-			return (
-				from === 'singlemessage' ||
-				from === 'groupmessage' ||
-				from === 'timeline'
-			);
-		}
-
-		function applyWxOpenLaunchSceneBodyClass() {
-			if (!isWeChatInAppBrowser()) return;
-			var ok = isWxOpenLaunchAppSceneSupported();
-			document.body.classList.toggle('wx-open-tag-scene', ok);
-			document.body.classList.toggle('wx-copy-link-entry', !ok);
+			if (from) return String(from).trim().toLowerCase();
+			try {
+				var h = location.hash || '';
+				var qi = h.indexOf('?');
+				if (qi >= 0) {
+					var hf = new URLSearchParams(h.slice(qi + 1)).get('from');
+					if (hf) return String(hf).trim().toLowerCase();
+				}
+			} catch (eH) {}
+			return '';
 		}
 
 		function isIOSWeChatBrowser() {
@@ -1270,18 +1259,12 @@
 		function logWxEntryDiagnostics() {
 			if (!isWeChatInAppBrowser()) return;
 			console.log('[wx-entry]', {
-				entryFrom: getWxShareEntryFrom() || '(无,多为复制链接进入)',
-				openLaunchTagScene: isWxOpenLaunchAppSceneSupported(),
+				entryFrom: getWxShareEntryFrom() || '(无)',
+				wxJssdkReady: weChatJssdkConfigured,
 				signUrl: getWxConfigSignUrl()
 			});
 		}
 
-		function showWxCopyLinkEntryTip() {
-			showFabToast(
-				'当前为复制链接进入,微信不支持直接打开 App。请使用 App「分享到微信」发送卡片后,点卡片进入。'
-			);
-		}
-
 		function readQueryParam(name) {
 			try {
 				var v = new URLSearchParams(location.search || '').get(name);
@@ -1588,10 +1571,7 @@
 				wx.ready(function () {
 					weChatJssdkConfigured = true;
 					document.body.classList.add('wx-jssdk-ready');
-					applyWxOpenLaunchSceneBodyClass();
-					if (isWxOpenLaunchAppSceneSupported()) {
-						refreshWxLaunchTagAttrs();
-					}
+					refreshWxLaunchTagAttrs();
 					console.log('[wx.config] ready, htmlUrl=', htmlUrl);
 					resolve(true);
 				});
@@ -1647,9 +1627,17 @@
 							? String(detail.errmsg)
 							: '';
 				console.warn('[wx-open-launch-app]', detail);
-				showAppOpenFailTip(
-				'请确复制链接进入U店在哪'
-				);
+				if (/launch:fail/i.test(errMsg) && !getWxShareEntryFrom()) {
+					showAppOpenFailTip(
+						'当前环境无法直接打开 App,请使用 App「分享到微信」后点分享卡片进入'
+					);
+				} else {
+					showAppOpenFailTip(
+						errMsg
+							? '未能打开 App:' + errMsg
+							: '未能打开 App,请确认已安装最新版「U店在哪」'
+					);
+				}
 			});
 		}
 
@@ -2999,7 +2987,6 @@
 			bindWeChatLaunchTagEvents();
 			if (isWeChatInAppBrowser()) {
 				document.body.classList.add('is-wechat');
-				applyWxOpenLaunchSceneBodyClass();
 				logWxEntryDiagnostics();
 			}
 			if (shouldInitWeChatJssdkOnLoad()) {
@@ -3011,7 +2998,6 @@
 
 			document.addEventListener('WeixinOpenTagsError', function (e) {
 				console.warn('[WeixinOpenTagsError]', e && e.detail);
-				applyWxOpenLaunchSceneBodyClass();
 			});
 
 			if (isWeChatInAppBrowser()) {
@@ -3022,10 +3008,6 @@
 							showFabToast(
 								wxInitLastError || '微信 SDK 初始化中,请稍候再点底部按钮'
 							);
-							return;
-						}
-						if (!isWxOpenLaunchAppSceneSupported()) {
-							showWxCopyLinkEntryTip();
 						}
 					});
 				}

+ 19 - 41
HBuilderProjects/shareUndefined.html

@@ -458,12 +458,12 @@
 		}
 
 		/* 与 secondShareGoods 一致:wx 就绪后仅显示开放标签(叠在 openApp 之上) */
-		body.is-wechat.wx-jssdk-ready.wx-open-tag-scene #launch-btn {
+		body.is-wechat.wx-jssdk-ready #launch-btn {
 			display: block;
 			pointer-events: auto;
 		}
 
-		body.is-wechat.wx-jssdk-ready.wx-open-tag-scene #openApp {
+		body.is-wechat.wx-jssdk-ready #openApp {
 			display: none !important;
 		}
 
@@ -864,27 +864,20 @@
 
 		function getWxShareEntryFrom() {
 			var from = q('from');
-			return from ? String(from).trim().toLowerCase() : '';
-		}
-
-		function isWxOpenLaunchAppSceneSupported() {
-			if (!isWeChatInAppBrowser()) return false;
-			if (readQueryParam('wxOpenTag') === '1' || readQueryParam('wxForceOpenTag') === '1') {
-				return true;
-			}
-			var from = getWxShareEntryFrom();
-			return (
-				from === 'singlemessage' ||
-				from === 'groupmessage' ||
-				from === 'timeline'
-			);
-		}
-
-		function applyWxOpenLaunchSceneBodyClass() {
-			if (!isWeChatInAppBrowser()) return;
-			var ok = isWxOpenLaunchAppSceneSupported();
-			document.body.classList.toggle('wx-open-tag-scene', ok);
-			document.body.classList.toggle('wx-copy-link-entry', !ok);
+			if (from) return String(from).trim().toLowerCase();
+			try {
+				var h = location.hash || '';
+				var qi = h.indexOf('?');
+				if (qi >= 0) {
+					var hf = new URLSearchParams(h.slice(qi + 1)).get('from');
+					if (hf) return String(hf).trim().toLowerCase();
+				}
+			} catch (eH) {}
+			try {
+				var sf = new URLSearchParams(location.search || '').get('from');
+				if (sf) return String(sf).trim().toLowerCase();
+			} catch (eS) {}
+			return '';
 		}
 
 		function isIOSWeChatBrowser() {
@@ -895,18 +888,12 @@
 		function logWxEntryDiagnostics() {
 			if (!isWeChatInAppBrowser()) return;
 			console.log('[wx-entry]', {
-				entryFrom: getWxShareEntryFrom() || '(无,多为复制链接进入)',
-				openLaunchTagScene: isWxOpenLaunchAppSceneSupported(),
+				entryFrom: getWxShareEntryFrom() || '(无)',
+				wxJssdkReady: weChatJssdkConfigured,
 				signUrl: getWxConfigSignUrl()
 			});
 		}
 
-		function showWxCopyLinkEntryTip() {
-			showFabToast(
-				'当前为复制链接进入,微信不支持直接打开 App。请使用 App「分享到微信」发送卡片后,点卡片进入。'
-			);
-		}
-
 		function readQueryParam(name) {
 			return q(name);
 		}
@@ -1152,10 +1139,7 @@
 				wx.ready(function () {
 					weChatJssdkConfigured = true;
 					document.body.classList.add('wx-jssdk-ready');
-					applyWxOpenLaunchSceneBodyClass();
-					if (isWxOpenLaunchAppSceneSupported()) {
-						refreshWxLaunchTagAttrs(false);
-					}
+					refreshWxLaunchTagAttrs(false);
 					console.log('[wx.config] ready, htmlUrl=', htmlUrl);
 					resolve(true);
 				});
@@ -1954,7 +1938,6 @@
 			bindWeChatLaunchTagEvents();
 			if (isWeChatInAppBrowser()) {
 				document.body.classList.add('is-wechat');
-				applyWxOpenLaunchSceneBodyClass();
 				logWxEntryDiagnostics();
 			}
 			if (shouldInitWeChatJssdkOnLoad()) {
@@ -1966,7 +1949,6 @@
 
 			document.addEventListener('WeixinOpenTagsError', function (e) {
 				console.warn('[WeixinOpenTagsError]', e && e.detail);
-				applyWxOpenLaunchSceneBodyClass();
 				var d = e && e.detail;
 				var em =
 					d && d.errMsg
@@ -1988,10 +1970,6 @@
 								wxInitLastError || '微信 SDK 初始化中,请稍候再点底部按钮'
 							);
 							initWeChatOpenLaunchApp(true);
-							return;
-						}
-						if (!isWxOpenLaunchAppSceneSupported()) {
-							showWxCopyLinkEntryTip();
 						}
 					});
 				}