如题。
小程序绘制出的海报上的小程序二维码iOS系统(ios12.4,iPhone6,微信7.0.5)长按识别不了(弹出菜单没有“前往图中包含的小程序”),安卓系统下长按识别没问题。why?怎么解决?困扰,盼答,Thanx!
同样出现这种问题,基本发生在iphone6以及以下
iphone5s同样无法识别,刚开始以为是小程序码大小的问题
后来经过测试,直接一个小程序码也无法识别,但是偶尔有些图又能识别
有点难顶(下图左边可以识别,右边不行)
var that;
var _app = getApp()
Page({
data: {
btnText: “保存卡片进行分享”,
partyObj: null,
shareImgSrc: “”,
headPath: “”,
posterPath: “”,
activityObj: {
},
ServiceUrl: ‘’,
userInfo: {
},
codePath: “”
},
Fanhui: function () {
wx.navigateBack()
},
onLoad: function (a) {
that = this;
wx.showLoading({
title: ‘正在制作卡片~’,
})
var interval = setInterval(function () {
if (_app.globalData.has) {
clearInterval(interval)
that.setData({
activityObj: JSON.parse(a.data),
userInfo: _app.globalData.userInfo
})
console.log(that.data.activityObj);
console.log(that.data.userInfo);
var s = “”,
n = “”,
l = “”,
o = [s = _app.globalData.userInfo.avatarUrl, n = _app.globalData.ServiceUrl + that.data.activityObj.activityImg, l = that.data.activityObj.QrCode == ‘’ ? _app.globalData.ServiceUrl + ‘/Images/QrCode.png’ : _app.globalData.ServiceUrl + that.data.activityObj.QrCode];//
//o = [s = _app.globalData.userInfo.avatarUrl, n = _app.globalData.ServiceUrl + that.data.activityObj.activityImg, l = that.data.activityObj.QrCode == ‘’ ? _app.globalData.ServiceUrl + ‘/Images/QrCode.png’ : _app.globalData.ServiceUrl + ‘/Images/QrCode.png’];
that.downloadImg(o, 0);
}
}, 100)
},
downloadImg: function (t, a) {
var i = t[a];
wx.downloadFile({
url: i,
success: function (i) {
0 == a ? (that.data.headPath = i.tempFilePath, that.downloadImg(t, 1)) : 1 == a ? (that.data.posterPath = i.tempFilePath,
that.downloadImg(t, 2)) : (that.data.codePath = i.tempFilePath, that.drawShare());
},
fail: function (t) {
that.drawShare();
}
});
},
drawShare: function () {
var t = wx.createCanvasContext(“myCanvas”);
t.setFillStyle(“white”), t.fillRect(0, 0, 290, 490);
var a = 10;
t.drawImage(that.data.headPath, 10, a, 42, 42), a += 57;
t.drawImage("…/…/images/comm/headFrame.png", 10, 10, 42, 42);
var e = that.data.userInfo.nickName;
e.length > 10 && (e = e.slice(0, 10) + “…”), t.setFontSize(12), t.setFillStyle("#0099e9"),
t.fillText(e, 62, 25), t.setFontSize(12), t.setFillStyle("#233040"), t.fillText(“分享了一个有趣的活动,快来看看吧~”, 62, 50),
t.drawImage(that.data.posterPath, 10, a, 270, 152), a += 172;
var i = [],
s = that.data.activityObj.activityName;
s.length > 16 ? (i.push(s.slice(0, 16)), s.length > 32 ? i.push(s.slice(16, 32) + “…”) : i.push(s.slice(16))) : i.push(s);
for (o = 0; o < i.length; o++) {
d = 20 * o;
t.setFontSize(15), t.setFillStyle("#233040"), t.fillText(i[o], 20, a + d), a += d;
}
a += 15;
t.drawImage("…/…/images/comm/time.png", 20, a, 16, 16), t.setFontSize(12), t.setFillStyle("#233040"),
t.fillText(that.data.activityObj.beginDate + ’ ~ ’ + that.data.activityObj.endDate, 40, a + 12), a += 30;
t.drawImage("…/…/images/comm/address.png", 20, a, 16, 16);
var n = [], l = “”;
if (that.data.activityObj.activityCity == “线上活动”) {
l = that.data.activityObj.activityCity;
} else {
l = that.data.activityObj.activityCity + that.data.activityObj.activityAddress;
}
l.length > 18 ? (n.push(l.slice(0, 18)), l.length > 36 ? n.push(l.slice(18, 36) + “…”) : n.push(l.slice(18))) : n.push(l);
for (var o = 0; o < n.length; o++) {
var d = 20 * o;
t.setFontSize(12), t.setFillStyle("#233040"), t.fillText(n[o], 40, a + 12 + d),
a += d;
}
a += 36, t.drawImage(that.data.codePath, 100, a, 90, 90), a += 115, t.setFontSize(12),
t.setFillStyle("#98A4B4"), t.setTextAlign(“center”), t.fillText(“长按识别小程序二维码查看”, 145, a),
t.draw();
wx.hideLoading()
},
bindFinish: function () {
wx.showLoading({
title: “卡片正在保存中”
});
wx.canvasToTempFilePath({
canvasId: “myCanvas”,
x: 0,
y: 0,
width: 290,
height: 490,
destWidth: 1450,
destHeight: 2450,
success: function (t) {
wx.saveImageToPhotosAlbum({
filePath: t.tempFilePath,
success: function (t) {
wx.hideLoading(), wx.showModal({
title: “保存成功”,
content: “卡片已保存到相册\n快去发布朋友圈吧”,
showCancel: !1,
confirmText: “我知道了”,
confirmColor: “#0099e9”,
success: function (t) {
t.confirm && wx.navigateBack({
delta: 1
});
}
});
},
fail: function (t) {
wx.hideLoading();
}
});
},
fail: function (t) {
wx.hideLoading();
}
}, this);
},
close: function () {
wx.navigateBack({
delta: 1
});
}
});