提交错分支 还原
This commit is contained in:
parent
965d8930dc
commit
e473a18487
|
@ -287,30 +287,6 @@ module Mobile
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "获取课程动态"
|
|
||||||
params do
|
|
||||||
requires :id, type: Integer
|
|
||||||
requires :token, type: String
|
|
||||||
end
|
|
||||||
post 'activities' do
|
|
||||||
authenticate!
|
|
||||||
|
|
||||||
user = current_user
|
|
||||||
|
|
||||||
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
|
|
||||||
activities = UserActivity.where("(container_type = 'Course' and container_id = #{params[:id]} and act_type in #{course_types})").order('updated_at desc')
|
|
||||||
|
|
||||||
page = params[:page] ? params[:page] : 0
|
|
||||||
all_count = activities.count
|
|
||||||
activities = activities.limit(10).offset(page * 10)
|
|
||||||
count = activities.count
|
|
||||||
present :data, activities, with: Mobile::Entities::Activity,user: user
|
|
||||||
present :all_count, all_count
|
|
||||||
present :count, count
|
|
||||||
present :page, page
|
|
||||||
present :status, 0
|
|
||||||
end
|
|
||||||
|
|
||||||
desc "课程作业列表"
|
desc "课程作业列表"
|
||||||
params do
|
params do
|
||||||
requires :token, type: String
|
requires :token, type: String
|
||||||
|
|
|
@ -16,139 +16,7 @@
|
||||||
|
|
||||||
<!--<div class="slice3 fl"></div>-->
|
<!--<div class="slice3 fl"></div>-->
|
||||||
<!--<div class="cl"></div>-->
|
<!--<div class="cl"></div>-->
|
||||||
|
<div class="class-search-wrap">
|
||||||
<div ng-class="{'undis': !showActivities}">
|
|
||||||
<div ng-repeat="act in course_activities">
|
|
||||||
<div ng-if="act.container_type=='Course' ">
|
|
||||||
<div ng-if="act.act_type=='HomeworkCommon'">
|
|
||||||
<div class="post-container">
|
|
||||||
<div class="post-wrapper">
|
|
||||||
<div class="post-main">
|
|
||||||
<div dataID = "{{act.act_id}}" ng-click="goDetail('homework',act.act_id, act.id)" id="act_{{act.id}}">
|
|
||||||
<div class="post-avatar fl mr10"><img ng-src="{{replaceUrl(act.author.img_url)}}" width="30" height="30" class="border-radius img-circle" /></div>
|
|
||||||
<div class="post-dynamic-author hidden fl">
|
|
||||||
<span>{{act.author.real_name}}</span>
|
|
||||||
<img ng-if="act.author.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
|
|
||||||
<img ng-if="act.author.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
|
|
||||||
</div>
|
|
||||||
<div class="post-dynamic-time fr f13">{{act.latest_update}}</div>
|
|
||||||
<div class="cl"></div>
|
|
||||||
<div class="post-dynamic-title c-grey3 hidden mt12 fb">【作业】{{act.subject|safeHtml}}</div>
|
|
||||||
<div class="post-content c-grey3 mt10 mb10">
|
|
||||||
<div class="post-all-content" ng-bind-html="act.description|safeHtml" ellipsis-show></div>
|
|
||||||
<span class="mr15 f12 c-grey2">迟交扣分:{{act.homework_common_detail.late_penalty}}分</span> <span ng-if="!act.homework_common_detail.anonymous_comment" class="f12 c-grey2">匿评开启时间:{{act.homework_common_detail.evaluation_start}}</span><br />
|
|
||||||
<span ng-if="!act.homework_common_detail.anonymous_comment" class="mr15 f12 c-grey2">缺评扣分:{{act.homework_common_detail.absence_penalty}}分/作品</span> <span ng-if="!act.homework_common_detail.anonymous_comment" class="f12 c-grey2">匿评关闭时间:{{act.homework_common_detail.evaluation_end}}</span>
|
|
||||||
</div>
|
|
||||||
<div class="cl"></div>
|
|
||||||
</div>
|
|
||||||
<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>
|
|
||||||
<div class="fr f13">
|
|
||||||
<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>赞</span></div>
|
|
||||||
<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
|
|
||||||
<div ng-if="act.has_praise" ng-click="decreasePraise(act);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
|
|
||||||
</div>
|
|
||||||
<div class="fr mr25 f13">
|
|
||||||
<a ng-if="!act.reply_count" ng-click="goDetail('homework',act.act_id, act.id)"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
|
|
||||||
<a ng-if="act.reply_count" ng-click="goDetail('homework',act.act_id, act.id)"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{act.reply_count}}</span></a>
|
|
||||||
</div>
|
|
||||||
<div class="cl"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div ng-if="act.act_type=='News'">
|
|
||||||
<div class="post-container">
|
|
||||||
<div class="post-wrapper">
|
|
||||||
<div class="post-main">
|
|
||||||
<div dataID = "{{act.act_id}}" ng-click="goDetail('course_notice',act.act_id, act.id)" id="act_{{act.id}}">
|
|
||||||
<div class="post-avatar fl mr10"><img ng-src="{{replaceUrl(act.author.img_url)}}" width="30" height="30" class="border-radius img-circle" /></div>
|
|
||||||
<div class="post-dynamic-author hidden fl">
|
|
||||||
<span>{{act.author.real_name}}</span>
|
|
||||||
<img ng-if="act.author.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
|
|
||||||
<img ng-if="act.author.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
|
|
||||||
</div>
|
|
||||||
<div class="post-dynamic-time fr f13">{{act.latest_update}}</div>
|
|
||||||
<div class="cl"></div>
|
|
||||||
<div class="post-dynamic-title c-grey3 hidden mt12 fb">【通知】{{act.subject|safeHtml}}</div>
|
|
||||||
<div class="post-content c-grey3 mt10 mb10">
|
|
||||||
<div class="post-all-content" ng-bind-html="act.description|safeHtml" ellipsis-show></div>
|
|
||||||
</div>
|
|
||||||
<div class="cl"></div>
|
|
||||||
</div>
|
|
||||||
<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>
|
|
||||||
<div class="fr f13">
|
|
||||||
<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>赞</span></div>
|
|
||||||
<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
|
|
||||||
<div ng-if="act.has_praise" ng-click="decreasePraise(act);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
|
|
||||||
</div>
|
|
||||||
<div class="fr mr25 f13">
|
|
||||||
<a ng-if="!act.reply_count" ng-click="goDetail('course_notice',act.act_id, act.id)"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
|
|
||||||
<a ng-if="act.reply_count" ng-click="goDetail('course_notice',act.act_id, act.id)"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{act.reply_count}}</span></a>
|
|
||||||
</div>
|
|
||||||
<div class="cl"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div ng-if="act.act_type=='Message'">
|
|
||||||
<div class="post-container">
|
|
||||||
<div class="post-wrapper">
|
|
||||||
<div class="post-main">
|
|
||||||
<div dataID = "{{act.act_id}}" ng-click="goDetail('course_discussion',act.act_id, act.id)" id="act_{{act.id}}">
|
|
||||||
<div class="post-avatar fl mr10"><img ng-src="{{replaceUrl(act.author.img_url)}}" width="30" height="30" class="border-radius img-circle" /></div>
|
|
||||||
<div class="post-dynamic-author hidden fl">
|
|
||||||
<span>{{act.author.real_name}}</span>
|
|
||||||
<img ng-if="act.author.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
|
|
||||||
<img ng-if="act.author.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
|
|
||||||
</div>
|
|
||||||
<div class="post-dynamic-time fr f13">{{act.latest_update}}</div>
|
|
||||||
<div class="cl"></div>
|
|
||||||
<div class="post-dynamic-title c-grey3 hidden mt12 fb">【帖子】{{act.subject|safeHtml}}</div>
|
|
||||||
<div class="post-content c-grey3 mt10 mb10">
|
|
||||||
<div class="post-all-content" ng-bind-html="act.description|safeHtml" ellipsis-show></div>
|
|
||||||
</div>
|
|
||||||
<!--<a herf="javascript:void(0);" class="c-grey2 f13 fr mt5 mb10 post-more mr20 undis" text-auto-height>点击展开</a>-->
|
|
||||||
<div class="cl"></div>
|
|
||||||
</div>
|
|
||||||
<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>
|
|
||||||
<div class="fr f13">
|
|
||||||
<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>赞</span></div>
|
|
||||||
<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
|
|
||||||
<div ng-if="act.has_praise" ng-click="decreasePraise(act);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
|
|
||||||
</div>
|
|
||||||
<div class="fr mr25 f13">
|
|
||||||
<a ng-if="!act.reply_count" ng-click="goDetail('course_discussion',act.act_id, act.id)"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
|
|
||||||
<a ng-if="act.reply_count" ng-click="goDetail('course_discussion',act.act_id, act.id)"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{act.reply_count}}</span></a>
|
|
||||||
</div>
|
|
||||||
<div class="cl"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div ng-if="act.act_type=='Course'">
|
|
||||||
<div class="post-container">
|
|
||||||
<div class="post-wrapper">
|
|
||||||
<div class="post-main">
|
|
||||||
<div class="post-avatar fl mr10"><img ng-src="{{replaceUrl(act.author.img_url)}}" width="30" height="30" class="border-radius img-circle" /></div>
|
|
||||||
<div class="post-title hidden mb5"><span class="c-grey3 f13 fb mr10">{{act.author.real_name}}</span>创建了<span class="c-grey3 f13 fb ml10">{{act.course_project_name}} | 班级</span></div>
|
|
||||||
<div class="post-title hidden"><span class="mr10">{{act.latest_update}}</span></div>
|
|
||||||
<div class="cl"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div ng-if="course_has_more">
|
|
||||||
<div id="more_course_activities" class="more-events mt10" ng-click="getActivities(course_activities_page+1);">更多</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div ng-class="['class-search-wrap',{'undis': current_tab != 1}]">
|
|
||||||
<div class="class-search-inner"> <img src="/images/wechat/search.png" width="18" class="class-search-icon" />
|
<div class="class-search-inner"> <img src="/images/wechat/search.png" width="18" class="class-search-icon" />
|
||||||
<input class="class-detail-search" ng-model="searchText" placeholder="输入关键词进行搜索" />
|
<input class="class-detail-search" ng-model="searchText" placeholder="输入关键词进行搜索" />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,29 +5,23 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
|
||||||
var courseid = $routeParams.id;
|
var courseid = $routeParams.id;
|
||||||
var tag = $routeParams.tag;
|
var tag = $routeParams.tag;
|
||||||
|
|
||||||
vm.course_activities_page = rms.get('course_activities_page') || 0;
|
|
||||||
vm.course_activities = rms.get("course_activities") || [];
|
|
||||||
vm.course_has_more = rms.get("course_has_more");
|
|
||||||
|
|
||||||
vm.course = rms.get("course") || null;
|
|
||||||
|
|
||||||
var getClassActivities = function(page){
|
var getClassActivities = function(page){
|
||||||
$http({
|
$http({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: apiUrl + "courses/activities?id=" + courseid,
|
url: apiUrl + "projects/activities?id=" + projectid,
|
||||||
data:{token:auth.token(),page:page}
|
data:{token:auth.token(),page:page}
|
||||||
}).then(function successCallback(response) {
|
}).then(function successCallback(response) {
|
||||||
console.log(response.data);
|
console.log(response.data);
|
||||||
if(response.data.status == 0){
|
if(response.data.status == 0){
|
||||||
vm.class_activities_page = response.data.page;
|
vm.project_activities_page = response.data.page;
|
||||||
if(response.data.page > 0)
|
if(response.data.page > 0)
|
||||||
{
|
{
|
||||||
vm.course_activities = vm.class_activities.concat(response.data.data);
|
vm.project_activities = vm.project_activities.concat(response.data.data);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
vm.course_activities = response.data.data;
|
vm.project_activities = response.data.data;
|
||||||
vm.course_activities_page = 0;
|
vm.project_activities_page = 0;
|
||||||
vm.course_has_more = (response.data.count + response.data.page * 10) < response.data.all_count;
|
vm.project_has_more = (response.data.count + response.data.page * 10) < response.data.all_count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -108,7 +102,6 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
|
||||||
vm.currentTab = index;
|
vm.currentTab = index;
|
||||||
vm.searchText = '';
|
vm.searchText = '';
|
||||||
|
|
||||||
vm.showActivities = false;
|
|
||||||
vm.showClassMate = false;
|
vm.showClassMate = false;
|
||||||
vm.showResources = false;
|
vm.showResources = false;
|
||||||
vm.showHomework = false;
|
vm.showHomework = false;
|
||||||
|
@ -119,8 +112,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
|
||||||
|
|
||||||
if(vm.isTeacher){
|
if(vm.isTeacher){
|
||||||
if(index == 1){
|
if(index == 1){
|
||||||
getClassActivities(0);
|
getClassActivities();
|
||||||
vm.showActivities = true;
|
|
||||||
}
|
}
|
||||||
else if(index == 2){ //课件
|
else if(index == 2){ //课件
|
||||||
getResources();
|
getResources();
|
||||||
|
@ -137,8 +129,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if(index == 1){
|
if(index == 1){
|
||||||
getClassActivities(0);
|
getClassActivities();
|
||||||
vm.showActivities = true;
|
|
||||||
}
|
}
|
||||||
else if(index == 3){
|
else if(index == 3){
|
||||||
getUsers();
|
getUsers();
|
||||||
|
@ -154,7 +145,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
|
||||||
|
|
||||||
vm.tabRecord = rms.get('tab_num') || 1;
|
vm.tabRecord = rms.get('tab_num') || 1;
|
||||||
|
|
||||||
// vm.course = {};
|
vm.course = {};
|
||||||
vm.students = [];
|
vm.students = [];
|
||||||
vm.teachers = [];
|
vm.teachers = [];
|
||||||
vm.reviewers = []; //待审批
|
vm.reviewers = []; //待审批
|
||||||
|
@ -168,11 +159,6 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
|
||||||
vm.alertService = alertService.create();
|
vm.alertService = alertService.create();
|
||||||
|
|
||||||
vm.invite = function(){
|
vm.invite = function(){
|
||||||
rms.save('course_activities_page',vm.course_activities_page);
|
|
||||||
rms.save("course_activities",vm.course_activities);
|
|
||||||
rms.save("course_has_more",vm.course_has_more);
|
|
||||||
rms.save("course",vm.course);
|
|
||||||
|
|
||||||
$location.path("/invite_code").search({id: courseid});
|
$location.path("/invite_code").search({id: courseid});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -227,39 +213,5 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
|
||||||
$location.path("/review_class_member").search({id: courseid,user_id: user.id});
|
$location.path("/review_class_member").search({id: courseid,user_id: user.id});
|
||||||
};
|
};
|
||||||
|
|
||||||
//跳到详情页
|
|
||||||
vm.goDetail = function(type, act_id,id){
|
|
||||||
rms.save("yoffset", document.documentElement.scrollTop || document.body.scrollTop);
|
|
||||||
rms.save('course_activities_page',vm.course_activities_page);
|
|
||||||
rms.save("course_activities",vm.course_activities);
|
|
||||||
rms.save('course_has_more', vm.course_has_more);
|
|
||||||
rms.save("course",vm.course);
|
|
||||||
// $location.path('/'+type+'/'+act_id);
|
|
||||||
$location.path("/"+type).search({id: act_id});
|
|
||||||
};
|
|
||||||
|
|
||||||
vm.addPraise = function(act){
|
|
||||||
for(var i in vm.course_activities){
|
|
||||||
if(vm.course_activities[i].act_id == act.act_id){
|
|
||||||
vm.course_activities[i].praise_count += 1;
|
|
||||||
vm.course_activities[i].has_praise = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
common.addCommonPraise(act);
|
|
||||||
};
|
|
||||||
|
|
||||||
vm.decreasePraise = function(act){
|
|
||||||
for(var i in vm.course_activities){
|
|
||||||
if(vm.course_activities[i].act_id == act.act_id){
|
|
||||||
vm.course_activities[i].praise_count -= 1;
|
|
||||||
vm.course_activities[i].has_praise = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
common.decreaseCommonPraise(act);
|
|
||||||
};
|
|
||||||
|
|
||||||
}]);
|
}]);
|
|
@ -114,7 +114,6 @@ app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'aut
|
||||||
//跳到详情页
|
//跳到详情页
|
||||||
vm.goDetail = function(type, act_id,id){
|
vm.goDetail = function(type, act_id,id){
|
||||||
rms.save("yoffset", document.documentElement.scrollTop || document.body.scrollTop);
|
rms.save("yoffset", document.documentElement.scrollTop || document.body.scrollTop);
|
||||||
rms.save('project_activities_page',vm.project_activities_page);
|
|
||||||
rms.save("project_activities",vm.project_activities);
|
rms.save("project_activities",vm.project_activities);
|
||||||
rms.save('project_has_more', vm.project_has_more);
|
rms.save('project_has_more', vm.project_has_more);
|
||||||
rms.save("project",vm.project);
|
rms.save("project",vm.project);
|
||||||
|
|
Loading…
Reference in New Issue