Merge branch 'weixin_guange' into develop

This commit is contained in:
yuanke 2016-09-22 13:41:52 +08:00
commit 0a9d288880
48 changed files with 922 additions and 54 deletions

View File

@ -118,6 +118,8 @@ module Mobile
roles_ids << "10" roles_ids << "10"
end end
go_course_group = 0
if roles_ids.length <= 0 if roles_ids.length <= 0
{status:-1,message:"请至少选择一个角色"} {status:-1,message:"请至少选择一个角色"}
else else
@ -125,7 +127,9 @@ module Mobile
status = cs.join_course_roles({role: roles_ids, openid: params[:openid], invite_code: params[:invite_code]}, current_user) status = cs.join_course_roles({role: roles_ids, openid: params[:openid], invite_code: params[:invite_code]}, current_user)
{ {
status: status[:state], status: status[:state],
message:CoursesService::JoinCourseError.message(status[:state]) message:CoursesService::JoinCourseError.message(status[:state]),
go_coursegroup_flag:status[:go_coursegroup_flag],
course_id:status[:course_id]
} }
end end
end end
@ -537,6 +541,7 @@ module Mobile
present :course_id,params[:id] present :course_id,params[:id]
present :user_id,params[:user_id] present :user_id,params[:user_id]
present :member_info,my_member, with: Mobile::Entities::ProjectMember present :member_info,my_member, with: Mobile::Entities::ProjectMember
present :course_group_id,my_member.course_group_id
present :status, 0 present :status, 0
else else
present :status, -1 present :status, -1
@ -750,6 +755,168 @@ module Mobile
end end
out.merge(message: message) out.merge(message: message)
end end
desc '获取分班列表'
params do
requires :id, type: Integer
requires :token, type:String
end
get 'course_groups/:id' do
begin
authenticate!
course = Course.find(params[:id])
groups = []
groups = course.course_groups if course.course_groups
present :data,groups
present :status,0
rescue
present :status,-1
end
end
desc "加入分班"
params do
requires :id, type: Integer
requires :token, type: String
requires :course_group_id, type: Integer
end
post 'user_join_coursegroup' do
begin
authenticate!
member = Member.where(:course_id => params[:id], :user_id => current_user.id).first
raise "你还不是该班级的学生!" unless member
member.course_group_id = params[:course_group_id].to_i
member.save
present :status,0
rescue Exception=>e
present :message,e.message
present :status,-1
end
end
desc "修改分班"
params do
requires :id, type: Integer
requires :token, type: String
requires :course_group_id, type: Integer
requires :user_id, type: Integer
end
post 'user_edit_coursegroup' do
begin
authenticate!
member = Member.where(:course_id => params[:id], :user_id => params[:user_id]).first
raise "不是该班级的学生!" unless member
member.course_group_id = params[:course_group_id].to_i
member.save
present :status,0
rescue Exception=>e
present :message,e.message
present :status,-1
end
end
desc '获取分班列表带上学生'
params do
requires :id, type: Integer
requires :token, type:String
end
get 'course_groups_withstudent/:id' do
begin
authenticate!
course = Course.find(params[:id])
groups = []
groups = course.course_groups if course.course_groups
present :data,groups, with: Mobile::Entities::CourseGroup
present :status,0
rescue
present :status,-1
end
end
desc "删除分班"
params do
requires :id, type: Integer
requires :token, type: String
requires :course_group_id, type: Integer
end
post 'delete_coursegroup' do
begin
authenticate!
c = Course.find("#{params[:id]}")
my_member = c.member_principals.where("users.id=#{current_user.id}").first
roles_ids = []
my_member.roles.each do |role|
roles_ids << role.id
end
if my_member && (roles_ids.include?(3) || roles_ids.include?(7) || roles_ids.include?(9) )
else
raise "您没有该权限!"
end
CourseGroup.delete(params[:course_group_id])
present :status,0
rescue Exception=>e
present :message,e.message
present :status,-1
end
end
desc "编辑分班"
params do
requires :id, type: Integer
requires :token, type: String
end
post 'edit_coursegroup' do
begin
authenticate!
c = Course.find("#{params[:id]}")
my_member = c.member_principals.where("users.id=#{current_user.id}").first
roles_ids = []
my_member.roles.each do |role|
roles_ids << role.id
end
if my_member && (roles_ids.include?(3) || roles_ids.include?(7) || roles_ids.include?(9) )
else
raise "您没有该权限!"
end
#增加分班和修改分班名
modify_groups = params[:modify_groups]
modify_groups.each do |g|
group = CourseGroup.find(g.id)
group.name = g.id.to_s + Time.now.to_i.to_s #只能先另取个名了不然原有的两个互换的话修改不了
group.save
end
modify_groups.each do |g|
group = CourseGroup.find(g.id)
group.name = g.name
group.save
end
#增加分班和修改分班名
add_groups = params[:add_groups]
add_groups.each do |name|
group = CourseGroup.new
group.name = name
group.course_id = params[:id]
group.save
end
present :status,0
rescue Exception=>e
present :message,e.message
present :status,-1
end
end
end end
end end
end end

View File

@ -23,6 +23,8 @@ module Mobile
(number_to_human_size(f.filesize)).gsub("ytes", "").to_s (number_to_human_size(f.filesize)).gsub("ytes", "").to_s
when :coursename when :coursename
f.course.nil? ? "" : f.course.name f.course.nil? ? "" : f.course.name
when :syllabus_title
f.course.nil? ? "" : f.course.syllabus.nil? ? "" : f.course.syllabus.title
when :course_id when :course_id
f.course.nil? ? 0 : f.course.id f.course.nil? ? 0 : f.course.id
@ -40,6 +42,7 @@ module Mobile
attachment_expose :file_dir attachment_expose :file_dir
attachment_expose :attafile_size attachment_expose :attafile_size
attachment_expose :coursename #所属班级名 attachment_expose :coursename #所属班级名
attachment_expose :syllabus_title #所属班级名
attachment_expose :course_id #所属班级名 attachment_expose :course_id #所属班级名
expose :current_user_is_teacher, if: lambda { |instance, options| options[:user] } do |instance, options| expose :current_user_is_teacher, if: lambda { |instance, options| options[:user] } do |instance, options|
current_user = options[:user] current_user = options[:user]

View File

@ -54,6 +54,7 @@ module Mobile
course_expose :updated_at course_expose :updated_at
course_expose :course_student_num course_expose :course_student_num
course_expose :member_count course_expose :member_count
course_expose :groupnum
expose :can_setting, if: lambda { |instance, options| options[:user] } do |instance, options| expose :can_setting, if: lambda { |instance, options| options[:user] } do |instance, options|
current_user = options[:user] current_user = options[:user]
can_setting = false can_setting = false

View File

@ -0,0 +1,19 @@
module Mobile
module Entities
class CourseGroup < Grape::Entity
include Redmine::I18n
include ApplicationHelper
include ApiHelper
def self.course_group_expose(f)
expose f do |u,opt|
if u.is_a?(Hash) && u.key?(f)
u[f]
end
end
end
expose :id
expose :name
expose :users, using: Mobile::Entities::User
end
end
end

View File

@ -19,6 +19,8 @@ module Mobile
case field case field
when :coursename when :coursename
f.course.nil? ? "" : f.course.name f.course.nil? ? "" : f.course.name
when :syllabus_title
f.course.nil? ? "" : f.course.syllabus.nil? ? "" : f.course.syllabus.title
end end
end end
end end
@ -27,6 +29,7 @@ module Mobile
expose :exercise_name expose :exercise_name
expose :exercise_description expose :exercise_description
exercise_expose :coursename #所属班级名 exercise_expose :coursename #所属班级名
exercise_expose :syllabus_title
expose :current_user_is_teacher, if: lambda { |instance, options| options[:user] } do |instance, options| expose :current_user_is_teacher, if: lambda { |instance, options| options[:user] } do |instance, options|
current_user = options[:user] current_user = options[:user]

View File

@ -39,6 +39,8 @@ module Mobile
val val
when :coursename when :coursename
f.course.nil? ? "" : f.course.name f.course.nil? ? "" : f.course.name
when :syllabus_title
f.course.nil? ? "" : f.course.syllabus.nil? ? "" : f.course.syllabus.title
end end
end end
end end
@ -49,6 +51,8 @@ module Mobile
#课程名称 #课程名称
homework_expose :course_name homework_expose :course_name
homework_expose :syllabus_title
homework_expose :course_id homework_expose :course_id
#作业发布者 #作业发布者
expose :author,using: Mobile::Entities::User do |f, opt| expose :author,using: Mobile::Entities::User do |f, opt|

View File

@ -22,6 +22,10 @@ module Mobile
else else
u.project.name u.project.name
end end
when :syllabus_title
if u.board.project_id == -1
u.course.syllabus.nil? ? "" : u.course.syllabus.title
end
when :lasted_comment when :lasted_comment
time_from_now u.created_on time_from_now u.created_on
when :praise_count when :praise_count
@ -50,6 +54,7 @@ module Mobile
message_expose :act_type message_expose :act_type
message_expose :act_id message_expose :act_id
message_expose :course_project_name message_expose :course_project_name
message_expose :syllabus_title
message_expose :board_id message_expose :board_id
message_expose :subject message_expose :subject
message_expose :title message_expose :title

View File

@ -26,6 +26,11 @@ module Mobile
f.id f.id
when :comment_count when :comment_count
f.comments.count f.comments.count
when :syllabus_title
unless f.course_id == nil
course = get_course(f.course_id)
course.syllabus.nil? ? "" : course.syllabus.title
end
end end
end end
elsif f.is_a?(::Comment) elsif f.is_a?(::Comment)
@ -89,6 +94,7 @@ module Mobile
news_expose :praise_count news_expose :praise_count
#课程名字 #课程名字
news_expose :course_name news_expose :course_name
news_expose :syllabus_title
news_expose :lasted_comment news_expose :lasted_comment
#评论 #评论

