Skip to content

Instantly share code, notes, and snippets.

@toobigdata
Last active January 29, 2016 06:06
Show Gist options
  • Save toobigdata/6402686 to your computer and use it in GitHub Desktop.
Save toobigdata/6402686 to your computer and use it in GitHub Desktop.
微信前端
function weixinAddContact(name){
WeixinJSBridge.invoke("addContact", {webtype: "1",username: name}, function(e) {
WeixinJSBridge.log(e.err_msg);
//e.err_msg:add_contact:added 已经添加
//e.err_msg:add_contact:cancel 取消添加
//e.err_msg:add_contact:ok 添加成功
if(e.err_msg == 'add_contact:added' || e.err_msg == 'add_contact:ok'){
//关注成功,或者已经关注过
}
})
}
function weixinShareTimeline(title,desc,link,imgUrl){
WeixinJSBridge.invoke('shareTimeline',{
"img_url":imgUrl,
//"img_width":"640",
//"img_height":"640",
"link":link,
"desc": desc,
"title":title
});
}
function weixinShareWeibo(title,link){
WeixinJSBridge.invoke('shareWeibo',{
"content":title + link,
"url":link
});
}
function weixinSendAppMessage(title,desc,link,imgUrl){
WeixinJSBridge.invoke('sendAppMessage',{
//"appid":appId,
"img_url":imgUrl,
//"img_width":"640",
//"img_height":"640",
"link":link,
"desc":desc,
"title":title
});
}
@panxianhai
Copy link

关注指定微信号 这个目前好像不能用了,我不知道是不是微信改了接口。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment