fix(web_view): 改用 wxscene 避免 scene 被微信拦截

微信小程序的 navigateTo 会把 `scene` 参数名当作保留字段
(只由扫码填充),导致 `option.scene` 为空。
改用 wxscene,同时在 web_view onLoad 中兼容检查两者。
This commit is contained in:
2026-07-08 18:29:08 +08:00
parent fa74238186
commit 0e9ce6f7d6
2 changed files with 4 additions and 3 deletions

View File

@@ -110,8 +110,9 @@ export default {
// 太阳码 scene 解析:scene="app=<identifier>" 时调 box_app 查 url
// 例如 box_app /api/wxacode?app=pregnancy → scene="app=pregnancy"
// CRMEB 收到后查 box_app /api/mp/apps?isPublished=1 找 url,跳对应 H5
if (option.scene && option.scene.indexOf('app=') === 0) {
const identifier = option.scene.slice(4);
if ((option.scene || option.wxscene) && (option.scene || option.wxscene).indexOf('app=') === 0) {
const source = option.scene || option.wxscene;
const identifier = source.slice(4);
console.log('[web_view] 太阳码 scene 解析: identifier=' + identifier);
// 异步处理:uni.request 拿 H5 url,赋值给 option.url 走后续逻辑
this._resolveAppScene(identifier, option);

View File

@@ -638,7 +638,7 @@ export default {
,goWxacodeTest() {
console.log("[user] 太阳码扫码测试");
uni.navigateTo({
url: "/pages/annex/web_view/index?scene=app=pregnancy"
url: "/pages/annex/web_view/index?wxscene=app=pregnancy"
});
}
}