微信动态分享图片修改

weixin_guange
yuanke 9 years ago
parent c0579de57d
commit aaa1c01eed

@ -17,6 +17,7 @@
window.g_debug = false; //调试标志,如果在本地请置为true window.g_debug = false; //调试标志,如果在本地请置为true
window.apiUrl = '/api/v1/'; window.apiUrl = '/api/v1/';
window.g_redirect_path = '<%= @path %>'; window.g_redirect_path = '<%= @path %>';
window.g_localhost = "<%= Setting.protocol%>://"+"<%= Setting.host_name%>";
<% if @course_id %> <% if @course_id %>
window.g_courseid = <%= @course_id %>; window.g_courseid = <%= @course_id %>;
<% elsif @project_id %> <% elsif @project_id %>

@ -13,7 +13,7 @@
<div class="f12 c-grey6 mt10 ml15"> <div class="f12 c-grey6 mt10 ml15">
<span class="f13 fb c-grey3">提示</span> <span class="f13 fb c-grey3">提示</span>
<ul class="mb15 mt5 ml10 new-tip"> <ul class="mb15 mt5 ml10 new-tip">
<li><span class="project-intro-dot"></span>教师、教角色需要班级管理员审批</li> <li><span class="project-intro-dot"></span>教师、教角色需要班级管理员审批</li>
<li><span class="project-intro-dot"></span>学生角色无需管理员审批</li> <li><span class="project-intro-dot"></span>学生角色无需管理员审批</li>
</ul> </ul>
</div> </div>