View File

@ -36,6 +36,8 @@ module Mobile
u.lastname u.lastname
when :mail when :mail
u.mail u.mail
when :is_me
defined? u.is_me ? u.is_me : 0
end end
end end
end end
@ -77,6 +79,8 @@ module Mobile
user_expose :name user_expose :name
user_expose :is_me
end end
end end

View File

@ -30,6 +30,8 @@ module Mobile
wh.journals_for_messages.count wh.journals_for_messages.count
when :course_name when :course_name
wh.course.name wh.course.name
when :syllabus_title
wh.course.syllabus.nil? ? "" : wh.course.syllabus.title
when :act_type when :act_type
'HomeworkCommon' 'HomeworkCommon'
when :act_id when :act_id
@ -65,6 +67,7 @@ module Mobile
whomework_expose :act_type whomework_expose :act_type
whomework_expose :act_id whomework_expose :act_id
whomework_expose :course_name whomework_expose :course_name
whomework_expose :syllabus_title
whomework_expose :created_at whomework_expose :created_at
whomework_expose :absence_penalty whomework_expose :absence_penalty
whomework_expose :evaluation_start whomework_expose :evaluation_start

View File

@ -495,10 +495,11 @@ class Course < ActiveRecord::Base
def generate_qrcode def generate_qrcode
ticket = self.qrcode ticket = self.qrcode
if !ticket || ticket.size < 10 if !ticket || ticket.size < 10 || (Time.now.to_i > self.qrcode_expiretime)
response = Wechat.api.qrcode_create_scene(invite_code, 2592000) response = Wechat.api.qrcode_create_scene(invite_code, 2592000)
logger.debug "response = #{response}" logger.debug "response = #{response}"
self.qrcode = response['ticket'] self.qrcode = response['ticket']
self.qrcode_expiretime = Time.now.to_i+response['expire_seconds']
save! && reload save! && reload
ticket = qrcode ticket = qrcode
end end

View File

@ -930,10 +930,11 @@ class Project < ActiveRecord::Base
def generate_qrcode def generate_qrcode
ticket = self.qrcode ticket = self.qrcode
if !ticket || ticket.size < 10 if !ticket || ticket.size < 10 || (Time.now.to_i > self.qrcode_expiretime)
response = Wechat.api.qrcode_create_scene(invite_code, 2592000) response = Wechat.api.qrcode_create_scene(invite_code, 2592000)
logger.debug "response = #{response}" logger.debug "response = #{response}"
self.qrcode = response['ticket'] self.qrcode = response['ticket']
self.qrcode_expiretime = Time.now.to_i+response['expire_seconds']
save! save!
ticket = qrcode ticket = qrcode
end end

View File

@ -115,7 +115,7 @@ class CoursesService
role_name: m.roles.first.name, role_name: m.roles.first.name,
name: m.user.show_name, name: m.user.show_name,
roles_id: role_ids.include?(7) ? 7 : (role_ids.include?(9) ? 9 : 10 ), roles_id: role_ids.include?(7) ? 7 : (role_ids.include?(9) ? 9 : 10 ),
:brief_introduction => m.user.user_extensions.brief_introduction,:realname=>m.user.realname} :brief_introduction => m.user.user_extensions.brief_introduction,:realname=>m.user.realname,:is_me => current_user.id == m.user.id ? 1:0 }
# end # end
end end
@ -332,7 +332,9 @@ class CoursesService
# unless (course.is_public == 1 || current_user.member_of_course?(course) || current_user.admin?) # unless (course.is_public == 1 || current_user.member_of_course?(course) || current_user.admin?)
# raise '403' # raise '403'
# end # end
{:course => course,:syllabus_title => course.syllabus.nil? ? "":course.syllabus.title ,:work_unit => work_unit, :img_url => url_to_avatar(course),:current_user_is_member => current_user.nil? ? false : current_user.member_of_course?(course),:current_user_is_teacher => current_user.nil? ? false : is_course_teacher(current_user,course),:course_student_num => course ? course.student.count.to_s : 0} groupnum = 0
groupnum = course.course_groups.length if course.course_groups
{:course => course,:syllabus_title => course.syllabus.nil? ? "":course.syllabus.title ,:work_unit => work_unit, :img_url => "/images/"+url_to_avatar(course),:current_user_is_member => current_user.nil? ? false : current_user.member_of_course?(course),:current_user_is_teacher => current_user.nil? ? false : is_course_teacher(current_user,course),:course_student_num => course ? course.student.count.to_s : 0,:groupnum => groupnum}
end end
#创建课程 #创建课程
@ -565,6 +567,8 @@ class CoursesService
#多个角色加入课程 #多个角色加入课程
def join_course_roles params,current_user def join_course_roles params,current_user
course = Course.find_by_invite_code(params[:invite_code]) if params[:invite_code] course = Course.find_by_invite_code(params[:invite_code]) if params[:invite_code]
go_coursegroup_flag = 0
course_id = 0
@state = 10 @state = 10
if course if course
@ -621,6 +625,8 @@ class CoursesService
course.members << members course.members << members
StudentsForCourse.create(:student_id => current_user.id, :course_id => course.id) StudentsForCourse.create(:student_id => current_user.id, :course_id => course.id)
@state = 0 @state = 0
go_coursegroup_flag = 1 if course.course_groups
course_id = course.id
send_wechat_join_class_notice current_user,course,10,0 send_wechat_join_class_notice current_user,course,10,0
else else
is_stu = false is_stu = false
@ -630,6 +636,8 @@ class CoursesService
course.members << members course.members << members
StudentsForCourse.create(:student_id => current_user.id, :course_id =>course.id) StudentsForCourse.create(:student_id => current_user.id, :course_id =>course.id)
is_stu = true is_stu = true
go_coursegroup_flag = 1 if course.course_groups
course_id = course.id
send_wechat_join_class_notice current_user,course,10,0 send_wechat_join_class_notice current_user,course,10,0
end end
#如果已经发送过消息了,那么就要给个提示 #如果已经发送过消息了,那么就要给个提示
@ -674,7 +682,7 @@ class CoursesService
else else
@state = 4 @state = 4
end end
{:state => @state,:course => course} {:state => @state,:course => course,:go_coursegroup_flag => go_coursegroup_flag,:course_id=>course_id}
end end

View File

@ -43,7 +43,7 @@
第<%= work.student_work_tests.count - index%>次测试 第<%= work.student_work_tests.count - index%>次测试
</p> </p>
<span class="fr c_grey"> <span class="fr c_grey">
<%= test.created_at.to_s(:db) %> <%= format_time(test.created_at).to_s %>
</span> </span>
<div class="cl"></div> <div class="cl"></div>
</div> </div>

View File

@ -0,0 +1,5 @@
class AddQrcodeExpiretimeToCourses < ActiveRecord::Migration
def change
add_column :courses, :qrcode_expiretime, :integer, :default => 0
end
end

View File

@ -0,0 +1,5 @@
class AddQrcodeExpiretimeToProjects < ActiveRecord::Migration
def change
add_column :projects, :qrcode_expiretime, :integer, :default => 0
end
end

View File

@ -40,7 +40,7 @@
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</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="post-dynamic-from hidden fl c-grey3">来源: <span ng-click = "goClass(act.course_project_id)" class="c-blue">{{act.syllabus_title}}<font class="fb" style="height:18px; line-height:18px; vertical-align:top; margin:0 3px;">·</font>{{act.course_project_name}}</span></div>
<div class="fr f13"> <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" 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.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>
<div class="cl"></div> <div class="cl"></div>
</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="post-dynamic-from hidden fl c-grey3">来源: <span ng-click = "goClass(act.course_project_id)" class="c-blue">{{act.syllabus_title}}<font class="fb" style="height:18px; line-height:18px; vertical-align:top; margin:0 3px;">·</font>{{act.course_project_name}}</span></div>
<div class="fr f13"> <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" 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.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>--> <!--<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 class="cl"></div>
</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="post-dynamic-from hidden fl c-grey3">来源: <span ng-click = "goClass(act.course_project_id)" class="c-blue">{{act.syllabus_title}}<font class="fb" style="height:18px; line-height:18px; vertical-align:top; margin:0 3px;">·</font>{{act.course_project_name}}</span></div>
<div class="fr f13"> <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" 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.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>--> <!--<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 class="cl"></div>
</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="post-dynamic-from hidden fl c-grey3">来源: <span ng-click = "goClass(act.course_project_id)" class="c-blue">{{act.syllabus_title}}<font class="fb" style="height:18px; line-height:18px; vertical-align:top; margin:0 3px;">·</font>{{act.course_project_name}}</span></div>
<!--<div class="fr f13">--> <!--<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" 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.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>
<div class="cl"></div> <div class="cl"></div>
</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="post-dynamic-from hidden fl c-grey3">来源: <span ng-click = "goClass(act.course_project_id)" class="c-blue">{{act.syllabus_title}}<font class="fb" style="height:18px; line-height:18px; vertical-align:top; margin:0 3px;">·</font>{{act.course_project_name}}</span></div>
<div class="fr f13"> <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" 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.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>
<div class="cl"></div> <div class="cl"></div>
</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="post-dynamic-from hidden fl c-grey3">来源: <span ng-click = "goClass(act.course_project_id)" class="c-blue">{{act.syllabus_title}}<font class="fb" style="height:18px; line-height:18px; vertical-align:top; margin:0 3px;">·</font>{{act.course_project_name}}</span></div>
<div class="fr f13"> <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" 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.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>--> <!--<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 class="cl"></div>
</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="post-dynamic-from hidden fl c-grey3">来源: <span ng-click = "goClass(act.course_project_id)" class="c-blue">{{act.syllabus_title}}<font class="fb" style="height:18px; line-height:18px; vertical-align:top; margin:0 3px;">·</font>{{act.course_project_name}}</span></div>
<div class="fr f13"> <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" 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.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>
@ -512,7 +512,7 @@
<!--<a herf="javascript:void(0);" class="c-grey2 f13 fr mt5 mb10 post-more mr20 undis" text-auto-height>点击展开</a>--> <!--<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 class="cl"></div>
</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="post-dynamic-from hidden fl c-grey3">来源: <span ng-click = "goClass(act.course_project_id)" class="c-blue">{{act.syllabus_title}}<font class="fb" style="height:18px; line-height:18px; vertical-align:top; margin:0 3px;">·</font>{{act.course_project_name}}</span></div>
<!--<div class="fr f13">--> <!--<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" 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.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

