|
|
|
@ -12,23 +12,78 @@ app.controller('InviteCodeController', ['$scope','$http', '$routeParams','config
|
|
|
|
|
function(response){
|
|
|
|
|
console.log(response.data);
|
|
|
|
|
vm.course = response.data.data;
|
|
|
|
|
wxinit();
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
vm.share = function(){
|
|
|
|
|
window.WeixinJSBridge.invoke('sendAppMessage',{
|
|
|
|
|
'appid': 'wxf694495398c7d470', // 公众号appID
|
|
|
|
|
'type': 'link', // 非必填,music,vido或link,默认为link。
|
|
|
|
|
'data_url': '', // 非必填,连接地址,如音乐的mp3数据地址,供内置播放器使用
|
|
|
|
|
'img_url': 'http://pnewsapp.tc.qq.com/newsapp_bt/0/9963967/640', // 缩略图地址
|
|
|
|
|
'img_height':370, // 缩略图高度
|
|
|
|
|
'img_width':550, // 缩略图宽度
|
|
|
|
|
'link':'http://view.inews.qq.com/a/WXN2013101101385701', // 链接地址
|
|
|
|
|
'desc':'desc', // 描述
|
|
|
|
|
'title':'title' // 标题
|
|
|
|
|
// vm.share = function(){
|
|
|
|
|
// window.WeixinJSBridge.invoke('sendAppMessage',{
|
|
|
|
|
// 'appid': 'wxf694495398c7d470', // 公众号appID
|
|
|
|
|
// 'type': 'link', // 非必填,music,vido或link,默认为link。
|
|
|
|
|
// 'data_url': '', // 非必填,连接地址,如音乐的mp3数据地址,供内置播放器使用
|
|
|
|
|
// 'img_url': 'http://pnewsapp.tc.qq.com/newsapp_bt/0/9963967/640', // 缩略图地址
|
|
|
|
|
// 'img_height':370, // 缩略图高度
|
|
|
|
|
// 'img_width':550, // 缩略图宽度
|
|
|
|
|
// 'link':'http://view.inews.qq.com/a/WXN2013101101385701', // 链接地址
|
|
|
|
|
// 'desc':'desc', // 描述
|
|
|
|
|
// 'title':'title' // 标题
|
|
|
|
|
// },function(res){
|
|
|
|
|
// //alert(res.err_msg);
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
wxinit = function(){
|
|
|
|
|
var descContent = '班级邀请:'+vm.course.name+'班级'; //分享给朋友或朋友圈时的文字简介
|
|
|
|
|
var shareTitle = 'Trustie创新实践平台'; //分享title
|
|
|
|
|
var appid = 'wxc09454f171153c2d'; //apiID,可留空
|
|
|
|
|
var linelink = 'https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket='+vm.course.qrcode;
|
|
|
|
|
|
|
|
|
|
function shareFriend() {
|
|
|
|
|
WeixinJSBridge.invoke('sendAppMessage',{
|
|
|
|
|
"appid": appid,
|
|
|
|
|
"img_width": "200",
|
|
|
|
|
"img_height": "200",
|
|
|
|
|
"link": linelink,
|
|
|
|
|
"desc": descContent,
|
|
|
|
|
"title": shareTitle
|
|
|
|
|
}, function(res) {
|
|
|
|
|
//_report('send_msg', res.err_msg);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
function shareTimeline() {
|
|
|
|
|
WeixinJSBridge.invoke('shareTimeline',{
|
|
|
|
|
"img_width": "200",
|
|
|
|
|
"img_height": "200",
|
|
|
|
|
"link": linelink,
|
|
|
|
|
"desc": descContent,
|
|
|
|
|
"title": shareTitle
|
|
|
|
|
}, function(res) {
|
|
|
|
|
//_report('timeline', res.err_msg);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
function shareWeibo() {
|
|
|
|
|
WeixinJSBridge.invoke('shareWeibo',{
|
|
|
|
|
"content": descContent,
|
|
|
|
|
"url": linelink
|
|
|
|
|
}, function(res) {
|
|
|
|
|
//alert(res.err_msg);
|
|
|
|
|
//_report('weibo', res.err_msg);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// 当微信内置浏览器完成内部初始化后会触发WeixinJSBridgeReady事件。
|
|
|
|
|
document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
|
|
|
|
|
// 发送给好友
|
|
|
|
|
WeixinJSBridge.on('menu:share:appmessage', function(argv){
|
|
|
|
|
shareFriend();
|
|
|
|
|
});
|
|
|
|
|
// 分享到朋友圈
|
|
|
|
|
WeixinJSBridge.on('menu:share:timeline', function(argv){
|
|
|
|
|
shareTimeline();
|
|
|
|
|
});
|
|
|
|
|
// 分享到微博
|
|
|
|
|
WeixinJSBridge.on('menu:share:weibo', function(argv){
|
|
|
|
|
shareWeibo();
|
|
|
|
|
});
|
|
|
|
|
}, false);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}]);
|
|
|
|
|