微信项目及课程申请审核相关功能
This commit is contained in:
parent
a4281b4934
commit
4ab2427827
|
@ -86,9 +86,24 @@ module Mobile
|
|||
develop_members = project.member_principals.includes(:roles, :principal).where("member_roles.role_id=4").all.sort
|
||||
report_members = project.member_principals.includes(:roles, :principal).where("member_roles.role_id=5").all.sort
|
||||
|
||||
review_master_members = []
|
||||
review_develop_members = []
|
||||
|
||||
my_member = project.member_principals.where("users.id=#{current_user.id}").first
|
||||
if my_member && my_member.roles[0] && my_member.roles[0].id == 3
|
||||
ps = ProjectsService.new
|
||||
|
||||
user = current_user
|
||||
review_master_members = ps.get_project_review_members(project,3,user)
|
||||
review_develop_members = ps.get_project_review_members(project,4,user)
|
||||
|
||||
end
|
||||
|
||||
present :master_members,master_members, with: Mobile::Entities::ProjectMember
|
||||
present :develop_members,develop_members, with: Mobile::Entities::ProjectMember
|
||||
present :report_members,report_members, with: Mobile::Entities::ProjectMember
|
||||
present :report_members,review_master_members
|
||||
present :report_members,review_develop_members
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
|
@ -182,6 +197,38 @@ module Mobile
|
|||
# {status:-1, message: '该功能将在近日开放,敬请期待!' }
|
||||
end
|
||||
|
||||
desc "项目单个未审核用户信息"
|
||||
params do
|
||||
requires :token, type: String
|
||||
requires :project_id, type: Integer, desc: "项目id"
|
||||
requires :user_id, type: Integer, desc: "用户id"
|
||||
end
|
||||
post 'review_member_info' do
|
||||
authenticate!
|
||||
|
||||
ps = ProjectsService.new
|
||||
reviewer = ps.get_reviewer_info(params)
|
||||
present :data, reviewer, with: Mobile::Entities::User
|
||||
present :status, 0
|
||||
end
|
||||
|
||||
desc "处理管理或开发的身份申请"
|
||||
params do
|
||||
requires :token, type: String
|
||||
requires :project_id, type: Integer, desc: "项目id"
|
||||
requires :user_id, type: Integer, desc: "用户id"
|
||||
requires :type, type: Integer, desc: "同意或拒绝"
|
||||
end
|
||||
post 'deal_join_apply' do
|
||||
authenticate!
|
||||
|
||||
ps = ProjectsService.new
|
||||
result = ps.deal_join_apply(params,current_user)
|
||||
|
||||
present :status, result[:status]
|
||||
present :message, result[:message]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,8 +4,8 @@ module Mobile
|
|||
expose :name
|
||||
expose :id
|
||||
expose :user_id
|
||||
expose :invite_code
|
||||
expose :qrcode
|
||||
# expose :invite_code
|
||||
# expose :qrcode
|
||||
expose :can_setting, if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||
current_user = options[:user]
|
||||
|
||||
|
|
|
@ -11,6 +11,14 @@ class AppliedProject < ActiveRecord::Base
|
|||
def send_appliled_message
|
||||
self.project.managers.each do |member|
|
||||
self.applied_messages << AppliedMessage.new(:user_id => member.user_id, :status => true, :viewed => false, :applied_user_id => self.user_id, :role => self.role, :project_id => self.project_id)
|
||||
|
||||
#----------------微信通知----------------------
|
||||
count = ShieldWechatMessage.where("container_type='User' and container_id=#{member.user_id} and shield_type='Project' and shield_id=#{self.project_id}").count
|
||||
if count == 0
|
||||
ws = WechatService.new
|
||||
ws.project_review_notice member.user_id, "review_project_member", self.project_id, "项目成员审批通知", self.project.name, self.user.show_name, format_time(Time.now),"点击查看申请详情。",self.user.id
|
||||
end
|
||||
#--------------------------------------------
|
||||
end
|
||||
# end
|
||||
end
|
||||
|
|
|
@ -605,7 +605,7 @@ class CoursesService
|
|||
rolename = role_ids.include?("7") ? "助教" : "教师"
|
||||
content = current_user.show_name + "申请以"+rolename+"身份加入班级,等待您的审批。"
|
||||
ws = WechatService.new
|
||||
ws.class_notice tea_user.id, "course_join_review", course.id, "班级成员审批通知", course.name, tea_user.show_name, format_time(Time.now), content, "点击查看申请详情"
|
||||
ws.class_notice tea_user.id, "review_class_member", course.id, "班级成员审批通知", course.name, tea_user.show_name, format_time(Time.now), content, "点击查看申请详情。",current_user.id
|
||||
end
|
||||
end
|
||||
#--------------------------------------------
|
||||
|
|
|
@ -13,8 +13,8 @@ class ProjectsService
|
|||
#显示项目
|
||||
def show_project(params,current_user)
|
||||
project = Project.find(params[:id])
|
||||
project.generate_invite_code
|
||||
project.generate_qrcode
|
||||
# project.generate_invite_code
|
||||
# project.generate_qrcode
|
||||
|
||||
project
|
||||
end
|
||||
|
@ -108,6 +108,8 @@ class ProjectsService
|
|||
4, '您已经是该项目的开发人员',
|
||||
5, '您已经是该项目的报告人员',
|
||||
6, '该项目不存在或已被删除啦',
|
||||
7, '您的申请已提交,请等待管理员审批',
|
||||
8, '您已经发送过申请了,请耐心等待',
|
||||
'未知错误,请稍后再试'
|
||||
]
|
||||
end
|
||||
|
@ -142,7 +144,13 @@ class ProjectsService
|
|||
|
||||
status = 0
|
||||
else
|
||||
if !AppliedProject.where(:project_id => project.id, :user_id => current_user.id).first.nil?
|
||||
status = 8
|
||||
else
|
||||
AppliedProject.create(:user_id => current_user.id, :project_id => project.id, :role => params[:role_id])
|
||||
|
||||
status = 7
|
||||
end
|
||||
end
|
||||
else
|
||||
status = 4
|
||||
|
@ -155,4 +163,87 @@ class ProjectsService
|
|||
status
|
||||
end
|
||||
|
||||
def get_project_review_members(project,role_id,current_user)
|
||||
review_members = []
|
||||
|
||||
if role_id == 3 || role_id == 4
|
||||
|
||||
#AppliedMessage.where(:applied_id => @applied_message.applied_id, :project_id => @applied_message.project_id, :status => 1,
|
||||
#:applied_type => "AppliedProject")
|
||||
|
||||
|
||||
apply_messages = AppliedMessage.where(:user_id => current_user.id, :project_id => project.id, :status => 1, :role=>role_id)
|
||||
|
||||
apply_messages.each do |m|
|
||||
user = User.find(m.applied_user_id)
|
||||
|
||||
if user
|
||||
img_url = url_to_avatar(user)
|
||||
gender = user.user_extensions.gender.nil? ? 0 : user.user_extensions.gender
|
||||
work_unit = get_user_work_unit user
|
||||
location = get_user_location user
|
||||
review_members << {:id => user.id, :img_url => img_url, :nickname => user.login, :gender => gender,
|
||||
:work_unit => work_unit, :mail => user.mail, :location => location,
|
||||
role_name: "",
|
||||
name: user.show_name,
|
||||
roles_id: role_id,
|
||||
:brief_introduction => user.user_extensions.brief_introduction,:realname=>user.realname}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
review_members
|
||||
end
|
||||
|
||||
def get_reviewer_info params
|
||||
info = nil
|
||||
project = Project.find(params[:project_id])
|
||||
if project
|
||||
messages = AppliedProject.where("project_id = ? and user_id=?",project.id,params[:user_id]).first
|
||||
|
||||
if messages
|
||||
user = User.find(params[:user_id])
|
||||
if user
|
||||
img_url = url_to_avatar(user)
|
||||
gender = user.user_extensions.gender.nil? ? 0 : user.user_extensions.gender
|
||||
work_unit = get_user_work_unit user
|
||||
location = get_user_location user
|
||||
info = {:id => user.id, :img_url => img_url, :nickname => user.login, :gender => gender,
|
||||
:work_unit => work_unit, :mail => user.mail, :location => location,
|
||||
role_name: "",
|
||||
name: user.show_name,
|
||||
roles_id: messages.role_id,
|
||||
:brief_introduction => user.user_extensions.brief_introduction,:realname=>user.realname}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
info
|
||||
end
|
||||
|
||||
def deal_join_apply params,current_user
|
||||
status = -1
|
||||
message = ""
|
||||
|
||||
project = Project.find(params[:project_id])
|
||||
|
||||
if project
|
||||
messages = AppliedProject.where("project_id = ? and user_id=?",project.id,params[:user_id]).first
|
||||
if messages
|
||||
apply_user = User.find(params[:user_id])
|
||||
|
||||
#
|
||||
|
||||
|
||||
status = 0
|
||||
else
|
||||
message = "该申请不存在或已被处理"
|
||||
end
|
||||
else
|
||||
message = "该班级不存在或已被删除"
|
||||
end
|
||||
|
||||
{:status => status,:message => message}
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -139,11 +139,16 @@ class WechatService
|
|||
data
|
||||
end
|
||||
|
||||
def three_keys_template(openid, template_id, type, id, first, key1, key2, key3, remark="")
|
||||
def three_keys_template(openid, template_id, type, id, first, key1, key2, key3, remark="",uid)
|
||||
tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}/#{id}"
|
||||
if uid && uid != 0
|
||||
tmpurl = tmpurl + "&user_id="+uid
|
||||
end
|
||||
|
||||
data = {
|
||||
touser:openid,
|
||||
template_id:template_id,
|
||||
url:"#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}/#{id}",#/assets/wechat/app.html#/#{type}/#{id}
|
||||
url:tmpurl,#/assets/wechat/app.html#/#{type}/#{id}
|
||||
topcolor:"#FF0000",
|
||||
data:{
|
||||
first: {
|
||||
|
@ -171,11 +176,16 @@ class WechatService
|
|||
data
|
||||
end
|
||||
|
||||
def four_keys_template(openid, template_id, type, id, first, key1, key2, key3, key4, remark="")
|
||||
def four_keys_template(openid, template_id, type, id, first, key1, key2, key3, key4, remark="",uid)
|
||||
tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}/#{id}"
|
||||
if uid && uid != 0
|
||||
tmpurl = tmpurl + "&user_id="+uid
|
||||
end
|
||||
|
||||
data = {
|
||||
touser:openid,
|
||||
template_id:template_id,
|
||||
url:"#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}/#{id}", #/assets/wechat/app.html#/#{type}/#{id}
|
||||
url:tmpurl, #/assets/wechat/app.html#/#{type}/#{id}
|
||||
topcolor:"#FF0000",
|
||||
data:{
|
||||
first: {
|
||||
|
@ -269,10 +279,10 @@ class WechatService
|
|||
end
|
||||
end
|
||||
|
||||
def class_notice(user_id, type, id, first, key1, key2, key3, key4, remark="")
|
||||
def class_notice(user_id, type, id, first, key1, key2, key3, key4, remark="",uid=0)
|
||||
uw = UserWechat.where(user_id: user_id).first
|
||||
unless uw.nil?
|
||||
data = four_keys_template uw.openid,Wechat.config.class_notice, type, id, first, key1, key2, key3, key4, remark
|
||||
data = four_keys_template uw.openid,Wechat.config.class_notice, type, id, first, key1, key2, key3, key4, remark, uid
|
||||
begin
|
||||
req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data)
|
||||
rescue Exception => e
|
||||
|
@ -360,4 +370,17 @@ class WechatService
|
|||
end
|
||||
end
|
||||
|
||||
def project_review_notice(user_id, type, id, first, key1, key2,key3,remark="",uid=0)
|
||||
uw = UserWechat.where(user_id: user_id).first
|
||||
unless uw.nil?
|
||||
data = three_keys_template uw.openid,Wechat.config.project_review_notice, type, id, first, key1, key2, key3, remark,uid
|
||||
begin
|
||||
req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data)
|
||||
rescue Exception => e
|
||||
Rails.logger.error "[project_review_notice] ===> #{e}"
|
||||
end
|
||||
Rails.logger.info "send over. #{req}"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
|
@ -22,7 +22,7 @@ default: &default
|
|||
class_notice: "MQ_mFupbXP-9jWbeHT3C5xqNBvPo8EIlNv4ULakSpJA"
|
||||
create_class_notice: "2GtJJGzzNlNy2i0UrsjEDlvfSVIUXQfSo47stpcQAVw"
|
||||
create_project_notice: "jYu0iimbDpgWYZaTLXioZe2lvqoWTdKnUPyphTJ1mxs"
|
||||
|
||||
project_review_notice: "kdb-8UlMjTc3z51Qcf8g2vY4i_nE4OGKZAucdQma_2E"
|
||||
production:
|
||||
<<: *default
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ default: &default
|
|||
class_notice: "8LVu33l6bP-56SDomVgHn-yJc57YpCwwJ81rAJgRONk"
|
||||
create_class_notice: "9CDIvHIKiGwPEQWRw_-wieec1o50tMXQPPZIfECKu0I"
|
||||
create_project_notice: "R2ZaQKJfDJgujPcHWPzadKHIRkIyj2CjX2o_qIuRqig"
|
||||
project_review_notice: "cwpAHzdrYQo0Gc5ZKCBHMYEe8NjlOF6KpMGklMch8RM"
|
||||
|
||||
production:
|
||||
<<: *default
|
||||
|
|
|
@ -110,16 +110,27 @@
|
|||
</div>
|
||||
<div class="member-banner f13 c-grey3">管理人员({{project_master_members.length}})</div>
|
||||
<div class="class-member-row f13 c-grey3" ng-repeat="master in project_master_members|filter:searchText">
|
||||
<img ng-src="/images/wechat/{{master.user.gender==0 ? 'male' : 'female'}}.jpg" width="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{master.user.real_name == "" ? master.user.name : master.user.real_name }}</span><span class="fr mr10 c-grey2">{{teacher.role_name|identify}}</span><img ng-src="/images/wechat/{{master.user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
|
||||
<img ng-src="/images/wechat/{{master.user.gender==0 ? 'male' : 'female'}}.jpg" width="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{master.user.real_name == "" ? master.user.name : master.user.real_name }}</span><img ng-src="/images/wechat/{{master.user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
|
||||
<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(master)" />
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div ng-show="project.can_setting" class="class-member-row f13 c-grey3" ng-repeat="user in review_master_members|filter:searchText">
|
||||
<img ng-src="/images/wechat/{{user.gender==0 ? 'male' : 'female'}}.jpg" width="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{user.real_name == "" ? user.name : user.real_name }}</span><span class="fr mr10 c-grey2"></span><img ng-src="/images/wechat/{{user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
|
||||
<span ng-click="review(user)" class = "fr mr25 mt5">待审批</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<div class="member-banner f13 mt10 c-grey3">开发人员({{project_develop_members.length}})</div>
|
||||
<div class="class-member-row f13 c-grey3" ng-repeat="develop in project_develop_members|filter:searchText">
|
||||
<img ng-src="/images/wechat/{{develop.user.gender==0 ? 'male' : 'female'}}.jpg" width="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{develop.user.real_name == "" ? develop.user.name : develop.user.real_name}}</span><img ng-src="/images/wechat/{{develop.user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
|
||||
<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(develop)" />
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div ng-show="project.can_setting" class="class-member-row f13 c-grey3" ng-repeat="user in review_develop_members|filter:searchText">
|
||||
<img ng-src="/images/wechat/{{user.gender==0 ? 'male' : 'female'}}.jpg" width="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{user.real_name == "" ? user.name : user.real_name}}</span><img ng-src="/images/wechat/{{user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
|
||||
<span ng-click="review(user)" class = "fr mr25 mt5">待审批</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="member-banner f13 mt10 c-grey3">报告人员({{project_report_members.length}})</div>
|
||||
<div class="class-member-row f13 c-grey3" ng-repeat="report in project_report_members|filter:searchText">
|
||||
<img ng-src="/images/wechat/{{report.user.gender==0 ? 'male' : 'female'}}.jpg" width="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{report.user.real_name == "" ? report.user.name : report.user.real_name}}</span><img ng-src="/images/wechat/{{report.user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
<div class="post-container">
|
||||
<div loading-spinner></div>
|
||||
<div ng-show="current_edit_member" class="post-container" style="padding-bottom:50px;">
|
||||
<div class="blue-title">角色变更</div>
|
||||
<div class="blue-title">{{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="syllabus.title" required placeholder="请输入6位邀请码" /></div>
|
||||
<div class="course-list-row f13 c-grey3 mt10"><span class="fl ml10">角色</span></div>
|
||||
<ul class="class-list f13 c-grey3">
|
||||
<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': role_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': role_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': role_id == 5}]"></span></li>
|
||||
<li><span class="fl ml10 class-list-name hidden">管理人员</span><span ng-class="['login-box', 'fr', 'mr10', 'mt12',{'bg-grey':current_review_member.roles_id == 4,'checked': current_edit_member.roles_id == 3}]"></span></li>
|
||||
<li><span class="fl ml10 class-list-name hidden">开发人员</span><span ng-class="['login-box', 'fr', 'mr10', 'mt12',{'bg-grey':current_review_member.roles_id == 3,'checked': current_edit_member.roles_id == 4}]"></span></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="join_project()" class="weixin-tab link-blue2 border-top">确定</a>
|
||||
<a href="javascript:void(0);" ng-click="deal(1)" class="weixin-tab c-grey border-top">拒绝</a>
|
||||
<a href="javascript:void(0);" ng-click="deal(0)" class="weixin-tab link-blue2 border-top">同意</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -19,6 +19,12 @@ app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'aut
|
|||
vm.project_develop_members = rms.get("project_develop_members") || [];
|
||||
vm.project_report_members = rms.get("project_report_members") || [];
|
||||
|
||||
// vm.review_master_members = rms.get("review_master_members") || [];
|
||||
// vm.review_develop_members = rms.get("review_master_members") || [];
|
||||
|
||||
vm.review_master_members = [];
|
||||
vm.review_develop_members = [];
|
||||
|
||||
// vm.project_members_has_more = rms.get("project_members_has_more");
|
||||
|
||||
vm.alertService = alertService.create();
|
||||
|
@ -82,6 +88,8 @@ app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'aut
|
|||
vm.project_develop_members = response.data.develop_members;
|
||||
vm.project_report_members = response.data.report_members;
|
||||
|
||||
vm.review_master_members = response.data.review_master_members;
|
||||
vm.review_develop_members = response.data.review_develop_members;
|
||||
}
|
||||
else{
|
||||
vm.alertService.showMessage('提示', response.data.message);
|
||||
|
@ -201,4 +209,11 @@ app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'aut
|
|||
$location.path("/edit_project_member").search({id: projectid,user_id: data.user.id});
|
||||
};
|
||||
|
||||
vm.review = function(user){
|
||||
rms.save('current_review_member', user);
|
||||
rms.save('current_project', vm.project);
|
||||
|
||||
$location.path("/review_project_member").search({id: projectid,user_id: user.id});
|
||||
}
|
||||
|
||||
}]);
|
|
@ -4,106 +4,65 @@ app.controller('ReviewProjectMemberController', ['$scope', '$http', 'auth', 'con
|
|||
var vm = $scope;
|
||||
|
||||
// vm.current_edit_member = rms.get('current_edit_member');
|
||||
vm.current_edit_member = null;
|
||||
|
||||
vm.current_review_member = rms.get('current_review_member');
|
||||
vm.current_project = rms.get('current_project');
|
||||
|
||||
vm.alertService = alertService.create();
|
||||
|
||||
var course_id = $routeParams.id;
|
||||
var project_id = $routeParams.id;
|
||||
var user_id = $routeParams.user_id;
|
||||
|
||||
vm.teacher = false; //教师
|
||||
vm.assistant = false; //教辅
|
||||
vm.student = false; //学生.
|
||||
if(!vm.current_course){
|
||||
$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);
|
||||
}
|
||||
|
||||
vm.tmpteacher = false; //教师
|
||||
vm.tmpassistant = false; //教辅
|
||||
vm.tmpstudent = false; //学生
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
if(!vm.current_edit_member){
|
||||
$http.post(config.apiUrl+'courses/get_member_info', {
|
||||
if(!vm.current_review_member){
|
||||
$http.post(config.apiUrl+'projects/review_member_info', {
|
||||
token: auth.token(),
|
||||
id: course_id,
|
||||
project_id: project_id,
|
||||
user_id:user_id
|
||||
}).then(function(response){
|
||||
if(response.data.status!=0){
|
||||
vm.alertService.showMessage('提示', response.data.message);
|
||||
} else {
|
||||
console.log(response);
|
||||
course_id = response.data.course_id;
|
||||
user_id = response.data.user_id;
|
||||
vm.current_edit_member = response.data.member_info;
|
||||
vm.current_roles_id = vm.current_edit_member.roles_id;
|
||||
|
||||
for(var i in vm.current_roles_id){
|
||||
if(vm.current_roles_id[i] == 9){
|
||||
vm.teacher = true;
|
||||
vm.tmpteacher = true;
|
||||
}
|
||||
else if(vm.current_roles_id[i] == 7){
|
||||
vm.assistant = true;
|
||||
vm.tmpassistant = true;
|
||||
}
|
||||
else if(vm.current_roles_id[i] == 10){
|
||||
vm.student = true;
|
||||
vm.tmpstudent = true;
|
||||
}
|
||||
}
|
||||
vm.current_review_member = response.data.data;
|
||||
console.log("review_member_info");
|
||||
console.log(response.data.data);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
vm.cancel = function(){
|
||||
// vm.alertService.showMessage('提示', '您确定不对角色进行变更吗?', function(){
|
||||
// window.history.back();
|
||||
// });
|
||||
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;
|
||||
}
|
||||
|
||||
if((vm.teacher == false)&& (vm.assistant == false)&&(vm.student == false)){
|
||||
vm.alertService.showMessage('提示', "请至少选择一种角色");
|
||||
return;
|
||||
}
|
||||
|
||||
$http.post(config.apiUrl+'courses/edit_member_role', {
|
||||
vm.deal = function(result){
|
||||
$http.post(config.apiUrl+'projects/deal_join_apply', {
|
||||
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});
|
||||
project_id: project_id,
|
||||
user_id:user_id,
|
||||
type:result
|
||||
}).then(function(response) {
|
||||
if (response.data.status == 0) {
|
||||
vm.alertService.showMessage('提示', response.data.message, function () {
|
||||
$location.path("/project_list");
|
||||
});
|
||||
}
|
||||
else{
|
||||
vm.alertService.showMessage('提示', response.data.message);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
vm.selectRole = function(role_id){
|
||||
if (role_id == 7){
|
||||
if(!vm.teacher){
|
||||
vm.assistant = !vm.assistant;
|
||||
}
|
||||
}
|
||||
else if (role_id == 9){
|
||||
if(!vm.assistant){
|
||||
vm.teacher = !vm.teacher;
|
||||
}
|
||||
}
|
||||
else if (role_id == 10){
|
||||
vm.student = !vm.student;
|
||||
}
|
||||
}
|
||||
|
||||
}] );
|
Loading…
Reference in New Issue