@ -41,6 +41,7 @@
<script src="/javascripts/wechat/directives/at_delete_link.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/iphone_recognize.js"></script>
<script src="/javascripts/wechat/directives/multi_reply.js"></script> <script src="/javascripts/wechat/directives/multi_reply.js"></script>
<script src="/javascripts/wechat/directives/img_preview.js"></script>
<script src="/javascripts/wechat/controllers/reg.js"></script> <script src="/javascripts/wechat/controllers/reg.js"></script>
<script src="/javascripts/wechat/controllers/login.js"></script> <script src="/javascripts/wechat/controllers/login.js"></script>
<script src="/javascripts/wechat/controllers/activity.js"></script> <script src="/javascripts/wechat/controllers/activity.js"></script>

View File

@ -25,7 +25,7 @@
<div class="post-dynamic-title c-black fb">{{blog.title}}<img ng-if="blog.locked" src="/images/locked.png" style="display:inline-block;" /></div> <div class="post-dynamic-title c-black fb">{{blog.title}}<img ng-if="blog.locked" src="/images/locked.png" style="display:inline-block;" /></div>
<div class="c-grey4 f13 mt5"><span class="mr10">博客</span><span>{{blog.created_at}}</span></div> <div class="c-grey4 f13 mt5"><span class="mr10">博客</span><span>{{blog.created_at}}</span></div>
<div class="f13 c-black mt5 text-control post-all-content" ng-bind-html="blog.content|safeHtml"></div> <div class="f13 c-black mt5 text-control post-all-content" ng-bind-html="blog.content|safeHtml" img-preview></div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<div class="fr f13"> <div class="fr f13">

View File

@ -1,6 +1,6 @@
<div class="post-container"> <div class="post-container">
<div loading-spinner></div> <div loading-spinner></div>
<div class="class-detail-name"><span class="course-name-width hidden inline-block">{{course.name}}</span><span ng-click="invite()" class="f13 blue-title-sub">邀请码</span></div> <div class="class-detail-name"><span class="course-name-width hidden inline-block">{{course.syllabus_title}}<font class="fb" style="height:39px; line-height:39px; vertical-align:top; margin:0 3px;">·</font>{{course.name}}</span><span ng-click="invite()" class="f13 blue-title-sub">邀请码</span></div>
<div class="tab-wrap"> <div class="tab-wrap">
<a ng-click="tab($index+1)" ng-repeat="menu in menus" id="class_tab_1" href="javascript:void(0);" ng-class="['weixin-tab', {'class-tab-active': currentTab == $index+1}]">{{menu}}</a> <a ng-click="tab($index+1)" ng-repeat="menu in menus" id="class_tab_1" href="javascript:void(0);" ng-class="['weixin-tab', {'class-tab-active': currentTab == $index+1}]">{{menu}}</a>
</div> </div>
@ -25,7 +25,7 @@
<div class="post-wrapper"> <div class="post-wrapper">
<div class="post-main"> <div class="post-main">
<div dataID = "{{act.act_id}}" ng-click="goDetail('homework',act.act_id, act.id)" id="act_{{act.id}}"> <div dataID = "{{act.act_id}}" ng-click="goDetail('homework',act.act_id, 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-avatar fl mr10"><img female="{{replaceUrl(act.author.img_url)}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-dynamic-author hidden fl"> <div class="post-dynamic-author hidden fl">
<span>{{act.author.real_name}}</span> <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/male.png" width="14" class="ml5" />
@ -256,12 +256,15 @@
<div class="class-member-row f13 c-grey3" ng-repeat="student in students|filter:searchText"> <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 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 = "isTeacher" 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)" />
<img src="/images/wechat/setting.png" ng-show = "!isTeacher && student.is_me==1" width="15" class="class-list-setting" ng-click="onSetting_1(student)" />
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<div ng-show="course.is_member" class="bottom-tab-wrap mt10" ng-class="{'undis': !showClassMate}"> <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> <a ng-show="!course.is_creator" ng-click="quit()" class="weixin-tab link-blue2 border-top">退出班级</a>
<a ng-show="isTeacher" ng-click="goEditGroup()" class="weixin-tab link-blue2 border-top">分班管理</a>
</div> </div>
</div> </div>
<div ng-class="{'undis': !showHomework}"> <div ng-class="{'undis': !showHomework}">

View File

