目前小程序是不支持直接识别二维码下载的!!
方法一:
通过小程序里面的webview 解决
1、在webview 里面放在应用宝的下载链接
2、通过长按事件自定义菜单,代码如下
<view class="img-wrapper" @longpress="distinguish">
<image :src="require('./img/ewm.png')" mode="" class="ewm"></image>
</view>
distinguish:function(){
uni.showActionSheet({
itemList: ['识别图中二维码'],
success: function (res) {
console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
uni.navigateTo({
url:'./webview' //第一步写的
})
},
fail: function (res) {
console.log(res.errMsg);
}
})
}
这里有一个很大的问题!!!webview 里面的第三方链接 一定要在后台配置业务域名,由于我采用的是应用宝的链接 https://a.app.qq.com 无法配置业务域名,所以这个方法不行!
方法二:
转变思路解决:复制应用宝链接到浏览器,由用户手动操作
1、绑定事件不变,一样的是长按事件
代码实现如下:
distinguish:function(){
uni.showActionSheet({
itemList: ['复制链接'],
success: function (res) {
console.log('选中了第' + (res.tapIndex + 1) + '个按钮');
uni.setClipboardData({
data:'https://a.app.qq.com/o/simple.jsp?pkgname=com.ddmg.cargo',
success:res=>{
uni.showToast({
title:'复制成功',
icon:'none'
});
}
});
},
fail: function (res) {
console.log(res.errMsg);
}
})
}
方法三:
通过小程序的客服功能,由客服发送链接给用户,用户可直接跳链接下载,需要设置小程序自动回复功能
1、一般效果的自动回复,将客服设置未离线状态即可
2、效果好一些的回复,需要调起小程序客服api,在小程序后台的消息中心配置,参考链接:https://developers.weixin.qq.com/miniprogram/introduction/custom.html#%E5%8A%9F%E8%83%BD%E4%BB%8B%E7%BB%8D
3、接入第三方客服平台,有自动回复功能,可能需要付费。
虽然效果没有那么好,不过也没办法波,跪求好办法!!