Merge branch 'weixin_guange' of https://git.trustie.net/jacknudt/trustieforge into weixin_guange
This commit is contained in:
commit
742100d9b5
|
@ -540,6 +540,7 @@ module Mobile
|
|||
present :status, 0
|
||||
else
|
||||
present :status, -1
|
||||
present :message, "该用户已不在班级中"
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -732,8 +733,8 @@ module Mobile
|
|||
end
|
||||
out = {status: status}
|
||||
message = case status
|
||||
when 0; "退出成功"
|
||||
when 1; "您不在课程中"
|
||||
when 0; "退出班级成功"
|
||||
when 1; "您不是该班级成员"
|
||||
when 2; "您还未登录"
|
||||
when 3; "管理员不能退出班级"
|
||||
else; "未知错误,请稍后再试"
|
||||
|
|
|
@ -127,6 +127,7 @@ module Mobile
|
|||
present :status, 0
|
||||
else
|
||||
present :status, -1
|
||||
present :message, "该用户已不在项目中"
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -283,7 +284,7 @@ module Mobile
|
|||
if(current_user.id != params[:user_id].to_i)
|
||||
#权限
|
||||
project = Project.find("#{params[:id]}")
|
||||
if project.tea_id != params[:user_id].to_i
|
||||
if project.user_id != params[:user_id].to_i
|
||||
|
||||
my_member = project.member_principals.where("users.id=#{current_user.id}").first
|
||||
|
||||
|
@ -308,7 +309,7 @@ module Mobile
|
|||
|
||||
out = {status: status}
|
||||
message = case status
|
||||
when 0; "退出成功"
|
||||
when 0; "删除成功"
|
||||
when 1; "该用户不在该项目中"
|
||||
when -1; "您还未登录"
|
||||
when -2; "您没有权限"
|
||||
|
@ -327,13 +328,15 @@ module Mobile
|
|||
post ':id/quit' do
|
||||
authenticate!
|
||||
|
||||
project = Project.find("#{params[:id]}")
|
||||
|
||||
ps = ProjectsService.new
|
||||
status = ps.exit_project(params[:id],current_user)
|
||||
status = ps.exit_project(project,current_user)
|
||||
|
||||
out = {status: status}
|
||||
message = case status
|
||||
when 0; "退出成功"
|
||||
when -3; "您不在课程中"
|
||||
when 0; "退出项目成功"
|
||||
when -3; "您不在项目中"
|
||||
when -1; "您还未登录"
|
||||
when -2; "项目创建者不能退出项目"
|
||||
else; "未知错误,请稍后再试"
|
||||
|
|
|
@ -79,7 +79,8 @@ class CoursesService
|
|||
else
|
||||
c = Course.find(course)
|
||||
end
|
||||
if current_user.nil? || !(current_user.admin? || c.is_public == 1 || (c.is_public == 0 && current_user.member_of_course?(c)))
|
||||
# if current_user.nil? || !(current_user.admin? || c.is_public == 1 || (c.is_public == 0 && current_user.member_of_course?(c)))
|
||||
if current_user.nil?
|
||||
raise '403'
|
||||
end
|
||||
#@canShowCode = isCourseTeacher(User.current.id,course) && params[:role] != '1'
|
||||
|
@ -458,8 +459,8 @@ class CoursesService
|
|||
joined = StudentsForCourse.where('student_id = ? and course_id = ?', user.id, params[:object_id])
|
||||
joined.each do |join|
|
||||
join.delete
|
||||
@state = 0
|
||||
end
|
||||
@state = 0
|
||||
@state
|
||||
end
|
||||
|
||||
|
|
|
@ -357,7 +357,7 @@ class ProjectsService
|
|||
|
||||
#删除项目成员
|
||||
def project_delete_member project,user_id,current_user
|
||||
if user.nil?
|
||||
if current_user.nil?
|
||||
state = -1
|
||||
return state
|
||||
end
|
||||
|
|
|
@ -217,7 +217,7 @@
|
|||
<div ng-if="course_has_more" class="mb50">
|
||||
<div id="more_course_activities" class="more-events mt10" ng-click="getClassActivities(course_activities_page+1);">更多</div>
|
||||
</div>
|
||||
<div class="bottom-tab-wrap mt10">
|
||||
<div ng-show="course.is_member" class="bottom-tab-wrap mt10">
|
||||
<a ng-show="isTeacher" ng-click="goPublishNotice()" class="weixin-tab link-blue2 border-top">发布通知</a>
|
||||
<a ng-click="goPublishIssue()" class="weixin-tab link-blue2 border-top">发起讨论</a>
|
||||
</div>
|
||||
|
@ -259,8 +259,8 @@
|
|||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<div class="bottom-tab-wrap mt10">
|
||||
<a ng-show="isTeacher" ng-click="goPublishNotice()" class="weixin-tab link-blue2 border-top">退出班级</a>
|
||||
<div ng-show="course.is_member" class="bottom-tab-wrap mt10" ng-class="{'undis': !showClassMate}">
|
||||
<a ng-show="!course.is_creator" ng-click="quit()" class="weixin-tab link-blue2 border-top">退出班级</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -278,4 +278,5 @@
|
|||
</div>
|
||||
|
||||
<my-alert message="alertService.message" title="alertService.title" visible="alertService.visible" cb="alertService.cb"></my-alert>
|
||||
<my-alert2 message="alertService_2.message" title="alertService_2.title" visible="alertService_2.visible" cb="alertService_2.cb"></my-alert2>
|
||||
</div>
|
||||
|
|
|
@ -3,21 +3,22 @@
|
|||
<div ng-show="current_edit_member" class="post-container" style="padding-bottom:50px;">
|
||||
<div class="blue-title">成员管理</div>
|
||||
<div class="class-detail-row f13 c-grey3"><img ng-src="{{current_edit_member.user.img_url}}" width="30" class="fl ml10 img-circle mt4" /><span class="fl mt10 ml10">{{current_edit_member.user.realname == "" ? current_edit_member.user.name : current_edit_member.user.realname}}</span><img ng-src="/images/wechat/{{current_edit_member.user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt10" /><div class="cl"></div> </div>
|
||||
<div class="course-list-row f13 c-grey3 mt10" ng-click="current_edit_member.show = !current_edit_member.show"><span class="fl ml10">角色变更</span></div>
|
||||
<div class="course-list-row f13 c-grey3 mt10" ng-click="clickChangeRole()"><span class="fl ml10">角色变更</span></div>
|
||||
<ul class="class-list f13 c-grey3" ng-class="{'undis':current_edit_member.show}">
|
||||
<li><span class="fl ml10 class-list-name hidden">教师</span><span ng-click="selectRole(9)" ng-class="['login-box', 'fr', 'mr10', 'mt12', {'bg-grey':assistant,'checked': teacher}]"></span></li>
|
||||
<li><span class="fl ml10 class-list-name hidden">助教</span><span ng-click="selectRole(7)" ng-class="['login-box', 'fr', 'mr10', 'mt12', {'bg-grey':teacher, 'checked': assistant}]"></span></li>
|
||||
<li class="border-bottom-none"><span class="fl ml10 class-list-name hidden">学生</span><span ng-click="selectRole(10)" ng-class="['login-box', 'fr', 'mr10', 'mt12', {'checked': student}]"></span></li>
|
||||
</ul>
|
||||
<div class="course-list-row f13 c-grey3 mt10" ng-click="current_edit_member.show = !current_edit_member.show" id="manageDelete"><span class="fl ml10">删除成员</span></div>
|
||||
<div class="course-list-row f13 c-grey3 mt10" ng-click="current_edit_member.show = !current_edit_member.show;buttongrey = false;" id="manageDelete"><span class="fl ml10">删除成员</span></div>
|
||||
<ul class="class-list f13 c-grey3" ng-class="{'undis':!current_edit_member.show}">
|
||||
<li class="border-bottom-none"><span class="fl ml10 class-list-name hidden">删除</span><input type="radio" name="delete" class="fr mr10 mt12" checked="checked" /></li>
|
||||
</ul>
|
||||
<div class="bottom-tab-wrap mt10">
|
||||
<a href="javascript:void(0);" ng-click="cancel()" class="weixin-tab c-grey border-top">取消</a>
|
||||
<a href="javascript:void(0);" ng-click="edit_member_role()" class="weixin-tab border-top bg-grey c-white" submit-start>确定</a>
|
||||
<a href="javascript:void(0);" ng-click="edit_member_role()" class="weixin-tab border-top link-blue2" ng-class="{'bg-grey':buttongrey}" >确定</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<my-alert message="alertService.message" title="alertService.title" visible="alertService.visible" cb="alertService.cb"></my-alert>
|
||||
<my-alert2 message="alertService_2.message" title="alertService_2.title" visible="alertService_2.visible" cb="alertService_2.cb"></my-alert2>
|
||||
</div>
|
||||
|
|
|
@ -3,23 +3,23 @@
|
|||
<div ng-show="current_edit_member" class="post-container" style="padding-bottom:50px;">
|
||||
<div class="blue-title">成员管理</div>
|
||||
<div class="class-detail-row f13 c-grey3"><img ng-src="{{current_edit_member.user.img_url}}" width="30" class="fl ml10 img-circle mt4" /><span class="fl mt10 ml10">{{current_edit_member.user.real_name == "" ? current_edit_member.user.name : current_edit_member.user.real_name}}</span><img ng-src="/images/wechat/{{current_edit_member.user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt10" /><div class="cl"></div> </div>
|
||||
<div class="course-list-row f13 c-grey3 mt10" ng-click="current_edit_member.show = !current_edit_member.show"><span class="fl ml10">角色变更</span></div>
|
||||
<div class="course-list-row f13 c-grey3 mt10" ng-click="clickChangeRole()"><span class="fl ml10">角色变更</span></div>
|
||||
<ul class="class-list f13 c-grey3" ng-class="{'undis':current_edit_member.show}">
|
||||
<li><span class="fl ml10 class-list-name hidden">管理人员</span><span ng-click="selectRole(3)" ng-class="['login-box', 'fr', 'mr10', 'mt12','img-circle', {'checked': current_edit_member.roles_id == 3}]"></span></li>
|
||||
<li><span class="fl ml10 class-list-name hidden">开发人员</span><span ng-click="selectRole(4)" ng-class="['login-box', 'fr', 'mr10', 'mt12','img-circle', {'checked': current_edit_member.roles_id == 4}]"></span></li>
|
||||
<li class="border-bottom-none"><span class="fl ml10 class-list-name hidden">报告人员</span><span ng-click="selectRole(5)" ng-class="['login-box', 'fr', 'mr10', 'mt12','img-circle', {'checked': current_edit_member.roles_id == 5}]"></span></li>
|
||||
</ul>
|
||||
<div class="course-list-row f13 c-grey3 mt10" ng-click="current_edit_member.show = !current_edit_member.show" id="manageDelete"><span class="fl ml10">删除成员</span></div>
|
||||
<div class="course-list-row f13 c-grey3 mt10" ng-click="current_edit_member.show = !current_edit_member.show;buttongrey = false;" id="manageDelete"><span class="fl ml10">删除成员</span></div>
|
||||
<ul class="class-list f13 c-grey3" ng-class="{'undis':!current_edit_member.show}">
|
||||
<li class="border-bottom-none"><span class="fl ml10 class-list-name hidden">删除</span><input type="radio" name="delete" class="fr mr10 mt12" checked="checked" /></li>
|
||||
</ul>
|
||||
<div class="bottom-tab-wrap mt10">
|
||||
<a href="javascript:void(0);" ng-click="cancel()" class="weixin-tab c-grey border-top">取消</a>
|
||||
<a href="javascript:void(0);" ng-click="edit_member_role()" class="weixin-tab border-top bg-grey c-white" submit-start>确定</a>
|
||||
<a href="javascript:void(0);" ng-click="edit_member_role()" class="weixin-tab border-top link-blue2" ng-class="{'bg-grey':buttongrey}">确定</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<my-alert message="alertService.message" title="alertService.title" visible="alertService.visible" cb="alertService.cb"></my-alert>
|
||||
<my-alert2 message="alertService_2.message" title="alertService_2.title" visible="alertService_2.visible" cb="alertService_2.cb"></my-alert2>
|
||||
</div>
|
||||
|
|
|
@ -98,7 +98,7 @@
|
|||
<div ng-if="project_has_more" class="mb50">
|
||||
<div id="more_project_activities" class="more-events mt10" ng-click="getActivities(project_activities_page+1);">更多</div>
|
||||
</div>
|
||||
<div class="bottom-tab-wrap mt10">
|
||||
<div ng-show="project.is_member" class="bottom-tab-wrap mt10">
|
||||
<a ng-click="goPublishNote()" class="weixin-tab link-blue2 border-top">发布新帖</a>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -138,10 +138,11 @@
|
|||
<img src="/images/wechat/setting.png" ng-show = "master.user.id != project.user_id && project.can_setting " width="15" class="class-list-setting" ng-click="onSetting(report)" />
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="bottom-tab-wrap mt10">
|
||||
<a ng-click="goPublishNotice()" class="weixin-tab link-blue2 border-top">退出项目</a>
|
||||
<div ng-show="project.is_member" class="bottom-tab-wrap mt10" ng-class="{'undis': currentTab != 2}">
|
||||
<a ng-show="!project.is_creator" ng-click="quit()" class="weixin-tab link-blue2 border-top">退出项目</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<my-alert message="alertService.message" title="alertService.title" visible="alertService.visible" cb="alertService.cb"></my-alert>
|
||||
<my-alert2 message="alertService_2.message" title="alertService_2.title" visible="alertService_2.visible" cb="alertService_2.cb"></my-alert2>
|
||||
</div>
|
||||
|
|
|
@ -177,6 +177,8 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
|
|||
vm.myresource_sendIndex = rms.get('myresource_sendIndex') || 1;
|
||||
|
||||
vm.alertService = alertService.create();
|
||||
//双弹框
|
||||
vm.alertService_2 = alertService.create();
|
||||
|
||||
vm.invite = function(){
|
||||
rms.save('course_activities_page',vm.course_activities_page);
|
||||
|
@ -327,44 +329,27 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
|
|||
$location.path("/homework").search({id: id});
|
||||
};
|
||||
|
||||
vm.deleteMember = function(user_id){
|
||||
$http({
|
||||
method: 'POST',
|
||||
url: apiUrl + "courses/deletemember?id=" + courseid,
|
||||
data:{token:auth.token(),user_id:user_id}
|
||||
}).then(function successCallback(response) {
|
||||
console.log(response.data);
|
||||
|
||||
if(response.data.status == 0){
|
||||
vm.alertService.showMessage('提示', response.data.message,function(){
|
||||
//确定
|
||||
|
||||
});
|
||||
}
|
||||
else{
|
||||
vm.alertService.showMessage('提示', response.data.message);
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
vm.quit = function(){
|
||||
$http({
|
||||
method: 'POST',
|
||||
url: apiUrl + "courses/quit?id=" + courseid,
|
||||
data:{token:auth.token()}
|
||||
}).then(function successCallback(response) {
|
||||
console.log(response.data);
|
||||
if(response.data.status == 0){
|
||||
vm.alertService.showMessage('提示', response.data.message,function(){
|
||||
//确定
|
||||
|
||||
});
|
||||
}
|
||||
else{
|
||||
vm.alertService.showMessage('提示', response.data.message);
|
||||
}
|
||||
vm.alertService_2.showMessage('提示', "是否确认退出班级",function(){
|
||||
$http({
|
||||
method: 'POST',
|
||||
url: apiUrl + "courses/" + courseid+"/quit",
|
||||
data:{token:auth.token()}
|
||||
}).then(function successCallback(response) {
|
||||
console.log(response.data);
|
||||
if(response.data.status == 0){
|
||||
vm.alertService.showMessage('提示', response.data.message,function(){
|
||||
//确定
|
||||
rms.save('syllabuses',[]);
|
||||
$location.path("/class_list");
|
||||
});
|
||||
}
|
||||
else{
|
||||
vm.alertService.showMessage('提示', response.data.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ app.controller('ClassPublishIssueController', ['$scope', '$http', 'auth', 'confi
|
|||
).then(function(response){
|
||||
if(response.data.status == 0)
|
||||
{
|
||||
vm.alertService.showMessage('提示', '您已成功发布问题',function(){
|
||||
vm.alertService.showMessage('提示', '发布成功',function(){
|
||||
rms.save('course_activities_page',0);
|
||||
rms.save("course_activities",[]);
|
||||
rms.save("course_has_more",false);
|
||||
|
|
|
@ -55,7 +55,7 @@ app.controller('ClassPublishNoticeController', ['$scope', '$http', 'auth', 'conf
|
|||
).then(function(response){
|
||||
if(response.data.status == 0)
|
||||
{
|
||||
vm.alertService.showMessage('提示', '您已成功发布通知',function(){
|
||||
vm.alertService.showMessage('提示', '发布成功',function(){
|
||||
rms.save('course_activities_page',0);
|
||||
rms.save("course_activities",[]);
|
||||
rms.save("course_has_more",false);
|
||||
|
|
|
@ -9,6 +9,8 @@ app.controller('EditClassMemberController', ['$scope', '$http', 'auth', 'config'
|
|||
vm.current_edit_member = null;
|
||||
|
||||
vm.alertService = alertService.create();
|
||||
//双弹框
|
||||
vm.alertService_2 = alertService.create();
|
||||
|
||||
var course_id = $routeParams.id;
|
||||
var user_id = $routeParams.user_id;
|
||||
|
@ -21,6 +23,8 @@ app.controller('EditClassMemberController', ['$scope', '$http', 'auth', 'config'
|
|||
vm.tmpassistant = false; //教辅
|
||||
vm.tmpstudent = false; //学生
|
||||
|
||||
vm.buttongrey = true;
|
||||
|
||||
|
||||
if(!vm.current_edit_member){
|
||||
$http.post(config.apiUrl+'courses/get_member_info', {
|
||||
|
@ -29,7 +33,9 @@ app.controller('EditClassMemberController', ['$scope', '$http', 'auth', 'config'
|
|||
user_id:user_id
|
||||
}).then(function(response){
|
||||
if(response.data.status!=0){
|
||||
vm.alertService.showMessage('提示', response.data.message);
|
||||
vm.alertService.showMessage('提示', response.data.message,function(){
|
||||
$location.path("/class").search({id: course_id,tag:1});
|
||||
});
|
||||
} else {
|
||||
console.log(response);
|
||||
course_id = response.data.course_id;
|
||||
|
@ -62,36 +68,69 @@ app.controller('EditClassMemberController', ['$scope', '$http', 'auth', 'config'
|
|||
window.history.back();
|
||||
};
|
||||
|
||||
vm.edit_member_role = function(){
|
||||
if((vm.teacher == vm.tmpteacher)&& (vm.assistant == vm.tmpassistant)&&(vm.student == vm.tmpstudent)){
|
||||
vm.alertService.showMessage('提示', "该用户当前已是该角色");
|
||||
return;
|
||||
}
|
||||
vm.deleteMember = function(user_id){
|
||||
vm.alertService_2.showMessage('提示', "是否确认删除成员",function(){
|
||||
$http({
|
||||
method: 'POST',
|
||||
url: apiUrl + "courses/" + course_id+"/deletemember",
|
||||
data:{token:auth.token(),user_id:user_id}
|
||||
}).then(function successCallback(response) {
|
||||
console.log(response.data);
|
||||
|
||||
if((vm.teacher == false)&& (vm.assistant == false)&&(vm.student == false)){
|
||||
vm.alertService.showMessage('提示', "请至少选择一种角色");
|
||||
return;
|
||||
}
|
||||
if(response.data.status == 0){
|
||||
vm.alertService.showMessage('提示', response.data.message,function(){
|
||||
//确定
|
||||
$location.path("/class").search({id: course_id,tag:1});
|
||||
});
|
||||
}
|
||||
else{
|
||||
vm.alertService.showMessage('提示', response.data.message);
|
||||
}
|
||||
|
||||
$http.post(config.apiUrl+'courses/edit_member_role', {
|
||||
token: auth.token(),
|
||||
id: course_id,
|
||||
user_id:vm.current_edit_member.user.id,
|
||||
teacher_flag:vm.teacher,
|
||||
assistant_flag:vm.assistant,
|
||||
student_flag:vm.student
|
||||
}).then(function(response){
|
||||
if(response.data.status!=0){
|
||||
vm.alertService.showMessage('提示', response.data.message);
|
||||
} else {
|
||||
vm.alertService.showMessage('提示', '修改角色成功', function(){
|
||||
// window.history.back();
|
||||
$location.path("/class").search({id: course_id,tag:1});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
vm.edit_member_role = function(){
|
||||
if(vm.buttongrey == true){
|
||||
return;
|
||||
}
|
||||
|
||||
if(vm.current_edit_member.show){
|
||||
//删除成员
|
||||
vm.deleteMember(vm.current_edit_member.user.id);
|
||||
}
|
||||
else{
|
||||
if((vm.teacher == vm.tmpteacher)&& (vm.assistant == vm.tmpassistant)&&(vm.student == vm.tmpstudent)){
|
||||
vm.alertService.showMessage('提示', "该用户当前已是该角色");
|
||||
return;
|
||||
}
|
||||
|
||||
if((vm.teacher == false)&& (vm.assistant == false)&&(vm.student == false)){
|
||||
vm.alertService.showMessage('提示', "请至少选择一种角色");
|
||||
return;
|
||||
}
|
||||
|
||||
$http.post(config.apiUrl+'courses/edit_member_role', {
|
||||
token: auth.token(),
|
||||
id: course_id,
|
||||
user_id:vm.current_edit_member.user.id,
|
||||
teacher_flag:vm.teacher,
|
||||
assistant_flag:vm.assistant,
|
||||
student_flag:vm.student
|
||||
}).then(function(response){
|
||||
if(response.data.status!=0){
|
||||
vm.alertService.showMessage('提示', response.data.message);
|
||||
} else {
|
||||
vm.alertService.showMessage('提示', '修改角色成功', function(){
|
||||
// window.history.back();
|
||||
$location.path("/class").search({id: course_id,tag:1});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
vm.selectRole = function(role_id){
|
||||
if (role_id == 7){
|
||||
if(!vm.teacher){
|
||||
|
@ -106,6 +145,28 @@ app.controller('EditClassMemberController', ['$scope', '$http', 'auth', 'config'
|
|||
else if (role_id == 10){
|
||||
vm.student = !vm.student;
|
||||
}
|
||||
}
|
||||
|
||||
if((vm.teacher == vm.tmpteacher)&& (vm.assistant == vm.tmpassistant)&&(vm.student == vm.tmpstudent)){
|
||||
vm.buttongrey = true;
|
||||
}
|
||||
else{
|
||||
vm.buttongrey = false;
|
||||
}
|
||||
|
||||
if((vm.teacher == false)&& (vm.assistant == false)&&(vm.student == false)){
|
||||
vm.buttongrey = true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
vm.clickChangeRole = function(){
|
||||
vm.current_edit_member.show = !vm.current_edit_member.show;
|
||||
if((vm.teacher == vm.tmpteacher)&& (vm.assistant == vm.tmpassistant)&&(vm.student == vm.tmpstudent)){
|
||||
vm.buttongrey = true;
|
||||
}
|
||||
else{
|
||||
vm.buttongrey = false;
|
||||
}
|
||||
};
|
||||
|
||||
}] );
|
|
@ -10,9 +10,14 @@ app.controller('EditProjectMemberController', ['$scope', '$http', 'auth', 'confi
|
|||
vm.current_edit_member = null;
|
||||
|
||||
vm.alertService = alertService.create();
|
||||
//双弹框
|
||||
vm.alertService_2 = alertService.create();
|
||||
|
||||
var project_id = $routeParams.id;
|
||||
var user_id = $routeParams.user_id;
|
||||
|
||||
vm.buttongrey = true;
|
||||
|
||||
if(!vm.current_edit_member){
|
||||
$http.post(config.apiUrl+'projects/get_member_info', {
|
||||
token: auth.token(),
|
||||
|
@ -20,7 +25,20 @@ app.controller('EditProjectMemberController', ['$scope', '$http', 'auth', 'confi
|
|||
user_id:user_id
|
||||
}).then(function(response){
|
||||
if(response.data.status!=0){
|
||||
vm.alertService.showMessage('提示', response.data.message);
|
||||
vm.alertService.showMessage('提示', response.data.message,function(){
|
||||
rms.save('project_activities_page',0);
|
||||
rms.save("project_activities",[]);
|
||||
rms.save("project_has_more",false);
|
||||
rms.save("project",null);
|
||||
rms.save("project_master_members",[]);
|
||||
rms.save("project_develop_members",[]);
|
||||
rms.save("project_report_members",[]);
|
||||
rms.save("review_master_members",[]);
|
||||
rms.save("review_develop_members",[]);
|
||||
rms.save('tab_num',null);
|
||||
// window.history.back();
|
||||
$location.path("/project").search({id: project_id,tag:1});
|
||||
});
|
||||
} else {
|
||||
project_id = response.data.project_id;
|
||||
user_id = response.data.user_id;
|
||||
|
@ -40,42 +58,104 @@ app.controller('EditProjectMemberController', ['$scope', '$http', 'auth', 'confi
|
|||
window.history.back();
|
||||
};
|
||||
|
||||
vm.deleteMember = function(user_id){
|
||||
vm.alertService_2.showMessage('提示', "是否确认删除成员",function(){
|
||||
$http({
|
||||
method: 'POST',
|
||||
url: apiUrl + "projects/" + project_id+"/deletemember",
|
||||
data:{token:auth.token(),user_id:user_id}
|
||||
}).then(function successCallback(response) {
|
||||
console.log(response.data);
|
||||
|
||||
if(response.data.status == 0){
|
||||
vm.alertService.showMessage('提示', response.data.message,function(){
|
||||
//确定
|
||||
rms.save('project_activities_page',0);
|
||||
rms.save("project_activities",[]);
|
||||
rms.save("project_has_more",false);
|
||||
rms.save("project",null);
|
||||
rms.save("project_master_members",[]);
|
||||
rms.save("project_develop_members",[]);
|
||||
rms.save("project_report_members",[]);
|
||||
rms.save("review_master_members",[]);
|
||||
rms.save("review_develop_members",[]);
|
||||
rms.save('tab_num',null);
|
||||
// window.history.back();
|
||||
$location.path("/project").search({id: project_id,tag:1});
|
||||
|
||||
});
|
||||
}
|
||||
else{
|
||||
vm.alertService.showMessage('提示', response.data.message);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
vm.edit_member_role = function(){
|
||||
if(vm.current_roles_id == vm.current_edit_member.roles_id){
|
||||
vm.alertService.showMessage('提示', "该用户当前已是该角色");
|
||||
if(vm.buttongrey == true){
|
||||
return;
|
||||
}
|
||||
|
||||
$http.post(config.apiUrl+'projects/edit_member_role', {
|
||||
token: auth.token(),
|
||||
id: project_id,
|
||||
user_id:vm.current_edit_member.user.id,
|
||||
role_id:vm.current_edit_member.roles_id
|
||||
}).then(function(response){
|
||||
if(response.data.status!=0){
|
||||
vm.alertService.showMessage('提示', response.data.message);
|
||||
} else {
|
||||
vm.alertService.showMessage('提示', '修改角色成功', function(){
|
||||
rms.save('project_activities_page',0);
|
||||
rms.save("project_activities",[]);
|
||||
rms.save("project_has_more",false);
|
||||
rms.save("project",null);
|
||||
rms.save("project_master_members",[]);
|
||||
rms.save("project_develop_members",[]);
|
||||
rms.save("project_report_members",[]);
|
||||
rms.save("review_master_members",[]);
|
||||
rms.save("review_develop_members",[]);
|
||||
rms.save('tab_num',null);
|
||||
// window.history.back();
|
||||
$location.path("/project").search({id: project_id,tag:1});
|
||||
});
|
||||
if(vm.current_edit_member.show){
|
||||
//删除成员
|
||||
vm.deleteMember(vm.current_edit_member.user.id);
|
||||
}
|
||||
else{
|
||||
if(vm.current_roles_id == vm.current_edit_member.roles_id){
|
||||
vm.alertService.showMessage('提示', "该用户当前已是该角色");
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
$http.post(config.apiUrl+'projects/edit_member_role', {
|
||||
token: auth.token(),
|
||||
id: project_id,
|
||||
user_id:vm.current_edit_member.user.id,
|
||||
role_id:vm.current_edit_member.roles_id
|
||||
}).then(function(response){
|
||||
if(response.data.status!=0){
|
||||
vm.alertService.showMessage('提示', response.data.message);
|
||||
} else {
|
||||
vm.alertService.showMessage('提示', '修改角色成功', function(){
|
||||
rms.save('project_activities_page',0);
|
||||
rms.save("project_activities",[]);
|
||||
rms.save("project_has_more",false);
|
||||
rms.save("project",null);
|
||||
rms.save("project_master_members",[]);
|
||||
rms.save("project_develop_members",[]);
|
||||
rms.save("project_report_members",[]);
|
||||
rms.save("review_master_members",[]);
|
||||
rms.save("review_develop_members",[]);
|
||||
rms.save('tab_num',null);
|
||||
// window.history.back();
|
||||
$location.path("/project").search({id: project_id,tag:1});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
vm.selectRole = function(role_id){
|
||||
vm.current_edit_member.roles_id = role_id;
|
||||
}
|
||||
|
||||
if(vm.current_roles_id == vm.current_edit_member.roles_id){
|
||||
vm.buttongrey = true;
|
||||
}
|
||||
else{
|
||||
vm.buttongrey = false;
|
||||
}
|
||||
};
|
||||
|
||||
vm.clickChangeRole = function(){
|
||||
vm.current_edit_member.show = !vm.current_edit_member.show;
|
||||
if(vm.current_roles_id == vm.current_edit_member.roles_id){
|
||||
vm.buttongrey = true;
|
||||
}
|
||||
else{
|
||||
vm.buttongrey = false;
|
||||
}
|
||||
};
|
||||
|
||||
}] );
|
|
@ -30,6 +30,8 @@ app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'aut
|
|||
// vm.project_members_has_more = rms.get("project_members_has_more");
|
||||
|
||||
vm.alertService = alertService.create();
|
||||
//双弹框
|
||||
vm.alertService_2 = alertService.create();
|
||||
|
||||
//跳入邀请界面
|
||||
vm.invite = function(){
|
||||
|
@ -253,44 +255,27 @@ app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'aut
|
|||
$location.path("/project_publishnote").search({id:projectid});
|
||||
};
|
||||
|
||||
vm.deleteMember = function(user_id){
|
||||
$http({
|
||||
method: 'POST',
|
||||
url: apiUrl + "projects/deletemember?id=" + projectid,
|
||||
data:{token:auth.token(),user_id:user_id}
|
||||
}).then(function successCallback(response) {
|
||||
console.log(response.data);
|
||||
|
||||
if(response.data.status == 0){
|
||||
vm.alertService.showMessage('提示', response.data.message,function(){
|
||||
//确定
|
||||
|
||||
});
|
||||
}
|
||||
else{
|
||||
vm.alertService.showMessage('提示', response.data.message);
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
vm.quit = function(){
|
||||
$http({
|
||||
method: 'POST',
|
||||
url: apiUrl + "projects/quit?id=" + projectid,
|
||||
data:{token:auth.token()}
|
||||
}).then(function successCallback(response) {
|
||||
console.log(response.data);
|
||||
if(response.data.status == 0){
|
||||
vm.alertService.showMessage('提示', response.data.message,function(){
|
||||
//确定
|
||||
|
||||
});
|
||||
}
|
||||
else{
|
||||
vm.alertService.showMessage('提示', response.data.message);
|
||||
}
|
||||
vm.alertService_2.showMessage('提示', "是否确认退出项目",function(){
|
||||
$http({
|
||||
method: 'POST',
|
||||
url: apiUrl + "projects/" + projectid+"/quit",
|
||||
data:{token:auth.token()}
|
||||
}).then(function successCallback(response) {
|
||||
console.log(response.data);
|
||||
if(response.data.status == 0){
|
||||
vm.alertService.showMessage('提示', response.data.message,function(){
|
||||
//确定
|
||||
rms.save('projects',[]);
|
||||
$location.path("/project_list");
|
||||
});
|
||||
}
|
||||
else{
|
||||
vm.alertService.showMessage('提示', response.data.message);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
}]);
|
|
@ -56,7 +56,7 @@ app.controller('ProjectPublishNoteController', ['$scope', '$http', 'auth', 'conf
|
|||
).then(function(response){
|
||||
if(response.data.status == 0)
|
||||
{
|
||||
vm.alertService.showMessage('提示', '您已成功发布帖子',function(){
|
||||
vm.alertService.showMessage('提示', '发布成功',function(){
|
||||
rms.save('project_activities_page',0);
|
||||
rms.save("project_activities",[]);
|
||||
rms.save("project_has_more",false);
|
||||
|
|
Loading…
Reference in New Issue