//jsApiList里面要有previewImage己沛,調(diào)用前一定要遍歷數(shù)據(jù)數(shù)組,標(biāo)記imgIndex
//微信中圖片點(diǎn)擊放大查看:
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],// 當(dāng)前顯示圖片的http鏈接
? ? urls: srcs// 需要預(yù)覽的圖片http鏈接列表
? ? });
}
$.ajax({
dataType:"json",
//對(duì)接微信接口末购,獲取授權(quán)
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"],// 需要檢測(cè)的JS接口列表,所有JS接口列表見(jiàn)附錄2,
success:function(res) {
// 以鍵值對(duì)的形式返回,可用的api值true,不可用為false
// 如:{"checkResult":{"chooseImage":true},"errMsg":"checkJsApi:ok"}
}
});
//WeinxinUtil.setShare();
isReady =true;
});
}
});