@ -0,0 +1,20 @@
<div class="post-container">
<div loading-spinner></div>
<div class="class-detail-name"><span class="course-name-width hidden inline-block">分班管理</span></div>
<div ng-repeat="group in groups">
<div class="member-banner f13 c-grey3" ng-class="{mt10:!$first}">{{group.name+"("+group.users.length+")"}}</div>
<div class="class-member-row f13 c-grey3" ng-repeat="user in group.users">
<img ng-src="{{user.img_url}}" width="30" height="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{user.realname == "" ? user.name : user.realname}}</span><img ng-src="/images/wechat/{{user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
<div class="cl"></div>
</div>
</div>
<div ng-show="course.is_member" class="bottom-tab-wrap mt10">
<a ng-show="course.current_user_is_teacher" ng-click="goEditGroup()" class="weixin-tab link-blue2 border-top">编辑</a>
</div>
<div ng-show="tip_1" class="blue-title">{{tip_1}}</div>
<my-alert message="alertService.message" title="alertService.title" visible="alertService.visible" cb="alertService.cb"></my-alert>
</div>

View File

@ -1,7 +1,7 @@
<div class="post-container"> <div class="post-container">
<div loading-spinner></div> <div loading-spinner></div>
<div class="blue-title">{{current_course.name}}</div> <div class="blue-title"><span class="course-name-width hidden inline-block">{{current_course.syllabus_title}}<font class="fb" style="height:39px; line-height:39px; vertical-align:top; margin:0 3px;">·</font>{{current_course.name}}</span></div>
<div class="course-list-row f13 c-grey3 mt30"><span class="fl ml15 c-grey3">标题</span><input class="new-class-input ml25" ng-model="issuetitle" placeholder="发起讨论,请先输入标题(限128字符)" maxlength="128"></div> <div class="course-list-row f13 c-grey3 mt30"><span class="fl ml15 c-grey3">标题</span><input class="new-class-input ml25" ng-model="issuetitle" placeholder="发起讨论,请先输入标题(限128字符)" maxlength="128"></div>
<div class="full-width-wrap mt15 mb50"><textarea class="full-width-textarea" ng-model="issue" placeholder="请输入您的讨论内容~"></textarea></div> <div class="full-width-wrap mt15 mb50"><textarea class="full-width-textarea" ng-model="issue" placeholder="请输入您的讨论内容~"></textarea></div>
<div class="bottom-tab-wrap mt10"> <div class="bottom-tab-wrap mt10">

View File

@ -1,7 +1,7 @@
<div class="post-container"> <div class="post-container">
<div loading-spinner></div> <div loading-spinner></div>
<div class="blue-title">{{current_course.name}}</div> <div class="blue-title"><span class="course-name-width hidden inline-block">{{current_course.syllabus_title}}<font class="fb" style="height:39px; line-height:39px; vertical-align:top; margin:0 3px;">·</font>{{current_course.name}}</span></div>
<div class="course-list-row f13 c-grey3 mt30"><span class="fl ml15 c-grey3">标题</span><input class="new-class-input ml25" ng-model="noticetitle" placeholder="发布通知,请先输入标题(限64字符)" maxlength="64"></div> <div class="course-list-row f13 c-grey3 mt30"><span class="fl ml15 c-grey3">标题</span><input class="new-class-input ml25" ng-model="noticetitle" placeholder="发布通知,请先输入标题(限64字符)" maxlength="64"></div>
<div class="full-width-wrap mt15 mb50"><textarea class="full-width-textarea" ng-model="notice" placeholder="请输入您的通知内容~"></textarea></div> <div class="full-width-wrap mt15 mb50"><textarea class="full-width-textarea" ng-model="notice" placeholder="请输入您的通知内容~"></textarea></div>
<div class="bottom-tab-wrap mt10"> <div class="bottom-tab-wrap mt10">

View File

@ -24,8 +24,8 @@
<div class="cl"></div> <div class="cl"></div>
<div class="ml40"> <div class="ml40">
<div class="post-dynamic-title c-black fb">{{discussion.subject}}<img ng-if="discussion.locked" src="/images/locked.png" style="display:inline-block;" /></div> <div class="post-dynamic-title c-black fb">{{discussion.subject}}<img ng-if="discussion.locked" src="/images/locked.png" style="display:inline-block;" /></div>
<div class="c-grey4 f13 mt5"><span class="mr10">{{discussion.course_project_name}} - 班级讨论区</span><span>{{discussion.created_on}}</span></div> <div class="c-grey4 f13 mt5"><span class="mr10">{{discussion.syllabus_title}}<font class="fb" style="height:18px; line-height:18px; vertical-align:top; margin:0 3px;">·</font>{{discussion.course_project_name}} - 班级讨论区</span><span>{{discussion.created_on}}</span></div>
<div class="f13 c-black mt5 text-control post-all-content" ng-bind-html="discussion.content|safeHtml"></div> <div class="f13 c-black mt5 text-control post-all-content" ng-bind-html="discussion.content|safeHtml" img-preview></div>
<div class="cl"></div> <div class="cl"></div>
<div class="fr f13"> <div class="fr f13">
<div ng-if="!discussion.praise_count" ng-click="addPraise(discussion);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div> <div ng-if="!discussion.praise_count" ng-click="addPraise(discussion);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div>

View File

@ -23,8 +23,8 @@
<div class="cl"></div> <div class="cl"></div>
<div class="ml40"> <div class="ml40">
<div class="post-dynamic-title c-black fb">{{news.title}}</div> <div class="post-dynamic-title c-black fb">{{news.title}}</div>
<div class="c-grey4 f13 mt5"><span class="mr10">{{news.course_name}} - 课程通知</span><span>{{news.created_on}}</span></div> <div class="c-grey4 f13 mt5"><span class="mr10">{{news.syllabus_title}}<font class="fb" style="height:18px; line-height:18px; vertical-align:top; margin:0 3px;">·</font>{{news.course_name}} - 课程通知</span><span>{{news.created_on}}</span></div>
<div class="f13 c-black mt5 text-control post-all-content" ng-bind-html="news.description|safeHtml"></div> <div class="f13 c-black mt5 text-control post-all-content" ng-bind-html="news.description|safeHtml" img-preview></div>
<div class="cl"></div> <div class="cl"></div>
<div class="fr f13"> <div class="fr f13">
<div ng-if="!news.praise_count" ng-click="addPraise(news);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div> <div ng-if="!news.praise_count" ng-click="addPraise(news);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div>

View File

@ -0,0 +1,14 @@
<div class="post-container">
<div loading-spinner></div>
<div class="blue-title">分班管理</div>
<div class="class-detail-row f13 c-grey3"><img src="images/logo.png" ng-src="{{course.img_url}}" class="fl ml10 img-circle mt4" width="30"><span class="fl mt10 ml10 ng-binding">{{course.name}}</span><div class="cl"></div> </div>
<form novalidate name="groupForm">
<div class="course-list-row f13 c-grey3 mt10" ng-repeat="group in groups" ><span class="fl ml15 c-grey3">分班名称</span><input ng-change="group.change = true" required ng-class="['new-class-input ml25', {'c-grey':group.change} ]" ng-model="group.tmpname" placeholder="如16级1班" /><a ng-click="deleteGroup($index)" class="fr mr10 c-grey6 delete-class-link">删除</a></div>
<div class="tac"><a ng-click="addGroup()" class="link-blue2 f13 mt15 inline-block add-class-link">+新增分班</a></div>
<a ng-click="newGroup(groupForm, groups)" ng-class="['finish-btn', {'btn-disabled':!groupForm.$valid} ]" >完成</a>
</form>
<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

@ -4,15 +4,25 @@
<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="class-detail-row f13 c-grey3"><img ng-src="{{current_edit_member.user.img_url}}" width="30" class="fl ml10 img-circle mt4" /><span class="fl mt10 ml10">{{current_edit_member.user.realname == "" ? current_edit_member.user.name : current_edit_member.user.realname}}</span><img ng-src="/images/wechat/{{current_edit_member.user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt10" /><div class="cl"></div> </div>
<div class="course-list-row f13 c-grey3 mt10" ng-click="clickChangeRole()"><span class="fl ml10">角色变更</span></div> <div class="course-list-row f13 c-grey3 mt10" ng-click="clickChangeRole()"><span class="fl ml10">角色变更</span></div>
<ul class="class-list f13 c-grey3" ng-class="{'undis':current_edit_member.show}"> <ul class="class-list f13 c-grey3" ng-class="{'undis':!show_1}">
<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(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><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> <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> </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> <div class="course-list-row f13 c-grey3 mt10" ng-click="clickDeleteMember()" id="manageDelete"><span class="fl ml10">删除成员</span></div>
<ul class="class-list f13 c-grey3" ng-class="{'undis':!current_edit_member.show}"> <ul class="class-list f13 c-grey3" ng-class="{'undis':!show_2}">
<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> <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> </ul>
<div class="course-list-row f13 c-grey3 mt10" ng-click="clickSelectGroup()" id="manageDelete"><span class="fl ml10">编辑分班</span></div>
<ul class="class-list f13 c-grey3" ng-class="{'undis':!show_3}">
<li><span class="fl ml10 class-list-name hidden">暂无</span><span ng-click="selectGroup(0)" class="login-box fr mr10 mt12 img-circle" ng-class="[{'checked': selectid == 0}]"></span></li>
<div ng-repeat="group in groups">
<li><span class="fl ml10 class-list-name hidden">{{group.course_group.name}}</span><span ng-click="selectGroup(group.course_group.id)" class="login-box fr mr10 mt12 img-circle" ng-class="[{'checked': selectid == group.course_group.id}]"></span></li>
<!--<li class="border-bottom-none"><span class="fl ml10 class-list-name hidden">分班2</span><span class="login-box fr mr10 mt12 img-circle" ng-class="['login-box', 'fr', 'mr10', 'mt12', {'checked': student}]"></span></li>-->
</div>
</ul>
<div class="bottom-tab-wrap mt10"> <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="cancel()" class="weixin-tab c-grey border-top">取消</a>
<a href="javascript:void(0);" ng-click="edit_member_role()" class="weixin-tab border-top" ng-class="[{'bg-grey c-white':buttongrey},{'link-blue2':!buttongrey}]" >确定</a> <a href="javascript:void(0);" ng-click="edit_member_role()" class="weixin-tab border-top" ng-class="[{'bg-grey c-white':buttongrey},{'link-blue2':!buttongrey}]" >确定</a>

View File

@ -12,6 +12,7 @@
<form name="regFrm" novalidate> <form name="regFrm" novalidate>
<div class="course-list-row f13 c-grey3 mt10"><span class="fl ml15 c-grey3">姓名</span><input class="new-class-input ml25" ng-model="lastname" placeholder="请输入您的真实姓名" maxlength="30" /></div> <div class="course-list-row f13 c-grey3 mt10"><span class="fl ml15 c-grey3">姓名</span><input class="new-class-input ml25" ng-model="lastname" placeholder="请输入您的真实姓名" maxlength="30" /></div>
<div ng-show="lastname == '' " class="c-red f12 mt5 ml65">姓名不能为空</div>
<div class="course-list-row f13 c-grey3 mt10" style="height:auto;"> <div class="course-list-row f13 c-grey3 mt10" style="height:auto;">
<div class="mt5" style="line-height:20px"> <div class="mt5" style="line-height:20px">
<span class="ml15 c-grey3">性别</span> <span class="ml15 c-grey3">性别</span>
@ -28,10 +29,10 @@
<div class="course-list-row f13 c-grey3 mt10"> <div class="course-list-row f13 c-grey3 mt10">
<span class="fl ml15 c-grey3">邮箱</span> <span class="fl ml15 c-grey3">邮箱</span>
<input class="new-class-input ml25" type="email" name="email" ng-model="mail" placeholder="请输入您的邮箱地址" maxlength="60" /> <input class="new-class-input ml25" type="email" name="email" ng-model="mail" placeholder="请输入您的邮箱地址" maxlength="60" />
<div ng-show="regFrm.$submitted || regFrm.email.$touched"> </div>
<span class="f12 c-red fl ml15" ng-show="regFrm.email.$error.required">电子邮箱地址不能为空</span> <div ng-show="regFrm.$submitted || regFrm.email.$touched">
<span class="f12 c-red fl ml15" ng-show="regFrm.email.$error.email">电子邮箱地址不合法</span> <span class="f12 c-red ml65" ng-show="regFrm.email.$error.required">电子邮箱地址不能为空</span>
</div> <span class="f12 c-red ml65" ng-show="regFrm.email.$error.email">电子邮箱地址不合法</span>
</div> </div>
<div ng-show="lastname == '' " class="f12 c-grey6 mt10 ml15"> <div ng-show="lastname == '' " class="f12 c-grey6 mt10 ml15">
<span class="f13 c-grey3">提示</span> <span class="f13 c-grey3">提示</span>

View File

@ -23,8 +23,8 @@
<div class="cl"></div> <div class="cl"></div>
<div class="ml40"> <div class="ml40">
<div class="post-dynamic-title c-black fb">{{homework.name}}</div> <div class="post-dynamic-title c-black fb">{{homework.name}}</div>
<div class="c-grey4 mt5 f13"><span class="mr10">{{homework.course_name}} - <span ng-if="homework.homework_type == 1">普通作业</span><span ng-if="homework.homework_type == 2">编程作业</span><span ng-if="homework.homework_type == 3">分组作业</span></span><span>{{homework.publish_time}}</span></div> <div class="c-grey4 mt5 f13"><span class="mr10">{{homework.syllabus_title}}<font class="fb" style="height:18px; line-height:18px; vertical-align:top; margin:0 3px;">·</font>{{homework.course_name}} - <span ng-if="homework.homework_type == 1">普通作业</span><span ng-if="homework.homework_type == 2">编程作业</span><span ng-if="homework.homework_type == 3">分组作业</span></span><span>{{homework.publish_time}}</span></div>
<div class="f13 c-black mt5 text-control post-all-content" ng-bind-html="homework.description|safeHtml"></div> <div class="f13 c-black mt5 text-control post-all-content" ng-bind-html="homework.description|safeHtml" img-preview></div>
<span class="c-grey f12 mr15">迟交扣分:{{homework.late_penalty}}分</span> <span class="c-grey f12 mr15">迟交扣分:{{homework.late_penalty}}分</span>
<span ng-if="!homework.anonymous_comment" class="c-grey f12">匿评开启时间:{{homework.evaluation_start}}</span><br /> <span ng-if="!homework.anonymous_comment" class="c-grey f12">匿评开启时间:{{homework.evaluation_start}}</span><br />
<span ng-if="!homework.anonymous_comment" class="c-grey f12 mr15">缺评扣分:{{homework.absence_penalty}}分/作品</span> <span ng-if="!homework.anonymous_comment" class="c-grey f12 mr15">缺评扣分:{{homework.absence_penalty}}分/作品</span>

View File

@ -1,7 +1,7 @@
<div class="post-container"> <div class="post-container">
<div class="qr-code-wrap"> <div class="qr-code-wrap">
<div class="qr-code-box"> <div class="qr-code-box">
<div class="share-class-name">{{course.name}}</div> <div class="share-class-name">{{course.syllabus_title}}<font class="fb" style="height:25px; line-height:25px; vertical-align:top; margin:0 3px;">·</font>{{course.name}}</div>
<div class="qr-img-wrap"><img ng-src="https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket={{course.qrcode}}" width="152" class="qr-code-img" /></div> <div class="qr-img-wrap"><img ng-src="https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket={{course.qrcode}}" width="152" class="qr-code-img" /></div>
<div class="invitation-code-wrap">邀请码:{{course.invite_code}}</div> <div class="invitation-code-wrap">邀请码:{{course.invite_code}}</div>
</div> </div>

View File

@ -26,7 +26,7 @@
<div class="post-dynamic-title c-black fb">{{issue.subject}}</div> <div class="post-dynamic-title c-black fb">{{issue.subject}}</div>
<div class="c-grey4 f13 mt5"><span class="mr10">{{issue.project_name}} - 项目问题</span><span>{{issue.created_on}}</span></div> <div class="c-grey4 f13 mt5"><span class="mr10">{{issue.project_name}} - 项目问题</span><span>{{issue.created_on}}</span></div>
<div class="f13 c-black mt5 text-control post-all-content" ng-bind-html="issue.description|safeHtml"></div> <div class="f13 c-black mt5 text-control post-all-content" ng-bind-html="issue.description|safeHtml" img-preview></div>
<span class="c-grey f12 mr15">&nbsp;&nbsp;&nbsp;态:{{issue.issue_status}}</span> <span class="c-grey f12 mr15">&nbsp;&nbsp;&nbsp;态:{{issue.issue_status}}</span>
<span class="c-grey f12">优先级:{{issue.issue_priority}}</span><br/> <span class="c-grey f12">优先级:{{issue.issue_priority}}</span><br/>
<span class="c-grey f12 mr15">指派给:{{issue.issue_assigned_to}}</span> <span class="c-grey f12 mr15">指派给:{{issue.issue_assigned_to}}</span>

View File

@ -0,0 +1,34 @@
<div class="post-container">
<div loading-spinner></div>
<div ng-show="current_course" class="post-container" style="padding-bottom:50px;">
<div class="blue-title">欢迎加入班级</div>
<div class="class-detail-row f13 c-grey3"><img src="images/logo.png" ng-src="{{current_course.img_url}}" class="fl ml10 img-circle mt4" width="30"><span class="fl mt10 ml10 ng-binding">{{current_course.name}}</span><div class="cl"></div> </div>
<div class="course-list-row f13 c-grey3 mt10"><span class="fl ml15">选择分班</span></div>
<ul class="class-list f13 c-grey3">
<li><span class="fl ml10 class-list-name hidden">暂无</span><span ng-click="selectGroup(0)" class="login-box fr mr10 mt12 img-circle" ng-class="[{'checked': selectid == 0}]"></span></li>
<div ng-repeat="group in groups">
<li><span class="fl ml10 class-list-name hidden">{{group.course_group.name}}</span><span ng-click="selectGroup(group.course_group.id)" class="login-box fr mr10 mt12 img-circle" ng-class="[{'checked': selectid == group.course_group.id}]"></span></li>
<!--<li class="border-bottom-none"><span class="fl ml10 class-list-name hidden">分班2</span><span class="login-box fr mr10 mt12 img-circle" ng-class="['login-box', 'fr', 'mr10', 'mt12', {'checked': student}]"></span></li>-->
</div>
</ul>
<div class="f12 c-grey6 mt10 ml15">
<span class="f13 c-grey3">提示</span>
<ul class="mb15 mt5 ml10 new-tip">
<li><span class="project-intro-dot"></span>该班级存在分班信息,请选择属于您的小班</li>
<li><span class="project-intro-dot"></span>老师可以在班级的成员管理页,对所有成员进行修改</li>
<li><span class="project-intro-dot"></span>学生可以在班级的我的同学页,对自己进行修改</li>
</ul>
</div>
<div class="bottom-tab-wrap mt10">
<a ng-click="cancel()" ng-click="cancel()" class="weixin-tab c-grey border-top">跳过</a>
<a ng-click="confirm()" ng-click="joinClass()" class="weixin-tab link-blue2 border-top">确认</a>
</div>
</div>
<div ng-show="tip_1" class="blue-title">{{tip_1}}</div>
<my-alert message="alertService.message" title="alertService.title" visible="alertService.visible" cb="alertService.cb"></my-alert>
</div>

View File

@ -24,7 +24,7 @@
<div class="ml40"> <div class="ml40">
<div class="c-grey4 f13 mt5"><span class="mr10">留言</span><span>{{message.created_on}}</span></div> <div class="c-grey4 f13 mt5"><span class="mr10">留言</span><span>{{message.created_on}}</span></div>
<div class="f13 c-black mt5 text-control post-all-content" ng-bind-html="message.content|safeHtml"></div> <div class="f13 c-black mt5 text-control post-all-content" ng-bind-html="message.content|safeHtml" img-preview></div>
<div class="cl"></div> <div class="cl"></div>
<div class="fr f13"> <div class="fr f13">
<div ng-if="!message.praise_count" ng-click="addPraise(message);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div> <div ng-if="!message.praise_count" ng-click="addPraise(message);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div>

View File

@ -13,7 +13,7 @@
<div ng-class="{'undis': currentTab!=1}"> <div ng-class="{'undis': currentTab!=1}">
<div ng-repeat="r in resources|filter:{filename:searchText}" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"> <div ng-repeat="r in resources|filter:{filename:searchText}" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]">
<img src="/images/wechat/courseware.png" width="15" class="ml10 fl" /> <a ng-href="{{g_localhost}}/attachments/download/{{r.id}}/{{r.filename}}?type=wechat" target="_blank" class="fl ml10 resource-width">{{r.filename}}</a><a ng-show="r.current_user_is_teacher" ng-click="sendFile(r,1)" class="fr mr10 link-blue2">发送</a><div class="cl"></div> <img src="/images/wechat/courseware.png" width="15" class="ml10 fl" /> <a ng-href="{{g_localhost}}/attachments/download/{{r.id}}/{{r.filename}}?type=wechat" target="_blank" class="fl ml10 resource-width">{{r.filename}}</a><a ng-show="r.current_user_is_teacher" ng-click="sendFile(r,1)" class="fr mr10 link-blue2">发送</a><div class="cl"></div>
<span class="f12 mt5 ml35 c-grey4 fl courseware-from-width hidden">课件来源:{{r.coursename}}</span><span class="f12 ml10 mt5 c-grey4 fl">大小:{{r.attafile_size}}</span><div class="cl"></div> <span class="f12 mt5 ml35 c-grey4 fl courseware-from-width hidden">课件来源:{{r.syllabus_title}}<font class="fb" style="height:18px; line-height:18px; vertical-align:top; margin:0 3px;">·</font>{{r.coursename}}</span><span class="f12 ml10 mt5 c-grey4 fl">大小:{{r.attafile_size}}</span><div class="cl"></div>
</div> </div>
<div ng-if="has_more"> <div ng-if="has_more">
<div id="more" class="more-events mt10" ng-click="loadResourceData(1,page+1);">更多</div> <div id="more" class="more-events mt10" ng-click="loadResourceData(1,page+1);">更多</div>
@ -24,7 +24,7 @@
</div> </div>
<div ng-class="{'undis': currentTab!=2}"> <div ng-class="{'undis': currentTab!=2}">
<div ng-repeat="r in homeworks|filter:{homework_name: searchText}" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><img src="/images/wechat/homework.png" width="15" class="ml10 fl" /><span ng-click="goHomeworkDetail(r.id)" class="fl ml10 resource-width">{{r.homework_name}}</span><a ng-show="r.current_user_is_teacher" ng-click="sendFile(r,2)" class="fr mr10 link-blue2 ">发送</a><div class="cl"></div> <div ng-repeat="r in homeworks|filter:{homework_name: searchText}" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><img src="/images/wechat/homework.png" width="15" class="ml10 fl" /><span ng-click="goHomeworkDetail(r.id)" class="fl ml10 resource-width">{{r.homework_name}}</span><a ng-show="r.current_user_is_teacher" ng-click="sendFile(r,2)" class="fr mr10 link-blue2 ">发送</a><div class="cl"></div>
<span class="f12 mt5 ml35 c-grey4 fl other-from-width hidden">作业来源:{{r.coursename}}</span><div class="cl"></div> <span class="f12 mt5 ml35 c-grey4 fl other-from-width hidden">作业来源:{{r.syllabus_title}}<font class="fb" style="height:18px; line-height:18px; vertical-align:top; margin:0 3px;">·</font>{{r.coursename}}</span><div class="cl"></div>
</div> </div>
<div ng-if="homework_has_more"> <div ng-if="homework_has_more">
<div id="more_homeworks" class="more-events mt10" ng-click="loadResourceData(2,homework_page+1);">更多</div> <div id="more_homeworks" class="more-events mt10" ng-click="loadResourceData(2,homework_page+1);">更多</div>

View File

@ -25,7 +25,7 @@
<div class="post-dynamic-title c-black fb">{{discussion.subject}}<img ng-if="discussion.locked" src="/images/locked.png" style="display:inline-block;" /></div> <div class="post-dynamic-title c-black fb">{{discussion.subject}}<img ng-if="discussion.locked" src="/images/locked.png" style="display:inline-block;" /></div>
<div class="c-grey4 f13 mt5"><span class="mr10">{{discussion.course_project_name}} - 项目讨论区</span><span>{{discussion.created_on}}</span></div> <div class="c-grey4 f13 mt5"><span class="mr10">{{discussion.course_project_name}} - 项目讨论区</span><span>{{discussion.created_on}}</span></div>
<div class="f13 c-black mt5 text-control post-all-content" ng-bind-html="discussion.content|safeHtml"></div> <div class="f13 c-black mt5 text-control post-all-content" ng-bind-html="discussion.content|safeHtml" img-preview></div>
<div class="cl"></div> <div class="cl"></div>
<div class="fr f13"> <div class="fr f13">
<div ng-if="!discussion.praise_count" ng-click="addPraise(discussion);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div> <div ng-if="!discussion.praise_count" ng-click="addPraise(discussion);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span></span></div>

View File

@ -2,7 +2,7 @@
<div loading-spinner></div> <div loading-spinner></div>
<div ng-show="current_course && current_review_member " class="post-container" style="padding-bottom:50px;"> <div ng-show="current_course && current_review_member " class="post-container" style="padding-bottom:50px;">
<div ng-show="status==0"> <div ng-show="status==0">
<div class="blue-title">{{current_course.name}}</div> <div class="blue-title"><span class="course-name-width hidden inline-block">{{current_course.syllabus_title}}<font class="fb" style="height:39px; line-height:39px; vertical-align:top; margin:0 3px;">·</font>{{current_course.name}}</span></div>
<div class="class-detail-row f13 c-grey3"><img ng-src="{{current_review_member.img_url}}" width="30" class="fl ml10 img-circle mt4" /><span class="fl mt10 ml10">{{current_review_member.realname == "" ? current_review_member.name : current_review_member.realname}}</span><img ng-src="/images/wechat/{{current_review_member.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt10" /><div class="cl"></div> </div> <div class="class-detail-row f13 c-grey3"><img ng-src="{{current_review_member.img_url}}" width="30" class="fl ml10 img-circle mt4" /><span class="fl mt10 ml10">{{current_review_member.realname == "" ? current_review_member.name : current_review_member.realname}}</span><img ng-src="/images/wechat/{{current_review_member.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> <div class="course-list-row f13 c-grey3 mt10"><span class="fl ml10">角色</span></div>
<ul class="class-list f13 c-grey3"> <ul class="class-list f13 c-grey3">
@ -29,7 +29,7 @@
</div> </div>
<div ng-show="current_course && !current_review_member "> <div ng-show="current_course && !current_review_member ">
<div class="blue-title">{{current_course.name}}</div> <div class="blue-title"><span class="course-name-width hidden inline-block">{{current_course.syllabus_title}}<font class="fb" style="height:39px; line-height:39px; vertical-align:top; margin:0 3px;">·</font>{{current_course.name}}</span></div>
<div class="tac sn-font-grey2" style="margin-top:50px;">{{tip_2}}</div> <div class="tac sn-font-grey2" style="margin-top:50px;">{{tip_2}}</div>
</div> </div>

View File

@ -0,0 +1,28 @@
<div class="post-container">
<div loading-spinner></div>
<div class="post-container" style="padding-bottom:50px;">
<div class="blue-title">我的信息</div>
<div class="class-detail-row f13 c-grey3"><img ng-src="{{current_edit_member.user.img_url}}" class="fl ml10 img-circle mt4" width="30"><span class="fl mt10 ml10 ng-binding">{{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" class="fl ml10 mt10" width="15"><div class="cl"></div> </div>
<div class="course-list-row f13 c-grey3 mt10"><span class="fl ml15">角色</span></div>
<div class="f13 ml35 mt10 c-grey3">学生</div>
<div class="course-list-row f13 c-grey3 mt10"><span class="fl ml15">选择分班</span></div>
<ul class="class-list f13 c-grey3">
<li><span class="fl ml10 class-list-name hidden">暂无</span><span ng-click="selectGroup(0)" class="login-box fr mr10 mt12 img-circle" ng-class="[{'checked': selectid == 0}]"></span></li>
<div ng-repeat="group in groups">
<li><span class="fl ml10 class-list-name hidden">{{group.course_group.name}}</span><span ng-click="selectGroup(group.course_group.id)" class="login-box fr mr10 mt12 img-circle" ng-class="[{'checked': selectid == group.course_group.id}]"></span></li>
<!--<li class="border-bottom-none"><span class="fl ml10 class-list-name hidden">分班2</span><span class="login-box fr mr10 mt12 img-circle" ng-class="['login-box', 'fr', 'mr10', 'mt12', {'checked': student}]"></span></li>-->
</div>
</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="confirm()" class="weixin-tab link-blue2 border-top">确定</a>
</div>
</div>
<div ng-show="tip_1" class="blue-title">{{tip_1}}</div>
<div ng-show="tip_2" class="blue-title">{{tip_2}}</div>
<my-alert message="alertService.message" title="alertService.title" visible="alertService.visible" cb="alertService.cb"></my-alert>
</div>

View File

@ -247,7 +247,6 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
resetMenu(vm.course.current_user_is_teacher,vm.currentTab); resetMenu(vm.course.current_user_is_teacher,vm.currentTab);
} }
vm.onSetting = function(user){ vm.onSetting = function(user){
rms.save('current_edit_member', user); rms.save('current_edit_member', user);
rms.save("course",vm.course); rms.save("course",vm.course);
@ -255,6 +254,13 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
$location.path("/edit_class_member").search({id: courseid,user_id: user.id}); $location.path("/edit_class_member").search({id: courseid,user_id: user.id});
}; };
vm.onSetting_1 = function(user){
rms.save('current_edit_member', user);
rms.save("course",vm.course);
rms.save("tab_num",vm.currentTab);
$location.path("/select_my_coursegroup").search({id: courseid,user_id: user.id});
};
vm.review = function(user){ vm.review = function(user){
rms.save('current_review_member', user); rms.save('current_review_member', user);
rms.save('current_course', vm.course); rms.save('current_course', vm.course);
@ -361,5 +367,24 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
}; };
vm.goEditGroup = function(){
if(!vm.isTeacher){
return;
}
rms.save('course_activities_page',vm.course_activities_page);
rms.save("course_activities",vm.course_activities);
rms.save('course_has_more', vm.course_has_more);
rms.save("tab_num",vm.currentTab);
rms.save("course",vm.course);
rms.save('current_course', vm.course);
if(vm.course.groupnum == 0){
$location.path("/edit_class_group").search({id: courseid});
}
else{
$location.path("/class_group").search({id: courseid});
}
}
}]); }]);

