微信增加发帖功能
This commit is contained in:
parent
34acb1aa2f
commit
c612104fab
|
@ -582,6 +582,85 @@ module Mobile
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "发布班级通知"
|
||||||
|
params do
|
||||||
|
requires :id, type: Integer
|
||||||
|
requires :token, type: String
|
||||||
|
requires :text, type: String
|
||||||
|
requires :title, type: String
|
||||||
|
end
|
||||||
|
post ':id/publishnotice' do
|
||||||
|
authenticate!
|
||||||
|
|
||||||
|
#老师或教辅才能发通知
|
||||||
|
c = Course.find("#{params[:id]}")
|
||||||
|
|
||||||
|
my_member = c.member_principals.where("users.id=#{current_user.id}").first
|
||||||
|
|
||||||
|
roles_ids = []
|
||||||
|
my_member.roles.each do |role|
|
||||||
|
roles_ids << role.id
|
||||||
|
end
|
||||||
|
if my_member && (roles_ids.include?(7)|| roles_ids.include?(9) || roles_ids.include?(3))
|
||||||
|
|
||||||
|
tmpparams = {}
|
||||||
|
tmpparams['title'] = params[:title]
|
||||||
|
tmpparams['description'] = params[:text]
|
||||||
|
tmpparams['sticky'] = 0
|
||||||
|
|
||||||
|
news = News.new(:course => c, :author => current_user)
|
||||||
|
#render :layout => 'base_courses'
|
||||||
|
news.safe_attributes = tmpparams
|
||||||
|
|
||||||
|
news.save!
|
||||||
|
|
||||||
|
present :status, 0
|
||||||
|
else
|
||||||
|
present :status, -1
|
||||||
|
present :message,"学生不能发布通知"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "发布班级问题"
|
||||||
|
params do
|
||||||
|
requires :id, type: Integer
|
||||||
|
requires :token, type: String
|
||||||
|
requires :text, type: String
|
||||||
|
end
|
||||||
|
post ':id/publishissue' do
|
||||||
|
authenticate!
|
||||||
|
|
||||||
|
c = Course.find("#{params[:id]}")
|
||||||
|
|
||||||
|
boards = c.boards.includes(:last_message => :author).all
|
||||||
|
if c.boards.empty?
|
||||||
|
board = c.boards.build
|
||||||
|
board.name = "班级问答区"
|
||||||
|
board.description = c.name.to_s
|
||||||
|
board.project_id = -1
|
||||||
|
if board.save
|
||||||
|
boards = c.boards.includes(:last_message => :author).all
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
board = boards.first
|
||||||
|
|
||||||
|
message = Message.new
|
||||||
|
message.author = current_user
|
||||||
|
message.board = board
|
||||||
|
|
||||||
|
tmpparams = {}
|
||||||
|
tmpparams['subject'] = params[:title]
|
||||||
|
tmpparams['content'] = params[:text]
|
||||||
|
|
||||||
|
message.safe_attributes = tmpparams
|
||||||
|
|
||||||
|
message.save!
|
||||||
|
|
||||||
|
present :status, 0
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -229,6 +229,45 @@ module Mobile
|
||||||
present :message, result[:message]
|
present :message, result[:message]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "发布项目帖子"
|
||||||
|
params do
|
||||||
|
requires :id, type: Integer
|
||||||
|
requires :token, type: String
|
||||||
|
requires :text, type: String
|
||||||
|
end
|
||||||
|
post ':id/publishnote' do
|
||||||
|
authenticate!
|
||||||
|
|
||||||
|
project = Project.find("#{params[:id]}")
|
||||||
|
|
||||||
|
boards = project.boards.includes(:last_message => :author).all
|
||||||
|
if project.boards.empty?
|
||||||
|
board = project.boards.build
|
||||||
|
board.name = "项目讨论区"
|
||||||
|
board.description = project.name.to_s
|
||||||
|
board.course_id = -1
|
||||||
|
if board.save
|
||||||
|
boards = project.boards.includes(:last_message => :author).all
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
board = boards.first
|
||||||
|
|
||||||
|
message = Message.new
|
||||||
|
message.author = current_user
|
||||||
|
message.board = board
|
||||||
|
|
||||||
|
tmpparams = {}
|
||||||
|
tmpparams['subject'] = params[:title]
|
||||||
|
tmpparams['content'] = params[:text]
|
||||||
|
|
||||||
|
message.safe_attributes = tmpparams
|
||||||
|
|
||||||
|
message.save!
|
||||||
|
|
||||||
|
present :status, 0
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -147,8 +147,8 @@
|
||||||
<div id="more_course_activities" class="more-events mt10" ng-click="getActivities(course_activities_page+1);">更多</div>
|
<div id="more_course_activities" class="more-events mt10" ng-click="getActivities(course_activities_page+1);">更多</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="bottom-tab-wrap mt10">
|
<div class="bottom-tab-wrap mt10">
|
||||||
<a href="javascript:void(0);" class="weixin-tab link-blue2 border-top">发布通知</a>
|
<a ng-show="isTeacher" ng-click="goPublishNotice()" class="weixin-tab link-blue2 border-top">发布通知</a>
|
||||||
<a href="javascript:void(0);" class="weixin-tab link-blue2 border-top">发布问题</a>
|
<a ng-click="goPublishIssue()" class="weixin-tab link-blue2 border-top">发布问题</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<div class="post-container">
|
||||||
|
<div loading-spinner></div>
|
||||||
|
|
||||||
|
<div class="blue-title">{{current_course.name}}</div>
|
||||||
|
<div class="course-list-row f13 c-grey3 mt30"><span class="fl ml15 c-grey3">标题</span><input class="new-class-input ml25" ng-model="issuetitle" placeholder="发布问题 ,请先输入标题"></div>
|
||||||
|
<div class="full-width-wrap mt15"><textarea class="full-width-textarea" ng-model="issue" placeholder="请输入您的问题内容~"></textarea></div>
|
||||||
|
<div class="bottom-tab-wrap mt10">
|
||||||
|
<a ng-click="cancel()" class="weixin-tab c-grey border-top">取消</a>
|
||||||
|
<a ng-click="publishIssue()" class="weixin-tab link-blue2 border-top">确定</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--<div ng-show="!current_course" class="blue-title">{{tip_1}}</div>-->
|
||||||
|
<my-alert message="alertService.message" title="alertService.title" visible="alertService.visible" cb="alertService.cb"></my-alert>
|
||||||
|
</div>
|
|
@ -0,0 +1,14 @@
|
||||||
|
<div class="post-container">
|
||||||
|
<div loading-spinner></div>
|
||||||
|
|
||||||
|
<div class="blue-title">{{current_course.name}}</div>
|
||||||
|
<div class="course-list-row f13 c-grey3 mt30"><span class="fl ml15 c-grey3">标题</span><input class="new-class-input ml25" ng-model="noticetitle" placeholder="发布通知,请先输入标题"></div>
|
||||||
|
<div class="full-width-wrap mt15"><textarea class="full-width-textarea" ng-model="notice" placeholder="请输入您的通知内容~"></textarea></div>
|
||||||
|
<div class="bottom-tab-wrap mt10">
|
||||||
|
<a ng-click="cancel()" class="weixin-tab c-grey border-top">取消</a>
|
||||||
|
<a ng-click="publishNotice()" class="weixin-tab link-blue2 border-top">确定</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--<div ng-show="!current_course" class="blue-title">{{tip_1}}</div>-->
|
||||||
|
<my-alert message="alertService.message" title="alertService.title" visible="alertService.visible" cb="alertService.cb"></my-alert>
|
||||||
|
</div>
|
|
@ -99,7 +99,7 @@
|
||||||
<div id="more_project_activities" class="more-events mt10" ng-click="getActivities(project_activities_page+1);">更多</div>
|
<div id="more_project_activities" class="more-events mt10" ng-click="getActivities(project_activities_page+1);">更多</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="bottom-tab-wrap mt10">
|
<div class="bottom-tab-wrap mt10">
|
||||||
<a href="javascript:void(0);" class="weixin-tab link-blue2 border-top">发布新帖</a>
|
<a ng-click="goPublishNote()" class="weixin-tab link-blue2 border-top">发布新帖</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<div class="post-container">
|
||||||
|
<div loading-spinner></div>
|
||||||
|
|
||||||
|
<div class="blue-title">{{current_project.name}}</div>
|
||||||
|
<div class="course-list-row f13 c-grey3 mt30"><span class="fl ml15 c-grey3">标题</span><input class="new-class-input ml25" ng-model="notetitle" placeholder="发布帖子,请先输入帖子标题"></div>
|
||||||
|
<div class="full-width-wrap mt15"><textarea class="full-width-textarea" ng-model="note" placeholder="请输入您的帖子内容~"></textarea></div>
|
||||||
|
<div class="bottom-tab-wrap mt10">
|
||||||
|
<a ng-click="cancel()" class="weixin-tab c-grey border-top">取消</a>
|
||||||
|
<a ng-click="publishNote()" class="weixin-tab link-blue2 border-top">确定</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--<div ng-show="!current_course" class="blue-title">{{tip_1}}</div>-->
|
||||||
|
<my-alert message="alertService.message" title="alertService.title" visible="alertService.visible" cb="alertService.cb"></my-alert>
|
||||||
|
</div>
|
|
@ -1,4 +1,4 @@
|
||||||
app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location','$routeParams','alertService','rms','common', function($scope, config, $http, auth, $location, $routeParams,alertService,rms,common){
|
app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location','$routeParams','alertService','rms','common','$timeout', function($scope, config, $http, auth, $location, $routeParams,alertService,rms,common,$timeout){
|
||||||
// common.checkLogin();
|
// common.checkLogin();
|
||||||
|
|
||||||
var vm = $scope;
|
var vm = $scope;
|
||||||
|
@ -103,7 +103,10 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
|
||||||
|
|
||||||
|
|
||||||
vm.isTeacher = false;
|
vm.isTeacher = false;
|
||||||
vm.currentTab = 1;
|
// vm.currentTab = 1;
|
||||||
|
|
||||||
|
vm.currentTab = rms.get('tab_num');
|
||||||
|
|
||||||
vm.tab = function(index){
|
vm.tab = function(index){
|
||||||
vm.currentTab = index;
|
vm.currentTab = index;
|
||||||
vm.searchText = '';
|
vm.searchText = '';
|
||||||
|
@ -119,7 +122,9 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
|
||||||
|
|
||||||
if(vm.isTeacher){
|
if(vm.isTeacher){
|
||||||
if(index == 1){
|
if(index == 1){
|
||||||
getClassActivities(0);
|
if(vm.course_activities.length <= 0){
|
||||||
|
getClassActivities(0);
|
||||||
|
}
|
||||||
vm.showActivities = true;
|
vm.showActivities = true;
|
||||||
}
|
}
|
||||||
else if(index == 2){ //课件
|
else if(index == 2){ //课件
|
||||||
|
@ -137,7 +142,9 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if(index == 1){
|
if(index == 1){
|
||||||
getClassActivities(0);
|
if(vm.course_activities.length <= 0){
|
||||||
|
getClassActivities(0);
|
||||||
|
}
|
||||||
vm.showActivities = true;
|
vm.showActivities = true;
|
||||||
}
|
}
|
||||||
else if(index == 3){
|
else if(index == 3){
|
||||||
|
@ -149,10 +156,10 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
|
||||||
vm.showResources = true;
|
vm.showResources = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rms.save("tab_num",index);
|
rms.save("tab_num",vm.currentTab);
|
||||||
};
|
};
|
||||||
|
|
||||||
vm.tabRecord = rms.get('tab_num') || 1;
|
// vm.tabRecord = rms.get('tab_num') || 1;
|
||||||
|
|
||||||
// vm.course = {};
|
// vm.course = {};
|
||||||
vm.students = [];
|
vm.students = [];
|
||||||
|
@ -182,48 +189,61 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
|
||||||
$location.path("/send_class_list").search({id: r.id});
|
$location.path("/send_class_list").search({id: r.id});
|
||||||
};
|
};
|
||||||
|
|
||||||
$http.get(config.apiUrl+ 'courses/'+courseid+"?token="+auth.token()).then(
|
if(!vm.currentTab){
|
||||||
function(response) {
|
$http.get(config.apiUrl+ 'courses/'+courseid+"?token="+auth.token()).then(
|
||||||
console.log(response.data);
|
function(response) {
|
||||||
|
console.log(response.data);
|
||||||
|
|
||||||
if (response.data.status == 0){
|
if (response.data.status == 0){
|
||||||
vm.course = response.data.data;
|
vm.course = response.data.data;
|
||||||
resetMenu(vm.course.current_user_is_teacher,vm.tabRecord);
|
resetMenu(vm.course.current_user_is_teacher,vm.currentTab);
|
||||||
if(tag){
|
if(tag){
|
||||||
vm.tab(4);
|
vm.tab(4);
|
||||||
tag = null;
|
tag = null;
|
||||||
|
vm.currentTab = 4;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
vm.currentTab = 1;
|
||||||
|
vm.tab(vm.currentTab);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
vm.tab(vm.tabRecord);
|
vm.alertService.showMessage('提示', response.data.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else{
|
);
|
||||||
vm.alertService.showMessage('提示', response.data.message);
|
}else {
|
||||||
}
|
$timeout(function(){
|
||||||
|
window.scrollTo(0, rms.get("yoffset"));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
var resetMenu = function(is_teacher,index){
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
var resetMenu = function(is_teacher){
|
|
||||||
vm.isTeacher = is_teacher;
|
vm.isTeacher = is_teacher;
|
||||||
if(is_teacher){
|
if(is_teacher){
|
||||||
vm.menus = ["动态", "课件", "作业", "成员管理"];
|
vm.menus = ["动态", "课件", "作业", "成员管理"];
|
||||||
} else {
|
} else {
|
||||||
vm.menus = ['动态','课件', "我的同学"];
|
vm.menus = ['动态','课件', "我的同学"];
|
||||||
}
|
}
|
||||||
|
vm.tab(index);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if(vm.course){
|
||||||
|
resetMenu(vm.course.current_user_is_teacher,vm.currentTab);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
vm.onSetting = function(user){
|
vm.onSetting = function(user){
|
||||||
rms.save('current_edit_member', user);
|
rms.save('current_edit_member', user);
|
||||||
|
rms.save("tab_num",vm.currentTab);
|
||||||
$location.path("/edit_class_member").search({id: courseid,user_id: user.id});
|
$location.path("/edit_class_member").search({id: courseid,user_id: user.id});
|
||||||
};
|
};
|
||||||
|
|
||||||
vm.review = function(user){
|
vm.review = function(user){
|
||||||
rms.save('current_review_member', user);
|
rms.save('current_review_member', user);
|
||||||
rms.save('current_course', vm.course);
|
rms.save('current_course', vm.course);
|
||||||
|
rms.save("tab_num",vm.currentTab);
|
||||||
$location.path("/review_class_member").search({id: courseid,user_id: user.id});
|
$location.path("/review_class_member").search({id: courseid,user_id: user.id});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -233,6 +253,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
|
||||||
rms.save('course_activities_page',vm.course_activities_page);
|
rms.save('course_activities_page',vm.course_activities_page);
|
||||||
rms.save("course_activities",vm.course_activities);
|
rms.save("course_activities",vm.course_activities);
|
||||||
rms.save('course_has_more', vm.course_has_more);
|
rms.save('course_has_more', vm.course_has_more);
|
||||||
|
rms.save("tab_num",vm.currentTab);
|
||||||
rms.save("course",vm.course);
|
rms.save("course",vm.course);
|
||||||
// $location.path('/'+type+'/'+act_id);
|
// $location.path('/'+type+'/'+act_id);
|
||||||
$location.path("/"+type).search({id: act_id});
|
$location.path("/"+type).search({id: act_id});
|
||||||
|
@ -262,4 +283,27 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
|
||||||
common.decreaseCommonPraise(act);
|
common.decreaseCommonPraise(act);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
vm.goPublishNotice = function(){
|
||||||
|
if(!vm.isTeacher){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
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("tab_num",vm.currentTab);
|
||||||
|
rms.save("course",vm.course);
|
||||||
|
rms.save('current_course', vm.course);
|
||||||
|
$location.path("/class_publishnotice").search({id:courseid});
|
||||||
|
};
|
||||||
|
|
||||||
|
vm.goPublishIssue = 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("tab_num",vm.currentTab);
|
||||||
|
rms.save("course",vm.course);
|
||||||
|
rms.save('current_course', vm.course);
|
||||||
|
$location.path("/class_publishissue").search({id:courseid});
|
||||||
|
};
|
||||||
|
|
||||||
}]);
|
}]);
|
|
@ -49,6 +49,11 @@ app.controller('ClassListController', ['$scope', 'config', 'auth', '$http', '$lo
|
||||||
}
|
}
|
||||||
|
|
||||||
vm.goClass = function (course_id) {
|
vm.goClass = function (course_id) {
|
||||||
|
rms.save('course_activities_page',0);
|
||||||
|
rms.save("course_activities",[]);
|
||||||
|
rms.save("course_has_more",false);
|
||||||
|
rms.save("course",null);
|
||||||
|
rms.save("tab_num",null);
|
||||||
console.log(course_id);
|
console.log(course_id);
|
||||||
$location.path("/class").search({id: course_id});
|
$location.path("/class").search({id: course_id});
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
app.controller('ClassPublishIssueController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms','common', function($scope, $http, auth, config, alertService, $location,$routeParams, rms,common){
|
||||||
|
// common.checkLogin();
|
||||||
|
|
||||||
|
var vm = $scope;
|
||||||
|
vm.current_course = rms.get('current_course');
|
||||||
|
|
||||||
|
vm.issuetitle = "";
|
||||||
|
vm.issue = "";
|
||||||
|
var course_id = $routeParams.id;
|
||||||
|
|
||||||
|
vm.alertService = alertService.create();
|
||||||
|
|
||||||
|
if(!vm.current_course){
|
||||||
|
$http.get(config.apiUrl+ 'courses/'+course_id+"?token="+auth.token()).then(
|
||||||
|
function(response) {
|
||||||
|
console.log(response.data);
|
||||||
|
if (response.data.status == 0){
|
||||||
|
vm.current_course = response.data.data;
|
||||||
|
console.log("courses");
|
||||||
|
console.log(response.data.data);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
vm.alertService.showMessage('提示', response.data.message);
|
||||||
|
}
|
||||||
|
if(!vm.current_course){
|
||||||
|
vm.tip_1 = "该班级不存在或已被删除";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
vm.cancel = function(){
|
||||||
|
window.history.back();
|
||||||
|
};
|
||||||
|
|
||||||
|
//发布问题 即项目讨论区
|
||||||
|
vm.publishIssue = function(){
|
||||||
|
if(vm.issuetitle.length == 0)
|
||||||
|
{
|
||||||
|
vm.alertService.showMessage('提示', '标题不能为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(vm.issue.length == 0)
|
||||||
|
{
|
||||||
|
vm.alertService.showMessage('提示', '内容不能为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var text = vm.issue.replace(/\n/g,'<br/>');
|
||||||
|
|
||||||
|
$http.post(config.apiUrl + "courses/"+course_id+"/publishissue",
|
||||||
|
{token: auth.token(),title: vm.issuetitle, text: text}
|
||||||
|
).then(function(response){
|
||||||
|
if(response.data.status == 0)
|
||||||
|
{
|
||||||
|
vm.alertService.showMessage('提示', '您已成功发布问题',function(){
|
||||||
|
rms.save('course_activities_page',0);
|
||||||
|
rms.save("course_activities",[]);
|
||||||
|
rms.save("course_has_more",false);
|
||||||
|
$location.path("/class").search({id: course_id});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
vm.alertService.showMessage('提示', response.data.message);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}] );
|
|
@ -0,0 +1,72 @@
|
||||||
|
app.controller('ClassPublishNoticeController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms','common', function($scope, $http, auth, config, alertService, $location,$routeParams, rms,common){
|
||||||
|
// common.checkLogin();
|
||||||
|
|
||||||
|
var vm = $scope;
|
||||||
|
vm.current_course = rms.get('current_course');
|
||||||
|
|
||||||
|
var course_id = $routeParams.id;
|
||||||
|
|
||||||
|
vm.alertService = alertService.create();
|
||||||
|
|
||||||
|
vm.noticetitle = "";
|
||||||
|
vm.notice = "";
|
||||||
|
|
||||||
|
if(!vm.current_course){
|
||||||
|
$http.get(config.apiUrl+ 'courses/'+course_id+"?token="+auth.token()).then(
|
||||||
|
function(response) {
|
||||||
|
console.log(response.data);
|
||||||
|
if (response.data.status == 0){
|
||||||
|
vm.current_course = response.data.data;
|
||||||
|
console.log("courses");
|
||||||
|
console.log(response.data.data);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
vm.alertService.showMessage('提示', response.data.message);
|
||||||
|
}
|
||||||
|
if(!vm.current_course){
|
||||||
|
vm.tip_1 = "该班级不存在或已被删除";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
vm.cancel = function(){
|
||||||
|
window.history.back();
|
||||||
|
};
|
||||||
|
|
||||||
|
//发布通知 只有老师能发布
|
||||||
|
vm.publishNotice = function(){
|
||||||
|
if(vm.noticetitle.length == 0)
|
||||||
|
{
|
||||||
|
vm.alertService.showMessage('提示', '标题不能为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(vm.notice.length == 0)
|
||||||
|
{
|
||||||
|
vm.alertService.showMessage('提示', '内容不能为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var text = vm.notice.replace(/\n/g,'<br/>');
|
||||||
|
|
||||||
|
$http.post(config.apiUrl + "courses/"+course_id+"/publishnotice",
|
||||||
|
{token: auth.token(),title: vm.noticetitle, text: text}
|
||||||
|
).then(function(response){
|
||||||
|
if(response.data.status == 0)
|
||||||
|
{
|
||||||
|
vm.alertService.showMessage('提示', '您已成功发布通知',function(){
|
||||||
|
rms.save('course_activities_page',0);
|
||||||
|
rms.save("course_activities",[]);
|
||||||
|
rms.save("course_has_more",false);
|
||||||
|
$location.path("/class").search({id: course_id});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
vm.alertService.showMessage('提示', response.data.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}] );
|
|
@ -238,4 +238,19 @@ app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'aut
|
||||||
$location.path("/review_project_member").search({id: projectid,user_id: user.id});
|
$location.path("/review_project_member").search({id: projectid,user_id: user.id});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vm.goPublishNote = function(){
|
||||||
|
rms.save('project_activities_page',vm.project_activities_page);
|
||||||
|
rms.save("project_activities",vm.project_activities);
|
||||||
|
rms.save("project_has_more",vm.project_has_more);
|
||||||
|
|
||||||
|
rms.save("project",vm.project);
|
||||||
|
rms.save("project_master_members",vm.project_master_members);
|
||||||
|
rms.save("project_develop_members",vm.project_develop_members);
|
||||||
|
rms.save("project_report_members",vm.project_report_members);
|
||||||
|
rms.save("review_master_members",vm.review_master_members);
|
||||||
|
rms.save("review_develop_members",vm.review_develop_members);
|
||||||
|
rms.save('current_project', vm.project);
|
||||||
|
$location.path("/project_publishnote").search({id:projectid});
|
||||||
|
};
|
||||||
|
|
||||||
}]);
|
}]);
|
|
@ -0,0 +1,74 @@
|
||||||
|
app.controller('ProjectPublishNoteController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms','common', function($scope, $http, auth, config, alertService, $location,$routeParams, rms,common){
|
||||||
|
// common.checkLogin();
|
||||||
|
|
||||||
|
var vm = $scope;
|
||||||
|
vm.current_project = rms.get('current_project');
|
||||||
|
|
||||||
|
var project_id = $routeParams.id;
|
||||||
|
|
||||||
|
vm.alertService = alertService.create();
|
||||||
|
|
||||||
|
vm.notetitle = "";
|
||||||
|
vm.note = "";
|
||||||
|
|
||||||
|
if(!vm.current_project){
|
||||||
|
$http.get(config.apiUrl+ 'projects/'+project_id+"?token="+auth.token()).then(
|
||||||
|
function(response) {
|
||||||
|
console.log(response.data);
|
||||||
|
if (response.data.status == 0){
|
||||||
|
vm.current_project = response.data.data;
|
||||||
|
console.log("projects");
|
||||||
|
console.log(response.data.data);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
vm.alertService.showMessage('提示', response.data.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!vm.current_project){
|
||||||
|
vm.tip_1 = "该项目不存在或已被删除";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
vm.cancel = function(){
|
||||||
|
window.history.back();
|
||||||
|
};
|
||||||
|
|
||||||
|
//发布通知 只有老师能发布
|
||||||
|
vm.publishNote = function(){
|
||||||
|
if(vm.notetitle.length == 0)
|
||||||
|
{
|
||||||
|
vm.alertService.showMessage('提示', '标题不能为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(vm.note.length == 0)
|
||||||
|
{
|
||||||
|
vm.alertService.showMessage('提示', '内容不能为空');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var text = vm.note.replace(/\n/g,'<br/>');
|
||||||
|
|
||||||
|
$http.post(config.apiUrl + "projects/"+project_id+"/publishnote",
|
||||||
|
{token: auth.token(),title: vm.notetitle, text: text}
|
||||||
|
).then(function(response){
|
||||||
|
if(response.data.status == 0)
|
||||||
|
{
|
||||||
|
vm.alertService.showMessage('提示', '您已成功发布帖子',function(){
|
||||||
|
rms.save('project_activities_page',0);
|
||||||
|
rms.save("project_activities",[]);
|
||||||
|
rms.save("project_has_more",false);
|
||||||
|
rms.save('tab_num',null);
|
||||||
|
$location.path("/project").search({id: project_id});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
vm.alertService.showMessage('提示', response.data.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}] );
|
|
@ -40,6 +40,8 @@ app.config(['$routeProvider',"$httpProvider", "$locationProvider",'config', func
|
||||||
.when('/send_class_list', makeRoute('send_class_list.html', 'SendClassListController'))
|
.when('/send_class_list', makeRoute('send_class_list.html', 'SendClassListController'))
|
||||||
.when('/join_class', makeRoute('join_class.html', 'JoinClassController'))
|
.when('/join_class', makeRoute('join_class.html', 'JoinClassController'))
|
||||||
.when('/review_class_member', makeRoute('review_class_member.html', 'ReviewClassMemberController'))
|
.when('/review_class_member', makeRoute('review_class_member.html', 'ReviewClassMemberController'))
|
||||||
|
.when('/class_publishnotice', makeRoute('class_publishnotice.html', 'ClassPublishNoticeController'))
|
||||||
|
.when('/class_publishissue', makeRoute('class_publishissue.html', 'ClassPublishIssueController'))
|
||||||
.when('/project_list', makeRoute('project_list.html', 'ProjectListController'))
|
.when('/project_list', makeRoute('project_list.html', 'ProjectListController'))
|
||||||
.when('/project', makeRoute('project.html', 'ProjectController'))
|
.when('/project', makeRoute('project.html', 'ProjectController'))
|
||||||
.when('/edit_project_member', makeRoute('edit_project_member.html', 'EditProjectMemberController'))
|
.when('/edit_project_member', makeRoute('edit_project_member.html', 'EditProjectMemberController'))
|
||||||
|
@ -47,6 +49,7 @@ app.config(['$routeProvider',"$httpProvider", "$locationProvider",'config', func
|
||||||
.when('/project_invite_code', {templateUrl: rootPath + 'project_invite_code.html', controller: 'ProjectInviteCodeController'})
|
.when('/project_invite_code', {templateUrl: rootPath + 'project_invite_code.html', controller: 'ProjectInviteCodeController'})
|
||||||
.when('/join_project', makeRoute('join_project.html', 'JoinProjectController'))
|
.when('/join_project', makeRoute('join_project.html', 'JoinProjectController'))
|
||||||
.when('/review_project_member', makeRoute('review_project_member.html', 'ReviewProjectMemberController'))
|
.when('/review_project_member', makeRoute('review_project_member.html', 'ReviewProjectMemberController'))
|
||||||
|
.when('/project_publishnote', makeRoute('project_publishnote.html', 'ProjectPublishNoteController'))
|
||||||
.when('/login_tip', makeRoute('login_tip.html', 'LoginTipController'))
|
.when('/login_tip', makeRoute('login_tip.html', 'LoginTipController'))
|
||||||
.otherwise({
|
.otherwise({
|
||||||
redirectTo: '/activites'
|
redirectTo: '/activites'
|
||||||
|
|
Loading…
Reference in New Issue