Merge branch 'weixin_guange' into develop

This commit is contained in:
yuanke 2016-09-01 14:11:20 +08:00
commit 11ed1ea345
40 changed files with 1271 additions and 582 deletions

View File

@ -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

View File

@ -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

View File

@ -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|

View File

@ -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

View File

@ -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

View File

@ -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 = []

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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: "历史推文"

View File

@ -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: "历史推文"

View File

@ -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="

View File

@ -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="

View File

@ -40,7 +40,7 @@
</div>
<div class="cl"></div>
</div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span ng-click = "goClass(act.course_project_id)" class="c-blue">{{act.course_project_name}}</span></div>
<div class="fr f13">
<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div>
<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
@ -75,7 +75,7 @@
</div>
<div class="cl"></div>
</div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span ng-click = "goClass(act.course_project_id)" class="c-blue">{{act.course_project_name}}</span></div>
<div class="fr f13">
<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div>
<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
@ -111,7 +111,7 @@
<!--<a herf="javascript:void(0);" class="c-grey2 f13 fr mt5 mb10 post-more mr20 undis" text-auto-height>点击展开</a>-->
<div class="cl"></div>
</div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span ng-click = "goClass(act.course_project_id)" class="c-blue">{{act.course_project_name}}</span></div>
<div class="fr f13">
<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div>
<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
@ -147,7 +147,7 @@
<!--<a herf="javascript:void(0);" class="c-grey2 f13 fr mt5 mb10 post-more mr20 undis" text-auto-height>点击展开</a>-->
<div class="cl"></div>
</div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span ng-click = "goClass(act.course_project_id)" class="c-blue">{{act.course_project_name}}</span></div>
<!--<div class="fr f13">-->
<!--<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>赞</span></div>-->
<!--<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>-->
@ -236,7 +236,7 @@
</div>
<div class="cl"></div>
</div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span ng-click = "goProject(act.course_project_id)" class="c-blue">{{act.course_project_name}}</span></div>
<div class="fr f13">
<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div>
<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
@ -272,7 +272,7 @@
</div>
<div class="cl"></div>
</div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span ng-click = "goProject(act.course_project_id)" class="c-blue">{{act.course_project_name}}</span></div>
<div class="fr f13">
<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div>
<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
@ -405,7 +405,7 @@
</div>
<div class="cl"></div>
</div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span ng-click = "goClass(act.course_project_id)" class="c-blue">{{act.course_project_name}}</span></div>
<div class="fr f13">
<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div>
<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
@ -440,7 +440,7 @@
</div>
<div class="cl"></div>
</div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span ng-click = "goClass(act.course_project_id)" class="c-blue">{{act.course_project_name}}</span></div>
<div class="fr f13">
<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div>
<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
@ -476,7 +476,7 @@
<!--<a herf="javascript:void(0);" class="c-grey2 f13 fr mt5 mb10 post-more mr20 undis" text-auto-height>点击展开</a>-->
<div class="cl"></div>
</div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span ng-click = "goClass(act.course_project_id)" class="c-blue">{{act.course_project_name}}</span></div>
<div class="fr f13">
<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div>
<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
@ -492,6 +492,42 @@
</div>
</div>
<div ng-if="act.act_type=='Poll'">
<div class="post-container">
<div class="post-wrapper">
<div class="post-main">
<div dataID = "{{act.act_id}}" id="act_{{act.id}}">
<div class="post-avatar fl mr10"><img ng-src="{{replaceUrl(act.author.img_url)}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-dynamic-author hidden fl">
<span>{{act.author.real_name}}</span>
<img ng-if="act.author.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="act.author.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
<div class="post-dynamic-time fr f13">{{act.latest_update}}</div>
<div class="cl"></div>
<div class="post-dynamic-title c-grey3 hidden mt12 fb">【问卷】{{act.subject|safeHtml}}</div>
<div class="post-content c-grey3 mt10 mb10">
<div class="post-all-content" ng-bind-html="act.description|safeHtml" ellipsis-show></div>
</div>
<!--<a herf="javascript:void(0);" class="c-grey2 f13 fr mt5 mb10 post-more mr20 undis" text-auto-height>点击展开</a>-->
<div class="cl"></div>
</div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span ng-click = "goClass(act.course_project_id)" class="c-blue">{{act.course_project_name}}</span></div>
<!--<div class="fr f13">-->
<!--<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>赞</span></div>-->
<!--<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>-->
<!--<div ng-if="act.has_praise" ng-click="decreasePraise(act);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>-->
<!--</div>-->
<!--<div class="fr mr25 f13">-->
<!--<a ng-if="!act.reply_count" ng-click="goDetail('course_discussion',act.act_id, act.id)"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>-->
<!--<a ng-if="act.reply_count" ng-click="goDetail('course_discussion',act.act_id, act.id)"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{act.reply_count}}</span></a>-->
<!--</div>-->
<div class="cl"></div>
</div>
</div>
</div>
</div>
<div ng-if="act.act_type=='Course'">
<div class="post-container">
@ -536,7 +572,7 @@
</div>
<div class="cl"></div>
</div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span ng-click = "goProject(act.course_project_id)" class="c-blue">{{act.course_project_name}}</span></div>
<div class="fr f13">
<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div>
<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>
@ -572,7 +608,7 @@
</div>
<div class="cl"></div>
</div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span class="c-blue">{{act.course_project_name}}</span></div>
<div class="post-dynamic-from hidden fl c-grey3">来源: <span ng-click = "goProject(act.course_project_id)" class="c-blue">{{act.course_project_name}}</span></div>
<div class="fr f13">
<div ng-if="!act.praise_count" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div>
<div ng-if="act.praise_count && !act.has_praise" ng-click="addPraise(act);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{act.praise_count}}</span></div>

