fix(web_view): 改用 wxscene 避免 scene 被微信拦截
微信小程序的 navigateTo 会把 `scene` 参数名当作保留字段 (只由扫码填充),导致 `option.scene` 为空。 改用 wxscene,同时在 web_view onLoad 中兼容检查两者。
This commit is contained in:
@@ -110,8 +110,9 @@ export default {
|
|||||||
// 太阳码 scene 解析:scene="app=<identifier>" 时调 box_app 查 url
|
// 太阳码 scene 解析:scene="app=<identifier>" 时调 box_app 查 url
|
||||||
// 例如 box_app /api/wxacode?app=pregnancy → scene="app=pregnancy"
|
// 例如 box_app /api/wxacode?app=pregnancy → scene="app=pregnancy"
|
||||||
// CRMEB 收到后查 box_app /api/mp/apps?isPublished=1 找 url,跳对应 H5
|
// CRMEB 收到后查 box_app /api/mp/apps?isPublished=1 找 url,跳对应 H5
|
||||||
if (option.scene && option.scene.indexOf('app=') === 0) {
|
if ((option.scene || option.wxscene) && (option.scene || option.wxscene).indexOf('app=') === 0) {
|
||||||
const identifier = option.scene.slice(4);
|
const source = option.scene || option.wxscene;
|
||||||
|
const identifier = source.slice(4);
|
||||||
console.log('[web_view] 太阳码 scene 解析: identifier=' + identifier);
|
console.log('[web_view] 太阳码 scene 解析: identifier=' + identifier);
|
||||||
// 异步处理:uni.request 拿 H5 url,赋值给 option.url 走后续逻辑
|
// 异步处理:uni.request 拿 H5 url,赋值给 option.url 走后续逻辑
|
||||||
this._resolveAppScene(identifier, option);
|
this._resolveAppScene(identifier, option);
|
||||||
|
|||||||
@@ -638,7 +638,7 @@ export default {
|
|||||||
,goWxacodeTest() {
|
,goWxacodeTest() {
|
||||||
console.log("[user] 太阳码扫码测试");
|
console.log("[user] 太阳码扫码测试");
|
||||||
uni.navigateTo({
|
uni.navigateTo({
|
||||||
url: "/pages/annex/web_view/index?scene=app=pregnancy"
|
url: "/pages/annex/web_view/index?wxscene=app=pregnancy"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user