@ -3,7 +3,7 @@
*/ */
app.controller('InviteCodeController', ['$scope','$http', '$routeParams','config','auth','wx', function($scope, $http, $routeParams, config, auth, wx){ app.controller('InviteCodeController', ['$scope','$http', '$routeParams','config','auth','wx','common', function($scope, $http, $routeParams, config, auth, wx,common){
var vm = $scope; var vm = $scope;
vm.course = {}; vm.course = {};
@ -15,35 +15,37 @@ app.controller('InviteCodeController', ['$scope','$http', '$routeParams','config
var desc = "班级邀请:"+vm.course.name+" 班级"; var desc = "班级邀请:"+vm.course.name+" 班级";
wx.ready(function(){ common.wxConfig(desc,"");
wx.onMenuShareTimeline({
title: 'Trustie创新实践平台', // 分享标题
// link: 'http://www.trustie.net/', // 分享链接
imgUrl: 'http://www.trustie.net/images/logo2.png', // 分享图标
success: function () {
console.log("share successed.");
},
cancel: function () {
console.log("share canceled.");
}
});
wx.onMenuShareAppMessage({ // wx.ready(function(){
title: 'Trustie创新实践平台', // 分享标题 // wx.onMenuShareTimeline({
desc: desc, // 分享描述 // title: 'Trustie创新实践平台', // 分享标题
// link: '', // 分享链接 //// link: 'http://www.trustie.net/', // 分享链接
// imgUrl: '', // 分享图标 // imgUrl: 'http://www.trustie.net/images/logo2.png', // 分享图标
imgUrl: 'http://www.trustie.net/images/logo2.png', // 分享图标 // success: function () {
// type: '', // 分享类型,music、video或link不填默认为link // console.log("share successed.");
// dataUrl: '', // 如果type是music或video则要提供数据链接默认为空 // },
success: function () { // cancel: function () {
// 用户确认分享后执行的回调函数 // console.log("share canceled.");
}, // }
cancel: function () { // });
// 用户取消分享后执行的回调函数 //
} // wx.onMenuShareAppMessage({
}); // title: 'Trustie创新实践平台', // 分享标题
}); // desc: desc, // 分享描述
//// link: '', // 分享链接
//// imgUrl: '', // 分享图标
// imgUrl: 'http://www.trustie.net/images/logo2.png', // 分享图标
//// type: '', // 分享类型,music、video或link不填默认为link
//// dataUrl: '', // 如果type是music或video则要提供数据链接默认为空
// success: function () {
// // 用户确认分享后执行的回调函数
// },
// cancel: function () {
// // 用户取消分享后执行的回调函数
// }
// });
// });
} }
); );

@ -3,7 +3,7 @@
*/ */
app.controller('ProjectInviteCodeController', ['$scope','$http', '$routeParams','config','auth','wx', function($scope, $http, $routeParams, config, auth,wx){ app.controller('ProjectInviteCodeController', ['$scope','$http', '$routeParams','config','auth','wx','common', function($scope, $http, $routeParams, config, auth,wx,common){
var vm = $scope; var vm = $scope;
vm.project = {}; vm.project = {};
@ -15,35 +15,37 @@ app.controller('ProjectInviteCodeController', ['$scope','$http', '$routeParams',
var desc = "项目邀请:"+vm.project.name+" 项目"; var desc = "项目邀请:"+vm.project.name+" 项目";
wx.ready(function(){ common.wxConfig(desc,"");
wx.onMenuShareTimeline({
title: 'Trustie创新实践平台', // 分享标题 // wx.ready(function(){
// link: 'http://www.trustie.net/', // 分享链接 // wx.onMenuShareTimeline({
imgUrl: 'http://www.trustie.net/images/logo2.png', // 分享图标 // title: 'Trustie创新实践平台', // 分享标题
success: function () { //// link: 'http://www.trustie.net/', // 分享链接
console.log("share successed."); // imgUrl: 'http://www.trustie.net/images/logo2.png', // 分享图标
}, // success: function () {
cancel: function () { // console.log("share successed.");
console.log("share canceled."); // },
} // cancel: function () {
}); // console.log("share canceled.");
// }
wx.onMenuShareAppMessage({ // });
title: 'Trustie创新实践平台', // 分享标题 //
desc: desc, // 分享描述 // wx.onMenuShareAppMessage({
// link: '', // 分享链接 // title: 'Trustie创新实践平台', // 分享标题
// imgUrl: '', // 分享图标 // desc: desc, // 分享描述
imgUrl: 'http://www.trustie.net/images/logo2.png', // 分享图标 //// link: '', // 分享链接
// type: '', // 分享类型,music、video或link不填默认为link //// imgUrl: '', // 分享图标
// dataUrl: '', // 如果type是music或video则要提供数据链接默认为空 // imgUrl: 'http://www.trustie.net/images/logo2.png', // 分享图标
success: function () { //// type: '', // 分享类型,music、video或link不填默认为link
// 用户确认分享后执行的回调函数 //// dataUrl: '', // 如果type是music或video则要提供数据链接默认为空
}, // success: function () {
cancel: function () { // // 用户确认分享后执行的回调函数
// 用户取消分享后执行的回调函数 // },
} // cancel: function () {
}); // // 用户取消分享后执行的回调函数
}); // }
// });
// });
} }
); );

@ -203,6 +203,7 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx', func
console.log(response.data); console.log(response.data);
var tmptile = "动态"; var tmptile = "动态";
var imgUrl = "";
if(response.data.data.title){ if(response.data.data.title){
tmptile = response.data.data.title; tmptile = response.data.data.title;
@ -212,43 +213,19 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx', func
if(response.data.data.user){ if(response.data.data.user){
tmpname = response.data.data.user.realname; tmpname = response.data.data.user.realname;
imgUrl = response.data.data.user.img_url;
} }
if(response.data.data.author){ if(response.data.data.author){
tmpname = response.data.data.author.realname; tmpname = response.data.data.author.realname;
imgUrl = response.data.data.author.img_url;
} }
imgUrl = window.g_localhost+imgUrl;
var desc = tmpname+""+tmptile; var desc = tmpname+""+tmptile;
console.log("desc = "+desc); console.log("desc = "+desc);
wx.ready(function(){ console.log("imgUrl= "+imgUrl);
wx.onMenuShareTimeline({ wxConfig(desc);
title: 'Trustie创新实践平台', // 分享标题
// link: 'http://www.trustie.net/', // 分享链接
imgUrl: 'http://www.trustie.net/images/logo2.png', // 分享图标
success: function () {
console.log("share successed.");
},
cancel: function () {
console.log("share canceled.");
}
});
wx.onMenuShareAppMessage({
title: 'Trustie创新实践平台', // 分享标题
desc: desc, // 分享描述
// link: '', // 分享链接
// imgUrl: '', // 分享图标
imgUrl: 'http://www.trustie.net/images/logo2.png', // 分享图标
// type: '', // 分享类型,music、video或link不填默认为link
// dataUrl: '', // 如果type是music或video则要提供数据链接默认为空
success: function () {
// 用户确认分享后执行的回调函数
},
cancel: function () {
// 用户取消分享后执行的回调函数
}
});
});
args.loadCallback(response.data); args.loadCallback(response.data);
}, function errorCallback(response) { }, function errorCallback(response) {
@ -352,7 +329,44 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx', func
args.scope.commentreply_path = config.rootPath+ 'templates/comment_reply.html'; args.scope.commentreply_path = config.rootPath+ 'templates/comment_reply.html';
} };
var wxConfig = function(desc,imgUrl){
if(imgUrl == null || imgUrl == ""){
imgUrl = 'http://www.trustie.net/images/logo2.png';
}
wx.ready(function(){
wx.onMenuShareTimeline({
title: 'Trustie创新实践平台', // 分享标题
// link: 'http://www.trustie.net/', // 分享链接
imgUrl: imgUrl, // 分享图标
success: function () {
console.log("share successed.");
},
cancel: function () {
console.log("share canceled.");
}
});
wx.onMenuShareAppMessage({
title: 'Trustie创新实践平台', // 分享标题
desc: desc, // 分享描述
// link: '', // 分享链接
// imgUrl: '', // 分享图标
imgUrl: imgUrl, // 分享图标
// type: '', // 分享类型,music、video或link不填默认为link
// dataUrl: '', // 如果type是music或video则要提供数据链接默认为空
success: function () {
// 用户确认分享后执行的回调函数
},
cancel: function () {
// 用户取消分享后执行的回调函数
}
});
});
};
return {init: init, addCommonReply: addCommonReply, loadCommonData: loadCommonData, addCommonPraise: addCommonPraise, decreaseCommonPraise: decreaseCommonPraise}; return {init: init, addCommonReply: addCommonReply, loadCommonData: loadCommonData, addCommonPraise: addCommonPraise, decreaseCommonPraise: decreaseCommonPraise, wxConfig: wxConfig};
}]); }]);

Loading…
Cancel
Save