Merge branch 'weixin_guange' of https://git.trustie.net/jacknudt/trustieforge into weixin_guange

This commit is contained in:
cxt 2016-04-06 11:40:16 +08:00
commit e46c963931
9 changed files with 2358 additions and 2187 deletions

File diff suppressed because it is too large Load Diff

View File

@ -12,9 +12,9 @@
<div class="post-title hidden"><a herf="javascript:void(0);" class="mr10">{{act.author.nickname}}</a>to<a herf="javascript:void(0);" class="ml10">{{act.course_project_name}}&nbsp;&nbsp;|&nbsp;&nbsp;{{act.activity_type_name}}</a></div> <div class="post-title hidden"><a herf="javascript:void(0);" class="mr10">{{act.author.nickname}}</a>to<a herf="javascript:void(0);" class="ml10">{{act.course_project_name}}&nbsp;&nbsp;|&nbsp;&nbsp;{{act.activity_type_name}}</a></div>
<div class="cl"></div> <div class="cl"></div>
<div class="post-content c-grey2 mt10"> <div class="post-content c-grey2 mt10">
<div class="post-all-content">{{act.description|safeHtml}}<br /> <div class="post-all-content" ng-bind-html="act.description|safeHtml"></div>
<span class="mr15">迟交扣分:{{act.homework_common_detail.late_penalty}}分</span> 匿评开启时间:{{act.homework_common_detail.evaluation_start}}<br /> <span class="mr15">迟交扣分:{{act.homework_common_detail.late_penalty}}分</span> 匿评开启时间:{{act.homework_common_detail.evaluation_start}}<br />
<span class="mr15">缺评扣分:{{act.homework_common_detail.absence_penalty}}分/作品</span> 匿评关闭时间:{{act.homework_common_detail.evaluation_end}}</div> <span class="mr15">缺评扣分:{{act.homework_common_detail.absence_penalty}}分/作品</span> 匿评关闭时间:{{act.homework_common_detail.evaluation_end}}
</div> </div>
<a herf="javascript:void(0);" class="link-blue f13 fl mt5 post-more undis" style="text-decoration:underline">点击展开</a> <a herf="javascript:void(0);" class="link-blue f13 fl mt5 post-more undis" style="text-decoration:underline">点击展开</a>
<div class="cl"></div> <div class="cl"></div>
@ -22,7 +22,7 @@
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<div class="post-interactive"> <div class="post-interactive">
<div class="post-interactive-column c-grey2"><a href="javascript:void(0);" ng-click="window.open('homework_detail.html?id={{act.act_id}}');" class="c-grey">回复 ({{act.reply_count}})</a></div> <div class="post-interactive-column c-grey2"><a href="javascript:void(0);" ng-href="#/homework/{{act.act_id}}" class="c-grey">回复 ({{act.reply_count}})</a></div>
<div class="post-interactive-column c-grey2">赞 ({{act.activity_praise_count}})</div> <div class="post-interactive-column c-grey2">赞 ({{act.activity_praise_count}})</div>
</div> </div>
</div> </div>
@ -63,9 +63,9 @@
<div class="post-title fl mb10 hidden"><a herf="javascript:void(0);" class="mr10">{{act.author.nickname}}</a>to<a herf="javascript:void(0);" class="ml10">{{act.course_project_name}}&nbsp;&nbsp;|&nbsp;&nbsp;{{act.activity_type_name}}</a></div> <div class="post-title fl mb10 hidden"><a herf="javascript:void(0);" class="mr10">{{act.author.nickname}}</a>to<a herf="javascript:void(0);" class="ml10">{{act.course_project_name}}&nbsp;&nbsp;|&nbsp;&nbsp;{{act.activity_type_name}}</a></div>
<div class="cl"></div> <div class="cl"></div>
<div class="post-content c-grey2 mt10"> <div class="post-content c-grey2 mt10">
<p class="post-all-content" ng-bind-html="act.description|safeHtml"></p> <div class="post-all-content" ng-bind-html="act.description|safeHtml"></div>
</div> </div>
<a herf="javascript:void(0);" class="link-blue f13 fl mt5 post-more undis" style="text-decoration:underline;">点击展开</a> <a herf="javascript:void(0);" class="link-blue f13 fl mt5 post-more undis" style="text-decoration:underline;" ng-click="descToggle()">点击展开</a>
<span class="c-grey f13 mt10 fl">{{act.latest_update}}</span> <span class="c-grey f13 mt10 fl">{{act.latest_update}}</span>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
@ -104,8 +104,9 @@
<div class="post-title hidden"><a herf="javascript:void(0);" class="mr10">{{act.author.nickname}}</a>to<a herf="javascript:void(0);" class="ml10">{{act.course_project_name}}&nbsp;&nbsp;|&nbsp;&nbsp;{{act.activity_type_name}}</a></div> <div class="post-title hidden"><a herf="javascript:void(0);" class="mr10">{{act.author.nickname}}</a>to<a herf="javascript:void(0);" class="ml10">{{act.course_project_name}}&nbsp;&nbsp;|&nbsp;&nbsp;{{act.activity_type_name}}</a></div>
<div class="cl"></div> <div class="cl"></div>
<div class="post-content c-grey2 mt10"> <div class="post-content c-grey2 mt10">
<div class="post-all-content">{{act.description|safeHtml}}<br /> <div class="post-all-content" ng-bind-html="act.description|safeHtml"></div>
<span class="mr15">状态:{{act.issue_detail.issue_status}}</span> <span class="mr15">优先级:{{act.issue_detail.issue_priority}}</span> <br /> <span class="mr15">指派给:{{act.issue_detail.issue_assigned_to}}</span> <span class="mr15">完成度:{{act.issue_detail.done_ratio}}%</span></div> <span class="mr15">状态:{{act.issue_detail.issue_status}}</span> <span class="mr15">优先级:{{act.issue_detail.issue_priority}}</span> <br />
<span class="mr15">指派给:{{act.issue_detail.issue_assigned_to}}</span> <span class="mr15">完成度:{{act.issue_detail.done_ratio}}%</span>
</div> </div>
<a herf="javascript:void(0);" class="link-blue f13 fl mt5 post-more undis" style="text-decoration:underline">点击展开</a> <a herf="javascript:void(0);" class="link-blue f13 fl mt5 post-more undis" style="text-decoration:underline">点击展开</a>
<div class="cl"></div> <div class="cl"></div>
@ -141,6 +142,14 @@
<div class="post-interactive-column c-grey2"><a href="javascript:void(0);" class="c-grey"> 回复 ({{act.reply_count}}) </a></div> <div class="post-interactive-column c-grey2"><a href="javascript:void(0);" class="c-grey"> 回复 ({{act.reply_count}}) </a></div>
<div class="post-interactive-column c-grey2">赞 ({{act.activity_praise_count}})</div> <div class="post-interactive-column c-grey2">赞 ({{act.activity_praise_count}})</div>
</div> </div>
<a herf="javascript:void(0);" class="link-blue f13 fl mt5 post-more undis" style="text-decoration:underline">点击展开</a>
<div class="cl"></div>
<span class="c-grey f13 mt10 fl"><!=activities[i].latest_update!></span>
<div class="cl"></div>
</div>
<div class="post-interactive">
<div class="post-interactive-column c-grey2"><a href="javascript:void(0);" onclick="window.open('project_discussion.html?id=<!=activities[i].act_id!>');" class="c-grey"> 回复 (<!=activities[i].reply_count!>) </a></div>
<div class="post-interactive-column c-grey2">赞 (<!=activities[i].activity_praise_count!>)</div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -20,6 +20,7 @@
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular-route.js"></script> <script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular-route.js"></script>
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular-sanitize.min.js"></script> <script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular-sanitize.min.js"></script>
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular-cookies.js"></script> <script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular-cookies.js"></script>
<script src="/javascripts/jquery-1.3.2.js"></script>
<script src="/javascripts/wechat/app.js"></script> <script src="/javascripts/wechat/app.js"></script>
</body> </body>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>课程讨论</title> <title>课程问答</title>
<meta charset='utf-8' /> <meta charset='utf-8' />
<meta name="keywords" content="" /> <meta name="keywords" content="" />
<meta name="description" content="" /> <meta name="description" content="" />
@ -19,13 +19,12 @@
<!-- 模板1开始可以使用scripttype设置为text/html来存放模板片段并且用id标示 --> <!-- 模板1开始可以使用scripttype设置为text/html来存放模板片段并且用id标示 -->
<script id="t:course-discussion" type="text/html"> <script id="t:course-discussion" type="text/html">
<div id="check"></div>
<div class="post-container"> <div class="post-container">
<div class="post-wrapper"> <div class="post-wrapper">
<div class="post-main"> <div class="post-main">
<div class="post-avatar fl"><img src="<!=discussion.user.img_url!>" width="45" height="45" class="border-radius" /></div> <div class="post-avatar fl"><img src="<!=discussion.user.img_url!>" width="45" height="45" class="border-radius" /></div>
<div class="post-title hidden mb5"><span class="c-grey3 f15 fb"><!=discussion.subject!></span></div> <div class="post-title hidden mb5"><span class="c-grey3 f15 fb"><!=discussion.subject!></span></div>
<div class="post-title hidden"><a herf="javascript:void(0);" class="mr10"><!=discussion.user.nickname!></a>to<a herf="javascript:void(0);" class="ml10"><!=discussion.discussion_name!>&nbsp;&nbsp;|&nbsp;&nbsp;课程问答区</a></div> <div class="post-title hidden"><a herf="javascript:void(0);" class="mr10"><!=discussion.user.nickname!></a>to<a herf="javascript:void(0);" class="ml10"><!=discussion.course_project_name!>&nbsp;&nbsp;|&nbsp;&nbsp;课程问答区</a></div>
<div class="cl"></div> <div class="cl"></div>
<div class="post-content c-grey2 mt10" style="height:auto;"> <div class="post-content c-grey2 mt10" style="height:auto;">
<div class="post-all-content"><!:=discussion.content!></div> <div class="post-all-content"><!:=discussion.content!></div>

