//jsApiList里面要有previewImage,调用前一定要遍历数据数组,标记imgIndex
//微信中图片点击放大查看:
previewImage:function(obj){
varimgSrc,imgIndex,srcs=[];
that.$scope.chatMsgList.map(function(msg){
if(msg.msg_type==2){
imgSrc =me.global.res+ msg.content;
srcs.push(imgSrc)
}
})
for(vari=0;i<srcs.length;i++){
if(srcs[i] ==(me.global.res+obj.content)){
imgIndex = i;
}
}
wx.previewImage({
current:srcs[imgIndex],// 当前显示图片的http链接
urls: srcs// 需要预览的图片http链接列表
});
}
$.ajax({
dataType:"json",
//对接微信接口,获取授权
url:"..//getWeixinJsSignature",
data: {
app_id:16,
url:url
},
success:function(data) {
data = data.data;
me.global("weixinInfo",data);
wx.config({
debug:false,
appId: data.appid,
timestamp: data.timestamp,
nonceStr: data.noncestr,
signature: data.sign,
jsApiList: [
"onMenuShareTimeline",
"onMenuShareAppMessage",
"onMenuShareQQ",
"onMenuShareWeibo",
"onMenuShareQZone",
"chooseImage",
"previewImage",
"uploadImage",
"downloadImage",
"chooseWXPay",
"startRecord",
"stopRecord",
"onVoiceRecordEnd",
"playVoice",
"pauseVoice",
"stopVoice",
"uploadVoice",
"downloadVoice",
"translateVoice"
]
});
wx.ready(function() {
wx.checkJsApi({
jsApiList: ["onMenuShareTimeline",
"onMenuShareAppMessage","chooseWXPay"],// 需要检测的JS接口列表,所有JS接口列表见附录2,
success:function(res) {
// 以键值对的形式返回,可用的api值true,不可用为false
// 如:{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
}
});
//WeinxinUtil.setShare();
isReady =true;
});
}
});
网友评论