diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb
index bfd559402..a42ebd470 100644
--- a/app/api/mobile/apis/courses.rb
+++ b/app/api/mobile/apis/courses.rb
@@ -540,6 +540,7 @@ module Mobile
present :status, 0
else
present :status, -1
+ present :message, "该用户已不在班级中"
end
end
@@ -568,14 +569,20 @@ module Mobile
roles_id << 10
end
-
c = Course.find("#{params[:id]}")
- #7教辅 9教师 10学生
- if c.tea_id == params[:user_id] || c.tea_id != current_user.id || roles_id.length <= 0
- present :status, -1
- else
+ my_member = c.member_principals.where("users.id=#{current_user.id}").first
+ rolesids = []
+ my_member.roles.each do |role|
+ rolesids << role.id
+ end
+
+ #7教辅 9教师 10学生
+ if c.tea_id == params[:user_id] || roles_id.length <= 0 || rolesids.include?(10)
+ present :status, -1
+ present :message,"修改失败"
+ else
cs = CoursesService.new
status = cs.modify_user_course_role params,roles_id
present :status, status
@@ -661,6 +668,85 @@ module Mobile
end
+ desc "删除班级成员"
+ params do
+ requires :id, type: Integer
+ requires :token, type: String
+ requires :user_id, type: Integer
+ end
+ post ':id/deletemember' do
+ authenticate!
+
+ status = -1
+
+ if(current_user.id != params[:user_id].to_i)
+ #权限
+ c = Course.find("#{params[:id]}")
+ if c.tea_id != params[:user_id].to_i
+
+ 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?(3) || roles_ids.include?(7) || roles_ids.include?(9) )
+ #删除该成员
+ cs = CoursesService.new
+ status = cs.delete_course_member(c,params[:user_id].to_i,current_user)
+ else
+ status = -2
+ end
+ else
+ status = -3
+ end
+ else
+ status = -4
+ end
+
+ out = {status: status}
+ message = case status
+ when 0; "删除成功"
+ when -1; "您还未登录"
+ when -2; "对不起您没有权限"
+ when -3; "不能删除班级管理员"
+ when -4; "不能删除自己"
+ when 1; "该用户不在该班级中"
+ else; "未知错误,请稍后再试"
+ end
+ out.merge(message: message)
+ end
+
+ desc "退出班级"
+ params do
+ requires :id, type: Integer
+ requires :token, type: String
+ end
+ post ':id/quit' do
+ authenticate!
+
+ #管理员不能退
+ cs = CoursesService.new
+ c = Course.find("#{params[:id]}")
+
+ user = current_user
+
+ if c.tea_id != user.id
+ status = cs.exit_course({:object_id => params[:id]}, user)
+ else
+ status = 3
+ end
+ out = {status: status}
+ message = case status
+ when 0; "退出班级成功"
+ when 1; "您不是该班级成员"
+ when 2; "您还未登录"
+ when 3; "管理员不能退出班级"
+ else; "未知错误,请稍后再试"
+ end
+ out.merge(message: message)
+ end
end
end
end
diff --git a/app/api/mobile/apis/projects.rb b/app/api/mobile/apis/projects.rb
index 2202fbd13..ecd850fd8 100644
--- a/app/api/mobile/apis/projects.rb
+++ b/app/api/mobile/apis/projects.rb
@@ -127,6 +127,7 @@ module Mobile
present :status, 0
else
present :status, -1
+ present :message, "该用户已不在项目中"
end
end
@@ -268,6 +269,81 @@ module Mobile
present :status, 0
end
+
+ desc "删除项目成员"
+ params do
+ requires :id, type: Integer
+ requires :token, type: String
+ requires :user_id, type: Integer
+ end
+ post ':id/deletemember' do
+ authenticate!
+
+ status = -1
+
+ if(current_user.id != params[:user_id].to_i)
+ #权限
+ project = Project.find("#{params[:id]}")
+ if project.user_id != params[:user_id].to_i
+
+ my_member = project.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?(3)
+ #删除该成员
+ ps = ProjectsService.new
+ status = ps.project_delete_member(project,params[:user_id].to_i,current_user)
+ else
+ status = -2
+ end
+ else
+ status = -3
+ end
+ else
+ status = -4
+ end
+
+ out = {status: status}
+ message = case status
+ when 0; "删除成功"
+ when 1; "该用户不在该项目中"
+ when -1; "您还未登录"
+ when -2; "您没有权限"
+ when -3; "不能删除项目创建者"
+ when -4; "不能删除自己"
+ else; "未知错误,请稍后再试"
+ end
+ out.merge(message: message)
+ end
+
+ desc "退出项目"
+ params do
+ requires :id, type: Integer
+ requires :token, type: String
+ end
+ post ':id/quit' do
+ authenticate!
+
+ project = Project.find("#{params[:id]}")
+
+ ps = ProjectsService.new
+ status = ps.exit_project(project,current_user)
+
+ out = {status: status}
+ message = case status
+ when 0; "退出项目成功"
+ when -3; "您不是该项目成员"
+ when -1; "您还未登录"
+ when -2; "项目创建者不能退出项目"
+ else; "未知错误,请稍后再试"
+ end
+ out.merge(message: message)
+ end
+
end
end
end
diff --git a/app/api/mobile/entities/activity.rb b/app/api/mobile/entities/activity.rb
index a56deaad3..9deeec58e 100644
--- a/app/api/mobile/entities/activity.rb
+++ b/app/api/mobile/entities/activity.rb
@@ -73,6 +73,12 @@ module Mobile
elsif ac.container_type == "Blog"
"发表博客"
end
+ when :course_project_id
+ if ac.container_type == "Course"
+ ac.container_id
+ elsif ac.container_type == "Project"
+ ac.container_id
+ end
when :activity_type_name
if ac.container_type == "Course"
case ac.act_type
@@ -137,6 +143,7 @@ module Mobile
act_expose :subject #标题
act_expose :description #描述
act_expose :latest_update #最新更新时间
+ act_expose :course_project_id #课程/项目ID
act_expose :course_project_name #课程/项目名字
act_expose :activity_type_name #课程问答区/项目缺陷等
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
diff --git a/app/api/mobile/entities/project.rb b/app/api/mobile/entities/project.rb
index 8da151b42..eef7a9c92 100644
--- a/app/api/mobile/entities/project.rb
+++ b/app/api/mobile/entities/project.rb
@@ -3,6 +3,7 @@ module Mobile
class Project < Grape::Entity
expose :name
expose :id
+ expose :is_public
expose :user_id
expose :invite_code
expose :qrcode
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index caf0b4bda..4c9411538 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -589,19 +589,19 @@ class IssuesController < ApplicationController
return false
end
end
- @issue.safe_attributes = issue_attributes
senduser = User.find(params[:issue][:assigned_to_id])
- if senduser.id != User.current.id
+ if senduser.id != User.current.id && @issue.assigned_to_id != params[:issue][:assigned_to_id].to_i
issue_id = @issue.id
issue_title = params[:issue][:subject]
priority_id = params[:issue][:priority_id]
-
ps = ProjectsService.new
ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id
end
+ @issue.safe_attributes = issue_attributes
+
@priorities = IssuePriority.active
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
true
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index d0ec28317..3c125a185 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -3244,6 +3244,16 @@ def get_all_children result, jour
result
end
+#获取该节点所在的帖子
+def get_root_parent comment
+ while comment.parent
+ comment = comment.parent
+ end
+ comment
+end
+
+
+
#将有置顶属性的提到数组前面
def sort_by_sticky topics
tmpTopics = []
diff --git a/app/models/at_message.rb b/app/models/at_message.rb
index bca2c7ba4..4c3ca9b74 100644
--- a/app/models/at_message.rb
+++ b/app/models/at_message.rb
@@ -1,6 +1,7 @@
#coding=utf-8
class AtMessage < ActiveRecord::Base
+ include ApplicationHelper
belongs_to :user
belongs_to :sender, class_name: "User", foreign_key: "sender_id"
attr_accessible :at_message, :container, :viewed, :user_id, :sender_id
@@ -10,7 +11,7 @@ class AtMessage < ActiveRecord::Base
has_many :message_alls, :class_name => 'MessageAll',:as =>:message, :dependent => :destroy
validates :user_id, :sender_id, :at_message_id, :at_message_type, presence: true
- after_create :add_user_message
+ after_create :add_user_message, :send_wechat_message
scope :unviewed, ->(type, id){
where(at_message_type: type, at_message_id:id, viewed: false)
@@ -34,6 +35,91 @@ class AtMessage < ActiveRecord::Base
end
end
+ #@的时候发微信模版消息通知被@的人
+ def send_wechat_message
+ shield_type = ""
+ container_id = 0
+ status = 0
+ type = ""
+ detail_id = 0
+ detail_title = ""
+
+ if defined? at_message.notes
+ detail_content = strip_html at_message.notes,30
+ elsif defined? at_message.content
+ detail_content = strip_html at_message.content,30
+ elsif defined? at_message.description
+ detail_content = strip_html at_message.description,30
+ end
+
+ user = self.user
+
+ topic = get_root_parent at_message
+
+ case at_message_type
+ when "Issue"
+ #新建issue
+ shield_type = "Project"
+ container_id = at_message.project.id
+ type = "issues"
+ detail_id = topic.id
+ detail_title = at_message.subject
+ when "Journal"
+ #issue回复
+ topic = get_root_parent at_message.journalized
+ shield_type = "Project"
+ container_id = at_message.journalized.project.id
+ type = "issues"
+ detail_id = topic.id
+ detail_title = at_message.journalized.subject
+ when 'Message'
+ if at_message.course
+ shield_type = "Course"
+ container_id = at_message.course.id
+ type = "course_discussion"
+ detail_id = topic.id
+ detail_title = at_message.subject
+ elsif at_message.project
+ shield_type = "Project"
+ container_id = at_message.project.id
+ type = "project_discussion"
+ detail_id = topic.id
+ detail_title = at_message.subject
+ else
+ status = -1
+ end
+ when 'JournalsForMessage'
+ if at_message.jour && at_message.jour.course
+ #作业回复
+ shield_type = "Course"
+ container_id = at_message.jour.course.id
+ type = "homework"
+ detail_id = at_message.jour.id
+ detail_title = at_message.jour.name
+ else
+ type = "journal_for_message"
+ detail_id = topic.id
+ detail_title = at_message.subject
+ end
+ else
+ status = -1
+ end
+
+ count = 0
+
+ detail_title = detail_title.gsub(/RE: /, '')
+
+ if container_id != 0
+ count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='#{shield_type}' and shield_id=#{container_id}").count
+ end
+ if count == 0 && status == 0
+ message_title = self.sender.show_name+"@了您"
+ ws = WechatService.new
+ ws.at_notice user.id, type, detail_id, message_title, detail_title, format_time(Time.now), detail_content, "点击查看详情。",0
+ end
+
+ end
+
def subject
case at_message_type
when "Issue"
diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb
index 7d574bada..f184fa923 100644
--- a/app/services/courses_service.rb
+++ b/app/services/courses_service.rb
@@ -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
@@ -1284,5 +1285,35 @@ class CoursesService
status
end
+ #删除班级成员
+ def delete_course_member course,user_id,current_user
+ if current_user.nil?
+ state = -1
+ return state
+ end
+
+ member = course.members.where("user_id=?",user_id).first
+
+ if member != nil
+ member.destroy
+ user_admin = CourseInfos.where("user_id = ? and course_id = ?", member.user_id, course.id)
+ if user_admin.size > 0
+ user_admin.each do |user|
+ user.destroy
+ end
+ end
+ joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,course.id)
+ joined.each do |join|
+ join.delete
+ end
+ roles = Role.givable.all[3..5]
+ #移出课程发送消息
+ CourseMessage.create(:user_id => member.user_id, :course_id => course.id, :course_message_type => "RemoveFromCourse", :viewed => false, :course_message_id => current_user.id)
+ return 0
+ else
+ return 1
+ end
+ end
+
end
diff --git a/app/services/projects_service.rb b/app/services/projects_service.rb
index fc7f25d1f..f3679aa22 100644
--- a/app/services/projects_service.rb
+++ b/app/services/projects_service.rb
@@ -355,4 +355,67 @@ class ProjectsService
end
end
+ #删除项目成员
+ def project_delete_member project,user_id,current_user
+ if current_user.nil?
+ state = -1
+ return state
+ end
+
+ member = project.members.where("user_id=?",user_id).first
+
+ if member != nil
+ member.destroy
+ # end
+ user_admin = ProjectInfo.where("user_id = ? and project_id = ?", member.user_id, project.id)
+ if user_admin.size > 0
+ user_admin.each do |user|
+ user.destroy
+ end
+ end
+ user_grade = UserGrade.where("user_id = ? and project_id = ?", member.user_id, project.id)
+ if user_grade.size > 0
+ user_grade.each do |grade|
+ grade.destroy
+ end
+ end
+ # 移出的时候删除申请消息,不需要删除消息,所以不必要关联删除
+ applied_projects = AppliedProject.where(:project_id => project.id, :user_id => member.user_id).first
+ unless applied_projects.nil?
+ applied_projects.delete
+ end
+ #移出项目发送消息
+ ForgeMessage.create(:user_id => member.user_id, :project_id => project.id, :forge_message_type => "RemoveFromProject", :viewed => false, :forge_message_id => current_user.id)
+ return 0
+ else
+ return 1
+ end
+ end
+
+ def exit_project project,user
+ if user.nil?
+ state = -1
+ return state
+ end
+
+ if project.user_id == user.id
+ state = -2
+ return state
+ end
+
+ members = Member.where(:user_id => user.id, :project_id=>project.id).first
+ if members != nil
+ members.destroy
+ # 移出的时候删除申请消息,不需要删除消息,所以不必要关联删除
+ applied_projects = AppliedProject.where(:project_id => project.id, :user_id => members.user_id).first
+ unless applied_projects.nil?
+ applied_projects.delete
+ end
+ state = 0
+ else
+ state = -3
+ end
+ return state
+ end
+
end
diff --git a/app/services/wechat_service.rb b/app/services/wechat_service.rb
index 423676983..8adc1392f 100644
--- a/app/services/wechat_service.rb
+++ b/app/services/wechat_service.rb
@@ -432,4 +432,17 @@ class WechatService
end
end
+ def at_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.at_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 "[at_notice] ===> #{e}"
+ end
+ Rails.logger.info "send over. #{req}"
+ end
+ end
+
end
\ No newline at end of file
diff --git a/config/menu.yml.production b/config/menu.yml.production
index 55318e811..8929d002e 100644
--- a/config/menu.yml.production
+++ b/config/menu.yml.production
@@ -22,14 +22,6 @@ button:
-
name: "更多"
sub_button:
- -
- type: "view"
- name: "加入班级"
- url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=join_class#wechat_redirect"
- -
- type: "view"
- name: "加入项目"
- url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=join_project#wechat_redirect"
-
type: "view"
name: "历史推文"
diff --git a/config/menu.yml.test b/config/menu.yml.test
index 45e23aaf3..303b30c26 100644
--- a/config/menu.yml.test
+++ b/config/menu.yml.test
@@ -22,14 +22,6 @@ button:
-
name: "更多"
sub_button:
- -
- type: "view"
- name: "加入班级"
- url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=join_class#wechat_redirect"
- -
- type: "view"
- name: "加入项目"
- url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=join_project#wechat_redirect"
-
type: "view"
name: "历史推文"
diff --git a/config/wechat.yml.template b/config/wechat.yml.template
index adda8e7e8..8ca6ac237 100644
--- a/config/wechat.yml.template
+++ b/config/wechat.yml.template
@@ -25,6 +25,7 @@ default: &default
project_review_notice: "kdb-8UlMjTc3z51Qcf8g2vY4i_nE4OGKZAucdQma_2E"
join_project_notice: "TtXvy0XMIQyCgpnXHhoB8t-x0QIfy-78gAJXsGf9afg"
project_issue_notice: "HP8JejOnkzmvFopTarc0l1Tp4bU9qnxzdH27x3186lI"
+ at_notice: "U3kqzgriCaqkPI9qX0NDQOInJ5hiwHCz6wgTsPysSx4"
auto_openid_url_1: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/wechat/user_activities"
auto_openid_url_2: "&response_type=code&scope=snsapi_base&state="
diff --git a/config/wechat.yml.test b/config/wechat.yml.test
index 8c0dafc2f..12cee4751 100644
--- a/config/wechat.yml.test
+++ b/config/wechat.yml.test
@@ -25,6 +25,7 @@ default: &default
project_review_notice: "ip192wVXTav3qchgUn9_7B6lFfTlCZjwL7A1tncTOuc"
join_project_notice: "3KnMQEMUCmQWkB5JvzrpmguEwnN8bvUHUdpOTudxv_M"
project_issue_notice: "HAF2aCta7BtnaOd_cotGvU4tErGWwCd9I9aiClFN7w8"
+ at_notice: "p4HfyZQuF8O5bP_44RbbJS30SGojLJAuZEqp34iB4JU"
auto_openid_url_1: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities"
auto_openid_url_2: "&response_type=code&scope=snsapi_base&state="
diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html
index 506dcc724..2d45f4d17 100644
--- a/public/assets/wechat/activities.html
+++ b/public/assets/wechat/activities.html
@@ -40,7 +40,7 @@
- 来源: {{act.course_project_name}}
+ 来源: {{act.course_project_name}}
赞
{{act.praise_count}}
@@ -75,7 +75,7 @@
- 来源: {{act.course_project_name}}
+ 来源: {{act.course_project_name}}
赞
{{act.praise_count}}
@@ -111,7 +111,7 @@
- 来源: {{act.course_project_name}}
+ 来源: {{act.course_project_name}}
赞
{{act.praise_count}}
@@ -147,7 +147,7 @@
- 来源: {{act.course_project_name}}
+ 来源: {{act.course_project_name}}
@@ -236,7 +236,7 @@
- 来源: {{act.course_project_name}}
+ 来源: {{act.course_project_name}}
赞
{{act.praise_count}}
@@ -272,7 +272,7 @@
- 来源: {{act.course_project_name}}
+ 来源: {{act.course_project_name}}
赞
{{act.praise_count}}
@@ -405,7 +405,7 @@
- 来源: {{act.course_project_name}}
+ 来源: {{act.course_project_name}}
赞
{{act.praise_count}}
@@ -440,7 +440,7 @@
- 来源: {{act.course_project_name}}
+ 来源: {{act.course_project_name}}
赞
{{act.praise_count}}
@@ -476,7 +476,7 @@
- 来源: {{act.course_project_name}}
+ 来源: {{act.course_project_name}}
赞
{{act.praise_count}}
@@ -492,6 +492,42 @@
+
+
+
+
+
+
+
+
{{act.author.real_name}}
+
+
+
+
{{act.latest_update}}
+
+
【问卷】{{act.subject|safeHtml}}
+
+
+
+
+
来源: {{act.course_project_name}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- 来源: {{act.course_project_name}}
+ 来源: {{act.course_project_name}}
赞
{{act.praise_count}}
@@ -572,7 +608,7 @@
- 来源: {{act.course_project_name}}
+ 来源: {{act.course_project_name}}
-
+
diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html
index 9b69916c8..f81b4f5f0 100644
--- a/public/assets/wechat/class.html
+++ b/public/assets/wechat/class.html
@@ -1,277 +1,282 @@
-
-
-
{{course.name}}邀请码
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{act.author.real_name}}
-
-
-
-
{{act.latest_update}}
-
-
【作业】{{act.subject|safeHtml}}
-
-
-
迟交扣分:{{act.homework_common_detail.late_penalty}}分 匿评开启时间:{{act.homework_common_detail.evaluation_start}}
-
缺评扣分:{{act.homework_common_detail.absence_penalty}}分/作品 匿评关闭时间:{{act.homework_common_detail.evaluation_end}}
-
-
-
-
-
-
赞
-
{{act.praise_count}}
-
{{act.praise_count}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{act.author.real_name}}
-
-
-
-
{{act.latest_update}}
-
-
【通知】{{act.subject|safeHtml}}
-
-
-
-
-
-
赞
-
{{act.praise_count}}
-
{{act.praise_count}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{act.author.real_name}}
-
-
-
-
{{act.latest_update}}
-
-
【帖子】{{act.subject|safeHtml}}
-
-
-
-
-
-
-
赞
-
{{act.praise_count}}
-
{{act.praise_count}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{act.author.real_name}}
-
-
-
-
{{act.latest_update}}
-
-
【问卷】{{act.subject|safeHtml}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{act.author.real_name}}创建了{{act.course_project_name}} | 班级
-
{{act.latest_update}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{r.filename}}发送
-
暂无课件,
- 请登录Trustie网站,在PC浏览器中上传课件。
-
-
-
授课老师
-
-
-
{{teacher.name}}
-
-
管理员
-
助教
-
-
-
-
-
{{reviewer.name}}
-
待审批 ▶
-
-
-
-
-
我的同学
-
-
-
-
-
{{r.homework_name}}发送
-
暂无作业,
- 请登录Trustie网站,在PC浏览器中上传作业。
-
-
-
-
-
{{r.exercise_name}}发送
-
暂无测验,
- 请登录Trustie网站,在PC浏览器中上传测验。
-
-
-
-
+
+
+
{{course.name}}邀请码
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{act.author.real_name}}
+
+
+
+
{{act.latest_update}}
+
+
【作业】{{act.subject|safeHtml}}
+
+
+
迟交扣分:{{act.homework_common_detail.late_penalty}}分 匿评开启时间:{{act.homework_common_detail.evaluation_start}}
+
缺评扣分:{{act.homework_common_detail.absence_penalty}}分/作品 匿评关闭时间:{{act.homework_common_detail.evaluation_end}}
+
+
+
+
+
+
赞
+
{{act.praise_count}}
+
{{act.praise_count}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{act.author.real_name}}
+
+
+
+
{{act.latest_update}}
+
+
【通知】{{act.subject|safeHtml}}
+
+
+
+
+
+
赞
+
{{act.praise_count}}
+
{{act.praise_count}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{act.author.real_name}}
+
+
+
+
{{act.latest_update}}
+
+
【帖子】{{act.subject|safeHtml}}
+
+
+
+
+
+
+
赞
+
{{act.praise_count}}
+
{{act.praise_count}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{act.author.real_name}}
+
+
+
+
{{act.latest_update}}
+
+
【问卷】{{act.subject|safeHtml}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{act.author.real_name}}创建了{{act.course_project_name}} | 班级
+
{{act.latest_update}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{r.filename}}发送
+
暂无课件,
+ 请登录Trustie网站,在PC浏览器中上传课件。
+
+
+
授课老师
+
+
+
{{teacher.name}}
+
+
管理员
+
助教
+
+
+
+
+
{{reviewer.name}}
+
待审批 ▶
+
+
+
+
+
我的同学
+
+
+
+
+
+
+
{{r.homework_name}}发送
+
暂无作业,
+ 请登录Trustie网站,在PC浏览器中上传作业。
+
+
+
+
+
{{r.exercise_name}}发送
+
暂无测验,
+ 请登录Trustie网站,在PC浏览器中上传测验。
+
+
+
+
+
diff --git a/public/assets/wechat/course_discussion.html b/public/assets/wechat/course_discussion.html
index 7c822bde4..4e309e6d6 100644
--- a/public/assets/wechat/course_discussion.html
+++ b/public/assets/wechat/course_discussion.html
@@ -24,7 +24,7 @@
{{discussion.praise_count}}
{{discussion.praise_count}}
-
+
diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html
index af9f22da1..85b3a901a 100644
--- a/public/assets/wechat/course_notice.html
+++ b/public/assets/wechat/course_notice.html
@@ -23,7 +23,7 @@
{{news.praise_count}}
{{news.praise_count}}
-
+
diff --git a/public/assets/wechat/edit_class_member.html b/public/assets/wechat/edit_class_member.html
index f27ab76cb..decb31efb 100644
--- a/public/assets/wechat/edit_class_member.html
+++ b/public/assets/wechat/edit_class_member.html
@@ -1,19 +1,24 @@
-
-
-
-
角色变更
-
{{current_edit_member.user.realname == "" ? current_edit_member.user.name : current_edit_member.user.realname}}
-
角色
-
-
-
-
-
-
+
+
+
+
成员管理
+
{{current_edit_member.user.realname == "" ? current_edit_member.user.name : current_edit_member.user.realname}}
+
角色变更
+
+
删除成员
+
+
+
+
+
+
+
diff --git a/public/assets/wechat/edit_project_member.html b/public/assets/wechat/edit_project_member.html
index 51294f43e..5500766d5 100644
--- a/public/assets/wechat/edit_project_member.html
+++ b/public/assets/wechat/edit_project_member.html
@@ -1,21 +1,25 @@
-
-
-
-
角色变更
-
{{current_edit_member.user.real_name == "" ? current_edit_member.user.name : current_edit_member.user.real_name}}
-
角色
-
-
-
-
-
-
-
-
+
+
+
+
成员管理
+
{{current_edit_member.user.real_name == "" ? current_edit_member.user.name : current_edit_member.user.real_name}}
+
角色变更
+
+
删除成员
+
+
+
+
+
+
+
+
diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html
index 6ead09e69..7fa8459c4 100644
--- a/public/assets/wechat/homework_detail.html
+++ b/public/assets/wechat/homework_detail.html
@@ -28,7 +28,7 @@
{{homework.praise_count}}
{{homework.praise_count}}
-
+
diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html
index c10d15ddb..efc7ed64d 100644
--- a/public/assets/wechat/issue_detail.html
+++ b/public/assets/wechat/issue_detail.html
@@ -29,7 +29,7 @@
{{issue.praise_count}}
{{issue.praise_count}}
-
+
diff --git a/public/assets/wechat/jour_message_detail.html b/public/assets/wechat/jour_message_detail.html
index 41f7290e5..e2e65ca58 100644
--- a/public/assets/wechat/jour_message_detail.html
+++ b/public/assets/wechat/jour_message_detail.html
@@ -23,7 +23,7 @@
{{message.praise_count}}
{{message.praise_count}}
-
+
diff --git a/public/assets/wechat/project.html b/public/assets/wechat/project.html
index 5b460ecad..89cbb1418 100644
--- a/public/assets/wechat/project.html
+++ b/public/assets/wechat/project.html
@@ -1,144 +1,148 @@
-
-
-
{{project.name}}邀请码
-
-
-
-
-
-
-
-
-
-
-
-
-
{{act.author.real_name}}
-
-
-
-
{{act.latest_update}}
-
-
【问题】{{act.subject|safeHtml}}
-
-
-
状态:{{act.issue_detail.issue_status}} 优先级:{{act.issue_detail.issue_priority}}
-
指派给:{{act.issue_detail.issue_assigned_to}} 完成度:{{act.issue_detail.done_ratio}}%
-
-
-
-
-
-
赞
-
{{act.praise_count}}
-
{{act.praise_count}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{act.author.real_name}}
-
-
-
-
{{act.latest_update}}
-
-
【帖子】{{act.subject|safeHtml}}
-
-
-
-
-
-
赞
-
{{act.praise_count}}
-
{{act.praise_count}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{act.author.real_name}}创建了{{act.course_project_name}} | 项目
-
{{act.latest_update}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
管理人员({{project_master_members.length}})
-
-
{{master.user.real_name == "" ? master.user.name : master.user.real_name }}
-
-
-
-
-
{{user.real_name == "" ? user.name : user.real_name }}
-
待审批 ▶
-
-
-
-
开发人员({{project_develop_members.length}})
-
-
{{develop.user.real_name == "" ? develop.user.name : develop.user.real_name}}
-
-
-
-
-
{{user.real_name == "" ? user.name : user.real_name}}
-
待审批 ▶
-
-
-
报告人员({{project_report_members.length}})
-
-
{{report.user.real_name == "" ? report.user.name : report.user.real_name}}
-
-
-
-
-
-
-
+
+
+
{{project.name}}邀请码
+
+
+
+
+
+
+
+
+
+
+
+
+
{{act.author.real_name}}
+
+
+
+
{{act.latest_update}}
+
+
【问题】{{act.subject|safeHtml}}
+
+
+
状态:{{act.issue_detail.issue_status}} 优先级:{{act.issue_detail.issue_priority}}
+
指派给:{{act.issue_detail.issue_assigned_to}} 完成度:{{act.issue_detail.done_ratio}}%
+
+
+
+
+
+
赞
+
{{act.praise_count}}
+
{{act.praise_count}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{act.author.real_name}}
+
+
+
+
{{act.latest_update}}
+
+
【帖子】{{act.subject|safeHtml}}
+
+
+
+
+
+
赞
+
{{act.praise_count}}
+
{{act.praise_count}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{act.author.real_name}}创建了{{act.course_project_name}} | 项目
+
{{act.latest_update}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
管理人员({{project_master_members.length}})
+
+
{{master.user.real_name == "" ? master.user.name : master.user.real_name }}
+
+
+
+
+
{{user.real_name == "" ? user.name : user.real_name }}
+
待审批 ▶
+
+
+
+
开发人员({{project_develop_members.length}})
+
+
{{develop.user.real_name == "" ? develop.user.name : develop.user.real_name}}
+
+
+
+
+
{{user.real_name == "" ? user.name : user.real_name}}
+
待审批 ▶
+
+
+
报告人员({{project_report_members.length}})
+
+
{{report.user.real_name == "" ? report.user.name : report.user.real_name}}
+
+
+
+
+
+
+
+
+
diff --git a/public/assets/wechat/project_discussion.html b/public/assets/wechat/project_discussion.html
index 4557ba55f..30d464802 100644
--- a/public/assets/wechat/project_discussion.html
+++ b/public/assets/wechat/project_discussion.html
@@ -24,7 +24,7 @@
{{discussion.praise_count}}
{{discussion.praise_count}}
-
+
diff --git a/public/javascripts/wechat/controllers/activity.js b/public/javascripts/wechat/controllers/activity.js
index 25ced0a17..c5a18e2f6 100644
--- a/public/javascripts/wechat/controllers/activity.js
+++ b/public/javascripts/wechat/controllers/activity.js
@@ -126,14 +126,14 @@ app.controller('ActivityController',
}
break;
}
- rms.save("tab_num",$scope.currentTab);
+ rms.save("activity_tab_num",$scope.currentTab);
}
- $scope.currentTab = rms.get('tab_num') || 1;
+ $scope.currentTab = rms.get('activity_tab_num') || 1;
if($scope.activities.length<=0){
- $scope.loadActData('tab_num',0);
+ $scope.loadActData($scope.currentTab,0);
} else {
$timeout(function(){
window.scrollTo(0, rms.get("yoffset"));
@@ -200,4 +200,40 @@ app.controller('ActivityController',
common.decreaseCommonPraise(act);
};
+
+
+ $scope.goClass = function(id){
+ rms.save("activities",[]);
+ rms.save("course_activities",[]);
+ rms.save("project_activities",[]);
+
+ rms.save('course_activities_page',0);
+ rms.save("course_has_more",false);
+ rms.save("course",null);
+ rms.save("tab_num",null);
+
+ rms.save("has_more",false);
+ rms.save("project_has_more",false);
+
+ $location.path("/class").search({id: id});
+ };
+
+ $scope.goProject = function(id){
+ rms.save("activities",[]);
+ rms.save("course_activities",[]);
+ rms.save("project_activities",[]);
+ rms.save('project_activities_page',0);
+ 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);
+ rms.save("has_more",false);
+ rms.save("course_has_more",false);
+
+ $location.path("/project").search({id: id});
+ };
}]);
\ No newline at end of file
diff --git a/public/javascripts/wechat/controllers/class.js b/public/javascripts/wechat/controllers/class.js
index a6fb0feed..2e3ab4b22 100644
--- a/public/javascripts/wechat/controllers/class.js
+++ b/public/javascripts/wechat/controllers/class.js
@@ -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);
@@ -244,6 +246,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
vm.onSetting = function(user){
rms.save('current_edit_member', user);
+ rms.save("course",vm.course);
rms.save("tab_num",vm.currentTab);
$location.path("/edit_class_member").search({id: courseid,user_id: user.id});
};
@@ -251,6 +254,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
vm.review = function(user){
rms.save('current_review_member', user);
rms.save('current_course', vm.course);
+ rms.save("course",vm.course);
rms.save("tab_num",vm.currentTab);
$location.path("/review_class_member").search({id: courseid,user_id: user.id});
};
@@ -323,6 +327,35 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
rms.save("course",vm.course);
// $location.path('/'+type+'/'+act_id);
$location.path("/homework").search({id: id});
- }
+ };
+
+ vm.quit = function(){
+ 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('course_activities_page',0);
+ rms.save("course_activities",[]);
+ rms.save("course_has_more",false);
+ rms.save("course",null);
+ rms.save("tab_num",null);
+ rms.save('syllabuses',[]);
+ $location.path("/class_list");
+ });
+ }
+ else{
+ vm.alertService.showMessage('提示', response.data.message);
+ }
+ });
+ });
+
+ };
+
}]);
\ No newline at end of file
diff --git a/public/javascripts/wechat/controllers/class_publishissue.js b/public/javascripts/wechat/controllers/class_publishissue.js
index 1cd7f1285..09b995bea 100644
--- a/public/javascripts/wechat/controllers/class_publishissue.js
+++ b/public/javascripts/wechat/controllers/class_publishissue.js
@@ -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);
diff --git a/public/javascripts/wechat/controllers/class_publishnotice.js b/public/javascripts/wechat/controllers/class_publishnotice.js
index a0b9ab676..b900305c1 100644
--- a/public/javascripts/wechat/controllers/class_publishnotice.js
+++ b/public/javascripts/wechat/controllers/class_publishnotice.js
@@ -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);
diff --git a/public/javascripts/wechat/controllers/edit_class_member.js b/public/javascripts/wechat/controllers/edit_class_member.js
index e00e36f20..d872dac09 100644
--- a/public/javascripts/wechat/controllers/edit_class_member.js
+++ b/public/javascripts/wechat/controllers/edit_class_member.js
@@ -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;
+ }
+ };
}] );
\ No newline at end of file
diff --git a/public/javascripts/wechat/controllers/edit_project_member.js b/public/javascripts/wechat/controllers/edit_project_member.js
index 511db35bb..b8ecb447d 100644
--- a/public/javascripts/wechat/controllers/edit_project_member.js
+++ b/public/javascripts/wechat/controllers/edit_project_member.js
@@ -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;
+ }
+ };
}] );
\ No newline at end of file
diff --git a/public/javascripts/wechat/controllers/join_class.js b/public/javascripts/wechat/controllers/join_class.js
index 1a9710bc1..006fa0b59 100644
--- a/public/javascripts/wechat/controllers/join_class.js
+++ b/public/javascripts/wechat/controllers/join_class.js
@@ -21,7 +21,9 @@ app.controller('JoinClassController', ['$scope', '$http', 'auth', 'config', 'ale
// window.history.back();
// });
if(tag){
- window.history.back();
+ rms.save('syllabuses',[]);
+ $location.path("/class_list");
+// window.history.back();
}
else{
wx.closeWindow();
@@ -55,6 +57,7 @@ app.controller('JoinClassController', ['$scope', '$http', 'auth', 'config', 'ale
}).then(function(response){
if(response.data.status == 0){
vm.alertService.showMessage('提示', response.data.message,function(){
+ rms.save('syllabuses',[]);
$location.path("/class_list");
});
} else {
diff --git a/public/javascripts/wechat/controllers/join_project.js b/public/javascripts/wechat/controllers/join_project.js
index d942e8859..2e8f9a269 100644
--- a/public/javascripts/wechat/controllers/join_project.js
+++ b/public/javascripts/wechat/controllers/join_project.js
@@ -15,7 +15,9 @@ app.controller('JoinProjectController', ['$scope', '$http', 'auth', 'config', 'a
vm.cancel = function(){
if(tag){
- window.history.back();
+// window.history.back();
+ rms.save('projects',[]);
+ $location.path("/project_list");
}
else{
wx.closeWindow();
@@ -47,6 +49,7 @@ app.controller('JoinProjectController', ['$scope', '$http', 'auth', 'config', 'a
}).then(function(response){
if(response.data.status == 0){
vm.alertService.showMessage('提示', response.data.message,function(){
+ rms.save('projects',[]);
$location.path("/project_list");
});
} else {
diff --git a/public/javascripts/wechat/controllers/project.js b/public/javascripts/wechat/controllers/project.js
index c45696668..1bdb2f1e0 100644
--- a/public/javascripts/wechat/controllers/project.js
+++ b/public/javascripts/wechat/controllers/project.js
@@ -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,4 +255,38 @@ app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'aut
$location.path("/project_publishnote").search({id:projectid});
};
+ vm.quit = function(){
+ 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('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);
+ rms.save('projects',[]);
+ $location.path("/project_list");
+ });
+ }
+ else{
+ vm.alertService.showMessage('提示', response.data.message);
+ }
+ });
+ });
+
+ };
+
}]);
\ No newline at end of file
diff --git a/public/javascripts/wechat/controllers/project_publishnote.js b/public/javascripts/wechat/controllers/project_publishnote.js
index 231faaea6..f39b32827 100644
--- a/public/javascripts/wechat/controllers/project_publishnote.js
+++ b/public/javascripts/wechat/controllers/project_publishnote.js
@@ -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);
diff --git a/public/javascripts/wechat/directives/iphone_recognize.js b/public/javascripts/wechat/directives/iphone_recognize.js
index 66014e71a..f3b167b96 100644
--- a/public/javascripts/wechat/directives/iphone_recognize.js
+++ b/public/javascripts/wechat/directives/iphone_recognize.js
@@ -7,21 +7,26 @@ app.directive('iphoneRecognize',["$timeout",function(timer){
scope: {},
link: function(scope, element){
timer(function(){
- var userAgent = navigator.userAgent;
var contentHeight = $(".post-container").height();
- if (/ipad|iphone|mac/i.test(navigator.userAgent)){
- $("#postInput1").bind('focus',function(){
+ var toBottom = function(){
element.css({"position":"relative","padding":"1px 0"});
- $(".post-wrapper").css("margin-bottom","0");
- $("#all_homework_reply").css("margin-bottom","0");
+ $(".post-wrapper").css("marginBottom","0");
+ $("#all_homework_reply").css("marginBottom","0");
window.scrollTo(0,contentHeight);
- });
- $("#postInput1").bind('blur',function(){
- element.css("position","fixed");
- $(".post-wrapper").css("margin-bottom","10px");
- $("#all_homework_reply").css("margin-bottom","50px");
- });
- }
+ };
+ if (/ipad|iphone|mac/i.test(navigator.userAgent)){
+ $("#postInput1").bind('focus',function(){
+ toBottom();
+ });
+ $("#postInput1,#replyBlock").bind("click",function(){
+ toBottom();
+ });
+ $("#postInput1").bind('blur',function(){
+ element.css("position","fixed");
+ $(".post-wrapper").css("marginBottom","10px");
+ $("#all_homework_reply").css("marginBottom","50px");
+ });
+ }
})
}
}
diff --git a/public/javascripts/wechat/directives/submit_start.js b/public/javascripts/wechat/directives/submit_start.js
new file mode 100644
index 000000000..cbdc469ab
--- /dev/null
+++ b/public/javascripts/wechat/directives/submit_start.js
@@ -0,0 +1,17 @@
+/**
+ * Created by ttang on 2016/8/31.
+ */
+app.directive('submitStart',["$timeout",function(timer){
+ return{
+ restrict: 'A',
+ scope: {},
+ link: function(scope, element){
+ timer(function(){
+ $("#manageDelete,.login-box").click(function(){
+ element.removeClass("bg-grey c-white");
+ element.addClass("link-blue2");
+ });
+ })
+ }
+ }
+}]);
diff --git a/public/javascripts/wechat/others/factory.js b/public/javascripts/wechat/others/factory.js
index 6d887282b..f08ef5813 100644
--- a/public/javascripts/wechat/others/factory.js
+++ b/public/javascripts/wechat/others/factory.js
@@ -111,6 +111,7 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc
}
var temp = data.comment.replace(/\n/g,'
');
+ temp = temp.replace(/^\:[a-z0-9_]+\:$/g, "[表情]");
var userInfo = {
type: type,