通过微信访问帖子内容页不显示贴内图片,已经帖子底部的点赞、回帖等操作点击也无效,原因应该是微信分享相关的代码没加载,导致js错误,从而影响其他js的执行
打开:template\default\m\js\viewthread.js
找到
var dataLoaded = function (json, isInit) {在它上边添加
var initWXShare = function (opts) {
WeixinJSBridge.on('menu:share:timeline', function (argv) {
var url = window.location.href + '&source=pyq&siteid=' + SITE_ID;
if (member_uid) {
url += '&fromuid=' + member_uid;
}
setTimeout(
function () {
WeixinJSBridge.invoke('shareTimeline', {
'img_url': opts.img,
'img_width': '120',
'img_height': '120',
'link': url,
'desc': opts.desc,
'title': opts.title
}, function (res) {
$('.tipInfo').hide();
$('.maskLayer').hide();
});
}
, 300
);
});
WeixinJSBridge.on('menu:share:appmessage', function (argv) {
var url = window.location.href + '&source=wxhy&siteid=' + SITE_ID;
setTimeout(
function () {
WeixinJSBridge.invoke('sendAppMessage', {
'appid': 'wx9324b266aa4818d0',
'img_url': opts.img,
'img_width': '120',
'img_height': '120',
'link': url,
'desc': opts.desc,
'title': opts.title
}, function (res) {
$('.tipInfo').hide();
$('.maskLayer').hide();
});
}
, 300
);
});
WeixinJSBridge.on('menu:share:weibo', function (argv) {
var url = window.location.href + '&source=wb&siteid=' + SITE_ID;
setTimeout(
function () {
WeixinJSBridge.invoke('shareWeibo', {
'img_url': opts.img,
'img_width': '120',
'img_height': '120',
'link': url,
'desc': opts.desc,
'title': opts.title,
'url': url,
'content': opts.desc
}, function (res) {
$('.tipInfo').hide();
$('.maskLayer').hide();
});
}
, 300
);
});
};修改后记得后台更新一下缓存,如果还是不行就连微信浏览器缓存一起更新(进程里完全退出软件)