View File

@ -0,0 +1,48 @@
app.controller('ClassGroupController', ['$scope', 'config','$http', 'auth','$location','$routeParams','alertService','rms','common','$timeout', function($scope, config, $http, auth, $location, $routeParams,alertService,rms,common,$timeout){
// common.checkLogin();
$scope.replaceUrl = function(url){
return url;
};
var vm = $scope;
var courseid = $routeParams.id;
vm.alertService = alertService.create();
if(!vm.course){
$http.get(config.apiUrl+ 'courses/'+courseid+"?token="+auth.token()).then(
function(response) {
console.log(response.data);
if (response.data.status == 0){
vm.course = response.data.data;
console.log("courses");
console.log(response.data.data);
}
else{
vm.alertService.showMessage('提示', response.data.message);
}
if(!vm.course){
vm.tip_1 = "该班级不存在或已被删除";
}
}
);
}
$http.get(config.apiUrl + 'courses/course_groups_withstudent/'+courseid+'?token='+auth.token()).then(
function(response) {
console.log("groups=");
console.log(response);
if(response.data.status == 0) {
vm.groups = response.data.data;
}
else{
vm.groups = [];
}
});
vm.goEditGroup = function(){
$location.path("/edit_class_group").search({id: courseid});
}
}]);

View File