View File

@ -1,90 +1,46 @@
<!DOCTYPE html>
<html>
<head>
<title>作业详情</title>
<meta charset='utf-8' />
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="apple-mobile-web-app-capable" content="no">
<meta content='True' name='HandheldFriendly' />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<link type="text/css" rel="stylesheet" href="/stylesheets/weui/weixin.css" />
</head>
<body>
<div id="homework-container"></div>
<!-- 模板1开始可以使用scripttype设置为text/html来存放模板片段并且用id标示 --> <!-- 模板1开始可以使用scripttype设置为text/html来存放模板片段并且用id标示 -->
<script id="t:homework-detail" type="text/html">
<div class="post-container"> <div class="post-container">
<div class="post-wrapper"> <div class="post-wrapper">
<div class="post-main"> <div class="post-main">
<div class="post-avatar fl"><img src="<!=homework.author.img_url!>" width="45" height="45" class="border-radius" /></div> <div class="post-avatar fl"><img ng-src="{{homework.author.img_url}}" width="45" height="45" class="border-radius" /></div>
<div class="post-title hidden mb5"><span class="c-grey3 f15 fb"><!=homework.name!></span></div> <div class="post-title hidden mb5"><span class="c-grey3 f15 fb">{{homework.name}}</span></div>
<div class="post-title hidden"><a herf="javascript:void(0);" class="mr10"><!=homework.author.nickname!></a>to<a herf="javascript:void(0);" class="ml10"><!=homework.course_name!>&nbsp;&nbsp;|&nbsp;&nbsp;课程作业</a></div> <div class="post-title hidden"><a herf="javascript:void(0);" class="mr10">{{homework.author.nickname}}</a>to<a herf="javascript:void(0);" class="ml10">{{homework.course_name}}&nbsp;&nbsp;|&nbsp;&nbsp;课程作业</a></div>
<div class="cl"></div> <div class="cl"></div>
<div class="post-content c-grey2 mt10" style="height:auto;"> <div class="post-content c-grey2 mt10" style="height:auto;">
<div class="post-all-content"><!:=homework.description!><br /> <div class="post-all-content" ng-bind-html="homework.description|safeHtml"></div>
<span class="mr15">迟交扣分:<!:=homework.late_penalty!></span> 匿评开启时间:<!:=homework.evaluation_start!><br /> <span class="mr15">迟交扣分:{{homework.late_penalty}}分</span> 匿评开启时间:{{homework.evaluation_start}}<br />
<span class="mr15">缺评扣分:<!:=homework.absence_penalty!>分/作品</span> 匿评关闭时间:<!:=homework.evaluation_end!></div> <span class="mr15">缺评扣分:{{homework.absence_penalty}}分/作品</span> 匿评关闭时间:{{homework.evaluation_end}}
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<span class="c-grey f13 mt10 fl"><!=homework.publish_time!></span> <span class="c-grey f13 mt10 fl">{{homework.publish_time}}</span>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<div class="post-interactive border-bottom"> <div class="post-interactive border-bottom">
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">(<!=homework.whomework_journal_count!>)</span></div> <div class="post-interactive-reply c-grey2">回复 <span class="reply-num">({{homework.whomework_journal_count}})</span></div>
<div class="post-interactive-praise c-grey2"><span class="paise-text"></span><span class="praise-num">(<!=homework.whomework_praise_count!>)</span></div> <div class="post-interactive-praise c-grey2"><span class="paise-text"></span><span class="praise-num">({{homework.whomework_praise_count}})</span></div>
</div> </div>
<div id="all_homework_reply"> <div id="all_homework_reply">
<! for(var j = (homework.journals_for_messages.length - 1); j >= 0; --j){ !> <div class="post-reply-wrap border-bottom" ng-repeat="journal in homework.journals_for_messages">
<div class="post-reply-wrap border-bottom">
<div class="post-reply-row"> <div class="post-reply-row">
<div class="post-reply-avatar fl"><img src="<!=homework.journals_for_messages[j].user.img_url!>" width="45" height="45" class="border-radius" /></div> <div class="post-reply-avatar fl"><img ng-src="{{journal.user.img_url}}" width="45" height="45" class="border-radius" /></div>
<div class="ml55"> <div class="ml55">
<div class="post-reply-user hidden"><!=homework.journals_for_messages[j].user.realname!></div> <div class="post-reply-user hidden">{{journal.user.realname}}</div>
<div class="post-reply-content c-grey2 mb10"><!:=homework.journals_for_messages[j].notes!></div> <div class="post-reply-content c-grey2 mb10" ng-bind-html="journal.notes|safeHtml"></div>
<div class="post-reply-date fl"><!=homework.journals_for_messages[j].lasted_comment!></div> <div class="post-reply-date fl">{{journal.lasted_comment}}</div>
<div class="post-reply-trigger fr undis">回复</div> <div class="post-reply-trigger fr undis">回复</div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
</div> </div>
<! } !>
</div> </div>
<div class="post-input-wrap"> <div class="post-input-wrap">
<div class="post-reply-row"> <div class="post-reply-row">
<!--<div class="post-reply-avatar fl"><img src="images/post-avatar.jpg" width="30" height="30" /></div>--> <!--<div class="post-reply-avatar fl"><img src="images/post-avatar.jpg" width="30" height="30" /></div>-->
<input type="text" class="post-reply-input" id="postInput" /> <input type="text" class="post-reply-input" id="postInput" ng-model="formData.comment" />
<input type="submit" value="回复" class="post-reply-submit fr mt10" /> <button ng-click="addIssueReply(formData)" value="回复" class="post-reply-submit fr mt10">回复</button>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</script>
<script id="t:homework-detail-reply" type="text/html">
<div class="post-reply-wrap border-bottom">
<div class="post-reply-row">
<div class="post-reply-avatar fl"><img src="<!=reply.user.img_url!>" width="45" height="45" class="border-radius" /></div>
<div class="ml55">
<div class="post-reply-user hidden"><!=reply.user.realname!></div>
<div class="post-reply-content c-grey2 mb10"><!:=reply.notes!></div>
<div class="post-reply-date fl"><!=reply.lasted_comment!></div>
</div>
<div class="cl"></div>
</div>
</div>
</script>
<script src="/javascripts/jquery-1.3.2.js"></script>
<script src="/javascripts/baiduTemplate.js"></script>
<script src="/javascripts/wechat/auth.js"></script>
<script src="/javascripts/wechat/homework_detail.js"></script>
</body>
</html>

