第三方应用跳转微信小程序
# H5过渡页
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>名片夹</title>
</head>
<body>
<script>
let url = window.location.href.split("?").slice(1);
let params = new URLSearchParams(url[0]);
let link = params.get("businessLink");
location.href = `${link}?${url[1]}`
</script>
</body>
</html>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 小程序跳转方法
/**
* @description: 第三方应用跳转微信小程序
* @param { Object } val
* eg: { path:"/subpkg/share-detail/share-detail", query: `id=${this.pageData.id}&shareUserId=${this.pageData.userId}`}
* @returns
*/
async function handleJumpWeiXin(val) {
const params = {
jump_wxa: val
}
// 后端生成小程序scheme码
const { data } = await http_getScheme(params)
// 跳转web-view页面eg:
uni.navigateTo({
url:`/subpkg/business-web?businessLink=${data}`
})
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 小程序web-view页面
<template>
<view class="container">
<web-view v-if="businessLink" :src="`http://demo_dev.adinnet.cn/demo1/businessCard?businessLink=${businessLink}`">
</web-view>
</view>
</template>
<script>
export default {
data() {
return {
businessLink: ""
};
},
onLoad(option) {
this.businessLink = option.businessLink;
}
};
</script>
<style>
</style>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
上次更新: 2023/08/07, 10:37:54