微信分享修改

weixin_guange
yuanke 9 years ago
parent 29e707a88d
commit 17c98eb9fe

@ -5,7 +5,7 @@ module Mobile
expose :id expose :id
expose :user_id expose :user_id
expose :invite_code expose :invite_code
# expose :qrcode expose :qrcode
expose :can_setting, if: lambda { |instance, options| options[:user] } do |instance, options| expose :can_setting, if: lambda { |instance, options| options[:user] } do |instance, options|
current_user = options[:user] current_user = options[:user]

@ -101,12 +101,22 @@ class CoursesService
gender = m.user.user_extensions.gender.nil? ? 0 : m.user.user_extensions.gender gender = m.user.user_extensions.gender.nil? ? 0 : m.user.user_extensions.gender
work_unit = get_user_work_unit m.user work_unit = get_user_work_unit m.user
location = get_user_location m.user location = get_user_location m.user
users << {:id => m.user.id, :img_url => img_url, :nickname => m.user.login, :gender => gender,
:work_unit => work_unit, :mail => m.user.mail, :location => location, role_ids = []
role_name: m.roles.first.name, m.roles.each do |r|
name: m.user.show_name, role_ids << r.id
roles_id: m.roles[0].id, end
:brief_introduction => m.user.user_extensions.brief_introduction,:realname=>m.user.realname}
#双重身份 学生列表中不显示
unless (params[:role] == '2' && role_ids.length >= 2)
users << {:id => m.user.id, :img_url => img_url, :nickname => m.user.login, :gender => gender,
:work_unit => work_unit, :mail => m.user.mail, :location => location,
role_name: m.roles.first.name,
name: m.user.show_name,
roles_id: role_ids.include?(7) ? 7 : (role_ids.include?(9) ? 9 : 10 ),
:brief_introduction => m.user.user_extensions.brief_introduction,:realname=>m.user.realname}
end
end end
users users
end end

@ -17,7 +17,7 @@ class ProjectsService
def show_project(params,current_user) def show_project(params,current_user)
project = Project.find(params[:id]) project = Project.find(params[:id])
project.generate_invite_code project.generate_invite_code
# project.generate_qrcode project.generate_qrcode
project project
end end

@ -6,26 +6,43 @@
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', function($scope, $http, $routeParams, config, auth, wx){
var vm = $scope; var vm = $scope;
wx.ready(function(){
wx.onMenuShareTimeline({
title: '定制的标题', // 分享标题
link: 'http://wechat.trustie.net/', // 分享链接
imgUrl: 'http://wechat.trustie.net/images/logo2.png', // 分享图标
success: function () {
console.log("share successed.");
},
cancel: function () {
console.log("share canceled.");
}
});
});
vm.course = {}; vm.course = {};
var courseid = $routeParams.id; var courseid = $routeParams.id;
$http.get(config.apiUrl+ 'courses/'+courseid+"?token="+auth.token()).then( $http.get(config.apiUrl+ 'courses/'+courseid+"?token="+auth.token()).then(
function(response){ function(response){
console.log(response.data); console.log(response.data);
vm.course = response.data.data; vm.course = response.data.data;
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.");
}
});
wx.onMenuShareAppMessage({
title: 'Trustie创新实践平台', // 分享标题
desc: desc, // 分享描述
// link: '', // 分享链接
// imgUrl: '', // 分享图标
// 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', function($scope, $http, $routeParams, config, auth){ app.controller('ProjectInviteCodeController', ['$scope','$http', '$routeParams','config','auth','wx', function($scope, $http, $routeParams, config, auth,wx){
var vm = $scope; var vm = $scope;
vm.project = {}; vm.project = {};
@ -12,23 +12,40 @@ app.controller('ProjectInviteCodeController', ['$scope','$http', '$routeParams',
function(response){ function(response){
console.log(response.data); console.log(response.data);
vm.project = response.data.data; vm.project = response.data.data;
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.");
}
});
wx.onMenuShareAppMessage({
title: 'Trustie创新实践平台', // 分享标题
desc: desc, // 分享描述
// link: '', // 分享链接
// imgUrl: '', // 分享图标
// type: '', // 分享类型,music、video或link不填默认为link
// dataUrl: '', // 如果type是music或video则要提供数据链接默认为空
success: function () {
// 用户确认分享后执行的回调函数
},
cancel: function () {
// 用户取消分享后执行的回调函数
}
});
});
} }
); );
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);
});
}
}]); }]);

@ -93,7 +93,7 @@ app.factory('rms', function(){
return {save: save, get: get}; return {save: save, get: get};
}); });
app.factory('common', ['$http', 'auth', '$routeParams','rms','config', function($http, auth, $routeParams,rms,config){ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx', function($http, auth, $routeParams,rms,config,wx){
var addCommonReply = function(id, type, data, cb){ var addCommonReply = function(id, type, data, cb){
if(!data.comment || data.comment.length<=0){ if(!data.comment || data.comment.length<=0){
@ -200,6 +200,36 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config', function(
args.scope.formData = {comment: ''}; args.scope.formData = {comment: ''};
var loadData = function(id,replytype,page){ var loadData = function(id,replytype,page){
loadCommonData(id, args.type,replytype,page).then(function successCallback(response) { loadCommonData(id, args.type,replytype,page).then(function successCallback(response) {
var desc = response.data.user.realname+""+response.data.title;
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: '', // 分享图标
// 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) {
}); });

Loading…
Cancel
Save