View File

@ -20,7 +20,6 @@
<div class="post-interactive-praise c-grey2"><span class="paise-text"></span> <span class="praise-num">({{issue.issue_praise_count}})</span></div> <div class="post-interactive-praise c-grey2"><span class="paise-text"></span> <span class="praise-num">({{issue.issue_praise_count}})</span></div>
</div> </div>
<div id="all_issue_reply"> <div id="all_issue_reply">
<div class="post-reply-wrap border-bottom" ng-repeat="journal in issue.issue_journals"> <div class="post-reply-wrap border-bottom" ng-repeat="journal in issue.issue_journals">
<div class="post-reply-row"> <div class="post-reply-row">
<div class="post-reply-avatar fl"><img ng-src="{{journal.user.img_url}}" width="45" height="45" class="border-radius" /></div> <div class="post-reply-avatar fl"><img ng-src="{{journal.user.img_url}}" width="45" height="45" class="border-radius" /></div>

View File

@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>课程讨论区</title> <title>项目讨论区</title>
<meta charset='utf-8' /> <meta charset='utf-8' />
<meta name="keywords" content="" /> <meta name="keywords" content="" />
<meta name="description" content="" /> <meta name="description" content="" />
@ -18,45 +18,46 @@
<!-- 模板1开始可以使用scripttype设置为text/html来存放模板片段并且用id标示 --> <!-- 模板1开始可以使用scripttype设置为text/html来存放模板片段并且用id标示 -->
<script id="t:prject-discussion" type="text/html"> <script id="t:project-discussion" type="text/html">
<div id="check"></div>
<div class="post-container"> <div class="post-container">
<div class="post-wrapper"> <div class="post-wrapper">
<div class="post-main"> <div class="post-main">
<div class="post-avatar fl"><img src="<!=homework.author.img_url!>" width="45" height="45" class="border-radius" /></div> <div class="post-avatar fl"><img src="<!=discussion.user.img_url!>" width="45" height="45" class="border-radius" /></div>
<div class="post-title hidden mb5"><span class="c-grey3 f15 fb"><!=homework.name!></span></div> <div class="post-title hidden mb5"><span class="c-grey3 f15 fb"><!=discussion.subject!></span></div>
<div class="post-title hidden"><a herf="javascript:void(0);" class="mr10"><!=homework.author.nickname!></a>to<a herf="javascript:void(0);" class="ml10"><!=homework.course_name!>&nbsp;&nbsp;|&nbsp;&nbsp;课程作业</a></div> <div class="post-title hidden"><a herf="javascript:void(0);" class="mr10"><!=discussion.user.nickname!></a>to<a herf="javascript:void(0);" class="ml10"><!=discussion.course_project_name!>&nbsp;&nbsp;|&nbsp;&nbsp;项目讨论区</a></div>
<div class="cl"></div> <div class="cl"></div>
<div class="post-content c-grey2 mt10" style="height:auto;"> <div class="post-content c-grey2 mt10" style="height:auto;">
<div class="post-all-content"><!:=homework.description!></div> <div class="post-all-content"><!:=discussion.content!></div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
<span class="c-grey f13 mt10 fl"><!=homework.publish_time!></span> <span class="c-grey f13 mt10 fl"><!=discussion.created_on!></span>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<div class="post-interactive border-bottom"> <div class="post-interactive border-bottom">
<div class="post-interactive-reply c-grey2">回复 <span class="reply-num">(<!=homework.whomework_journal_count!>)</span></div> <div class="post-interactive-reply c-grey2">回复 <span class="reply-num">(<!=discussion.replies_count!>)</span></div>
<div class="post-interactive-praise c-grey2"><span class="paise-text"></span><span class="praise-num">(<!=homework.whomework_praise_count!>)</span></div> <div class="post-interactive-praise c-grey2"><span class="paise-text"></span><span class="praise-num">()</span></div>
</div> </div>
<! for(var j =0; j < homework.journals_for_messages.length; ++j){ !> <div id="all_homework_reply">
<! for(var j = (homework.journals_for_messages.length - 1); j >= 0; --j){ !>
<div class="post-reply-wrap border-bottom"> <div class="post-reply-wrap border-bottom">
<div class="post-reply-row"> <div class="post-reply-row">
<div class="post-reply-avatar fl"><img src="<!=homework.journals_for_messages[j].user.img_url!>" width="45" height="45" class="border-radius" /></div> <div class="post-reply-avatar fl"><img src="<!=discussion.message_children[j].user.img_url!>" width="45" height="45" class="border-radius" /></div>
<div class="ml55"> <div class="ml55">
<div class="post-reply-user hidden"><!=homework.journals_for_messages[j].user.realname!></div> <div class="post-reply-user hidden"><!=discussion.message_children[j].user.realname!></div>
<div class="post-reply-content c-grey2 mb10"><!:=homework.journals_for_messages[j].notes!></div> <div class="post-reply-content c-grey2 mb10"><!:=discussion.message_children[j].content!></div>
<div class="post-reply-date fl"><!=homework.journals_for_messages[j].lasted_comment!></div> <div class="post-reply-date fl"><!=discussion.message_children[j].lasted_comment!></div>
<div class="post-reply-trigger fr undis">回复</div> <div class="post-reply-trigger fr undis">回复</div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
</div> </div>
<! } !> <! } !>
</div>
<div class="post-input-wrap"> <div class="post-input-wrap">
<div class="post-reply-row"> <div class="post-reply-row">
<!--<div class="post-reply-avatar fl" id = "100"><img src="images/post-avatar.jpg" width="30" height="30" /></div>--> <!--<div class="post-reply-avatar fl"><img src="images/post-avatar.jpg" width="30" height="30" /></div>-->
<input type="text" class="post-reply-input" id="postInput" /> <input type="text" class="post-reply-input" id="postInput" />
<input type="submit" value="回复" class="post-reply-submit fr mt10" onclick="replyInsert()" /> <input type="submit" value="回复" class="post-reply-submit fr mt10" />
<div class="cl"></div> <div class="cl"></div>
</div> </div>
</div> </div>
@ -64,10 +65,25 @@
</div> </div>
</script> </script>
<script id="t:homework-detail-reply" type="text/html">
<div class="post-reply-wrap border-bottom">
<div class="post-reply-row">
<div class="post-reply-avatar fl"><img src="<!=reply.user.img_url!>" width="45" height="45" class="border-radius" /></div>
<div class="ml55">
<div class="post-reply-user hidden"><!=reply.user.realname!></div>
<div class="post-reply-content c-grey2 mb10"><!:=reply.notes!></div>
<div class="post-reply-date fl"><!=reply.lasted_comment!></div>
</div>
<div class="cl"></div>
</div>
</div>
</script>
<script src="/javascripts/jquery-1.3.2.js"></script> <script src="/javascripts/jquery-1.3.2.js"></script>
<script src="/javascripts/baiduTemplate.js"></script> <script src="/javascripts/baiduTemplate.js"></script>
<script src="/javascripts/wechat/project_discussion.js"></script>
<script src="/javascripts/wechat/auth.js"></script> <script src="/javascripts/wechat/auth.js"></script>
<script src="/javascripts/wechat/homework-detail.js"></script> <script src="/javascripts/wechat/homework_detail.js"></script>
</body> </body>
</html> </html>

