修改分享链接

This commit is contained in:
yuanke 2016-08-09 17:01:06 +08:00
parent 001b48869d
commit 66357c4024
16 changed files with 84 additions and 14 deletions

View File

@ -12,6 +12,8 @@ module Mobile
# authenticate!
user = current_user
#is_public true 公开 false 私有 1公开 0私有
#0一级回复的更多 1 二级回复的更多
type = params[:type] || 0
page = params[:page] || 0
@ -19,6 +21,7 @@ module Mobile
present :data, issue, with: Mobile::Entities::Issue,user: user,type: type,page: page
present :type, type
present :page, page
present :is_public, issue.project.is_public
present :status, 0
rescue Exception=>e
present :status, -1

View File

@ -16,9 +16,19 @@ module Mobile
page = params[:page] || 0
jour = JournalsForMessage.find params[:id]
is_public = 1
if jour.jour_type == "Project"
is_public = jour.project.is_public
elsif jour.jour_type == "Course"
is_public = jour.course.is_public
end
present :data, jour, with: Mobile::Entities::Jours,user: user,type: type,page: page
present :type, type
present :page, page
present :is_public, is_public
present :status, 0
rescue Exception=>e
present :status, -1

View File

@ -15,9 +15,23 @@ module Mobile
type = params[:type] || 0
page = params[:page] || 0
message = Message.find params[:id]
is_public = 1
type_name = ""
if message.project
is_public = message.project.is_public
type_name = "project"
elsif message.course
is_public = message.course.is_public
type_name = "course"
end
present :data, message, with: Mobile::Entities::Message,user: user,type: type,page: page
present :type, type
present :page, page
present :is_public, is_public
present :type_name, type_name
present :status, 0
rescue Exception=>e
present :status, -1

View File

@ -15,9 +15,19 @@ module Mobile
type = params[:type] || 0
page = params[:page] || 0
news = News.find params[:id]
is_public = 1
if news.project
is_public = news.project.is_public
elsif news.project
is_public = news.project.is_public
end
present :data, news, with: Mobile::Entities::News,user: user,type: type,page: page
present :type, type
present :page, page
present :is_public, is_public
present :status, 0
rescue Exception=>e
present :status, -1

View File

@ -15,8 +15,11 @@ module Mobile
type = params[:type] || 0
page = params[:page] || 0
is_public = 1
if type == 0
homework = HomeworkCommon.find params[:id]
is_public = homework.course.is_public
present :data, homework, with: Mobile::Entities::Whomework,user: user,type: type,page: page,comment_type: "homework"
else
jour = JournalsForMessage.find params[:id]
@ -24,6 +27,7 @@ module Mobile
end
present :type, type
present :page, page
present :is_public, is_public
present :status, 0
rescue Exception=>e
present :status, -1

View File

