如何通过打开普通URL跳转小程序?
目前可以扫普通二维码跳转小程序,可否通过直接打开二维码的地址打开小程序,而不通过扫码的形式
目前可以扫普通二维码跳转小程序,可否通过直接打开二维码的地址打开小程序,而不通过扫码的形式
外部h5任意外链跳转微信打开小程序,参考案例 http://m.jumpwx.com/wx/?i=170
:https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_Open_Tag.html#21
微信外浏览器用urlscheme.generate:https://developers.weixin.qq.com/miniprogram/dev/api-backend/open-api/url-scheme/urlscheme.generate.html
let postData = {
appKey: 'QTSHE_MINI_APP',
path: 'pages/partdetails/partdetails',
query: 'partJobId=123456' || 'a=1'
}
this.$axios.post('/qtsWeChat/wechat/qrCode/scheme/info', postData).then((res) => {
if (res.success) {
const url = res.data.openlink
// 将scheme转为我们平台的短链接,否则在安卓手机上无法打开微信小程序,会默认打开浏览器搜索。
this.$axios.get(`/misc/shortLink/conversion`, {url}).then((res) => {
if (res.success) {
this.shortLink = res.data
}
})
} else {
this.$Message.error('获取失败,请稍后重试')
}
}).catch((err) => {
console.log(err)
})
wx-open-launch-app 微信h5唤起本地已经安装的app,以及 wx-open-launch-weapp 微信h5唤起小程序,操作如下:window.wx.config({
debug: false,
appId: window.g_info.wx_appid,
timestamp: data.data.timestamp,
nonceStr: data.data.nonceStr,
signature: data.data.signature,
jsApiList: [],
openTagList: [
'wx-open-launch-app',
'wx-open-launch-weapp'
]
})
<script type="text/wxtag-template"></script>进行代替,来包裹插槽模版和样式。position: fixed; top -100;等,尽量不要写在插槽模版的节点中,请声明在标签或其父节点上;frame-src https://*.qq.com webcompt:,才能在页面中正常使用开放标签。<wx-open-launch-weapp id="launch-btn" username="gh_7c2bc00a6bf8" path="pages/partdetails/partdetails.html?partJobId=1013456">
<script type="text/wxtag-template">
<style>
img {
width: 100%;
display: block;
animation: free_download 0.9s linear alternate infinite;
will-change: transform;
}
@keyframes free_download {
0% {
transform: scale(0.9);
}
100% {
transform: scale(1);
}
}
</style>
<img src="https://qiniu-image.qtshe.com/202103179.png" alt="" />
</script>
</wx-open-launch-weapp>

// 各个端口跳转兼职详情页
jumpToPartJobDetail(partJobId) {
util.isAliMiniApp().then((res) => {
if (res) { // 如果是在支付宝小程序环境则打开小程序详情页
my.navigateTo({
url: `/pages/partdetails/partdetails?partJobId=${partJobId}`
})
} else {
// 如果是在客户端app环境,则打开原生岗位详情页
if (util.isAndroidApp() || util.isIosApp()) {
jsBridge.evokeNormalPartJobDetailPage(partJobId)
} else if (util.isMiniApp()) { // 微信小程序里则打开微信小程序岗位详情
wx.miniProgram.navigateTo({
url: `/pages/partdetails/partdetails?partJobId=${partJobId}`
})
} else if (util.isMobile()) {
// 如果是在手机自带浏览器或者除微信外的app浏览器,统一打开支付宝小程序
let url = `alipays://platformapi/startapp?appId=2018082861168647&page=pages/partdetails/partdetails&query=partJobId%3D${partJobId}`
window.location.href = `https://ds.alipay.com/?scheme=${encodeURIComponent(url)}`
} else { // pc端打开h5的兼职详情页
window.location.href = `/app/partdetails?partJobId=${partJobId}`
}
}
})
}