View File

@ -1,12 +1,12 @@
var app = angular.module('wechat', ['ngRoute','ngCookies']); var app = angular.module('wechat', ['ngRoute','ngCookies']);
var apiUrl = 'http://wechat.trustie.net/api/v1/'; var apiUrl = 'http://localhost:3000/api/v1/';
var debug = false; //调试标志,如果在本地请置为true var debug = true; //调试标志,如果在本地请置为true
app.factory('auth', function($http,$routeParams, $cookies){ app.factory('auth', function($http,$routeParams, $cookies){
var _openid = ''; var _openid = '';
if(debug===true){ if(debug===true){
_openid = "oCnvgvz8R7QheXE-R9Kkr39j8Ndg"; _openid = "2";
} }
var getOpenId = function(cb) { var getOpenId = function(cb) {
@ -74,7 +74,6 @@ app.controller('ActivityController',function($scope, $http, auth){
}); });
$scope.loadActData = loadActData; $scope.loadActData = loadActData;
}); });
app.controller('IssueController', function($scope, $http, $routeParams, auth){ app.controller('IssueController', function($scope, $http, $routeParams, auth){
@ -119,8 +118,94 @@ app.controller('IssueController', function($scope, $http, $routeParams, auth){
}, function errorCallback(response) { }, function errorCallback(response) {
}); });
} }
});
app.controller('IssueController', function($scope, $http, $routeParams, auth){
$scope.formData = {comment: ''};
var loadData = function(id){
$http({
method: 'GET',
url: apiUrl+ "issues/"+id,
}).then(function successCallback(response) {
console.log(response.data);
$scope.issue = response.data.data;
}, function errorCallback(response) {
});
}
loadData($routeParams.id);
$scope.addIssueReply = function(data){
console.log(data.comment);
if(!data.comment || data.comment.length<=0){
return;
}
var userInfo = {
type: "Issue",
content: data.comment,
openid: auth.openid(),
};
$http({
method: 'POST',
url: apiUrl+ "new_comment/"+$routeParams.id,
data: userInfo,
}).then(function successCallback(response) {
alert("提交成功");
$scope.formData = {comment: ''};
loadData($routeParams.id);
}, function errorCallback(response) {
});
}
});
app.controller('HomeworkController', function($scope, $http, $routeParams, auth){
$scope.formData = {comment: ''};
var loadData = function(id){
$http({
method: 'GET',
url: apiUrl+ "whomeworks/"+id,
}).then(function successCallback(response) {
console.log(response.data);
$scope.homework = response.data.data;
}, function errorCallback(response) {
});
}
loadData($routeParams.id);
$scope.addIssueReply = function(data){
console.log(data.comment);
if(!data.comment || data.comment.length<=0){
return;
}
var userInfo = {
type: "HomeworkCommon",
content: data.comment,
openid: auth.openid(),
};
$http({
method: 'POST',
url: apiUrl+ "new_comment/"+$routeParams.id,
data: userInfo,
}).then(function successCallback(response) {
alert("提交成功");
$scope.formData = {comment: ''};
loadData($routeParams.id);
}, function errorCallback(response) {
});
}
}); });
app.filter('safeHtml', function ($sce) { app.filter('safeHtml', function ($sce) {
@ -139,6 +224,10 @@ app.config(['$routeProvider',function ($routeProvider) {
templateUrl: 'issue_detail.html', templateUrl: 'issue_detail.html',
controller: 'IssueController' controller: 'IssueController'
}) })
.when('/homework/:id', {
templateUrl: 'homework_detail.html',
controller: 'HomeworkController'
})
.otherwise({ .otherwise({
redirectTo: '/activities' redirectTo: '/activities'
}); });

View File

@ -1,3 +1,105 @@
/** /**
* Created by root on 4/1/16. * Created by root on 4/1/16.
*/ */
/**
* Created by root on 4/1/16.
*/
$(document).ready(function(){
var bt=baidu.template;
bt.LEFT_DELIMITER='<!';
bt.RIGHT_DELIMITER='!>';
var apiUrl = '/api/v1/';
var setReplyTemplate = function(data){
console.log(data);
var html=bt('t:homework-detail-reply',{reply: data});
$('#all_homework_reply').prepend(html);
};
var setTemplate = function(data){
console.log(data);
var html=bt('t:project-discussion',{discussion: data});
$('#p-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('<div class="post-reply-wrap border-bottom"><div class="post-reply-row"><div class="post-reply-avatar fl"><img src="images/post-avatar.jpg" width="45" height="45" /></div><div class="ml55"><div class="post-reply-user hidden">Mrs. Ashford</div><div class="post-reply-content c-grey2 mb10"></div><div class="post-reply-date fl"></div><div class="post-reply-trigger fr undis">回复</div></div><div class="cl"></div></div> </div>');
$(".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: apiUrl + 'new_comment/' + homeworkID, //提交的页面,方法名
data: userInfo, //参数如果没有可以为null
success: function (data) { //如果执行成功,那么执行此方法
setReplyTemplate(data.data); //用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 + ")");
}*/
});