@ -63,7 +63,7 @@ app.controller('EditClassController', ['$scope', '$http', 'auth', 'config', 'ale
vm.syllabus.courses.splice(index, 1); vm.syllabus.courses.splice(index, 1);
} }
} };
vm.newClass = function (frm, syllabus) { vm.newClass = function (frm, syllabus) {
frm.$setSubmitted(); frm.$setSubmitted();

View File

@ -0,0 +1,136 @@
app.controller('EditClassGroupController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms','common', function($scope, $http, auth, config, alertService, $location,$routeParams, rms,common){
var vm = $scope;
var courseid = $routeParams.id;
vm.alertService = alertService.create();
vm.alertService_2 = alertService.create();
if(!vm.course){
$http.get(config.apiUrl+ 'courses/'+courseid+"?token="+auth.token()).then(
function(response) {
console.log(response.data);
if (response.data.status == 0){
vm.course = response.data.data;
console.log("courses");
console.log(response.data.data);
}
else{
vm.alertService.showMessage('提示', response.data.message);
}
if(!vm.course){
vm.tip_1 = "该班级不存在或已被删除";
}
}
);
}
$http.get(config.apiUrl + 'courses/course_groups/'+courseid+'?token='+auth.token()).then(
function(response) {
console.log("groups=");
console.log(response);
if(response.data.status == 0) {
vm.groups = response.data.data;
for(var i in vm.groups){
vm.groups[i].tmpname = vm.groups[i].course_group.name;
}
}
else{
vm.groups = [];
}
});
vm.addGroup = function(){
vm.groups.push({tmpname:""});
};
vm.deleteGroup = function(index){
var group = vm.groups[index];
if(group.course_group){
vm.alertService_2.showMessage('提示', '您确定要删除该分班吗?', function() {
$http.post(config.apiUrl+'courses/delete_coursegroup', {
token: auth.token(),
id: courseid,
course_group_id:group.course_group.id
}).then(function(response){
console.log(response);
if(response.data.status == 0){
vm.alertService.showMessage('提示', "删除成功!",function(){
vm.groups.splice(index, 1);
});
} else {
vm.alertService.showMessage('提示', response.data.message);
}
});
});
} else {
vm.groups.splice(index, 1);
}
};
vm.newGroup = function (frm, groups) {
frm.$setSubmitted();
console.log(groups);
if(!frm.$valid){
console.log(frm.$error);
return;
}
if(vm.groups.length == 0){
$location.path("/class").search({id: courseid,tag:1});
return;
}
//不能有相同名称的分班
for(var i=0;i< vm.groups.length-1;i++) {
for (var j=i+1;j<vm.groups.length;j++){
if(vm.groups[i].tmpname == vm.groups[j].tmpname){
vm.alertService.showMessage('提示', "分班名称不能重复!");
return;
}
}
};
var add_groups = [];
var modify_groups = [];
for(var i in vm.groups){
var group = vm.groups[i];
if(!group.course_group){
add_groups.push(group.tmpname);
}
else if(group.tmpname != group.course_group.name){
modify_groups.push({id:group.course_group.id,name:group.tmpname});
}
}
if(add_groups.length == 0 && modify_groups.length == 0){
vm.alertService.showMessage('提示', "保存分班成功!",function(){
$location.path("/class").search({id: courseid,tag:1});
return;
});
}
//编辑分班
$http.post(config.apiUrl+'courses/edit_coursegroup', {
token: auth.token(),
id: courseid,
add_groups: add_groups,
modify_groups: modify_groups
}).then(function(response){
console.log(response);
if(response.data.status == 0){
vm.alertService.showMessage('提示', "保存分班成功!",function(){
$location.path("/class").search({id: courseid,tag:1});
});
} else {
vm.alertService.showMessage('提示', response.data.message,function(){
$location.path("/class").search({id: courseid,tag:1});
});
}
});
}
}] );

View File

@ -24,6 +24,11 @@ app.controller('EditClassMemberController', ['$scope', '$http', 'auth', 'config'
vm.tmpstudent = false; //学生 vm.tmpstudent = false; //学生
vm.buttongrey = true; vm.buttongrey = true;
vm.selectid = 0;
vm.show_1 = true;
vm.show_2 = false;
vm.show_3 = false;
if(!vm.current_edit_member){ if(!vm.current_edit_member){
@ -42,6 +47,8 @@ app.controller('EditClassMemberController', ['$scope', '$http', 'auth', 'config'
user_id = response.data.user_id; user_id = response.data.user_id;
vm.current_edit_member = response.data.member_info; vm.current_edit_member = response.data.member_info;
vm.current_roles_id = vm.current_edit_member.roles_id; vm.current_roles_id = vm.current_edit_member.roles_id;
vm.selectid = response.data.course_group_id;
vm.course_group_id = vm.selectid;
for(var i in vm.current_roles_id){ for(var i in vm.current_roles_id){
if(vm.current_roles_id[i] == 9){ if(vm.current_roles_id[i] == 9){
@ -57,6 +64,18 @@ app.controller('EditClassMemberController', ['$scope', '$http', 'auth', 'config'
vm.tmpstudent = true; vm.tmpstudent = true;
} }
} }
$http.get(config.apiUrl + 'courses/course_groups/'+course_id+'?token='+auth.token()).then(
function(response) {
console.log("groups=");
console.log(response);
if(response.data.status == 0) {
vm.groups = response.data.data;
}
else{
vm.groups = [];
}
});
} }
}); });
} }
@ -96,10 +115,29 @@ app.controller('EditClassMemberController', ['$scope', '$http', 'auth', 'config'
return; return;
} }
if(vm.current_edit_member.show){ if(vm.show_2){
//删除成员 //删除成员
vm.deleteMember(vm.current_edit_member.user.id); vm.deleteMember(vm.current_edit_member.user.id);
} }
else if(vm.show_3){
//加入分班
$http.post(config.apiUrl+'courses/user_edit_coursegroup', {
token: auth.token(),
id: course_id,
course_group_id:vm.selectid,
user_id:vm.current_edit_member.user.id
}).then(function(response){
console.log(response);
if(response.data.status == 0){
vm.alertService.showMessage('提示', "修改分班成功!",function(){
$location.path("/class").search({id: course_id,tag:1});
});
} else {
vm.alertService.showMessage('提示', response.data.message);
}
});
}
else{ else{
if((vm.teacher == vm.tmpteacher)&& (vm.assistant == vm.tmpassistant)&&(vm.student == vm.tmpstudent)){ if((vm.teacher == vm.tmpteacher)&& (vm.assistant == vm.tmpassistant)&&(vm.student == vm.tmpstudent)){
vm.alertService.showMessage('提示', "该用户当前已是该角色"); vm.alertService.showMessage('提示', "该用户当前已是该角色");
@ -159,14 +197,53 @@ app.controller('EditClassMemberController', ['$scope', '$http', 'auth', 'config'
}; };
vm.clickChangeRole = function(){ vm.clickDeleteMember = function(){
vm.current_edit_member.show = !vm.current_edit_member.show; vm.show_2 = !vm.show_2;
if((vm.teacher == vm.tmpteacher)&& (vm.assistant == vm.tmpassistant)&&(vm.student == vm.tmpstudent)){ if(vm.show_2){
vm.buttongrey = true; vm.show_1 = false;
} vm.show_3 = false;
else{
vm.buttongrey = false; vm.buttongrey = false;
} }
}; };
vm.clickChangeRole = function(){
vm.show_1 = !vm.show_1;
if(vm.show_1){
vm.show_2 = false;
vm.show_3 = false;
if((vm.teacher == vm.tmpteacher)&& (vm.assistant == vm.tmpassistant)&&(vm.student == vm.tmpstudent)){
vm.buttongrey = true;
}
else{
vm.buttongrey = false;
}
}
};
vm.clickSelectGroup = function(){
vm.show_3 = !vm.show_3;
if(vm.show_3){
vm.show_1 = false;
vm.show_2 = false;
if(vm.selectid != vm.course_group_id){
vm.buttongrey = false;
}
else{
vm.buttongrey = true;
}
}
};
vm.selectGroup = function(id){
vm.selectid = id;
if(vm.course_group_id != vm.selectid){
vm.buttongrey = false;
}
else{
vm.buttongrey = true;
}
};
}] ); }] );

