微信中图片点击放大查看

//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;

});

}

});

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容