View File

@ -40,6 +40,7 @@
<script src="/javascripts/wechat/directives/input_focus.js"></script>
<script src="/javascripts/wechat/directives/at_delete_link.js"></script>
<script src="/javascripts/wechat/directives/iphone_recognize.js"></script>
<script src="/javascripts/wechat/directives/submit_start.js"></script>
<script src="/javascripts/wechat/controllers/reg.js"></script>
<script src="/javascripts/wechat/controllers/login.js"></script>
<script src="/javascripts/wechat/controllers/activity.js"></script>

View File

@ -25,7 +25,7 @@
<div ng-if="blog.praise_count && !blog.has_praise" ng-click="addPraise(blog);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{blog.praise_count}}</span></div>
<div ng-if="blog.has_praise" ng-click="decreasePraise(blog);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{blog.praise_count}}</span></div>
</div>
<div class="fr mr25 f13" input-focus>
<div id="replyBlock" class="fr mr25 f13" input-focus>
<a ng-if="!blog.comment_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
<a ng-if="blog.comment_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{blog.comment_count}}</span></a>
</div>

View File

@ -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>
@ -234,12 +234,12 @@
<p ng-show="resources_tag == true && resources.length<=0" class="class-test-tip">暂无课件,<br />
请登录Trustie网站在PC浏览器中上传课件。</p>
</div>
<div ng-class="{'undis': !showClassMate}">
<div class="mb50" ng-class="{'undis': !showClassMate}">
<div class="member-banner f13 c-grey3">授课老师</div>
<div class="class-member-row f13 c-grey3" ng-repeat="teacher in teachers|filter:searchText">
<img ng-src="{{teacher.img_url}}" width="30" height="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{teacher.name}}</span><img ng-src="/images/wechat/{{teacher.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
<img src="/images/wechat/setting.png" ng-show = "course.is_creator && teacher.id != course.tea_id" width="15" class="fr mr10" style="margin-top:7px;" ng-click="onSetting(teacher)" />
<img src="/images/wechat/setting.png" ng-show = "isTeacher && teacher.id != course.tea_id" width="15" class="fr mr10" style="margin-top:7px;" ng-click="onSetting(teacher)" />
<span class = "fr mr25 mt5" ng-show ="teacher.id == course.tea_id">管理员</span>
<span ng-class="['fr','mt5',{'mr10': course.is_creator,'mr25': !course.is_creator}]" ng-show ="teacher.id != course.tea_id && teacher.roles_id == 7">助教</span>
<div class="cl"></div>
@ -255,9 +255,13 @@
<div class="member-banner f13 mt10 c-grey3">我的同学</div>
<div class="class-member-row f13 c-grey3" ng-repeat="student in students|filter:searchText">
<img ng-src="{{student.img_url}}" width="30" height="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{student.name}}</span><img ng-src="/images/wechat/{{student.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
<img src="/images/wechat/setting.png" ng-show = "course.is_creator" width="15" class="class-list-setting" ng-click="onSetting(student)" />
<img src="/images/wechat/setting.png" ng-show = "isTeacher" width="15" class="class-list-setting" ng-click="onSetting(student)" />
<div class="cl"></div>
</div>
<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>
<div ng-class="{'undis': !showHomework}">
@ -274,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>

View File

@ -24,7 +24,7 @@
<div ng-if="discussion.praise_count && !discussion.has_praise" ng-click="addPraise(discussion);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{discussion.praise_count}}</span></div>
<div ng-if="discussion.has_praise" ng-click="decreasePraise(discussion);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{discussion.praise_count}}</span></div>
</div>
<div class="fr mr25 f13" input-focus>
<div id="replyBlock" class="fr mr25 f13" input-focus>
<a ng-if="!discussion.comment_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
<a ng-if="discussion.comment_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{discussion.comment_count}}</span></a>
</div>

View File

@ -23,7 +23,7 @@
<div ng-if="news.praise_count && !news.has_praise" ng-click="addPraise(news);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{news.praise_count}}</span></div>
<div ng-if="news.has_praise" ng-click="decreasePraise(news);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{news.praise_count}}</span></div>
</div>
<div class="fr mr25 f13" input-focus>
<div id="replyBlock" class="fr mr25 f13" input-focus>
<a ng-if="!news.comment_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
<a ng-if="news.comment_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{news.comment_count}}</span></a>
</div>

View File

@ -1,19 +1,24 @@
<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">成员管理</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"><span class="fl ml10">角色</span></div>
<ul class="class-list f13 c-grey3">
<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;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 link-blue2 border-top">确定</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>

View File

@ -1,21 +1,25 @@
<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">成员管理</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"><span class="fl ml10">角色</span></div>
<ul class="class-list f13 c-grey3">
<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;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 link-blue2 border-top">确定</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>

View File

@ -28,7 +28,7 @@
<div ng-if="homework.praise_count && !homework.has_praise" ng-click="addPraise(homework);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{homework.praise_count}}</span></div>
<div ng-if="homework.has_praise" ng-click="decreasePraise(homework);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{homework.praise_count}}</span></div>
</div>
<div class="fr mr25 f13" input-focus>
<div id="replyBlock" class="fr mr25 f13" input-focus>
<a ng-if="!homework.comment_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
<a ng-if="homework.comment_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{homework.comment_count}}</span></a>
</div>

View File

@ -29,7 +29,7 @@
<div ng-if="issue.praise_count && !issue.has_praise" ng-click="addPraise(discussion);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{issue.praise_count}}</span></div>
<div ng-if="issue.has_praise" ng-click="decreasePraise(issue);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{issue.praise_count}}</span></div>
</div>
<div class="fr mr25 f13" input-focus>
<div id="replyBlock" class="fr mr25 f13" input-focus>
<a ng-if="!issue.comment_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
<a ng-if="issue.comment_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{issue.comment_count}}</span></a>
</div>

View File

@ -23,7 +23,7 @@
<div ng-if="message.praise_count && !message.has_praise" ng-click="addPraise(message);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{message.praise_count}}</span></div>
<div ng-if="message.has_praise" ng-click="decreasePraise(message);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{message.praise_count}}</span></div>
</div>
<div class="fr mr25 f13" input-focus>
<div id="replyBlock" class="fr mr25 f13" input-focus>
<a ng-if="!message.comment_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
<a ng-if="message.comment_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{message.comment_count}}</span></a>
</div>

View File

@ -98,12 +98,12 @@
<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>
<div ng-show="project" ng-class="{'undis': currentTab != 2}">
<div ng-show="project" class="mb50" ng-class="{'undis': currentTab != 2}">
<div class="class-search-wrap">
<div class="class-search-inner"> <img src="/images/wechat/search.png" width="18" class="class-search-icon" />
<input class="class-detail-search" ng-model="searchText" placeholder="输入关键词进行搜索" />
@ -138,7 +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 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>

View File

@ -24,7 +24,7 @@
<div ng-if="discussion.praise_count && !discussion.has_praise" ng-click="addPraise(discussion);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{discussion.praise_count}}</span></div>
<div ng-if="discussion.has_praise" ng-click="decreasePraise(discussion);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{discussion.praise_count}}</span></div>
</div>
<div class="fr mr25 f13" input-focus>
<div id="replyBlock" class="fr mr25 f13" input-focus>
<a ng-if="!discussion.comment_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
<a ng-if="discussion.comment_count"><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">{{discussion.comment_count}}</span></a>
</div>

View File

@ -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});
};
}]);

View File

@ -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);
}
});
});
};
}]);

View File

@ -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);

View File

@ -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);

View File

@ -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;
}
};
}] );

View File

@ -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;
}
};
}] );

View File

@ -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 {

View File

@ -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 {

View File

@ -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);
}
});
});
};
}]);

View File

@ -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);

View File

@ -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");
});
}
})
}
}

View File

@ -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");
});
})
}
}
}]);

View File

@ -111,6 +111,7 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc
}
var temp = data.comment.replace(/\n/g,'<br/>');
temp = temp.replace(/^\:[a-z0-9_]+\:$/g, "[表情]");
var userInfo = {
type: type,