View File

@ -55,13 +55,23 @@ app.controller('JoinClassController', ['$scope', '$http', 'auth', 'config', 'ale
assistant_flag:vm.assistant, assistant_flag:vm.assistant,
student_flag:vm.student student_flag:vm.student
}).then(function(response){ }).then(function(response){
console.log(response);
if(response.data.status == 0){ if(response.data.status == 0){
vm.alertService.showMessage('提示', response.data.message,function(){ vm.alertService.showMessage('提示', response.data.message,function(){
rms.save('syllabuses',[]); rms.save('syllabuses',[]);
$location.path("/class_list"); if(response.data.go_coursegroup_flag == 0){
$location.path("/class_list");
}
else{
$location.path("/join_classgroup").search({id: response.data.course_id});
}
}); });
} else { } else {
vm.alertService.showMessage('提示', response.data.message); vm.alertService.showMessage('提示', response.data.message,function(){
if(response.data.go_coursegroup_flag == 1) {
$location.path("/join_classgroup").search({id: response.data.course_id});
}
});
} }
}); });
}; };

View File

@ -0,0 +1,82 @@
app.controller('JoinClassGroupController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms','wx','common', function($scope, $http, auth, config, alertService, $location,$routeParams, rms,wx,common){
var vm = $scope;
var course_id = $routeParams.id;
vm.alertService = alertService.create();
vm.selectid = null;
$http.get(config.apiUrl+ 'courses/'+course_id+"?token="+auth.token()).then(
function(response) {
console.log(response.data);
if (response.data.status == 0){
vm.current_course = response.data.data;
console.log("courses=");
console.log(response.data.data);
if(vm.current_course){
$http.get(config.apiUrl + 'courses/course_groups/'+course_id+'?token='+auth.token()).then(
function(response) {
console.log("groups=");
console.log(response);
if(response.data.status == 0) {
vm.groups = response.data.data;
}
else{
vm.groups = [];
}
});
}
}
else{
vm.alertService.showMessage('提示', response.data.message);
}
if(!vm.current_course){
vm.tip_1 = "该班级不存在或已被删除";
}
}
);
vm.selectGroup = function(id){
vm.selectid = id;
};
vm.cancel = function(){
rms.save('syllabuses',[]);
$location.path("/class_list");
};
vm.confirm = function(){
if(vm.selectid == null){
vm.alertService.showMessage('提示', "请选择分班!");
return;
}
if(vm.selectid == 0){
$location.path("/class_list");
return;
}
//加入分班
$http.post(config.apiUrl+'courses/user_join_coursegroup', {
token: auth.token(),
id: course_id,
course_group_id:vm.selectid
}).then(function(response){
console.log(response);
if(response.data.status == 0){
vm.alertService.showMessage('提示', "选择分班成功!",function(){
rms.save('syllabuses',[]);
$location.path("/class_list");
});
} else {
vm.alertService.showMessage('提示', response.data.message,function(){
rms.save('syllabuses',[]);
$location.path("/class_list");
});
}
});
};
}] );

