微信动态分享图片修改

This commit is contained in:
yuanke 2016-08-04 10:47:35 +08:00
parent c0579de57d
commit aaa1c01eed
5 changed files with 109 additions and 90 deletions

View File

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

View File

@ -13,7 +13,7 @@
<div class="f12 c-grey6 mt10 ml15">
<span class="f13 fb c-grey3">提示</span>
<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>
</ul>
</div>

View File

@ -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;
vm.course = {};
@ -15,35 +15,37 @@ app.controller('InviteCodeController', ['$scope','$http', '$routeParams','config
var desc = "班级邀请:"+vm.course.name+" 班级";
wx.ready(function(){
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.");
}
});
common.wxConfig(desc,"");
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 () {
// 用户取消分享后执行的回调函数
}
});
});
// wx.ready(function(){
// 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({
// 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 () {
// // 用户取消分享后执行的回调函数
// }
// });
// });
}
);

View File

@ -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;
vm.project = {};
@ -15,35 +15,37 @@ app.controller('ProjectInviteCodeController', ['$scope','$http', '$routeParams',
var desc = "项目邀请:"+vm.project.name+" 项目";
wx.ready(function(){
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.");
}
});
common.wxConfig(desc,"");
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 () {
// 用户取消分享后执行的回调函数
}
});
});
// wx.ready(function(){
// 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({
// 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 () {
// // 用户取消分享后执行的回调函数
// }
// });
// });
}
);

View File

@ -203,6 +203,7 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx', func
console.log(response.data);
var tmptile = "动态";
var imgUrl = "";
if(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){
tmpname = response.data.data.user.realname;
imgUrl = response.data.data.user.img_url;
}
if(response.data.data.author){
tmpname = response.data.data.author.realname;
imgUrl = response.data.data.author.img_url;
}
imgUrl = window.g_localhost+imgUrl;
var desc = tmpname+""+tmptile;
console.log("desc = "+desc);
wx.ready(function(){
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({
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 () {
// 用户取消分享后执行的回调函数
}
});
});
console.log("imgUrl= "+imgUrl);
wxConfig(desc);
args.loadCallback(response.data);
}, 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';
}
};
return {init: init, addCommonReply: addCommonReply, loadCommonData: loadCommonData, addCommonPraise: addCommonPraise, decreaseCommonPraise: decreaseCommonPraise};
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, wxConfig: wxConfig};
}]);