diff --git a/app/api/mobile/entities/activity.rb b/app/api/mobile/entities/activity.rb index 9389f589e..d58057b62 100644 --- a/app/api/mobile/entities/activity.rb +++ b/app/api/mobile/entities/activity.rb @@ -44,6 +44,8 @@ module Mobile ac.act.description unless ac.nil? || ac.act.nil? elsif ac.act_type == "Message" || ac.act_type == "BlogComment" ac.act.content unless ac.nil? || ac.act.nil? + elsif ac.act_type == "JournalsForMessage" + ac.act.notes end when :latest_update time_from_now ac.updated_at unless ac.nil? diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html index c1467bc52..0f5420984 100644 --- a/public/assets/wechat/activities.html +++ b/public/assets/wechat/activities.html @@ -66,7 +66,7 @@
-
回复 ()
+
回复 ()
赞 ()
@@ -77,17 +77,18 @@
- + +

点击展开 +
-
回复 ()
+
回复 ()
赞 ()
@@ -97,7 +98,7 @@
- +
@@ -124,7 +125,7 @@
-
回复 ()
+
回复 ()
赞 ()
@@ -147,7 +148,7 @@
-
回复 ()
+
回复 ()
赞 ()
@@ -171,8 +172,8 @@
- + +

@@ -181,7 +182,7 @@
-
回复 ()
+
回复 ()
赞 ()
@@ -204,20 +205,20 @@
-
回复 ()
+
回复 ()
赞 ()
-
更多
+
更多
- - + + \ No newline at end of file diff --git a/public/assets/wechat/blog_detail.html b/public/assets/wechat/blog_detail.html new file mode 100644 index 000000000..8b3f44eb5 --- /dev/null +++ b/public/assets/wechat/blog_detail.html @@ -0,0 +1,73 @@ + + + + 博客 + + + + + + + + + + +
+ + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/assets/wechat/course_discussion.html b/public/assets/wechat/course_discussion.html new file mode 100644 index 000000000..b5d56cd7e --- /dev/null +++ b/public/assets/wechat/course_discussion.html @@ -0,0 +1,73 @@ + + + + 课程讨论区 + + + + + + + + + + +
+ + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html new file mode 100644 index 000000000..6c508ab9c --- /dev/null +++ b/public/assets/wechat/course_notice.html @@ -0,0 +1,73 @@ + + + + 课程通知 + + + + + + + + + + +
+ + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index 72e3b46f0..3f05b1b8e 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -57,7 +57,7 @@
-
+
@@ -68,7 +68,7 @@ - + diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html index c06988ba6..8c326d631 100644 --- a/public/assets/wechat/issue_detail.html +++ b/public/assets/wechat/issue_detail.html @@ -1,7 +1,7 @@ - 缺陷详情 + 问题跟踪 @@ -13,13 +13,13 @@ -
+
- - + \ No newline at end of file diff --git a/public/assets/wechat/message_detail.html b/public/assets/wechat/message_detail.html new file mode 100644 index 000000000..04563184f --- /dev/null +++ b/public/assets/wechat/message_detail.html @@ -0,0 +1,71 @@ + + + + 留言 + + + + + + + + + + +
+ + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/assets/wechat/project_discussion.html b/public/assets/wechat/project_discussion.html new file mode 100644 index 000000000..5201d8299 --- /dev/null +++ b/public/assets/wechat/project_discussion.html @@ -0,0 +1,73 @@ + + + + 课程讨论区 + + + + + + + + + + +
+ + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/javascripts/wechat/blog_detail.js b/public/javascripts/wechat/blog_detail.js new file mode 100644 index 000000000..44121f83c --- /dev/null +++ b/public/javascripts/wechat/blog_detail.js @@ -0,0 +1,95 @@ +/** + * Created by root on 4/1/16. + */ +$(document).ready(function(){ + + var bt=baidu.template; + bt.LEFT_DELIMITER=''; + + + var apiUrl = '/api/v1/'; + + var setTemplate = function(data){ + console.log(data); + var html=bt('t:blog-detail',{blog: data}); + $('#blog-container').prepend(html); + $('.post-reply-submit').click(function(){ + replyInsert(); + }); + $('post-interactive-praise').click(function(){ + praiseClick(); + }); + }; + + var loadDataFromServer = function(id){ + //getOpenId(function(openid){ + $.ajax({ + url: apiUrl + 'blog_comments/' + id, + dataType: 'json', + success: function(data){ + setTemplate(data.data); + }, + error: function(xhr,status,err){ + console.log(err); + } + }); + //}) + + + }; + + var homeworkUrl = window.location.search; + var homeworkID = homeworkUrl.split("=")[1]; + + loadDataFromServer(homeworkID); + + //点击回复按钮,插入回复内容 + var replyInsert = function(){ + var replyContent = $("#postInput").val(); + if (!replyContent){ + alert("请输入回复"); + }else{ + + //将用户输入内容插入最后一条回复 + $(".post-reply-wrap:last").after('
回复
'); + $(".post-reply-content:last").append(replyContent); + $(".post-reply-date:last").append(Date()); + var postInput = $("#postInput").val(); + $("#postInput").val(""); + //回复数目+1 + var replyNum = $(".post-interactive-reply").text().match(/\d+/g); + replyNum++; + $(".reply-num").text("(" + replyNum + ")"); + + //获取并传送回复用户数据 + var userInfo = { + "replyType" : "homework_assignment", + "replyContent" : postInput + }; + + $.ajax({ + type: "POST", //提交方式 + dataType: "json", //类型 + url: "前台地址/后台方法", //提交的页面,方法名 + data: userInfo, //参数,如果没有,可以为null + success: function (data) { //如果执行成功,那么执行此方法 + alert(data.d); //用data.d来获取后台传过来的json语句,或者是单纯的语句 + }, + error: function (err) { //如果执行不成功,那么执行此方法 + alert("err:" + err); + } + }); + } + + } + + //点赞效果 + var praiseClick = function(){ + var praiseNum = $(".post-interactive-praise").text().match(/\d+/g); + praiseNum++; + $(".praise-num").text("(" + praiseNum + ")"); + } + + +}); \ No newline at end of file diff --git a/public/javascripts/wechat/course_discussion.js b/public/javascripts/wechat/course_discussion.js new file mode 100644 index 000000000..12533d5f6 --- /dev/null +++ b/public/javascripts/wechat/course_discussion.js @@ -0,0 +1,95 @@ +/** + * Created by root on 4/1/16. + */ +$(document).ready(function(){ + + var bt=baidu.template; + bt.LEFT_DELIMITER=''; + + + var apiUrl = '/api/v1/'; + + var setTemplate = function(data){ + console.log(data); + var html=bt('t:course-discussion',{discussion: data}); + $('#c-discussion-container').prepend(html); + $('.post-reply-submit').click(function(){ + replyInsert(); + }); + $('post-interactive-praise').click(function(){ + praiseClick(); + }); + }; + + var loadDataFromServer = function(id){ + //getOpenId(function(openid){ + $.ajax({ + url: apiUrl + 'messages/' + id, + dataType: 'json', + success: function(data){ + setTemplate(data.data); + }, + error: function(xhr,status,err){ + console.log(err); + } + }); + //}) + + + }; + + var homeworkUrl = window.location.search; + var homeworkID = homeworkUrl.split("=")[1]; + + loadDataFromServer(homeworkID); + + //点击回复按钮,插入回复内容 + var replyInsert = function(){ + var replyContent = $("#postInput").val(); + if (!replyContent){ + alert("请输入回复"); + }else{ + + //将用户输入内容插入最后一条回复 + $(".post-reply-wrap:last").after('
回复
'); + $(".post-reply-content:last").append(replyContent); + $(".post-reply-date:last").append(Date()); + var postInput = $("#postInput").val(); + $("#postInput").val(""); + //回复数目+1 + var replyNum = $(".post-interactive-reply").text().match(/\d+/g); + replyNum++; + $(".reply-num").text("(" + replyNum + ")"); + + //获取并传送回复用户数据 + var userInfo = { + "Type" : "Message", + "Content" : postInput + }; + + $.ajax({ + type: "POST", //提交方式 + dataType: "json", //类型 + url: "前台地址/后台方法", //提交的页面,方法名 + data: userInfo, //参数,如果没有,可以为null + success: function (data) { //如果执行成功,那么执行此方法 + alert(data.d); //用data.d来获取后台传过来的json语句,或者是单纯的语句 + }, + error: function (err) { //如果执行不成功,那么执行此方法 + alert("err:" + err); + } + }); + } + + } + + //点赞效果 + var praiseClick = function(){ + var praiseNum = $(".post-interactive-praise").text().match(/\d+/g); + praiseNum++; + $(".praise-num").text("(" + praiseNum + ")"); + } + + +}); \ No newline at end of file diff --git a/public/javascripts/wechat/course_notice.js b/public/javascripts/wechat/course_notice.js new file mode 100644 index 000000000..f20526a5f --- /dev/null +++ b/public/javascripts/wechat/course_notice.js @@ -0,0 +1,95 @@ +/** + * Created by root on 4/1/16. + */ +$(document).ready(function(){ + + var bt=baidu.template; + bt.LEFT_DELIMITER=''; + + + var apiUrl = '/api/v1/'; + + var setTemplate = function(data){ + console.log(data); + var html=bt('t:course-notice',{course: data}); + $('#c-notice-container').prepend(html); + $('.post-reply-submit').click(function(){ + replyInsert(); + }); + $('post-interactive-praise').click(function(){ + praiseClick(); + }); + }; + + var loadDataFromServer = function(id){ + //getOpenId(function(openid){ + $.ajax({ + url: apiUrl + 'newss/' + id, + dataType: 'json', + success: function(data){ + setTemplate(data.data); + }, + error: function(xhr,status,err){ + console.log(err); + } + }); + //}) + + + }; + + var homeworkUrl = window.location.search; + var homeworkID = homeworkUrl.split("=")[1]; + + loadDataFromServer(homeworkID); + + //点击回复按钮,插入回复内容 + var replyInsert = function(){ + var replyContent = $("#postInput").val(); + if (!replyContent){ + alert("请输入回复"); + }else{ + + //将用户输入内容插入最后一条回复 + $(".post-reply-wrap:last").after('
回复
'); + $(".post-reply-content:last").append(replyContent); + $(".post-reply-date:last").append(Date()); + var postInput = $("#postInput").val(); + $("#postInput").val(""); + //回复数目+1 + var replyNum = $(".post-interactive-reply").text().match(/\d+/g); + replyNum++; + $(".reply-num").text("(" + replyNum + ")"); + + //获取并传送回复用户数据 + var userInfo = { + "replyType" : "homework_assignment", + "replyContent" : postInput + }; + + $.ajax({ + type: "POST", //提交方式 + dataType: "json", //类型 + url: "前台地址/后台方法", //提交的页面,方法名 + data: userInfo, //参数,如果没有,可以为null + success: function (data) { //如果执行成功,那么执行此方法 + alert(data.d); //用data.d来获取后台传过来的json语句,或者是单纯的语句 + }, + error: function (err) { //如果执行不成功,那么执行此方法 + alert("err:" + err); + } + }); + } + + } + + //点赞效果 + var praiseClick = function(){ + var praiseNum = $(".post-interactive-praise").text().match(/\d+/g); + praiseNum++; + $(".praise-num").text("(" + praiseNum + ")"); + } + + +}); \ No newline at end of file diff --git a/public/javascripts/wechat/homework-detail.js b/public/javascripts/wechat/homework_detail.js similarity index 100% rename from public/javascripts/wechat/homework-detail.js rename to public/javascripts/wechat/homework_detail.js diff --git a/public/javascripts/wechat/issue_detail.js b/public/javascripts/wechat/issue_detail.js new file mode 100644 index 000000000..2a2153062 --- /dev/null +++ b/public/javascripts/wechat/issue_detail.js @@ -0,0 +1,98 @@ +/** + * Created by root on 4/1/16. + */ +/** + * Created by root on 3/31/16. + */ +$(document).ready(function(){ + + var bt=baidu.template; + bt.LEFT_DELIMITER=''; + + + var apiUrl = '/api/v1/'; + + var setTemplate = function(data){ + console.log(data); + var html=bt('t:issue-detail',{issues: data}); + $('#issue-container').prepend(html); + $('.post-reply-submit').click(function(){ + replyInsert(); + }); + $('post-interactive-praise').click(function(){ + praiseClick(); + }); + }; + + var loadDataFromServer = function(id){ + //getOpenId(function(openid){ + $.ajax({ + url: apiUrl + 'issues/' + id, + dataType: 'json', + success: function(data){ + setTemplate(data.data); + }, + error: function(xhr,status,err){ + console.log(err); + } + }); + //}) + + + }; + + var homeworkUrl = window.location.search; + var homeworkID = homeworkUrl.split("=")[1]; + + loadDataFromServer(homeworkID); + + //点击回复按钮,插入回复内容 + var replyInsert = function(){ + var replyContent = $("#postInput").val(); + if (!replyContent){ + alert("请输入回复"); + }else{ + + //将用户输入内容插入最后一条回复 + $(".post-reply-wrap:last").after('
回复
'); + $(".post-reply-content:last").append(replyContent); + $(".post-reply-date:last").append(Date()); + var postInput = $("#postInput").val(); + $("#postInput").val(""); + //回复数目+1 + var replyNum = $(".post-interactive-reply").text().match(/\d+/g); + replyNum++; + $(".reply-num").text("(" + replyNum + ")"); + + //获取并传送回复用户数据 + var userInfo = { + "replyType" : "homework_assignment", + "replyContent" : postInput + }; + + $.ajax({ + type: "POST", //提交方式 + dataType: "json", //类型 + url: "前台地址/后台方法", //提交的页面,方法名 + data: userInfo, //参数,如果没有,可以为null + success: function (data) { //如果执行成功,那么执行此方法 + alert(data.d); //用data.d来获取后台传过来的json语句,或者是单纯的语句 + }, + error: function (err) { //如果执行不成功,那么执行此方法 + alert("err:" + err); + } + }); + } + + } + + //点赞效果 + var praiseClick = function(){ + var praiseNum = $(".post-interactive-praise").text().match(/\d+/g); + praiseNum++; + $(".praise-num").text("(" + praiseNum + ")"); + } + + +}); \ No newline at end of file diff --git a/public/javascripts/wechat/message_detail.js b/public/javascripts/wechat/message_detail.js new file mode 100644 index 000000000..279da05d9 --- /dev/null +++ b/public/javascripts/wechat/message_detail.js @@ -0,0 +1,95 @@ +/** + * Created by root on 4/1/16. + */ +$(document).ready(function(){ + + var bt=baidu.template; + bt.LEFT_DELIMITER=''; + + + var apiUrl = '/api/v1/'; + + var setTemplate = function(data){ + console.log(data); + var html=bt('t:message-detail',{message: data}); + $('#message-container').prepend(html); + $('.post-reply-submit').click(function(){ + replyInsert(); + }); + $('post-interactive-praise').click(function(){ + praiseClick(); + }); + }; + + var loadDataFromServer = function(id){ + //getOpenId(function(openid){ + $.ajax({ + url: apiUrl + 'journal_for_messages/' + id, + dataType: 'json', + success: function(data){ + setTemplate(data.data); + }, + error: function(xhr,status,err){ + console.log(err); + } + }); + //}) + + + }; + + var homeworkUrl = window.location.search; + var homeworkID = homeworkUrl.split("=")[1]; + + loadDataFromServer(homeworkID); + + //点击回复按钮,插入回复内容 + var replyInsert = function(){ + var replyContent = $("#postInput").val(); + if (!replyContent){ + alert("请输入回复"); + }else{ + + //将用户输入内容插入最后一条回复 + $(".post-reply-wrap:last").after('
回复
'); + $(".post-reply-content:last").append(replyContent); + $(".post-reply-date:last").append(Date()); + var postInput = $("#postInput").val(); + $("#postInput").val(""); + //回复数目+1 + var replyNum = $(".post-interactive-reply").text().match(/\d+/g); + replyNum++; + $(".reply-num").text("(" + replyNum + ")"); + + //获取并传送回复用户数据 + var userInfo = { + "replyType" : "homework_assignment", + "replyContent" : postInput + }; + + $.ajax({ + type: "POST", //提交方式 + dataType: "json", //类型 + url: "前台地址/后台方法", //提交的页面,方法名 + data: userInfo, //参数,如果没有,可以为null + success: function (data) { //如果执行成功,那么执行此方法 + alert(data.d); //用data.d来获取后台传过来的json语句,或者是单纯的语句 + }, + error: function (err) { //如果执行不成功,那么执行此方法 + alert("err:" + err); + } + }); + } + + } + + //点赞效果 + var praiseClick = function(){ + var praiseNum = $(".post-interactive-praise").text().match(/\d+/g); + praiseNum++; + $(".praise-num").text("(" + praiseNum + ")"); + } + + +}); \ No newline at end of file diff --git a/public/javascripts/wechat/project_discussion.js b/public/javascripts/wechat/project_discussion.js new file mode 100644 index 000000000..0ba69c153 --- /dev/null +++ b/public/javascripts/wechat/project_discussion.js @@ -0,0 +1,3 @@ +/** + * Created by root on 4/1/16. + */ diff --git a/public/javascripts/wechat/wechat-dev.js b/public/javascripts/wechat/wechat_dev.js similarity index 100% rename from public/javascripts/wechat/wechat-dev.js rename to public/javascripts/wechat/wechat_dev.js