@ -146,7 +146,7 @@ app.controller('ActivityController',
rms.save("activities",$scope.activities);
rms.save("course_activities",$scope.course_activities);
rms.save("project_activities",$scope.project_activities);
$location.path('/'+type+'/'+act_id);
$location.path("/"+type).search({id: act_id});
};
$scope.addPraise = function(act){

View File

@ -7,6 +7,7 @@ app.controller('BlogController',
scope: $scope,
type: 'blog_comments',
replyType: 'BlogComment',
urlName: 'blog_comment',
loadCallback: function(data){
console.log(data.data);

View File

@ -6,6 +6,7 @@ app.controller('CourseNoticeController', ['$scope', '$http', '$routeParams', 'au
scope: $scope,
type: 'newss',
replyType: 'News',
urlName: 'course_notice',
loadCallback: function(data){
$scope.news = data.data;
},

View File

@ -5,6 +5,7 @@ app.controller('DiscussionController', ['$scope', '$http', '$routeParams', 'auth
scope: $scope,
type: 'messages',
replyType: 'Message',
urlName: 'discussion',
loadCallback: function(data){
console.log(data.data);

View File

@ -5,6 +5,7 @@ app.controller('HomeworkController', ['$scope', '$http', '$routeParams', 'auth',
scope: $scope,
type: 'whomeworks',
replyType: 'HomeworkCommon',
urlName: 'homework',
loadCallback: function(data){
console.log(data.data);

View File

@ -14,8 +14,11 @@ app.controller('InviteCodeController', ['$scope','$http', '$routeParams','config
vm.course = response.data.data;
var desc = "班级邀请:"+vm.course.name+" 班级";
var link = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d" +
"&redirect_uri=https://test.forge.trustie.net/wechat/user_activities?id="+vm.course.id+
"&response_type=code&scope=snsapi_base&state=invite_code&connect_redirect=1#wechat_redirect";
common.wxConfig("",desc,"");
common.wxConfig("",desc,"",link);
// wx.ready(function(){
// wx.onMenuShareTimeline({

View File

@ -5,6 +5,7 @@ app.controller('IssueController', ['$scope', '$http', '$routeParams', 'auth', 'c
scope: $scope,
type: 'issues',
replyType: 'Issue',
urlName: 'issues',
loadCallback: function(data){
console.log(data);
$scope.issue = data.data;

View File

@ -4,6 +4,7 @@ app.controller('JournalsController', ['$scope', '$http', '$routeParams', 'auth',
scope: $scope,
type: 'journal_for_messages',
replyType: 'JournalsForMessage',
urlName: 'journal_for_message',
loadCallback: function(data){
console.log(data.data);

View File

@ -15,7 +15,11 @@ app.controller('ProjectInviteCodeController', ['$scope','$http', '$routeParams',
var desc = "项目邀请:"+vm.project.name+" 项目";
common.wxConfig("",desc,"");
var link = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d" +
"&redirect_uri=https://test.forge.trustie.net/wechat/user_activities?id="+vm.project.id+
"&response_type=code&scope=snsapi_base&state=project_invite_code&connect_redirect=1#wechat_redirect";
common.wxConfig("",desc,"",link);
// wx.ready(function(){
// wx.onMenuShareTimeline({

View File

@ -238,7 +238,23 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc
console.log("desc = "+desc);
console.log("imgUrl= "+imgUrl);
wxConfig(title,desc,imgUrl);
var link = "";
if(args.urlName == "discussion"){
var urlName = response.data.type_name + "_discussion";
link = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d" +
"&redirect_uri=https://test.forge.trustie.net/wechat/user_activities?id="+response.data.data.act_id+
"&response_type=code&scope=snsapi_base&state="+urlName+"&connect_redirect=1#wechat_redirect";
}
else{
link = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d" +
"&redirect_uri=https://test.forge.trustie.net/wechat/user_activities?id="+response.data.data.act_id+
"&response_type=code&scope=snsapi_base&state="+args.urlName+"&connect_redirect=1#wechat_redirect";
}
console.log("link= "+link);
wxConfig(title,desc,imgUrl,link);
//--------------分享内容定制-------------
args.loadCallback(response.data);
@ -345,7 +361,7 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc
};
var wxConfig = function(title,desc,imgUrl){
var wxConfig = function(title,desc,imgUrl,link){
if(title == null || title == ""){
title = 'Trustie创新实践平台';
@ -362,7 +378,7 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc
wx.ready(function(){
wx.onMenuShareTimeline({
title: title, // 分享标题
// link: 'http://www.trustie.net/', // 分享链接
link: link, // 分享链接
imgUrl: imgUrl, // 分享图标
success: function () {
console.log("share successed.");
@ -375,7 +391,7 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc
wx.onMenuShareAppMessage({
title: title, // 分享标题
desc: desc, // 分享描述
// link: '', // 分享链接
link: link, // 分享链接
// imgUrl: '', // 分享图标
imgUrl: imgUrl, // 分享图标
// type: '', // 分享类型,music、video或link不填默认为link

View File

@ -23,13 +23,13 @@ app.config(['$routeProvider',"$httpProvider", "$locationProvider",'config', func
controller: 'RegController'
})
.when('/activites', makeRoute('activities.html', 'ActivityController'))
.when('/issues/:id', makeRoute('issue_detail.html', 'IssueController'))
.when('/project_discussion/:id', makeRoute('project_discussion.html', 'DiscussionController'))
.when('/homework/:id', makeRoute('homework_detail.html', 'HomeworkController'))
.when('/course_notice/:id', makeRoute('course_notice.html', 'CourseNoticeController'))
.when('/course_discussion/:id', makeRoute('course_discussion.html', 'DiscussionController'))
.when('/journal_for_message/:id', makeRoute('jour_message_detail.html', 'JournalsController'))
.when('/blog_comment/:id', makeRoute('blog_detail.html', 'BlogController'))
.when('/issues', makeRoute('issue_detail.html', 'IssueController'))
.when('/project_discussion', makeRoute('project_discussion.html', 'DiscussionController'))
.when('/homework', makeRoute('homework_detail.html', 'HomeworkController'))
.when('/course_notice', makeRoute('course_notice.html', 'CourseNoticeController'))
.when('/course_discussion', makeRoute('course_discussion.html', 'DiscussionController'))
.when('/journal_for_message', makeRoute('jour_message_detail.html', 'JournalsController'))
.when('/blog_comment', makeRoute('blog_detail.html', 'BlogController'))
.when('/class', makeRoute('class.html', 'ClassController'))
.when('/new_class', makeRoute('new_class.html', 'NewClassController'))
.when('/edit_class', makeRoute('edit_class.html', 'EditClassController'))