diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html index fd5b44b2b..f042daba7 100644 --- a/public/assets/wechat/activities.html +++ b/public/assets/wechat/activities.html @@ -20,23 +20,25 @@
-
+
迟交扣分:{{act.homework_common_detail.late_penalty}}分 匿评开启时间:{{act.homework_common_detail.evaluation_start}}
缺评扣分:{{act.homework_common_detail.absence_penalty}}分/作品 匿评关闭时间:{{act.homework_common_detail.evaluation_end}}
- 普通作业 - 编程作业 - 分组作业 - {{act.latest_update}} - 回复 - {{act.reply_count}} -
-
{{act.praise_count}}
-
{{act.praise_count}}
-
+
+ 普通作业 + 编程作业 + 分组作业 + {{act.latest_update}} + 回复 + {{act.reply_count}} +
+
{{act.praise_count}}
+
{{act.praise_count}}
+
+
@@ -58,14 +60,16 @@
- {{act.activity_type_name}} - {{act.latest_update}} - 回复 - {{act.reply_count}} -
-
{{act.praise_count}}
-
{{act.praise_count}}
-
+
+ {{act.activity_type_name}} + {{act.latest_update}} + 回复 + {{act.reply_count}} +
+
{{act.praise_count}}
+
{{act.praise_count}}
+
+
@@ -87,14 +91,16 @@
- {{act.activity_type_name}} - {{act.latest_update}} - 回复 - {{act.reply_count}} -
-
{{act.praise_count}}
-
{{act.praise_count}}
-
+
+ {{act.activity_type_name}} + {{act.latest_update}} + 回复 + {{act.reply_count}} +
+
{{act.praise_count}}
+
{{act.praise_count}}
+
+
@@ -127,21 +133,23 @@
-
+
状态:{{act.issue_detail.issue_status}} 优先级:{{act.issue_detail.issue_priority}}
指派给:{{act.issue_detail.issue_assigned_to}} 完成度:{{act.issue_detail.done_ratio}}%
- {{act.activity_type_name}} - {{act.latest_update}} - 回复 - {{act.reply_count}} -
-
{{act.praise_count}}
-
{{act.praise_count}}
-
+
+ {{act.activity_type_name}} + {{act.latest_update}} + 回复 + {{act.reply_count}} +
+
{{act.praise_count}}
+
{{act.praise_count}}
+
+
@@ -164,14 +172,16 @@
- {{act.activity_type_name}} - {{act.latest_update}} - 回复 - {{act.reply_count}} -
-
{{act.praise_count}}
-
{{act.praise_count}}
-
+
+ {{act.activity_type_name}} + {{act.latest_update}} + 回复 + {{act.reply_count}} +
+
{{act.praise_count}}
+
{{act.praise_count}}
+
+
@@ -208,13 +218,15 @@
- {{act.latest_update}} - 回复 - {{act.reply_count}} -
-
{{act.praise_count}}
-
{{act.praise_count}}
-
+
+ {{act.latest_update}} + 回复 + {{act.reply_count}} +
+
{{act.praise_count}}
+
{{act.praise_count}}
+
+
@@ -237,13 +249,15 @@
- {{act.latest_update}} - 回复 - {{act.reply_count}} -
-
{{act.praise_count}}
-
{{act.praise_count}}
-
+
+ {{act.latest_update}} + 回复 + {{act.reply_count}} +
+
{{act.praise_count}}
+
{{act.praise_count}}
+
+
diff --git a/public/assets/wechat/course_discussion.html b/public/assets/wechat/course_discussion.html index 69daf2b05..cc188f978 100644 --- a/public/assets/wechat/course_discussion.html +++ b/public/assets/wechat/course_discussion.html @@ -15,7 +15,7 @@ 来   源: {{discussion.course_project_name}}  |  课程问答区 -
+
{{discussion.created_on}}
diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html index 6d2d49d23..e3346ea93 100644 --- a/public/assets/wechat/course_notice.html +++ b/public/assets/wechat/course_notice.html @@ -14,7 +14,7 @@ 来   源: {{news.course_name}}  |  课程通知 -
+
{{news.created_on}}
diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index 974af2246..387b69867 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -18,13 +18,13 @@ 类   别: - 普通作业 - 编程作业 - 分组作业 + 普通作业 + 编程作业 + 分组作业 -
+
迟交扣分:{{homework.late_penalty}}分
缺评扣分:{{homework.absence_penalty}}分/作品
匿评开启时间:{{homework.evaluation_start}}
diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html index 4438c453d..4fc085b7e 100644 --- a/public/assets/wechat/issue_detail.html +++ b/public/assets/wechat/issue_detail.html @@ -14,7 +14,7 @@ 来   源: {{issue.project_name}}  |  项目问题 -
+
状   态:{{issue.issue_status}}
优先级:{{issue.issue_priority}}
指派给:{{issue.issue_assigned_to}}
diff --git a/public/assets/wechat/project_discussion.html b/public/assets/wechat/project_discussion.html index 696ffd7d1..8be12c403 100644 --- a/public/assets/wechat/project_discussion.html +++ b/public/assets/wechat/project_discussion.html @@ -14,7 +14,7 @@ 来   源: {{discussion.course_project_name}}  |  项目讨论区 -
+
{{discussion.created_on}}
diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js index 00d6bf3bc..5c0d7d5bf 100644 --- a/public/javascripts/wechat/app.js +++ b/public/javascripts/wechat/app.js @@ -1,9 +1,66 @@ var app = angular.module('wechat', ['ngRoute']); +<<<<<<< HEAD app.constant('config', { rootPath: '/assets/wechat/', rootUrl: '/', apiUrl: '/api/v1/' +======= +if(debug===true){ + //apiUrl = 'http://localhost:3000/api/v1/'; + apiUrl = 'http://www.trustie.net/api/v1/'; +} + + +app.factory('auth', function($http,$routeParams, $q){ + var _openid = ''; + + if(typeof g_openid !== 'undefined'){ + _openid = g_openid; + } + + if(debug===true){ + _openid = "1"; //guange的帐号 + } + + var getOpenId = function() { + var deferred = $q.defer(); + if (typeof _openid !== 'undefined' && _openid.length > 0){ + deferred.resolve(_openid); + } else { + var code = $routeParams.code; + $http({ + url: '/wechat/get_open_id', + data: {code: code}, + method: 'POST' + }).then(function successCallback(response) { + _openid = response.data.openid; + deferred.resolve(_openid); + }, function errorCallback(response) { + deferred.reject(response); + }); + } + return deferred.promise; + }; + var openid = function(){ + return _openid; + }; + return {getOpenId: getOpenId, openid: openid}; +}); + + +app.factory('rms', function(){ + var _saveStorage = {}; + var save = function(key, value){ + _saveStorage[key] = value; + }; + + var get = function(key){ + return _saveStorage[key]; + }; + + return {save: save, get: get}; +>>>>>>> b17b92cc3ec7341ef1d1e2179be0de623605a725 }); @@ -16,14 +73,394 @@ app.run(['$rootScope', 'auth', '$location', '$routeParams', function($rootScope, $rootScope.$on('$routeChangeError', function(event, next, current){ +<<<<<<< HEAD if(next && next.templateUrl){ if(!next.templateUrl.endsWith("login.html") && !next.templateUrl.endsWith("reg.html")){ $location.path("/login"); +======= + $scope.decreasePraise = function(act){ + common.decreaseCommonPraise(act); + }; +}); + +app.factory('common', function($http, auth, $routeParams){ + var addCommonReply = function(id, type, data, cb){ + + if(!data.comment || data.comment.length<=0){ + return; + } + + var temp = data.comment.replace(/\n/g,'
'); + + var userInfo = { + type: type, + content: temp, + openid: auth.openid() + }; + //回复按钮禁用 + data.disabled = true; + + $http({ + method: 'POST', + url: apiUrl+ "new_comment/"+id, + data: userInfo + }).then(function successCallback(response) { + //alert("提交成功"); + if(typeof cb === 'function'){ + cb(); +>>>>>>> b17b92cc3ec7341ef1d1e2179be0de623605a725 } } +<<<<<<< HEAD }); $rootScope.$on('$routeChangeStart', function(event, next, current){ }); } -]); \ No newline at end of file +]); +======= + ); + + $scope.addIssueReply = function(data){ + console.log(data.comment); + common.addCommonReply($routeParams.id, 'Issue', data, function(){ + $scope.formData = {comment: ''}; + loadData($routeParams.id); + //数据提交完成,回复按钮启用 + data.disabled = false; + }); + + }; + + $scope.addPraise = function(act){ + common.addCommonPraise(act); + }; + + $scope.decreasePraise = function(act){ + common.decreaseCommonPraise(act); + }; +}); + +app.controller('HomeworkController', function($scope, $http, $routeParams, auth, common){ + $scope.formData = {comment: ''}; + + var loadData = function(id){ + common.loadCommonData(id, 'whomeworks').then(function successCallback(response) { + console.log(response.data); + $scope.homework = response.data.data; + }, function errorCallback(response) { + }); + }; + + auth.getOpenId().then( + function successCallback(response){ + loadData($routeParams.id); + }, function errorCallback(response) { + alert("获取openid出错:"+response); + } + ); + + $scope.addHomeworkReply = function(data){ + console.log(data.comment); + common.addCommonReply($routeParams.id, 'HomeworkCommon', data, function(){ + $scope.formData = {comment: ''}; + loadData($routeParams.id); + //数据提交完成,回复按钮启用 + data.disabled = false; + }); + }; + + $scope.addPraise = function(act){ + common.addCommonPraise(act); + }; + + $scope.decreasePraise = function(act){ + common.decreaseCommonPraise(act); + }; +}); + +app.controller('CourseNoticeController', function($scope, $http, $routeParams, auth, common){ + $scope.formData = {comment: ''}; + + var loadData = function(id){ + common.loadCommonData(id, 'newss').then(function successCallback(response) { + console.log(response.data); + $scope.news = response.data.data; + }, function errorCallback(response) { + }); + }; + + auth.getOpenId().then( + function successCallback(response){ + loadData($routeParams.id); + }, function errorCallback(response) { + alert("获取openid出错:"+response); + } + ); + + $scope.addNoticeReply = function(data){ + console.log(data.comment); + common.addCommonReply($routeParams.id, 'News', data, function(){ + $scope.formData = {comment: ''}; + loadData($routeParams.id); + //数据提交完成,回复按钮启用 + data.disabled = false; + }); + }; + + $scope.addPraise = function(act){ + common.addCommonPraise(act); + }; + + $scope.decreasePraise = function(act){ + common.decreaseCommonPraise(act); + }; +}); + +app.controller('DiscussionController', function($scope, $http, $routeParams, auth, common){ + $scope.formData = {comment: ''}; + + var loadData = function(id){ + common.loadCommonData(id, 'messages').then(function successCallback(response) { + console.log(response.data); + $scope.discussion = response.data.data; + }, function errorCallback(response) { + }); + }; + + auth.getOpenId().then( + function successCallback(response){ + loadData($routeParams.id); + }, function errorCallback(response) { + alert("获取openid出错:"+response); + } + ); + + $scope.addDiscussionReply = function(data){ + console.log(data.comment); + common.addCommonReply($routeParams.id, 'Message', data, function(){ + $scope.formData = {comment: ''}; + loadData($routeParams.id); + //数据提交完成,回复按钮启用 + data.disabled = false; + }); + }; + + $scope.addPraise = function(act){ + common.addCommonPraise(act); + }; + + $scope.decreasePraise = function(act){ + common.decreaseCommonPraise(act); + }; +}); + +app.controller('JournalsController', function($scope, $http, $routeParams, auth, common){ + $scope.formData = {comment: ''}; + + var loadData = function(id){ + common.loadCommonData(id, 'journal_for_messages').then(function successCallback(response) { + console.log(response.data); + $scope.message = response.data.data; + }, function errorCallback(response) { + }); + }; + + auth.getOpenId().then( + function successCallback(response){ + loadData($routeParams.id); + }, function errorCallback(response) { + alert("获取openid出错:"+response); + } + ); + + $scope.addJournalReply = function(data){ + console.log(data.comment); + common.addCommonReply($routeParams.id, 'JournalsForMessage', data, function(){ + $scope.formData = {comment: ''}; + loadData($routeParams.id); + //数据提交完成,回复按钮启用 + data.disabled = false; + }); + }; + + $scope.addPraise = function(act){ + console.log(act); + common.addCommonPraise(act); + }; + + $scope.decreasePraise = function(act){ + console.log(act); + common.decreaseCommonPraise(act); + }; +}); + +app.controller('BlogController', function($scope, $http, $routeParams, auth, common){ + $scope.formData = {comment: ''}; + + var loadData = function(id){ + common.loadCommonData(id, 'blog_comments').then(function successCallback(response) { + console.log(response.data); + $scope.blog = response.data.data; + }, function errorCallback(response) { + }); + }; + + auth.getOpenId().then( + function successCallback(response){ + loadData($routeParams.id); + }, function errorCallback(response) { + alert("获取openid出错:"+response); + } + ); + + $scope.addBlogReply = function(data){ + console.log(data.comment); + common.addCommonReply($routeParams.id, 'BlogComment', data, function(){ + $scope.formData = {comment: ''}; + loadData($routeParams.id); + //数据提交完成,回复按钮启用 + data.disabled = false; + }); + }; + + $scope.addPraise = function(act){ + console.log(act); + common.addCommonPraise(act); + }; + + $scope.decreasePraise = function(act){ + console.log(act); + common.decreaseCommonPraise(act); + }; +}); + +app.filter('safeHtml', function ($sce) { + return function (input) { + return $sce.trustAsHtml(input); + } +}); + +//app.directive('textAutoHeight', function($timeout){ +// return { +// restrict: 'A', +// scope: {}, +// link: function(scope, element, attr){ +// scope.text = '点击展开'; +// $timeout(function(){ +// var e = element.parent().children().eq(5); +// var height = e[0].scrollHeight; +// if(height>90){ +// element.css('display', 'block'); +// element.on('click', function(){ +// if(element.text() == "点击展开"){ +// e.css("height", height+'px'); +// element.text("点击隐藏"); +// } else { +// e.css("height", '90px'); +// element.text("点击展开"); +// } +// +// }); +// } +// }, false); +// +// } +// } +//}); + +app.directive('inputAuto',function(){ + return{ + restrict: 'A', + scope: {}, + link: function(scope, element){ + var copyContainer = element.parent().children().eq(0); + var sendButton = element.parent().next(); + element.on('input',function(){ + console.log(sendButton); + copyContainer.html(element[0].value); + var textHeight = copyContainer[0].scrollHeight; + element.css('height', textHeight + 'px'); + }); + sendButton.on('click',function(){ + element.css('height','28px'); + }); + } + } +}); + +app.directive('loadingSpinner', ['$http', function ($http) { + return { + restrict: 'A', + replace: true, + template: '
加载中...
', + }; +}]); + +app.config(['$routeProvider',"$httpProvider", "$locationProvider",function ($routeProvider, $httpProvider, $locationProvider) { + var rootPath = '/assets/wechat/' + //$locationProvider.html5Mode(true); + $routeProvider + .when('/activites', { + templateUrl: rootPath + 'activities.html', + controller: 'ActivityController' + }) + .when('/issues/:id', { + templateUrl: rootPath + 'issue_detail.html', + controller: 'IssueController' + }) + .when('/project_discussion/:id', { + templateUrl: rootPath + 'project_discussion.html', + controller: 'DiscussionController' + }) + .when('/homework/:id', { + templateUrl: rootPath + 'homework_detail.html', + controller: 'HomeworkController' + }) + .when('/course_notice/:id', { + templateUrl: rootPath + 'course_notice.html', + controller: 'CourseNoticeController' + }) + .when('/course_discussion/:id', { + templateUrl: rootPath + 'course_discussion.html', + controller: 'DiscussionController' + }) + .when('/journal_for_message/:id', { + templateUrl: rootPath + 'jour_message_detail.html', + controller: 'JournalsController' + }) + .when('/blog_comment/:id', { + templateUrl: rootPath + 'blog_detail.html', + controller: 'BlogController' + }) + .otherwise({ + redirectTo: '/activites' + }); + + //监听异步请求,实现加载中显隐标记 + $httpProvider.interceptors.push(function ($q, $rootScope) { + if ($rootScope.activeCalls == undefined) { + $rootScope.activeCalls = 0; + } + + return { + request: function (config) { + $rootScope.activeCalls += 1; + return config; + }, + requestError: function (rejection) { + $rootScope.activeCalls -= 1; + return rejection; + }, + response: function (response) { + $rootScope.activeCalls -= 1; + return response; + }, + responseError: function (rejection) { + $rootScope.activeCalls -= 1; + return rejection; + } + }; + }); +}]); +>>>>>>> b17b92cc3ec7341ef1d1e2179be0de623605a725 diff --git a/public/stylesheets/weui/weixin.css b/public/stylesheets/weui/weixin.css index 8391b1083..955a7ab73 100644 --- a/public/stylesheets/weui/weixin.css +++ b/public/stylesheets/weui/weixin.css @@ -14,6 +14,7 @@ blockquote {border:1px solid #d4d4d4; padding: 0.6em; margin-left: 1.4em; margin .f15 {font-size:15px;} .fb {font-weight:bold;} .mt2 {margin-top:2px;} +.mt3 {margin-top:3px;} .mt4 {margin-top:4px;} .mt5 {margin-top:5px;} .mt10 {margin-top:10px;} @@ -65,7 +66,7 @@ a.underline {text-decoration:underline;} .block-center {margin-left:auto; margin-right:auto; display:block;} /*背景色*/ -.bg-grey {background-color:#c1c1c1;} +.bg-grey {background-color:#c1c1c1 !important;} .bg-blue {background-color:#3b94d6;} /*按钮样式*/ @@ -73,6 +74,8 @@ a.underline {text-decoration:underline;} .bg-blue:not(.btn-disabled):active {background-color:#2780c2;} .btn-disabled {background-color:#ccc;} +/*背景色*/ + /*动态样式*/ .post-container {width:100%;} .post-wrapper {width:98%; border-radius:3px; box-shadow:0px 0px 8px rgba(146, 153, 169, 0.5); background-color:#ffffff; margin:10px auto;} @@ -83,7 +86,8 @@ a.underline {text-decoration:underline;} .fl {float:left;} .fr {float:right;} .cl {clear:both; overflow:hidden;} -.post-content {width:100%; font-size:13px; line-height:18px; height:95px; overflow:hidden; word-break:break-all; word-wrap:break-word;} +.post-content {width:100%; font-size:13px; line-height:18px; height:90px; overflow:hidden; word-break:break-all; word-wrap:break-word;} +.post-all-content a {color:#136ec2;} .post-interactive {width:100%; height:35px; line-height:35px; vertical-align:middle; border-top:1px solid #e6e6e6; background-color:#f8f9fb;} .post-interactive-column, .post-interactive-reply, @@ -105,6 +109,8 @@ a.underline {text-decoration:underline;} .reply-icon {background:url(/images/wechat/icon_list.gif) -150px -155px no-repeat; width:20px; height:20px; display:inline-block; vertical-align:middle;} .praise-icon {background:url(/images/wechat/icon_list.gif) -36px -88px no-repeat; width:20px; height:20px; display:inline-block; vertical-align:middle;} .praised-icon {background:url(/images/wechat/icon_list.gif) -152px -86px no-repeat; width:20px; height:20px; display:inline-block; vertical-align:middle;} +.num-block {display:inline-block; vertical-align:top;} +.post-op-banner {height:20px; line-height:20px; vertical-align:middle;} /* loading 弹框*/ .loading-bg {position:fixed; width:100%; height:100%; left:0; top:0; z-index:99; background:rgba(206, 206, 206, 0.3); overflow:hidden;} @@ -176,4 +182,4 @@ a.underline {text-decoration:underline;} .login-box.checked{background:#63c360;} .login-box.checked:after{content:url(/images/wechat/checked.png);} .forget-psw-wrap {width:60px; margin:0 auto;} -.forget-psw {position:fixed; bottom:10px;} \ No newline at end of file +.forget-psw {position:fixed; bottom:10px;}