View File

@ -0,0 +1,117 @@
app.controller('SelectMyCourseGroupController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms','common', function($scope, $http, auth, config, alertService, $location,$routeParams, rms,common){
// common.checkLogin();
var vm = $scope;
vm.current_review_member = rms.get('current_review_member');
vm.alertService = alertService.create();
vm.tip_1 = "";
vm.tip_2 = "";
var course_id = $routeParams.id;
var user_id = $routeParams.user_id;
vm.selectid = null;
if(!vm.current_course){
$http.get(config.apiUrl+ 'courses/'+course_id+"?token="+auth.token()).then(
function(response) {
console.log(response.data);
if (response.data.status == 0){
vm.current_course = response.data.data;
console.log("courses");
console.log(response.data.data);
}
else{
vm.alertService.showMessage('提示', response.data.message);
}
if(!vm.current_course){
vm.tip_1 = "该班级不存在或已被删除";
}
}
);
}
if(!vm.current_edit_member){
$http.post(config.apiUrl+'courses/get_member_info', {
token: auth.token(),
id: course_id,
user_id:user_id
}).then(function(response){
if(response.data.status!=0){
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;
vm.current_edit_member = response.data.member_info;
vm.current_roles_id = vm.current_edit_member.roles_id;
vm.selectid = response.data.course_group_id;
vm.course_group_id = vm.selectid;
for(var i in vm.current_roles_id){
if(vm.current_roles_id[i] == 10){
vm.student = true;
}
}
if(!vm.student){
vm.tip_2 = "您不是该班级的学生!";
}
else{
$http.get(config.apiUrl + 'courses/course_groups/'+course_id+'?token='+auth.token()).then(
function(response) {
console.log("groups=");
console.log(response);
if(response.data.status == 0) {
vm.groups = response.data.data;
}
else{
vm.groups = [];
}
});
}
}
});
}
vm.cancel = function(){
window.history.back();
};
vm.confirm = function(){
if(vm.course_group_id == vm.selectid){
$location.path("/class").search({id: course_id,tag:1});
return;
}
//加入分班
$http.post(config.apiUrl+'courses/user_edit_coursegroup', {
token: auth.token(),
id: course_id,
course_group_id:vm.selectid,
user_id:user_id
}).then(function(response){
console.log(response);
if(response.data.status == 0){
vm.alertService.showMessage('提示', "修改分班成功!",function(){
$location.path("/class").search({id: course_id,tag:1});
});
} else {
vm.alertService.showMessage('提示', response.data.message,function(){
$location.path("/class").search({id: course_id,tag:1});
});
}
});
};
vm.selectGroup = function(id){
vm.selectid = id;
};
}] );

View File

@ -0,0 +1,22 @@
/**
* Created by ttang on 2016/9/20.
*/
app.directive('imgPreview',["$timeout",'wx',function(timer,wx){
return{
restrict: 'A',
scope: {},
link: function(scope, element){
timer(function(){
var srcList = [];
$.each($(".post-all-content img"),function(i,item){
if(item.src){
srcList.push(item.src);
$(item).click(function(e){
wx.previewImage({current:this.src,urls:srcList});
});
}
});
})
}
}
}]);

View File

@ -33,15 +33,19 @@ app.config(['$routeProvider',"$httpProvider", "$locationProvider",'config', func
.when('/class', makeRoute('class.html', 'ClassController')) .when('/class', makeRoute('class.html', 'ClassController'))
.when('/new_class', makeRoute('new_class.html', 'NewClassController')) .when('/new_class', makeRoute('new_class.html', 'NewClassController'))
.when('/edit_class', makeRoute('edit_class.html', 'EditClassController')) .when('/edit_class', makeRoute('edit_class.html', 'EditClassController'))
.when('/edit_class_group', makeRoute('edit_class_group.html', 'EditClassGroupController'))
.when('/class_list', makeRoute('class_list.html', 'ClassListController')) .when('/class_list', makeRoute('class_list.html', 'ClassListController'))
.when('/edit_class_member', makeRoute('edit_class_member.html', 'EditClassMemberController')) .when('/edit_class_member', makeRoute('edit_class_member.html', 'EditClassMemberController'))
.when('/myresource', makeRoute('myresource.html', 'MyResourceController')) .when('/myresource', makeRoute('myresource.html', 'MyResourceController'))
.when('/invite_code', {templateUrl: rootPath + 'invite_code.html', controller: 'InviteCodeController'}) .when('/invite_code', {templateUrl: rootPath + 'invite_code.html', controller: 'InviteCodeController'})
.when('/send_class_list', makeRoute('send_class_list.html', 'SendClassListController')) .when('/send_class_list', makeRoute('send_class_list.html', 'SendClassListController'))
.when('/join_class', makeRoute('join_class.html', 'JoinClassController')) .when('/join_class', makeRoute('join_class.html', 'JoinClassController'))
.when('/join_classgroup', makeRoute('join_classgroup.html', 'JoinClassGroupController'))
.when('/review_class_member', makeRoute('review_class_member.html', 'ReviewClassMemberController')) .when('/review_class_member', makeRoute('review_class_member.html', 'ReviewClassMemberController'))
.when('/select_my_coursegroup', makeRoute('select_my_coursegroup.html', 'SelectMyCourseGroupController'))
.when('/class_publishnotice', makeRoute('class_publishnotice.html', 'ClassPublishNoticeController')) .when('/class_publishnotice', makeRoute('class_publishnotice.html', 'ClassPublishNoticeController'))
.when('/class_publishissue', makeRoute('class_publishissue.html', 'ClassPublishIssueController')) .when('/class_publishissue', makeRoute('class_publishissue.html', 'ClassPublishIssueController'))
.when('/class_group', makeRoute('class_group.html', 'ClassGroupController'))
.when('/project_list', makeRoute('project_list.html', 'ProjectListController')) .when('/project_list', makeRoute('project_list.html', 'ProjectListController'))
.when('/project', makeRoute('project.html', 'ProjectController')) .when('/project', makeRoute('project.html', 'ProjectController'))
.when('/edit_project_member', makeRoute('edit_project_member.html', 'EditProjectMemberController')) .when('/edit_project_member', makeRoute('edit_project_member.html', 'EditProjectMemberController'))

View File

@ -43,6 +43,7 @@ blockquote {border:1px solid #d4d4d4; padding: 0.6em; margin: 5px 0.4em 5px 1.4e
.mr25 {margin-right:25px;} .mr25 {margin-right:25px;}
.ml55 {margin-left:55px;} .ml55 {margin-left:55px;}
.mr55 {margin-right:55px;} .mr55 {margin-right:55px;}
.ml65 {margin-left:65px;}
.c-red {color:#e81a1a;} .c-red {color:#e81a1a;}
.c-blue {color:#269ac9;} .c-blue {color:#269ac9;}
.c-grey {color:#9a9a9a !important;} .c-grey {color:#9a9a9a !important;}
@ -147,7 +148,7 @@ a.underline {text-decoration:underline;}
.post-dynamic-author {width:50%; height:30px; line-height:30px; font-size:14px; color:#5b5b5b; vertical-align:middle;} .post-dynamic-author {width:50%; height:30px; line-height:30px; font-size:14px; color:#5b5b5b; vertical-align:middle;}
.post-dynamic-time {height:30px; line-height:30px; vertical-align:middle;} .post-dynamic-time {height:30px; line-height:30px; vertical-align:middle;}
.post-dynamic-title {font-size:15px;} .post-dynamic-title {font-size:15px;}
.post-dynamic-from {width:50%; font-size:13px;} .post-dynamic-from {width:55%; font-size:13px;}
.post-box-shadow {box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5);} .post-box-shadow {box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5);}
.post-reply-author {width:50%; height:20px; line-height:20px; font-size:12px; color:#5d5d5d; vertical-align:middle;} .post-reply-author {width:50%; height:20px; line-height:20px; font-size:12px; color:#5d5d5d; vertical-align:middle;}
.post-reply-time {height:20px; line-height:20px; vertical-align:middle;} .post-reply-time {height:20px; line-height:20px; vertical-align:middle;}
@ -203,7 +204,7 @@ a.underline {text-decoration:underline;}
.img-circle {border-radius:50% !important;} .img-circle {border-radius:50% !important;}
.member-banner {height:24px; line-height:24px; text-align:center; vertical-align:middle; background-color:#dfdfdf;} .member-banner {height:24px; line-height:24px; text-align:center; vertical-align:middle; background-color:#dfdfdf;}
.resource-width {width:76%;} .resource-width {width:76%;}
.courseware-from-width {max-width:57%;} .courseware-from-width {max-width:50%;}
.other-from-width {max-width:80%;} .other-from-width {max-width:80%;}
.course-name-width {width:68%;} .course-name-width {width:68%;}