Merge branch 'rep_quality' of https://git.trustie.net/jacknudt/trustieforge into rep_quality

This commit is contained in:
huang 2016-08-26 15:14:07 +08:00
commit a434942b6d
128 changed files with 2330 additions and 1029 deletions

View File

@ -13,50 +13,55 @@ module Mobile
requires :container_type, type: String
end
post do
authenticate!
begin
authenticate!
user = current_user
user = current_user
container_type = params[:container_type] ? params[:container_type] : "All"
container_type = params[:container_type] ? params[:container_type] : "All"
if container_type == "All" || container_type == "Project"
shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{user.id} and shield_type='Project'").map(&:shield_id)
user_project_ids = (user.projects.where("status = 1").map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (user.projects.where("status = 1").map{|project| project.id}-shield_project_ids).join(",") + ")"
project_types = "('Message','Issue','Project')"
if container_type == "All" || container_type == "Project"
shield_project_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{user.id} and shield_type='Project'").map(&:shield_id)
user_project_ids = (user.projects.where("status = 1").map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (user.projects.where("status = 1").map{|project| project.id}-shield_project_ids).join(",") + ")"
project_types = "('Message','Issue','Project')"
end
if container_type == "All" || container_type == "Course"
shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{user.id} and shield_type='Course'").map(&:shield_id)
user_course_ids = (user.courses.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (user.courses.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")"
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
end
page = params[:page] ? params[:page] : 0
principal_types = "JournalsForMessage"
watched_user_ids = User.watched_by(user.id).count == 0 ? " " : ("," + User.watched_by(user.id).map{|u| u.id.to_s }.join(','))
user_ids = "(" + user.id.to_s + watched_user_ids + ")"
watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}").count == 0 ? " " :Blog.select("id").where("author_id in #{user_ids}").map { |blog| blog.id}.join(",")
blog_ids = "(" + watched_user_blog_ids + ")"
if container_type == "Course"
activities = UserActivity.where("(container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})").order('updated_at desc')
elsif container_type == "Project"
activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})").order('updated_at desc')
else
activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{user.id}) " +
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc')
end
all_count = activities.count
activities = activities.limit(10).offset(page * 10)
count = activities.count
present :data, activities, with: Mobile::Entities::Activity,user: user
present :all_count, all_count
present :count, count
present :page, page
present :status, 0
present :container_type, container_type
rescue Exception=>e
present :status, -1
present :message, e.message
end
if container_type == "All" || container_type == "Course"
shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{user.id} and shield_type='Course'").map(&:shield_id)
user_course_ids = (user.courses.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (user.courses.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")"
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
end
page = params[:page] ? params[:page] : 0
principal_types = "JournalsForMessage"
watched_user_ids = User.watched_by(user.id).count == 0 ? " " : ("," + User.watched_by(user.id).map{|u| u.id.to_s }.join(','))
user_ids = "(" + user.id.to_s + watched_user_ids + ")"
watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}").count == 0 ? " " :Blog.select("id").where("author_id in #{user_ids}").map { |blog| blog.id}.join(",")
blog_ids = "(" + watched_user_blog_ids + ")"
if container_type == "Course"
activities = UserActivity.where("(container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})").order('updated_at desc')
elsif container_type == "Project"
activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})").order('updated_at desc')
else
activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{user.id}) " +
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc')
end
all_count = activities.count
activities = activities.limit(10).offset(page * 10)
count = activities.count
present :data, activities, with: Mobile::Entities::Activity,user: user
present :all_count, all_count
present :count, count
present :page, page
present :status, 0
present :container_type, container_type
end
end
end

View File

@ -7,17 +7,22 @@ module Mobile
desc "get special topic"
post ':id' do
user = current_user
begin
user = current_user
#0一级回复的更多 1 二级回复的更多
type = params[:type] || 0
page = params[:page] || 0
#0一级回复的更多 1 二级回复的更多
type = params[:type] || 0
page = params[:page] || 0
blog = BlogComment.find params[:id]
present :data, blog, with: Mobile::Entities::BlogComment,user: user,type: type,page: page
present :type, type
present :page, page
present :status, 0
blog = BlogComment.find params[:id]
present :data, blog, with: Mobile::Entities::BlogComment,user: user,type: type,page: page
present :type, type
present :page, page
present :status, 0
rescue Exception=>e
present :status, -1
present :message, e.message
end
end
end
end

View File

@ -167,8 +167,20 @@ module Mobile
requires :course_id, type: Integer, desc: "课程id"
end
get 'teachers' do
course = Course.find(params[:course_id])
cs = CoursesService.new
teachers = cs.course_teacher_or_student_list({role: '1'}, params[:course_id],current_user)
teachers.each do |m|
if m[:id] == course.tea_id
teachers.delete(m)
teachers.insert(0,m)
break
end
end
present :data, teachers, with: Mobile::Entities::User
present :status, 0
end

View File

@ -8,17 +8,25 @@ module Mobile
desc "get special issuse"
post ':id' do
authenticate!
user = current_user
begin
# authenticate!
user = current_user
#0一级回复的更多 1 二级回复的更多
type = params[:type] || 0
page = params[:page] || 0
issue = Issue.find params[:id]
present :data, issue, with: Mobile::Entities::Issue,user: user,type: type,page: page
present :type, type
present :page, page
present :status, 0
#is_public true 公开 false 私有 1公开 0私有
#0一级回复的更多 1 二级回复的更多
type = params[:type] || 0
page = params[:page] || 0
issue = Issue.find params[:id]
present :data, issue, with: Mobile::Entities::Issue,user: user,type: type,page: page
present :type, type
present :page, page
present :is_public, issue.project.is_public
present :status, 0
rescue Exception=>e
present :status, -1
present :message, e.message
end
end
end
end

View File

@ -7,18 +7,33 @@ module Mobile
desc "get special journal"
post ':id' do
authenticate!
user = current_user
begin
# authenticate!
user = current_user
#0一级回复的更多 1 二级回复的更多
type = params[:type] || 0
page = params[:page] || 0
#0一级回复的更多 1 二级回复的更多
type = params[:type] || 0
page = params[:page] || 0
jour = JournalsForMessage.find params[:id]
present :data, jour, with: Mobile::Entities::Jours,user: user,type: type,page: page
present :type, type
present :page, page
present :status, 0
jour = JournalsForMessage.find params[:id]
is_public = 1
if jour.jour_type == "Project"
is_public = jour.project.is_public
elsif jour.jour_type == "Course"
is_public = jour.course.is_public
end
present :data, jour, with: Mobile::Entities::Jours,user: user,type: type,page: page
present :type, type
present :page, page
present :is_public, is_public
present :status, 0
rescue Exception=>e
present :status, -1
present :message, e.message
end
end
end
end

View File

@ -7,17 +7,36 @@ module Mobile
desc "get special topic"
post ':id' do
authenticate!
user = current_user
begin
# authenticate!
user = current_user
#0一级回复的更多 1 二级回复的更多
type = params[:type] || 0
page = params[:page] || 0
message = Message.find params[:id]
present :data, message, with: Mobile::Entities::Message,user: user,type: type,page: page
present :type, type
present :page, page
present :status, 0
#0一级回复的更多 1 二级回复的更多
type = params[:type] || 0
page = params[:page] || 0
message = Message.find params[:id]
is_public = 1
type_name = ""
if message.project
is_public = message.project.is_public
type_name = "project"
elsif message.course
is_public = message.course.is_public
type_name = "course"
end
present :data, message, with: Mobile::Entities::Message,user: user,type: type,page: page
present :type, type
present :page, page
present :is_public, is_public
present :type_name, type_name
present :status, 0
rescue Exception=>e
present :status, -1
present :message, e.message
end
end
end
end

View File

@ -11,69 +11,208 @@ module Mobile
params do
requires :type, type: String
requires :content, type: String
requires :token, type: String
end
post ':id' do
unless current_user
#如果当前用户不存在 则需要根据微信昵称注册一个帐号
openid = session[:wechat_openid]
raise "无法获取到openid,请在微信中打开本页面" unless openid
us = UsersService.new
access_token = session[:access_token]
refresh_token = session[:refresh_token]
if access_token.present? && refresh_token.present?
begin
refreshinfo = Wechat.api.web_refresh_access_token(refresh_token)
rescue
info = Wechat.api.web_access_token(session[:wechat_code])
openid =info["openid"]
access_token =info["access_token"]
if access_token
session[:access_token] = access_token
end
refresh_token = info["refresh_token"]
if refresh_token
session[:refresh_token] = refresh_token
end
refreshinfo = Wechat.api.web_refresh_access_token(refresh_token)
end
access_token = refreshinfo["access_token"]
refresh_token = refreshinfo["refresh_token"]
session[:access_token] = access_token
session[:refresh_token] = refresh_token
#获取用户信息
userinfo = Wechat.api.web_userinfo(access_token,openid)
Rails.logger.info "userinfo!!!!!!!!!"
Rails.logger.info userinfo
name = userinfo["nickname"]
else
name = openid[0..3]+"***"+openid.last
end
user = us.register ({:login=>openid, :mail=>"#{openid}@163.com",
:password=>"12345678", :password_confirmation=>"12345678",
:should_confirmation_password => true})
raise user.errors.full_messages.first if user.new_record?
user.update_attributes(:lastname=>name)
#自动激活
if Setting.self_registration != '3'
user.activate
user.last_login_on = Time.now
if user.save
UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0)
end
end
UserWechat.create!(
openid: openid,
user: user,
bindtype: 1
)
end
authenticate!
subscribe = 0 #默认未关注
#-------------------获取用户是否关注此公众号-----------------------------
openid = session[:wechat_openid]
raise "无法获取到openid,请在微信中打开本页面" unless openid
user_info = Wechat.api.user(openid)
Rails.logger.info "user_info!!!!!!!!!"
Rails.logger.info user_info
subscribe = user_info["subscribe"]
status = 0
tip = 0 #0班级1项目
type = params[:type]
result = 1
if params[:content]!="" && current_user
case type
when "HomeworkCommon"
homework_common = HomeworkCommon.find(params[:id])
#如果是私有的 并且不是成员则不能回复
# is_public = homework_common.course.is_public
# if is_public == 0 && !current_user.member_of_course?(homework_common.course)
# status = -1
# tip = 0
# else
# feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], params[:id])
# if (feedback.errors.empty?)
# homework_common.update_column(:updated_at, Time.now)
# result = 2
# end
# end
feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], params[:id])
if (feedback.errors.empty?)
homework_common.update_column(:updated_at, Time.now)
result = 2
end
when "News"
news = News.find(params[:id])
comment = Comment.new
comment.comments = params[:content]
comment.author = current_user
if news.comments << comment
result = 2
# if news.project
# if news.project.is_public == false && !current_user.member_of?(news.project)
# status = -1
# tip = 1
# end
# elsif news.course
# if news.course.is_public == 0 && !current_user.member_of_course?(news.course)
# status = -1
# tip = 0
# end
# end
if status == 0
comment = Comment.new
comment.comments = params[:content]
comment.author = current_user
if news.comments << comment
result = 2
end
end
when "Message"
message = Message.find(params[:id])
board = Board.find(message.board_id)
topic = message.root
reply = Message.new
reply.author = current_user
reply.board = board
reply.content = params[:content]
reply.parent_id = params[:id]
reply.subject = "RE: #{topic.subject}"
if topic.children << reply
result = 2
# if message.project
# if message.project.is_public == false && !current_user.member_of?(message.project)
# status = -1
# tip = 1
# end
# elsif message.course
# if message.course.is_public == 0 && !current_user.member_of_course?(message.course)
# status = -1
# tip = 0
# end
# end
if status == 0
topic = message.root
reply = Message.new
reply.author = current_user
reply.board = board
reply.content = params[:content]
reply.parent_id = params[:id]
reply.subject = "RE: #{topic.subject}"
if topic.children << reply
result = 2
end
end
when "JournalsForMessage"
jour = JournalsForMessage.find params[:id]
parent_id = params[:id]
author_id = current_user.id
reply_user_id = jour.user_id
reply_id = params[:id]
content = params[:content]
options = {:user_id => author_id,
:status => true,
:m_parent_id => parent_id,
:m_reply_id => reply_id,
:reply_id => reply_user_id,
:notes => content,
:is_readed => false}
jfm = jour.user.add_jour(nil, nil, nil, options)
if jfm.errors.empty?
(JournalsForMessage.find parent_id).update_attribute(:updated_on,Time.now)
result = 2
# if jour.jour_type == "Project"
# if jour.project.is_public == false && !current_user.member_of?(jour.project)
# status = -1
# tip = 1
# end
# elsif jour.jour_type == "Course"
# if jour.course.is_public == 0 && !current_user.member_of_course?(jour.course)
# status = -1
# tip = 0
# end
# end
if status == 0
parent_id = params[:id]
author_id = current_user.id
reply_user_id = jour.user_id
reply_id = params[:id]
content = params[:content]
options = {:user_id => author_id,
:status => true,
:m_parent_id => parent_id,
:m_reply_id => reply_id,
:reply_id => reply_user_id,
:notes => content,
:is_readed => false}
jfm = jour.user.add_jour(nil, nil, nil, options)
if jfm.errors.empty?
(JournalsForMessage.find parent_id).update_attribute(:updated_on,Time.now)
result = 2
end
end
when 'Issue'
issue = Issue.find params[:id]
is_jour = Journal.new
is_jour.user_id = current_user.id
is_jour.notes = params[:content]
is_jour.journalized = issue
if is_jour.save
result = 2
# if issue.project.is_public == false && !current_user.member_of?(issue.project)
# status = -1
# tip = 1
# end
if status == 0
is_jour = Journal.new
is_jour.user_id = current_user.id
is_jour.notes = params[:content]
is_jour.journalized = issue
if is_jour.save
result = 2
end
end
when 'BlogComment'
blog = BlogComment.find(params[:id]).root
@ -97,7 +236,9 @@ module Mobile
result = 3
end
present :result, result
present :status, 0
present :status, status
present :tip, tip
present :subscribe,subscribe
end
end
end

View File

@ -7,17 +7,32 @@ module Mobile
desc "get special news"
post ':id' do
authenticate!
user = current_user
begin
# authenticate!
user = current_user
#0一级回复的更多 1 二级回复的更多
type = params[:type] || 0
page = params[:page] || 0
news = News.find params[:id]
present :data, news, with: Mobile::Entities::News,user: user,type: type,page: page
present :type, type
present :page, page
present :status, 0
#0一级回复的更多 1 二级回复的更多
type = params[:type] || 0
page = params[:page] || 0
news = News.find params[:id]
is_public = 1
if news.project
is_public = news.project.is_public
elsif news.course
is_public = news.course.is_public
end
present :data, news, with: Mobile::Entities::News,user: user,type: type,page: page
present :type, type
present :page, page
present :is_public, is_public
present :status, 0
rescue Exception=>e
present :status, -1
present :message, e.message
end
end
end
end

View File

@ -28,9 +28,10 @@ module Mobile
ss = SyllabusesService.new
sy = ::Syllabus.find(params[:id])
sy.courses = sy.courses.not_deleted
present :data, sy, with: Mobile::Entities::Syllabus,user: current_user
result = {:title=>sy.title, :id=>sy.id , :user_id=>sy.user_id,:courses=>sy.courses.not_deleted}
present :data, result, with: Mobile::Entities::Syllabus,user: current_user
present :status, 0
end

View File

@ -29,7 +29,7 @@ module Mobile
logger.debug "openid ============== #{openid}"
raise "无法获取到openid,请在微信中打开本页面" unless openid
uw = UserWechat.where(openid: openid).first
raise "此微信号已绑定用户(#{uw.user.login}), 不能重复绑定" if uw
raise "此微信号已绑定用户(#{uw.user.login}), 不能重复绑定" if uw && uw.real?
user, last_login_on = User.try_to_login(params[:login], params[:password])
raise "用户名或密码错误,请重新输入" unless user
@ -37,12 +37,17 @@ module Mobile
raise "此用户已经绑定过公众号, 请换一个帐户试试" if user.user_wechat
UserWechat.create!(
if uw && !uw.real?
uw.migrate_user(user)
else
UserWechat.create!(
openid: openid,
user: user
)
)
end
ws = WechatService.new
ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台。", user.login, Time.now.strftime("%Y-%m-%d"))
ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台。", user.show_name+"("+user.login+")", Time.now.strftime("%Y-%m-%d"))
present status: 0, message: '您已成功绑定Trustie平台'
end
@ -53,22 +58,38 @@ module Mobile
requires :password, type: String, desc: 'password'
end
post do
openid = session[:wechat_openid]
logger.debug "openid ============== #{openid}"
raise "无法获取到openid,请在微信中打开本页面" unless openid
uw = UserWechat.where(openid: openid).first
raise "此微信号已绑定用户(#{uw.user.login}), 不能重复绑定" if uw && uw.real?
us = UsersService.new
user = us.register params.merge(:password_confirmation => params[:password],
:should_confirmation_password => true)
raise user.errors.full_messages.first if user.new_record?
UserWechat.create!(
#自动激活
if Setting.self_registration != '3'
# user = automatically_register(user)
user.activate
user.last_login_on = Time.now
if user.save
UserStatus.create(:user_id => user.id, :changsets_count => 0, :watchers_count => 0)
end
end
if uw && !uw.real?
user.update_attributes(:lastname=>uw.user[:lastname])
uw.migrate_user(user)
else
UserWechat.create!(
openid: openid,
user: user
)
)
end
ws = WechatService.new
ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台。", user.login, Time.now.strftime("%Y-%m-%d"))
ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台。", user.show_name+"("+user.login+")", Time.now.strftime("%Y-%m-%d"))
present :data, user, with: Mobile::Entities::User
present :status, 0
end

View File

@ -7,23 +7,32 @@ module Mobile
desc "get one homework"
post ':id' do
authenticate!
user = current_user
begin
# authenticate!
user = current_user
#0一级回复的更多 1 二级回复的更多
type = params[:type] || 0
page = params[:page] || 0
#0一级回复的更多 1 二级回复的更多
type = params[:type] || 0
page = params[:page] || 0
if type == 0
homework = HomeworkCommon.find params[:id]
present :data, homework, with: Mobile::Entities::Whomework,user: user,type: type,page: page,comment_type: "homework"
else
jour = JournalsForMessage.find params[:id]
present :data, jour, with: Mobile::Entities::Jours,user: user,type: type,page: page,comment_type: "homework"
is_public = 1
if type == 0
homework = HomeworkCommon.find params[:id]
is_public = homework.course.is_public
present :data, homework, with: Mobile::Entities::Whomework,user: user,type: type,page: page,comment_type: "homework"
else
jour = JournalsForMessage.find params[:id]
present :data, jour, with: Mobile::Entities::Jours,user: user,type: type,page: page,comment_type: "homework"
end
present :type, type
present :page, page
present :is_public, is_public
present :status, 0
rescue Exception=>e
present :status, -1
present :message, e.message
end
present :type, type
present :page, page
present :status, 0
end
end
end

View File

@ -65,9 +65,9 @@ module Mobile
end
member = course.members.where("user_id=#{current_user.id} and course_id=#{course.id}")[0]
roleName = member.roles[0].name if member
role_ids = member.role_ids if member
if roleName && (roleName == "TeachingAsistant" || roleName == "Teacher" )
if role_ids && (role_ids.include?(7) || role_ids.include?(9) )
can_setting = true
end
@ -76,6 +76,15 @@ module Mobile
end
can_setting
end
expose :is_member, if: lambda { |instance, options| options[:user] } do |instance, options|
current_user = options[:user]
if instance[:course]
course = instance[:course]
else
course = instance
end
current_user.member_of_course?(course)
end
expose :teacher, using: Mobile::Entities::User do |c, opt|
if c.is_a? ::Course
c.teacher

View File

@ -23,6 +23,16 @@ module Mobile
current_user.id == instance.user_id
end
expose :is_member, if: lambda { |instance, options| options[:user] } do |instance, options|
current_user = options[:user]
if instance[:project]
project = instance[:project]
else
project = instance
end
current_user.member_of?(project)
end
expose :member_count, if: lambda { |instance, options| options[:user] } do |instance, options|
instance.members.count

View File

@ -5,8 +5,8 @@ module Mobile
expose :id
expose :can_setting, if: lambda { |instance, options| options[:user] } do |instance, options|
current_user = options[:user]
can_setting = instance.user_id == current_user.id ? true : false
can_setting = false if instance.id.nil?
can_setting = instance[:user_id] == current_user.id ? true : false
can_setting = false if instance[:id].nil?
can_setting
end
expose :courses, using: Mobile::Entities::Course

View File

@ -26,7 +26,13 @@ class AccountController < ApplicationController
if request.get?
@login = params[:login] || true
if User.current.logged?
redirect_to user_path(User.current)
# 判断用户基本资料是否完善,不完善讲强制完善基本资料,完善进入主页
user = UserExtensions.where(:user_id => User.current.id).first
if user.gender.nil? || user.school_id.nil? || User.current.lastname.nil?
redirect_to my_account_path(:tip => 1)
else
redirect_to user_path(User.current)
end
else
render :layout => 'login'
end
@ -127,7 +133,7 @@ class AccountController < ApplicationController
session[:auth_source_registration] = nil
self.logged_user = @user
flash[:notice] = l(:notice_account_activated)
redirect_to my_account_path
redirect_to my_account_path(:tip=>1)
end
else
us = UsersService.new
@ -144,7 +150,7 @@ class AccountController < ApplicationController
if !@user.new_record?
self.logged_user = @user
flash[:notice] = l(:notice_account_activated)
redirect_to my_account_url
redirect_to my_account_url(:tip=>1)
else
redirect_to signin_path
end
@ -347,9 +353,15 @@ class AccountController < ApplicationController
else
#by young
#redirect_back_or_default my_page_path
redirect_back_or_default User.current
# 基本资料不完善的用户,将强制用户完善基本资料。
user = UserExtensions.where(:user_id => User.current.id).first
if user.gender.nil? || user.school_id.nil? || User.current.lastname.nil?
redirect_to my_account_path(:tip => 1)
else
redirect_back_or_default User.current
#redirect_to my_account_url
#redirect_to User.current
end
end
end
end

View File

@ -698,7 +698,7 @@ class AdminController < ApplicationController
apply_school_ids = apply_schools.empty? ? "(-1)" : "(" + apply_schools.map{|sc| sc.school_id}.join(',') + ")"
if !params[:search].nil?
search = "%#{params[:search].to_s.strip.downcase}%"
@schools = School.where("id not in #{apply_school_ids} and #{School.table_name}.name like :p",:p=>search)
@schools = School.where("id not in #{apply_school_ids} and #{School.table_name}.name like :p", :p => search)
#@schools = School.all
else
#@course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id}").select { |course| @user.allowed_to?(:as_teacher,course)}

View File

@ -75,6 +75,8 @@ class AppliedProjectController < ApplicationController
@project.project_infos << project_info
@project.user_grades << user_grades unless user_grades.first.user_id.nil?
ps = ProjectsService.new
ps.send_wechat_join_project_notice User.current,@project,5,0
else
@flag = 4
role = params[:member] == "member_manager" ? 3 : (params[:member] == "member_developer" ? 4 :5)

View File

@ -10,7 +10,7 @@ class AtController < ApplicationController
@users = users.uniq { |u| u.id }.delete_if { |u| u.id == User.current.id }.sort{|x,y| to_pinyin(x.show_name) <=> to_pinyin(y.show_name)} if users
#加上all
if @user && @users.size > 0
if User.current.logged? && @users.size > 0
allUser = Struct.new(:id, :name).new
allUser.id = @users.map{|u| u.id}.join(",")
allUser.name = "all"

View File

@ -84,7 +84,8 @@ class MembersController < ApplicationController
# 添加成功后,申请人收到消息
AppliedMessage.create(:user_id => @applied_message.applied_user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,
:status => 6, :viewed => false, :applied_user_id => @applied_message.user_id, :role => applied_project.role, :project_id => applied_project.project_id)
ps = ProjectsService.new
ps.send_wechat_join_project_notice user,project,ap_role,0
# 添加成功后,批准人收到消息
# AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,
# :status => 7, :viewed => true, :applied_user_id => @applied_message.applied_user_id, :role => applied_project.role, :project_id => applied_project.project_id)
@ -114,6 +115,11 @@ class MembersController < ApplicationController
@applied_message = AppliedMessage.find(params[:applied_message_id])
# AppliedMessage.create(:user_id => @applied_message.user_id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 5,
# :viewed => true, :applied_user_id => @applied_message.applied_user_id, :role => applied_project.role, :project_id => applied_project.project_id)
ps = ProjectsService.new
user = User.find(@applied_message.applied_user_id)
ap_role = applied_project.try(:role)
ps.send_wechat_join_project_notice user,project,ap_role,1
applied_project.delete
end

View File

@ -114,9 +114,15 @@ class MyController < ApplicationController
applied_message.update_attribute(:viewed, true)
end
# 基本资料不完善 @force为false 完善 @force为true
@force = false
if params[:tip]
@force = true
end
@user = User.current
lg=@user.login
lg = @user.login
@pref = @user.pref
diskfile = disk_filename('User', @user.id)
diskfile1 = diskfile + 'temp'
@ -178,7 +184,12 @@ class MyController < ApplicationController
File.delete(diskfile1) if File.exist?(diskfile1)
end
render :layout=>'new_base_user'
# 基本资料不完善,无法使用其他功能,完善着可继续使用
if @force
render :layout => 'new_base_user_show'
else
render :layout => 'new_base_user'
end
end
# Destroys user's account

View File

@ -1,8 +1,10 @@
class PullRequestsController < ApplicationController
before_filter :authorize_logged
before_filter :find_project_and_repository
before_filter :connect_gitlab, :only => [:index, :show, :create, :accept_pull_request, :pull_request_commits, :pull_request_changes, :new,
:update_pull_request, :pull_request_comments, :create_pull_request_comment]
layout "base_projects"
include PullRequestsHelper
include ApplicationHelper
@ -235,6 +237,13 @@ class PullRequestsController < ApplicationController
end
private
def authorize_logged
if !User.current.logged?
redirect_to signin_path
return
end
end
def connect_gitlab
@g = Gitlab.client
end

View File

@ -386,9 +386,9 @@ update
project_score.update_column(:changeset_num, @changesets_all_count)
end
# unless @changesets_latest_coimmit.blank?
# update_commits_date(@project, @changesets_latest_coimmit)
# end
unless @changesets_latest_coimmit.blank?
update_commits_date(@project, @changesets_latest_coimmit)
end
@creator = @project.owner.to_s
gitlab_address = Redmine::Configuration['gitlab_address']

View File

@ -868,6 +868,7 @@ class StudentWorkController < ApplicationController
update_org_activity(@homework.class,@homework.id)
if @work.save
@work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:id => @work.id).first
@count = @homework.student_works.has_committed.count
respond_to do |format|
format.js
end

View File

@ -353,14 +353,14 @@ class UsersController < ApplicationController
def dealwith_apply_request
@msg = CourseMessage.find(params[:msg_id])
#CourseMessage content存的是role 7教辅 9 教师
apply_user = User.find(@msg.course_message_id)
ids = @msg.content.split(",") # [@msg.content] msg content保存的是申请的职位角色
integer_ids = []
ids.each do |role_id|
integer_ids << role_id.to_i
end
case params[:agree]
when 'Y'
apply_user = User.find(@msg.course_message_id)
ids = @msg.content.split(",") # [@msg.content] msg content保存的是申请的职位角色
integer_ids = []
ids.each do |role_id|
integer_ids << role_id.to_i
end
if apply_user.member_of_course?(Course.find(@msg.course_id))
#将角色改为老师或者教辅
member = Course.find(@msg.course_id).members.where(:user_id=>apply_user.id).all[0]
@ -383,11 +383,32 @@ class UsersController < ApplicationController
Course.find(@msg.course_id).members << members
CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>1)
@msg.update_attributes(:status=>1,:viewed=>1)
if integer_ids.include?(9)
cs = CoursesService.new
c = Course.find(@msg.course_id)
cs.send_wechat_join_class_notice apply_user,c,9,0
else
cs = CoursesService.new
c = Course.find(@msg.course_id)
cs.send_wechat_join_class_notice apply_user,c,7,0
end
end
when 'N'
CourseMessage.create(:user_id => @msg.course_message_id, :course_id => @msg.course_id, :viewed => false,:content=> @msg.content,:course_message_id=>User.current.id,:content=>@msg.content,:course_message_type=>'CourseRequestDealResult',:status=>2)
@msg.update_attributes(:status=>2,:viewed=>1)
if integer_ids.include?(9)
cs = CoursesService.new
c = Course.find(@msg.course_id)
cs.send_wechat_join_class_notice apply_user,c,9,1
else
cs = CoursesService.new
c = Course.find(@msg.course_id)
cs.send_wechat_join_class_notice apply_user,c,7,1
end
end
respond_to do |format|
format.js

View File

@ -137,7 +137,7 @@ class WechatsController < ActionController::Base
on :fallback, respond: 'fallback message'
on :click, with: 'FEEDBACK' do |request, key|
request.reply.text "如有反馈问题,请直接切换至输入框,发微信给我们即可"
request.reply.text "如有问题反馈,请您:\n1、直接切换至输入框发微信给我们。\n2、加入QQ群173184401我们直接互动。\n欢迎大家积极反馈,谢谢啦!"
end
on :click, with: 'MY_NEWS' do |request, key|
@ -252,13 +252,16 @@ class WechatsController < ActionController::Base
end
def sendBind(request)
tmpurl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{ROOT_URL+'/wechat/user_activities'}&response_type=code&scope=snsapi_base&state=login&connect_redirect=1#wechat_redirect"
logger.info "tmpurl!!!!!!!!!!!!!!"
logger.info tmpurl
news = (1..1).each_with_object([]) { |n, memo| memo << { title: '绑定登录', content: "欢迎使用Trustie创新实践服务平台
" } }
request.reply.news(news) do |article, n, index| # article is return object
url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{ROOT_URL+'/wechat/user_activities'}&response_type=code&scope=snsapi_base&state=login#wechat_redirect"
url = tmpurl
pic_url = "#{ROOT_URL}/images/weixin_pic.jpg"
article.item title: "#{n[:title]}",
description: n[:content],
@ -284,7 +287,7 @@ class WechatsController < ActionController::Base
end
news = (1..1).each_with_object([]) { |n, memo| memo << { title: '恭喜您成功加入班级,开始学习吧!',
content: "课程名称:#{course.name}\n班级名称:#{course.name}\n任课老师:#{course.teacher.show_name}\n进入班级,和小伙伴愉快的学习吧!"} }
content: "课程名称:#{course.syllabus.title}\n班级名称:#{course.name}\n任课老师:#{course.teacher.show_name}\n进入班级,和小伙伴愉快的学习吧!"} }
return request.reply.news(news) do |article, n, index| # article is return object
url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{ROOT_URL+'/wechat/user_activities#/class?id='+course.id.to_s}&response_type=code&scope=snsapi_base&state=myclass#wechat_redirect"
pic_url = "#{ROOT_URL}/images/wechat/class.jpg"
@ -314,7 +317,7 @@ class WechatsController < ActionController::Base
creator = User.find(project.user_id)
news = (1..1).each_with_object([]) { |n, memo| memo << { title: '恭喜您成功加入项目,开始研发吧!',
content: "项目名称:#{project.name}\n发起人:#{creator.name}\n进入项目,和小伙伴轻松的研发吧!"} }
content: "项目名称:#{project.name}\n发起人:#{creator.show_name}\n进入项目,和小伙伴轻松的研发吧!"} }
return request.reply.news(news) do |article, n, index| # article is return object
url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{ROOT_URL+'/wechat/user_activities#/project?id='+project.id.to_s}&response_type=code&scope=snsapi_base&state=myproject#wechat_redirect"
pic_url = "#{ROOT_URL}/images/wechat/project.jpg"
@ -333,10 +336,12 @@ class WechatsController < ActionController::Base
code = params[:code] || session[:wechat_code]
openid = get_openid_from_code(code)
raise "无法获取到微信openid" unless openid
# raise "无法获取到微信openid" unless openid
raise "请在微信中关注Trustie创新实践平台后再打开本页面" unless openid
uw = UserWechat.where(openid: openid).first
raise "还未绑定trustie帐户" unless uw
raise "还未绑定trustie帐户" unless (uw && uw.bindtype == 0)
logger.debug "get_bind ============= #{uw}"
user = uw.user
@ -349,13 +354,25 @@ class WechatsController < ActionController::Base
end
end
def is_bind
begin
code = params[:code] || session[:wechat_code]
open_id = get_openid_from_code(code)
raise "还未绑定trustie帐户" unless user_binded?(open_id)
render :json => {status: 0}
rescue Exception=>e
render :json => {status: -1, message: e.message}
end
end
def bind
begin
code = params[:code] || session[:wechat_code]
openid = get_openid_from_code(code)
raise "无法获取到openid请在微信中打开本页面" unless openid
# raise "无法获取到openid请在微信中打开本页面" unless openid
raise "请在微信中关注Trustie创新实践平台后再打开本页面" unless openid
raise "此微信号已绑定用户,不能重复绑定" if user_binded?(openid)
user, last_login_on = User.try_to_login(params[:username], params[:password])
@ -369,7 +386,7 @@ class WechatsController < ActionController::Base
user: user
)
ws = WechatService.new
ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台", user.login, format_time(Time.now))
ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台", user.show_name+"("+user.login+")", format_time(Time.now))
render :json => {status:0, msg: "绑定成功"}
rescue Exception=>e
render :json => {status: -1, msg: e.message}
@ -398,8 +415,16 @@ class WechatsController < ActionController::Base
unless open_id
render 'wechats/open_wechat', layout: nil and return
end
logger.info "user_activities!!!!!!!!!!!!!!"
logger.info params
#保证下面的redirect_to "/wechat/user_activities##{@path}?id=...不会往下走
if params[:state] == nil
return
end
unless user_binded?(open_id)
unless (user_binded?(open_id) || params[:state] == "invite_code" || params[:state] == "project_invite_code" || params[:state] == "blog_comment" || params[:state] == "course_notice" || params[:state] == "project_discussion" || params[:state] == "course_discussion" || params[:state] == "homework" || params[:state] == "issues" || params[:state] == "journal_for_message")
@path = '/login'
else
if params[:state] == 'myclass'
@ -410,7 +435,14 @@ class WechatsController < ActionController::Base
session[:wechat_openid] = open_id
if params[:code]
redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}" and return
if params[:userid]
redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}&userid=#{params[:userid]}" and return
elsif params[:id]
redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}" and return
else
redirect_to "/wechat/user_activities##{@path}" and return
end
# redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}" and return
end
end
render 'wechats/user_activities', layout: nil
@ -421,10 +453,19 @@ class WechatsController < ActionController::Base
def get_openid_from_code(code)
return 'oCnvgvz8R7QheXE-R9Kkr39j8Ndg' if code =='only-for-test'
openid = session[:wechat_openid]
unless openid
if code
openid = wechat.web_access_token(code)["openid"]
#不能联系调两次web_access_token 否则会提示请在微信客户端打开次链接
info = wechat.web_access_token(code)
openid =info["openid"]
access_token =info["access_token"]
if access_token
session[:access_token] = access_token
end
refresh_token = info["refresh_token"]
if refresh_token
session[:refresh_token] = refresh_token
end
end
end
@ -437,6 +478,11 @@ class WechatsController < ActionController::Base
def user_binded?(openid)
uw = UserWechat.where(openid: openid).first
if uw && uw.bindtype == 0
uw
else
nil
end
end
def current_url

View File

@ -2169,7 +2169,7 @@ module ApplicationHelper
candown= User.current.member_of_course?(course) || (attachment.is_public == 1) || attachment.get_status_by_attach(User.current.id) == 2
elsif attachment.container.is_a?(OrgSubfield)
org = attachment.container.organization
candown = User.current.member_of_org?(org) || (attachment.is_public == 1) || attachment.get_status_by_attach(User.current.id) == 2
candown = User.current.member_of_org?(org) || ((attachment.is_public == 1 || attachment.get_status_by_attach(User.current.id) == 2) && org.allow_guest_download == true)
elsif attachment.container.is_a?(OrgDocumentComment)
org = attachment.container.organization
candown = org.allow_guest_download || User.current.member_of_org?(org) || (org.is_public && attachment.is_public == 1)
@ -3436,3 +3436,9 @@ def course_syllabus_option user = User.current
end
type
end
# 获取项目动态更新时间
def get_forge_act_message(act, type)
forge_act = ForgeActivity.where(:forge_act_id => act.id, :forge_act_type => type).first
format_time(forge_act.nil? ? act.created_on : forge_act.try(:updated_at))
end

View File

@ -77,7 +77,7 @@ class HomeworkCommon < ActiveRecord::Base
count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count
if count == 0
ws = WechatService.new
ws.homework_message_notice(m.user_id, "homework", self.id, "#{m.user.show_name}#{l(:label_new_homework_template)}", self.course.name, "新作业:"+ self.name.html_safe, "作业内容请点击“详情”查看。")
ws.homework_message_notice(m.user_id, "homework", self.id, "#{m.user.show_name}#{l(:label_new_homework_template)}", self.course.name, "新作业:"+ self.name.html_safe, "作业内容请点击“详情”查看。")
end
# end
end

View File

@ -173,7 +173,7 @@ class News < ActiveRecord::Base
count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count
if count == 0
ws = WechatService.new
content = strip_html self.author.try(:realname) + " 发布了通知:" + self.title.html_safe, 200
content = self.title
ws.class_notice m.user_id, "course_notice", self.id, "#{l(:label_new_notice_template)}", self.course.name, self.author.show_name, format_time(self.created_on), content, "点击查看通知详情"
end
end

View File

@ -228,7 +228,7 @@ class User < Principal
# Prevents unauthorized assignments
attr_protected :login, :admin, :password, :password_confirmation, :hashed_password
LOGIN_LENGTH_LIMIT = 25
LOGIN_LENGTH_LIMIT = 30
MAIL_LENGTH_LIMIT = 60
validates_presence_of :login, :mail, :if => Proc.new { |user| !user.is_a?(AnonymousUser) }

View File

@ -1,6 +1,27 @@
class UserWechat < ActiveRecord::Base
attr_accessible :subscribe, :openid, :nickname, :sex, :language, :city, :province, :country,
:headimgurl, :subscribe_time, :unionid, :remark, :groupid, :user, :user_id
:headimgurl, :subscribe_time, :unionid, :remark, :groupid, :user, :user_id, :bindtype
belongs_to :user
def real?
bindtype == 0
end
def migrate_user(u)
self.bindtype = 0
old_user = user.id
self.user = u
self.save
## 主要是将comment 迁移
User.delete(old_user)
JournalsForMessage.where(user_id: old_user).update_all(user_id: u.id)
Journal.where(user_id: old_user).update_all(user_id: u.id)
Comment.where(author_id: old_user).update_all(author_id: u.id)
Message.where(author_id: old_user).update_all(author_id: u.id)
BlogComment.where(author_id: old_user).update_all(author_id: u.id)
UserActivity.where(user_id: old_user).update_all(user_id: u.id)
end
end

View File

@ -97,7 +97,7 @@ class CoursesService
end
users = []
@members.each do |m|
img_url = url_to_avatar(m.user)
img_url = "/images/"+url_to_avatar(m.user)
gender = m.user.user_extensions.gender.nil? ? 0 : m.user.user_extensions.gender
work_unit = get_user_work_unit m.user
location = get_user_location m.user
@ -108,14 +108,14 @@ class CoursesService
end
#双重身份 学生列表中不显示
unless (params[:role] == '2' && role_ids.length >= 2)
# unless (params[:role] == '2' && role_ids.length >= 2)
users << {:id => m.user.id, :img_url => img_url, :nickname => m.user.login, :gender => gender,
:work_unit => work_unit, :mail => m.user.mail, :location => location,
role_name: m.roles.first.name,
name: m.user.show_name,
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}
end
# end
end
users
@ -223,16 +223,20 @@ class CoursesService
end
if integer_ids.include?(9)
message = "您已同意教师"+apply_user.show_name+",加入班级"
send_wechat_join_class_notice apply_user,c,9,0
else
message = "您已同意助教"+apply_user.show_name+",加入班级"
send_wechat_join_class_notice apply_user,c,7,0
end
else
CourseMessage.create(:user_id => apply_user.id, :course_id => c.id, :viewed => false,:content=> messages.content,:course_message_id=>current_user.id,:course_message_type=>'CourseRequestDealResult',:status=>2)
messages.update_attributes(:status=>2,:viewed=>1)
if integer_ids.include?(9)
message = "您已拒绝教师"+apply_user.show_name+",加入班级"
send_wechat_join_class_notice apply_user,c,9,1
else
message = "您已拒绝助教"+apply_user.show_name+",加入班级"
send_wechat_join_class_notice apply_user,c,7,1
end
end
status = 0
@ -528,6 +532,33 @@ class CoursesService
{:state => @state,:course => course}
end
#加入班级结果
def send_wechat_join_class_notice user,course,role_id,result
count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Course' and shield_id=#{course.id}").count
if count == 0
ws = WechatService.new
role_name = role_id == 7 ? "助教" : role_id == 9 ? "教师" : "学生"
result_name = result == 0 ? "通过" : "被拒绝"
content = "您以"+role_name+"身份加入班级的申请已"+result_name+""
if result == 0
title = "恭喜您加入班级成功。"
remark = "点击查看班级详情。"
uid = 0
type = "class"
else
title = "很遗憾您未能成功加入班级。"
remark = "点击查看申请详情。"
uid = user.id
type = "review_class_member"
end
ws = WechatService.new
ws.class_notice user.id, type, course.id, title, course.name, user.show_name, format_time(Time.now), content, remark,uid
end
end
#多个角色加入课程
def join_course_roles params,current_user
course = Course.find_by_invite_code(params[:invite_code]) if params[:invite_code]
@ -587,6 +618,7 @@ class CoursesService
course.members << members
StudentsForCourse.create(:student_id => current_user.id, :course_id => course.id)
@state = 0
send_wechat_join_class_notice current_user,course,10,0
else
is_stu = false
if role_ids.include?("10")
@ -595,6 +627,7 @@ class CoursesService
course.members << members
StudentsForCourse.create(:student_id => current_user.id, :course_id =>course.id)
is_stu = true
send_wechat_join_class_notice current_user,course,10,0
end
#如果已经发送过消息了,那么就要给个提示
if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and content = '#{role_str}' and course_message_id = #{current_user.id} and course_id = #{course.id} and status = 0").count != 0

View File

@ -256,7 +256,7 @@ class HomeworkService
jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")
jours.each do |jour|
user = jour.user
img_url = url_to_avatar(jour.user)
img_url = "/images/"+url_to_avatar(jour.user)
datetime = jour.created_on
content = jour.notes
end

View File

@ -117,6 +117,27 @@ class ProjectsService
]
end
#加入项目结果
def send_wechat_join_project_notice user,project,role_id,result
count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Project' and shield_id=#{project.id}").count
if count == 0
result_name = result == 0 ? "已同意" : "已拒绝"
if result == 0
title = "恭喜您加入项目成功。"
remark = "点击查看项目详情。"
uid = 0
type = "project"
else
title = "很遗憾您未能成功加入项目。"
remark = "点击查看申请详情。"
uid = user.id
type = "review_project_member"
end
ws = WechatService.new
ws.join_project_notice user.id, "project", project.id,title, project.name,result_name, remark,uid
end
end
def join_project params,current_user
status = -1
project = Project.find_by_invite_code(params[:invite_code]) if params[:invite_code]
@ -128,6 +149,10 @@ class ProjectsService
if current_user.member_of?(project) #如果已经是成员
member = project.member_principals.includes(:roles, :principal).where("user_id=?",current_user.id).first
status = member.member_roles[0].role_id
#将之前的申请都改为已拒绝
applied_messages = AppliedMessage.where(:project_id => project.id, :status => true, :applied_user_id=>current_user.id,:applied_type => "AppliedProject")
applied_messages.update_all(:status=>5)
else
if params[:invite_code].present?
@ -146,6 +171,11 @@ class ProjectsService
project.project_infos << project_info
status = 0
send_wechat_join_project_notice current_user,project,5,0
#将之前的申请都改为已拒绝
applied_messages = AppliedMessage.where(:project_id => project.id, :status => true, :applied_user_id=>current_user.id,:applied_type => "AppliedProject")
applied_messages.update_all(:status=>5)
else
if !AppliedProject.where(:project_id => project.id, :user_id => current_user.id).first.nil?
status = 8
@ -181,7 +211,7 @@ class ProjectsService
user = User.find(m.applied_user_id)
if user
img_url = url_to_avatar(user)
img_url = "/images/"+url_to_avatar(user)
gender = user.user_extensions.gender.nil? ? 0 : user.user_extensions.gender
work_unit = get_user_work_unit user
location = get_user_location user
@ -210,7 +240,7 @@ class ProjectsService
status = applied_message.status
user = User.find(params[:user_id])
if user
img_url = url_to_avatar(user)
img_url = "/images/"+url_to_avatar(user)
gender = user.user_extensions.gender.nil? ? 0 : user.user_extensions.gender
work_unit = get_user_work_unit user
location = get_user_location user
@ -239,7 +269,12 @@ class ProjectsService
if apply_message
if user.member_of?(project)
message = "已经是该项目的成员了"
applied_messages.update_all(:status=>7)
u_member = project.member_principals.includes(:roles, :principal).where("user_id=?",params[:user_id]).first
if u_member.member_roles[0].role_id == 5
applied_messages.update_all(:status=>5)
else
applied_messages.update_all(:status=>7)
end
else
applied_project = apply_message.applied
ap_role = applied_project.try(:role)
@ -266,6 +301,8 @@ class ProjectsService
message = "您已同意"+rolename+user.show_name+",加入项目"
send_wechat_join_project_notice user,project,ap_role,0
else
#拒绝
AppliedMessage.create(:user_id => user.id, :applied_type => "AppliedProject", :applied_id => applied_project.id ,:status => 4,
@ -275,6 +312,8 @@ class ProjectsService
applied_project.delete
message = "您已拒绝"+rolename+user.show_name+",加入项目"
send_wechat_join_project_notice user,project,ap_role,1
end
status = 0

View File

@ -36,24 +36,21 @@ class SyllabusesService
# courses.each do |c|
# other.courses << c[:course] unless c[:course].syllabus
# end
result = []
i = 0
courses = user.courses.not_deleted
syllabus_ids = courses.empty? ? '(-1)' : "(" + courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")"
syllabuses = Syllabus.where("id in #{syllabus_ids} or user_id = #{user.id}").order("updated_at desc")
syllabuses.each do |syllabus|
syllabus.courses = courses.where("syllabus_id = #{syllabus.id}").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("time desc")
tmp_courses = courses.where("syllabus_id = #{syllabus.id}").select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc")
result[i] = {:title=>syllabus.title, :id=>syllabus.id , :user_id=>syllabus.user_id,:courses=>tmp_courses }
i = i + 1
end
# syllabuses.to_a << other
syllabuses.to_a
#管理权限 can_setting
# syllabuses.each do |s|
# s = judge_can_setting(s,user)
# end
syllabuses
# syllabuses.to_a
# syllabuses
result
end
def after_create_course(course, user)
@ -72,7 +69,7 @@ class SyllabusesService
if count == 0
ws = WechatService.new
title = "恭喜您创建班级成功。"
ws.create_class_notice user.id, "create_course_notice", course.id,title, course.name, user.show_name, 0, "点击查看班级详情。"
ws.create_class_notice user.id, "create_course_notice", course.id,title, course.name, user.show_name, 1, "点击查看班级详情。"
end
end

View File

@ -80,7 +80,7 @@ class UsersService
#id用户id
def show_user(params)
@user = User.find(params[:id])
img_url = url_to_avatar(@user)
img_url = "/images/"+url_to_avatar(@user)
gender = @user.user_extensions.gender.nil? ? 0 : @user.user_extensions.gender
work_unit = get_user_work_unit @user
location = get_user_location @user
@ -224,7 +224,7 @@ class UsersService
membership.sort! {|older, newer| newer.created_on <=> older.created_on }
course_list = []
membership.each do |mp|
course_list << {:course => mp.course,:img_url => url_to_avatar(mp.course),:current_user_is_member => current_user.member_of_course?(mp.course),:current_user_is_teacher => is_course_teacher(current_user,mp.course)}
course_list << {:course => mp.course,:img_url => "/images/"+url_to_avatar(mp.course),:current_user_is_member => current_user.member_of_course?(mp.course),:current_user_is_teacher => is_course_teacher(current_user,mp.course)}
end
course_list
end

View File

@ -111,11 +111,17 @@ class WechatService
end
end
def two_keys_template(openid, template_id, type, id, first, key1, key2, remark="")
def two_keys_template(openid, template_id, type, id, first, key1, key2, remark="",uid)
# tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"
tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3
if uid && uid != 0
tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s
# tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+ "&user_id="+uid.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3
end
data = {
touser:openid,
template_id:template_id,
url:"#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}/#{id}",#/assets/wechat/app.html#/#{type}/#{id}
url:tmpurl,#/assets/wechat/app.html#/#{type}/#{id}
topcolor:"#FF0000",
data:{
first: {
@ -140,9 +146,11 @@ class WechatService
end
def three_keys_template(openid, template_id, type, id, first, key1, key2, key3, remark="",uid)
tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}/#{id}"
# tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"
tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3
if uid && uid != 0
tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s
# tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+ "&user_id="+uid.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3
end
data = {
@ -177,9 +185,11 @@ class WechatService
end
def four_keys_template(openid, template_id, type, id, first, key1, key2, key3, key4, remark="",uid)
tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}/#{id}"
# tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"
tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3
if uid && uid != 0
tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s
# tmpurl = Wechat.config.auto_openid_url_1+"?id="+id.to_s+ "&user_id="+uid.to_s+Wechat.config.auto_openid_url_2+type+Wechat.config.auto_openid_url_3
end
data = {
@ -223,7 +233,7 @@ class WechatService
data = {
touser:uw.openid,
template_id:Wechat.config.binding_succ_notice,
url:"#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities",
url:Wechat.config.auto_openid_url_1+Wechat.config.auto_openid_url_2+"activites"+Wechat.config.auto_openid_url_3,
topcolor:"#FF0000",
data:{
first: {
@ -292,13 +302,26 @@ class WechatService
end
end
# def join_class_notice(user_id, type, id, first, key1, key2, key3,remark="")
# uw = UserWechat.where(user_id: user_id).first
# unless uw.nil?
# data = three_keys_template uw.openid,Wechat.config.join_class_notice, type, id, first, key1, key2, key3, remark
# begin
# req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data)
# rescue Exception => e
# Rails.logger.error "[join_class__notice] ===> #{e}"
# end
# Rails.logger.info "send over. #{req}"
# end
# end
def create_class_notice(user_id, type, id, first, key1, key2, key3, remark="")
uw = UserWechat.where(user_id: user_id).first
unless uw.nil?
data = {
touser:uw.openid,
template_id:Wechat.config.create_class_notice,
url:"#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/class?id="+id.to_s,
url:Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+"class"+Wechat.config.auto_openid_url_3,
topcolor:"#FF0000",
data:{
first: {
@ -339,7 +362,7 @@ class WechatService
data = {
touser:uw.openid,
template_id:Wechat.config.create_project_notice,
url:"#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/project?id="+id.to_s,
url:Wechat.config.auto_openid_url_1+"?id="+id.to_s+Wechat.config.auto_openid_url_2+"project"+Wechat.config.auto_openid_url_3,
topcolor:"#FF0000",
data:{
first: {
@ -383,4 +406,19 @@ class WechatService
end
end
def join_project_notice(user_id, type, id, first, key1, key2,remark="",uid=0)
uw = UserWechat.where(user_id: user_id).first
unless uw.nil?
data = two_keys_template uw.openid,Wechat.config.join_project_notice, type, id, first, key1, key2,remark,uid
begin
req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data)
rescue Exception => e
Rails.logger.error "[join_project_notice] ===> #{e}"
end
Rails.logger.info "send over. #{req}"
end
end
end

View File

@ -1,11 +1,11 @@
[
<% @users && @users.each_with_index do |person,index| %>
<% if index == 0 %>
{"id":<%=index%>, "userid": "<%=person.id%>", "name": "所有人", "login": "<%=person.name%>", "searchKey": "<%=person.name%>"}
<%= index != @users.size-1 ? ',' : '' %>
<% else %>
{"id":<%=index%>, "userid": <%=person.id%>, "name": "<%=person.show_name%>", "login": "<%=person.login%>", "searchKey": "<%=person.get_at_show_name%>"}
<%= index != @users.size-1 ? ',' : '' %>
<% end %>
<% end %>
<% @users && @users.each_with_index do |person,index| %>
<% if index == 0 %>
{"id":<%=index%>, "userid": "<%=person.id%>", "name": "所有人", "login": "<%=person.name%>", "searchKey": "<%=person.name%>"}
<%= index != @users.size-1 ? ',' : '' %>
<% else %>
{"id":<%=index%>, "userid": "<%=person.id%>", "name": "<%=person.show_name%>", "login": "<%=person.login%>", "searchKey": "<%=person.get_at_show_name%>"}
<%= index != @users.size-1 ? ',' : '' %>
<% end %>
<% end %>
]

View File

@ -3,7 +3,7 @@
<div class="break_word">
<span class="fl">
<span title="<%= attachment.filename %>" id="attachment_<%=attachment.id %>">
<%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw380', :download => true -%>
<%= link_to_short_attachment attachment,:length=> 58, :class => 'hidden link_file_a fl newsBlue mw380', :download => true %>
</span>
</span>
<span class="postAttSize">(

View File

@ -11,9 +11,9 @@
<div class="homepagePostTitle break_word">
<%# 如果有历史版本则提供历史版本下载 %>
<% if file.attachment_histories.count == 0 %>
<%= link_to file.is_public? ? truncate(file.filename, length: 45) : truncate(file.filename,length: 35, omission: '...'),
download_named_attachment_path(file.id, file.filename),
:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %>
<%= link_to file.is_public? ? truncate(file.filename, length: 45) : truncate(file.filename,length: 35, omission: '...'),
download_named_attachment_path(file.id, file.filename),
:title => file.filename+"\n"+file.description.to_s, :style => "overflow: hidden; white-space: nowrap;text-overflow: ellipsis;",:class => "linkGrey3 f_14" %>
<% else %>
<%= link_to truncate(file.filename,length: 35, omission: '...'), attachment_history_download_path(file.id),
:title => file.filename+"\n"+file.description.to_s,

View File

@ -0,0 +1,43 @@
<div id="Footer" class="f12">
<div class="footerAboutContainer">
<ul class="footerAbout">
<li class="fl"><a href="javascript:void(0);" disabled="true" class="f_grey mw20" target="_blank"><%= l(:label_about_us)%></a>|</li>
<li class="fl"><a href="javascript:void(0);" disabled="true" class="f_grey mw20" target="_blank">服务协议</a>|</li>
<li class="fl" style="display: none"><span class="f_grey mw20" title="暂未开放"><%= l(:label_recruitment_information)%></span>|</li>
<li class="fl"><%= link_to l(:label_surpport_group), "javascript:void(0);", :class => "f_grey mw20", :target=>"_blank" %>|</li>
<li class="fl"><a href="javascript:void(0);" disabled="true" class="f_grey mw20" target="_blank"><%= l(:label_forums)%></a></li>
</ul>
</div>
<div class="cl"></div>
<ul class="departments">
<!--li class="fl mr10">
<strong><%#= l(:label_hosted_organization)%></strong><a href="http://www.nudt.edu.cn/ArticleShow.asp?ID=47" class=" ml10 f_grey" target="_blank"><%#= l(:label_hosted_by)%></a>
</li>
<li class="fl">
<a href="http://www.nudt.edu.cn/ArticleShow.asp?ID=41" class="mr45 f_grey" target="_blank"><%#= l(:label_sponsor)%></a>
</li-->
<li class="fl mr10">
<strong><%= l(:label_partners)%></strong>
</li>
<li class="fl mr20">
<a href="http://eecs.pku.edu.cn" class="f_grey" target="_blank"><%#= l(:label_co_organizer_EECS)%><img src="/images/footer_logo/PekingUniversity.png" width="121" height="40" style="display: inline-block;" alt="北京大学" /></a>
</li>
<li class="fl mr20">
<a href="http://scse.buaa.edu.cn/" class="f_grey" target="_blank"><%#= l(:label_co_organizer_BHU)%><img src="/images/footer_logo/BeiHang_university.png" width="173" height="40" style="display: inline-block;" alt="北京航空航天大学" /></a>
</li>
<li class="fl mr20">
<a href="http://www.iscas.ac.cn/" class="f_grey" target="_blank"><%#= l(:label_co_organizer_CAS)%><img src="/images/footer_logo/ISCAS_logo.png" width="91" height="40" style="display: inline-block;" alt="ISCAS" /></a>
</li>
<li class="fl mr20">
<a href="http://www.inforbus.com/" class="f_grey" target="_blank"><%#= l(:label_co_organizer_InforS)%><img src="/images/footer_logo/CVICSE.png" width="165" height="40" style="display: inline-block;" alt="中创软件" /></a>
</li>
<li class="fl"><a href="http://www.webxmf.com/" target="_blank"><img src="/images/footer_logo/bee_logo.png" width="167" height="40" style="display: inline-block;" alt="web小蜜蜂" /></a></li>
</ul>
<div class="cl"></div>
<ul class="copyright">
<li class="fl mr30"><%= l(:label_rights_reserved)%></li>
<li class="fl"><a href="http://www.miibeian.gov.cn/" class="fl f_grey" target="_blank"><%= l(:label_license)%></a></li>
</ul>
</div><!--Footer end-->

View File

@ -0,0 +1,111 @@
<div class="navHomepage">
<div class="navHomepageLogo fl">
<a href ="javascript:void(0);" disabled="true" class="mt3"><%= image_tag("../images/nav_logo.png",width:"51px", height: "45px",class: "mt3")%></a>
</div>
<div class="fl">
<ul>
<li class="navHomepageMenu fl">
<a href ="javascript:void(0);" disabled="true" class="c_white f16 db p10">首页</a>
</li>
<li class="navHomepageMenu fl">
<a href ="javascript:void(0);" disabled="true" class="c_white f16 db p10">资源库</a>
</li>
<li class="navHomepageMenu fl">
<a href ="javascript:void(0);" disabled="true" class="c_white f16 db p10">题库</a>
</li>
<li class="navHomepageMenu fl mr30">
<a href ="javascript:void(0);" disabled="true" class="c_white f16 db p10">帮助中心</a>
</li>
</ul>
</div>
<div class="fl" id="navHomepageSearch">
<!--<form class="navHomepageSearchBox">-->
<% name = name%>
<a href ="javascript:void(0);" disabled="true"><%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %>
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的班级、项目、用户、资源以及帖子"/>
<input type="hidden" name="search_type" id="type" value="all"/>
<input type="text" style="display: none;"/>
<a href="javascript:void(0);" class="homepageSearchIcon" disabled="true"></a>
<% end %></a>
</div>
<div class="navHomepageProfile" id="navHomepageProfile">
<ul>
<li class="homepageProfileMenuIcon" id="homepageProfileMenuIcon">
<div class="mt5 mb8" id="user_avatar"></div>
<a href ="javascript:void(0);" disabled="true"><%= image_tag(url_to_avatar(User.current),:width =>"40",:height => "40",:alt=>"头像", :id => "nh_user_logo", :class => "portraitRadius") %></a>
<ul class="topnav_login_list none" id="topnav_login_list">
<li>
<a href ="javascript:void(0);" class="menuGrey" disabled="true">修改资料</a>
</li>
<li>
<a href ="javascript:void(0);" class="menuGrey" disabled="true">我的组织</a>
</li>
<li>
<a href ="javascript:void(0);" class="menuGrey" disabled="true">新建组织</a>
</li>
<!--<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>-->
<li>
<%= link_to "退出",logout_url_without_domain,:class => "menuGrey",:method => "post"%>
</li>
</ul>
</li>
</ul>
</div>
<div class="navHomepageNews" id="user_messages">
<a href ="javascript:void(0);" class="homepageNewsIcon" disabled="true" title = "您的所有消息" ></a>
<%#= link_to User.current.count_new_message, user_message_path(User.current), :class => "homepageNewsIcon" %>
</div>
</div>
<script type="text/javascript">
var onUserMessages = false;
var onNotice = false;
//搜索相关
$("#navHomepageSearch").mouseover(function(){
$("#navHomepageSearchType").show();
}).mouseout(function(){
$("#navHomepageSearchType").hide();
});
$("#user_messages").mouseenter(function(){
onNotice = true;
$("#user_messages_list").show();
if($("#message_list_detail").length == 0){
$.get('<%=user_messages_unviewed_users_path %>');
$("#ajax-indicator").hide();
}
var obj = $("#user_messages_list");
clearTimeout(obj.timer);
}).mouseleave(function(){
onNotice = false;
var obj = $("#user_messages_list");
setTimeout(function(){
if(!onNotice && !onUserMessages) {
obj.hide();
obj.html("<%=escape_javascript(render :partial => 'layouts/message_loading') %>");
} }, 500);
});
$("#message_list_detail").mouseenter(function(event){
event.stopPropagation();
onUserMessages = true;
}).mouseleave(function(){
onUserMessages = false;
});
$("#navHomepageProfile").mouseenter(function(){
$("#homepageProfileMenuIcon").addClass("homepageProfileMenuIconhover");
$("#topnav_login_list").show();
});
$("#navHomepageProfile").mouseleave(function(){
$("#homepageProfileMenuIcon").removeClass("homepageProfileMenuIconhover");
$("#topnav_login_list").hide();
});
function signout(){
$.post(
'<%= signout_path%>',
{}
);
}
</script>

View File

@ -82,7 +82,6 @@
<% end %>
<% if all_count > (page.to_i+1) * 10%>
<input type="hidden" value="<%= page%>" id="course_page_num">
<a class="user_navmorebox" href="javascript:void(0);" id="user_show_more_course" onclick="show_more_course('<%= user_courses4show_user_path(user.id,:page => page)%>');">
<span class="user_icons_moreclass"></span>
</a>

View File

@ -59,7 +59,6 @@
<% end %>
<% if all_count > (page.to_i+1) * 10%>
<input type="hidden" value="<%= page%>" id="project_page_num">
<a class="user_navmorebox" href="javascript:void(0);" id="user_show_more_project" onclick="show_more_project('<%= user_projects4show_user_path(user.id,:page => page)%>');">
<span class="user_icons_moreclass"></span>
</a>

View File

@ -102,8 +102,10 @@
<div class="homepageContent">
<div class="homepageLeft mt10" id="LSide">
<div class="user_leftinfo mb10">
<% if User.current.logged?%>
<%=link_to image_tag(url_to_avatar(@user),width:"74", height: "74", :id=>'nh_user_tx'), my_clear_user_avatar_temp_path, :class => "user_leftinfo_img", :remote => true%>
<% if User.current.logged? && User.current == @user%>
<%=link_to image_tag(url_to_avatar(@user),width:"74", height: "74", :id => 'nh_user_tx'), my_clear_user_avatar_temp_path, :class => "user_leftinfo_img", :remote => true%>
<% elsif User.current.logged? %>
<a href="javascript:void(0)" style="cursor: default;" class="user_leftinfo_img"><%=image_tag(url_to_avatar(@user),width:"74", height: "74", :id=>'nh_user_tx') %></a>
<% else %>
<img src="images/user/male.jpg" width="74" height="74" />
<% end %>

View File

@ -0,0 +1,335 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title><%= h html_title %></title>
<meta name="description" content="<%= Redmine::Info.app_name %>" />
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common', 'css/structure','css/public', 'prettify','css/project','css/courses','css/popup','syllabus',:media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "bootstrap","avatars","new_user",'attachments','prettify'%>
<%= heads_for_theme %>
<%= call_hook :view_layouts_base_html_head %>
<%= yield :header_tags -%>
<!-- MathJax的配置 -->
<script type="text/javascript"
src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>
<!-- 配置 在生成的公式图片上去掉Math定义的右键菜单$$ $$ \( \) \[ \] 中的公式给予显示-->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
showMathMenu: false,
showMathMenuMSIE: false,
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
});
</script>
<script>
var onUserCard = false;
var onImage = false;
$(document).ready(function(){
$("#relateProject,.relatePInfo").mouseover(function(){
$(".relatePInfo").css("display","block");
})
$("#relateProject,.relatePInfo").mouseout(function(){
$(".relatePInfo").css("display","none");
})
$(".homepagePostPortrait").mouseover(function(){
onImage = true;
$(this).children(".userCard").css("display","block");
})
$(".homepagePostPortrait").mouseout(function(){
var cur = $(this);
onImage = false;
setTimeout(function(){
if (onUserCard == false && onImage == false) {
$(cur).children(".userCard").css("display","none");
}
},500);
})
$(".userCard").mouseover(function(){
onUserCard = true;
$(this).css("display","block");
})
$(".userCard").mouseout(function(){
onUserCard = false;
$(this).css("display","none");
})
$(".coursesLineGrey").mouseover(function(){
$(this).css("color","#ffffff");
})
$(".coursesLineGrey").mouseout(function(){
$(this).css("color","#808080");
});
//侧导航栏配置设置
$(".homepageLeftMenuCoursesLine").mouseover(function(){
$(this).children(".shild").css("background","url(/images/hwork_icon.png) -82px -399px no-repeat");
$(this).children().css("color","#ffffff");
});
$(".homepageLeftMenuCoursesLine").mouseout(function(){
$(this).children(".shild").css("background","url(/images/hwork_icon.png) -6px -354px no-repeat");
$(this).children().css("color","#808080");
});
$(".subNavRow").mouseover(function(){
$(this).css("background-color","#269ac9");
$(this).children().css("color","#ffffff");
});
$(".subNavRow").mouseout(function(){
$(this).css("background-color","#ffffff");
$(this).children().css("color","#888888");
});
})
</script>
</head>
<body onload="prettyPrint();">
<div class="navContainer">
<% is_current_user = User.current.logged? && User.current == @user%>
<% if User.current.logged? %>
<%= render :partial => 'layouts/logined_header_show' %>
<% else%>
<%= render :partial => 'layouts/unlogin_header' %>
<% end%>
</div>
<div class="cl"></div>
<div class="homepageContentContainer" id="">
<!--div class="homepageRightBannerImg"></div-->
<div class="cl"></div>
<div class="homepageContent">
<div class="homepageLeft mt10" id="LSide">
<div class="user_leftinfo mb10">
<% if User.current.logged?%>
<a href ="javascript:void(0);" disabled="true" class="user_leftinfo_img"><%= image_tag(url_to_avatar(@user),width:"74", height: "74", :id=>'nh_user_tx')%></a>
<% else %>
<img src="images/user/male.jpg" width="74" height="74" />
<% end %>
<% if (@user.user_extensions && (@user.user_extensions.identity != 2) ) %>
<span class="<%= @user.user_extensions.gender == 1 ? 'user_leftinfo_female' : 'user_leftinfo_male' %> "></span>
<% end %>
<div class="user_info_inner">
<div class=" user_leftinfo_namebox" >
<a href="javascript:void(0);" class="user_leftinfo_name"><%=@user.show_name %></a>
<% if @user.user_extensions && @user.user_extensions.identity %>
<span class="user_cirbtn_yellow" ><%= get_user_roll @user %></span>
<% end%>
</div>
<div>
<div class="user_info_intro">
<div id="user_brief_introduction_show">
<%= render :partial => 'layouts/user_brief_introduction', :locals => {:user => @user} %>
</div>
</div>
<textarea class="homepageSignatureTextarea none" placeholder="请编辑签名" id="user_brief_introduction_edit" onblur="edit_user_introduction('<%= edit_brief_introduction_user_path(@user.id)%>');"><%= @user.user_extensions.brief_introduction %></textarea>
</div>
<ul class="user_atten clear">
<li>
<a href="javascript:void(0);" disabled="true">
<strong>博客</strong><br />
<span class="sy_cgrey"><%=@user.blog.blog_comments.where("#{BlogComment.table_name}.parent_id is null").count %></span>
</a>
</li>
<li>
<a href="javascript:void(0);" disabled="true">
<strong>关注</strong><br />
<span class="sy_cgrey"><%=User.watched_by(@user.id).count %></span>
</a>
</li>
<li>
<a href="javascript:void(0);" disabled="true">
<strong>粉丝</strong><br />
<span class="sy_cgrey"><%= @user.watcher_users.count %></span>
</a>
</li>
</ul>
</div>
<div id="watch_user_btn_div">
<a href="javascript:void(0);" class="user_editinfo" disabled="true">编辑个人资料</a>
</div>
</div>
<div class="user_leftnav ">
<% hidden_courses = Setting.find_by_name("hidden_courses") %>
<% unvisiable = hidden_courses && hidden_courses.value == "1"%>
<% if !unvisiable %>
<ul class="users_accordion mb10">
<li id="user_01" class="user_icons_course">
<a href ="javascript:void(0);" disabled="true">课程</a>
<% courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(10) %>
<% all_count = @user.courses.visible.where("is_delete =?", 0).count%>
<div class="<%= courses.empty? ? 'none' : ''%>" >
<div id="homepageLeftMenuCourses">
<ul class="user_sub_menu" id="user_courses_li">
</ul>
</div>
<% if !courses.empty? %>
<a class="user_navmorebox" href="javascript:void(0);" id="user_hide_course" >
<span id="hide_show_courseicon" class="user_icons_closeclass"></span>
</a>
<% end %>
</div>
</li>
<% if is_current_user %>
<li id="user_02" class="user_icons_new">
<a href ="javascript:void(0);" disabled="true">新建课程</a>
</li>
<li id="user_03" class="user_icons_new">
<a href ="javascript:void(0);" disabled="true">新建班级</a>
</li>
<li id="user_04" class="user_icons_addclass">
<a href ="javascript:void(0);" disabled="true">加入班级</a>
</li>
<% if @user == User.current %>
<li id="user_05" class="user_icons_myhw">
<a href ="javascript:void(0);" disabled="true">我的作业</a>
</li>
<% end %>
<% end %>
</ul>
<% end %>
<ul class="users_accordion mb10">
<li id="user_06" class="user_icons_project">
<a href ="javascript:void(0);" disabled="true">项目</a>
<% all_count = @user.projects.visible.count%>
<% projects = @user.projects.visible.select("projects.*, (SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(10)%>
<div class="<%= projects.empty? ? 'none' : ''%>" >
<div id="homepageLeftMenuForge">
<ul class="user_sub_menu" id="user_projects_li">
</ul>
</div>
<% if !projects.empty? %>
<a class="user_navmorebox" href="javascript:void(0);" id="user_hide_project" onclick="leftProjectslistChange();">
<span id="hide_show_projecticon" class="user_icons_closeclass"></span>
</a>
<% end %>
</div>
</li>
<% if is_current_user %>
<li id="user_07" class="user_icons_new">
<a href ="javascript:void(0);" disabled="true">新建项目</a>
</li>
<li id="user_08" class="user_icons_addproject">
<a href ="javascript:void(0);" disabled="true">加入项目</a>
</li>
<!--<li id="user_09" class="user_icons_myissues">-->
<!--<a href="#user_09" >我的任务</a>-->
<!--</li>-->
<% end %>
</ul>
<ul class="users_accordion mb10">
<li id="user_10" class="user_icons_mes">
<a href ="javascript:void(0);" disabled="true">留言</a>
</li>
</ul>
</div><!--sy_class_leftnav end-->
<div class="fontGrey5 mt10 ml20">访问计数 <%= @user.visits.to_i %> 自2016年5月</div>
</div>
<div class="homepageRight">
<%= yield %>
</div>
</div>
<%= render :partial => 'layouts/new_feedback' %>
</div>
<div class="cl"></div>
<%= render :partial => 'layouts/footer_show' %>
<div class="cl"></div>
<div id="ajax-modal" style="display:none;"></div>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>
<div id="nh_tx_dialog_html" class="white_content" style="display:none;">
<div>
<div><a href="javascript:hideModal();" class="box_close"></a></div>
<div class="cl"></div>
<div class="pro_new">
<h3 class="box_h3 mb10">头像设置</h3>
<div class="uppicBox">
<input type="button" class="uppic_btn" onclick="$('#upload_user_image').click();" value="浏览.."/>
<%= file_field_tag 'avatar[image]',
:id => "upload_user_image",
:style => 'display:none;',#added by young
:size => "1",
:multiple => false,
:onchange => 'addInputAvatar(this);',
:data => {
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
:file_type => Redmine::Configuration['pic_types'].to_s,
:type_support_message => l(:error_pic_type),
:upload_path => upload_avatar_path(:format => 'js'),
:description_placeholder => nil ,# l(:label_optional_description)
:source_type => @user.class.to_s,
:source_id => @user.id.to_s
} %>
<!--<br/>-->
<!--<span>只支持jpg,png,gif,大小不超过5M</span>-->
</div>
<div class="showpicBox">
<p>预览</p>
<%= image_tag(url_to_avatar(@user), :style=>"width:96px;height:96px;",:class=>"mb5 mt10",:nhname=>'avatar_image') %>
<br/>
<span >96px*96px</span> <br />
<div class="mb20"></div>
<%= image_tag(url_to_avatar(@user), :style=>"width:48px;height:48px;",:class=>"mb5",:nhname=>'avatar_image') %>
<br />
<span>48px*48px</span> <br />
</div>
<div class="cl mb10"></div>
<a href="javascript:void(0);" class=" fr grey_btn mr15 f14"> 取&nbsp;&nbsp;消</a>
<a href="javascript:void(0);" data-remote="true" class="blue_btn fr mr10 f14">确&nbsp;&nbsp;定</a>
</div><!--talknew end-->
<div class="cl"></div>
</div><!--floatbox end-->
</div>
<script type="text/javascript">
$(function(){
$('#user_hide_course').hide();
$('#user_hide_project').hide();
autoUrl("user_brief_introduction_show");
if(<%= @is_course == 1 %>) {
$("#user_course_list").addClass('active');
} else if(<%= @is_project == 1 %>) {
$("#user_project_list").addClass('active');
}
});
$("#courseMenu").mouseenter(function(){
$("#topnav_course_menu").show();
});
$("#courseMenu").mouseleave(function(){
$("#topnav_course_menu").hide();
});
$("#projectMenu").mouseenter(function(){
$("#topnav_project_menu").show();
});
$("#projectMenu").mouseleave(function(){
$("#topnav_project_menu").hide();
});
function leftCourseslistChange(){
var target = $('#user_courses_li>li');
for(var i = 10; i < target.length; i++){
target.eq(i).slideToggle();
}
$('#hide_show_courseicon').toggleClass("user_icons_closeclass");
$('#hide_show_courseicon').toggleClass("user_icons_moreclass");
}
function leftProjectslistChange(){
var target = $('#user_projects_li>li');
for(var i = 10; i < target.length; i++){
target.eq(i).slideToggle();
}
$('#homepageLeftMenuForge').slideToggle();
$('#hide_show_projecticon').toggleClass("user_icons_closeclass");
$('#hide_show_projecticon').toggleClass("user_icons_moreclass");
}
</script>
</body>
</html>

View File

@ -1,4 +1,15 @@
<% if @force %>
<% message = AppliedMessage.where(:status => 3, :user_id => User.current.id, :viewed => 0).first %>
<% unless message.nil? %>
<div class="homepageRightBanner">
<div class="polls_head" style="font-size:8px;">&nbsp;&nbsp;消息:&nbsp;&nbsp;您添加新的单位“<%= message.name %>”的申请,经确认为无效的单位信息,已被删除,请重新编辑您的单位资料。谢谢!</div>
<% message.update_attribute(:viewed, true)%>
</div>
<% end %>
<div class="homepageRightBanner" style="border-bottom:2px solid #ddd;">
<div class="polls_head" style="color:red; font-size:17px;">&nbsp;&nbsp;提示:&nbsp;&nbsp;您尚未完善您的基本资料,完善后可使用更多功能</div>
</div>
<% end %>
<div id="RSide" style="margin-left:0px; margin-bottom:0px; width:728px;">
<div id="users_tb_" class="users_tb_">
<ul>
@ -29,9 +40,12 @@
<li>&nbsp;&nbsp;</li>
</ul>
<ul class="setting_right ">
<li><%= f.text_field :login,:no_label=>true, :required => true,:style=>"color:grey", :nh_required=>"1",:disabled=>'disabled', :name => "login",:class=>"w210"%></li>
<li><%= f.text_field :mail,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210"%></li>
<li><%= f.text_field :login,:no_label=>true, :required => true,:style => "color:grey", :nh_required => "1",:disabled => 'disabled', :name => "login",:class => "w210"%></li>
<% if @force %>
<li><%= f.text_field :mail,:no_label=>true, :required => true,:nh_required => "1",:class=>"w210",:disabled=>'disabled'%></li>
<% else %>
<li><%= f.text_field :mail,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210"%></li>
<% end %>
<li>
<select onchange="showtechnical_title(this.value);" required = true, nh_required="1" name="identity" id="userIdentity" class="location" class="w70" style="height:28px;margin-left:2px;">
<option value="-1">
@ -81,7 +95,7 @@
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="" placeholder=" --请选择您所属的单位--"/>
<p class="fl ml10">
<!-- <span id="errortip" class="icons_warning fl mt5" style="display: none;"></span> -->
<span id="hint" style="color: #7f7f7f;display: none">平台找到了<a id="school_num" href="javascript:void(0)" style="color: red" >0</a>个包含<a id="search_condition" href="javascript:void(0)">"国防"</a>的高校</span>
<span id="hint" style="color: #7f7f7f;display: none"><a id="school_num" href="javascript:void(0)" style="color: red" ></a><a id="search_condition" href="javascript:void(0)"></a></span>
</p>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>-->
<% elsif User.current.user_extensions.identity == 3 || User.current.user_extensions.identity == 2 %>
@ -89,7 +103,7 @@
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="<%= @user.user_extensions.occupation %>" />
<p class="fl ml10">
<!-- <span id="errortip" class="icons_warning fl mt5" style="display: none;"></span> -->
<span id="hint" style="color: #7f7f7f;display: none">平台找到了<a id="school_num" href="javascript:void(0)" style="color: red" >0</a>个包含<a id="search_condition" href="javascript:void(0)">"国防"</a>的高校</span>
<span id="hint" style="color: #7f7f7f;display: none"><a id="school_num" href="javascript:void(0)" style="color: red" ></a><a id="search_condition" href="javascript:void(0)"></a></span>
</p>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>-->
<% elsif User.current.user_extensions.school.nil? %>
@ -97,7 +111,7 @@
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" placeholder=" --请选择您所属的单位--" />
<p class="fl ml10">
<!-- <span id="errortip" class="icons_warning fl mt5" style="display: none;"></span> -->
<span id="hint" style="color: #7f7f7f;display: none">平台找到了<a id="school_num" href="javascript:void(0)" style="color: red" >0</a>个包含<a id="search_condition" href="javascript:void(0)">"国防"</a>的高校</span>
<span id="hint" style="color: #7f7f7f;display: none"><a id="school_num" href="javascript:void(0)" style="color: red" ></a><a id="search_condition" href="javascript:void(0)"></a></span>
</p>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>-->
<% else %>
@ -105,7 +119,7 @@
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" type="text" style="display: none;" class="w210" value="<%= User.current.user_extensions.school.id %>"/>
<p class="fl ml10">
<!-- <span id="errortip" class="icons_warning fl mt5" style="display: none;"></span> -->
<span id="hint" style="color: #7f7f7f;display: none">平台找到了<a id="school_num" href="javascript:void(0)" style="color: red" >0</a>个包含<a id="search_condition" href="javascript:void(0)">"国防"</a>的高校</span>
<span id="hint" style="color: #7f7f7f;display: none"><a id="school_num" href="javascript:void(0)" style="color: red" ></a><a id="search_condition" href="javascript:void(0)"></a></span>
</p>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" value="<%#= User.current.user_extensions.school.name %>" readonly="true" style="background-color: #E2E2E2;"/>-->
<% end %>
@ -155,7 +169,7 @@
<li>
<%= select_tag( 'user[mail_notification]', options_for_select( user_mail_notification_options(@user), @user.mail_notification) ) %>
<label class="ml10"><%= check_box_tag 'no_self_notified', 1, @user.pref[:no_self_notified],:style=>"height:14px;" %>不要发送对我自己提交的修改的通知</label>
<label class="ml10"><%= check_box_tag 'no_self_notified', 1, @user.pref[:no_self_notified],:style => "height:14px;" %>不要发送对我自己提交的修改的通知</label>
</li>
<!--<li><input name="brief_introduction" class="w450" type="text" maxlength="255" value="<%#= (@user.user_extensions.nil?) ? '' : @user.user_extensions.brief_introduction %>"></li>-->
<li style="height:auto;"><textarea name="description" class="w450 h200" maxlength="255" style="resize:none;"><%= (@user.user_extensions.nil?) ? '' : @user.user_extensions.description %></textarea></li>
@ -466,7 +480,7 @@
}else{
$("#search_school_result_list").html('');
str = e.target.value.length > 4 ? e.target.value.substr(0, 4)+"..." : e.target.value;
$("#hint").html('如果找不到自己的单位,您可以<a style="color:#64bdd9" onclick="apply_add_school();" href="javascript:void(0);">添加单位</a>');
$("#hint").html('如果找不到自己的单位,您可以&nbsp;<a style="color:#64bdd9" onclick="apply_add_school();" href="javascript:void(0);">添加单位</a>');
$("#hint").show();
$("#errortip").show();
}
@ -477,7 +491,6 @@
if($(e.target).attr("id") != 'search_school_result_list' && $(e.target).attr("id") != 'province')
{
$("#search_school_result_list").hide();
$("#hint").hide();
$("#errortip").hide();
}
});
@ -516,7 +529,7 @@
}else{
$("#search_school_result_list").html('');
str = e.target.value.length > 4 ? e.target.value.substr(0, 4)+"..." : e.target.value;
$("#hint").html('您输入的名称尚不存在,<a style="color:#64bdd9" onclick="apply_add_school();" href="javascript:void(0);">申请添加</a>');
$("#hint").html('如果找不到自己的单位,您可以&nbsp;<a style="color:#64bdd9" onclick="apply_add_school();" href="javascript:void(0);">添加单位</a>');
$("#hint").show();
$("#errortip").show();
}

View File

@ -47,52 +47,52 @@
<!--<a href="javascript:void(0);" class="logoEnter fl linkGrey4">上传图片</a>-->
<%#= form_for( @organization,{:controller => 'organizations',:action => 'update',:id=>@organization,:html=>{:id=>'update_org_form',:method=>'put'}}) do %>
<%= labelled_form_for @organization do |f|%>
<%= render :partial=>"new_org_avatar_form",:locals=> {source:@organization} %>
<!--<div class="cl"></div>-->
<!--</div>-->
<div class="orgRow mb10"><span class="c_red">*&nbsp;</span>组织名称:<input type="text" name="organization[name]" id="organization_name" maxlength="100" onblur="check_uniq(<%=@organization.id %>);" onfocus="$('#check_name_hint').hide()" class="orgNameInput" value="<%= @organization.name%>" />
<div class="cl"></div>
</div>
<%= render :partial=>"new_org_avatar_form",:locals=> {source:@organization} %>
<!--<div class="cl"></div>-->
<!--</div>-->
<div class="orgRow mb10"><span class="c_red">*&nbsp;</span>组织名称:<input type="text" name="organization[name]" id="organization_name" maxlength="100" onblur="check_uniq(<%=@organization.id %>);" onfocus="$('#check_name_hint').hide()" class="orgNameInput" value="<%= @organization.name%>" />
<div class="cl"></div>
</div>
<div style="margin-left: 80px " id="check_name_hint"></div>
<div class="orgRow mb10"><span class="ml10">组织描述:</span><textarea type="text" name="organization[description]" class="orgDes" id="org_desc" placeholder="最多3000个汉字或6000个英文字符"><%= @organization.description%></textarea>
<div class="cl"></div>
</div>
<div style="margin-left: 80px " id="check_desc_hint"></div>
<div class="orgRow mb10"><span class="ml10">组织URL</span>
<div class="w607 fr">http//
<input type="text" name="organization[domain]" id="domain" value="<%= domain.nil? ? '' : domain.subname %>" class="orgUrlInput" onfocus="observe_input_to_lowercase($(this));" />
.trustie.net<a href="javascript:void(0);" class="linkBlue ml15" style="text-decoration:underline;" onclick="apply_subdomain(<%= @organization.id %>,$('#domain').val());">申请</a>
<% record = OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first %>
<% if domain.present? and record.present? and record.content == domain.subname %>
<span>(已批准)</span>
<% elsif record %>
<span>(您申请了子域名<%= OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first.content %>,还未批准)</span>
<% end %>
<p class="c_green f12" id="apply_hint" ></p></div>
<!--class="c_green f12" 您的申请已提交,系统会以消息的形式通知您结果 -->
</div>
<div class="cl"></div>
<div class="orgRow mb10 mt5">
<span style="margin-left:10px;" >显示模式&nbsp;: </span>
<input type="radio" id="show_mode_ordinary" value="0" name="show_mode" style="margin-left:5px;" <%= @organization.show_mode == 0 ? "checked" : "" %> />
<label for="show_mode_ordinary">简洁模式</label>
<input type="radio" id="show_mode_special" value="1" name="show_mode" style="margin-left:10px;" <%= @organization.show_mode == 1 ? "checked" : "" %> />
<label for="show_mode_special">门户模式</label>
</div>
<div class="orgRow mb10 mt5"><span style="margin-left:38px;" >公开&nbsp;: </span>
<input type="checkbox" id="is_public" onclick="disable_down($(this), $('#allow_download'),$('#allow_down_hint'));" name="organization[is_public]" <%= @organization.is_public ? 'checked': ''%> class="ml3" />
</div>
<div class="orgRow mb10 mt5"><span style="margin-left:10px;">下载支持&nbsp;: </span>
<input id="allow_download" type="checkbox" style="margin-top:5px;" <%= @organization.is_public? ? "":"DISABLED" %> name="organization[allow_guest_download]" <%= @organization.allow_guest_download ? 'checked': ''%> class="ml3" />
&nbsp;<span>允许游客下载</span>
<span class="c_green f12" id="allow_down_hint"><%= @organization.is_public? ? "" : "(私有组织不允许游客下载资源)" %></span>
</div>
<!--<%# if User.current.admin? %>-->
<!--<div class="orgRow mb10 mt5"><span style="margin-left:10px;">允许设置名师榜&nbsp;: </span>-->
<!--<input id="allow_set_excellent_teachers" type="checkbox" style="margin-top:5px;" name="organization[allow_teacher]" <%#= @organization.allow_teacher==1 ? 'checked': ''%> class="ml3" />-->
<!--</div>-->
<!--<%# end %>-->
<a href="javascript:void(0);" class="saveBtn ml80 db fl" onclick="update_org('<%=@organization.id %>','<%= @organization.name %>', $('#organization_name'));">保存</a>
<div class="orgRow mb10"><span class="ml10">组织描述:</span><textarea type="text" name="organization[description]" class="orgDes" id="org_desc" placeholder="最多3000个汉字或6000个英文字符"><%= @organization.description%></textarea>
<div class="cl"></div>
</div>
<div style="margin-left: 80px " id="check_desc_hint"></div>
<div class="orgRow mb10"><span class="ml10">组织URL</span>
<div class="w607 fr">http//
<input type="text" name="organization[domain]" id="domain" value="<%= domain.nil? ? '' : domain.subname %>" class="orgUrlInput" onfocus="observe_input_to_lowercase($(this));" />
.trustie.net<a href="javascript:void(0);" class="linkBlue ml15" style="text-decoration:underline;" onclick="apply_subdomain(<%= @organization.id %>,$('#domain').val());">申请</a>
<% record = OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first %>
<% if domain.present? and record.present? and record.content == domain.subname %>
<span>(已批准)</span>
<% elsif record %>
<span>(您申请了子域名<%= OrgMessage.where("organization_id=? and message_type='ApplySubdomain'", @organization.id).order("updated_at desc").first.content %>,还未批准)</span>
<% end %>
<p class="c_green f12" id="apply_hint" ></p></div>
<!--class="c_green f12" 您的申请已提交,系统会以消息的形式通知您结果 -->
</div>
<div class="cl"></div>
<div class="orgRow mb10 mt5">
<span style="margin-left:10px;" >显示模式&nbsp;: </span>
<input type="radio" id="show_mode_ordinary" value="0" name="show_mode" style="margin-left:5px;" <%= @organization.show_mode == 0 ? "checked" : "" %> />
<label for="show_mode_ordinary">简洁模式</label>
<input type="radio" id="show_mode_special" value="1" name="show_mode" style="margin-left:10px;" <%= @organization.show_mode == 1 ? "checked" : "" %> />
<label for="show_mode_special">门户模式</label>
</div>
<div class="orgRow mb10 mt5"><span style="margin-left:38px;" >公开&nbsp;: </span>
<input type="checkbox" id="is_public" onclick="disable_down($(this), $('#allow_download'),$('#allow_down_hint'));" name="organization[is_public]" <%= @organization.is_public ? 'checked': ''%> class="ml3" />
</div>
<div class="orgRow mb10 mt5"><span style="margin-left:10px;">下载支持&nbsp;: </span>
<input id="allow_download" type="checkbox" style="margin-top:5px;" <%= @organization.is_public? ? "":"DISABLED" %> name="organization[allow_guest_download]" <%= @organization.allow_guest_download ? 'checked': ''%> class="ml3" />
&nbsp;<span>允许游客下载</span>
<span class="c_green f12" id="allow_down_hint"><%= @organization.is_public? ? "" : "(私有组织不允许游客下载资源)" %></span>
</div>
<!--<%# if User.current.admin? %>-->
<!--<div class="orgRow mb10 mt5"><span style="margin-left:10px;">允许设置名师榜&nbsp;: </span>-->
<!--<input id="allow_set_excellent_teachers" type="checkbox" style="margin-top:5px;" name="organization[allow_teacher]" <%#= @organization.allow_teacher==1 ? 'checked': ''%> class="ml3" />-->
<!--</div>-->
<!--<%# end %>-->
<a href="javascript:void(0);" class="saveBtn ml80 db fl" onclick="update_org('<%=@organization.id %>','<%= @organization.name %>', $('#organization_name'));">保存</a>
<% end %>
</div>
<div class="undis ml15 mr15" id="orgContent_2">

View File

@ -40,12 +40,12 @@
</div>
<% end %>
<% if allow_pull_request(@project) %>
<div class="subNav">
<%= link_to "Pull Requests", project_pull_requests_path(@project), :class => "f14 c_blue02" %>
<div class="subNav">
<%= link_to "Pull Requests", project_pull_requests_path(@project), :class => "f14 c_blue02" %>
<% if allow_pull_request(@project) %>
<%= link_to "+新建请求", new_project_pull_request_path(:project_id => @project.id), :class => "subnav_green" %>
</div>
<% end %>
<% end %>
</div>
<%# --版本库被设置成私有、module中设置不显示、没有创建版本库 三种情况不显示-- %>
<% if visible_repository?(@project) %>

View File

@ -5,8 +5,10 @@
<div id="pull_request_show">
<div id="mergeShow" class="f14 fontGrey2 merge-show">
<span class="mr10 open-status"><%= get_state(@request.state) %></span><span class="mr10">合并请求</span> 由 <%= link_to @request.author.try(:username), user_path(get_user_by_login_and(@request.author.try(:username))), :class => "link-blue" %> 于 <%= time_tag(@request.created_at) %> 前提交 · 最后编辑时间 <%= time_tag(@request.updated_at) %> 前
<% unless @request.state == "merged" %>
<%= link_to "#{@request.state == 'closed' ? '重新打开' : '关闭'}", update_pull_request_project_pull_request_path(@request.id, :project_id => @project.id, :state => @request.state =="closed" ? "reopen" : "close"), :class => "BlueCirBtn fr" %>
<% if User.current.login == @request.author.try(:username) || is_project_manager?(User.current.id, @project.id) %>
<% unless @request.state == "merged" %>
<%= link_to "#{@request.state == 'closed' ? '重新打开' : '关闭'}", update_pull_request_project_pull_request_path(@request.id, :project_id => @project.id, :state => @request.state =="closed" ? "reopen" : "close"), :class => "BlueCirBtn fr" %>
<% end %>
<% end %>
<div class="cl"></div>
</div>

View File

@ -3,8 +3,9 @@
<li class="active"><%= link_to "待处理<span class='project-number-dot'>#{@requests_opened_count}</span>".html_safe, project_pull_requests_path(:type => "1"), :remote => true %></li>
<li><%= link_to "已处理<span class='project-number-dot'>#{@requests_merged_count}</span>".html_safe, project_pull_requests_path(:type => "2"), :remote => true %></li>
<li><%= link_to "已关闭<span class='project-number-dot'>#{@requests_closed_count}</span>".html_safe, project_pull_requests_path(:type => "3"), :remote => true %></li>
<%= link_to "创建Pull Request", new_project_pull_request_path, :class => "BlueCirBtn fr ml10 mt10", :style => "width:110px;" %>
<% if allow_pull_request(@project) %>
<%= link_to "创建Pull Request", new_project_pull_request_path, :class => "BlueCirBtn fr ml10 mt10", :style => "width:110px;" %>
<% end %>
<div class="cl"></div>
</ul>
<div class="cl"></div>

View File

@ -2,7 +2,7 @@
<span class="c_dark f14 fb fl mr15">
作品
<font class="f12 c_red">
(<%= @student_work_count%>人已交)
(<span id="student_work_count"><%= @student_work_count%></span>人已交)
</font>
<%# my_work = @homework.student_works.where("user_id = #{User.current.id}").first %>
<% my_work = cur_user_works_for_homework @homework %>

View File

@ -17,3 +17,5 @@ $("#score_list_<%= @work.id%>").removeAttr("style");
$("tr[id='student_work_<%= @work.id%>']").replaceWith("<%= escape_javascript(render :partial => 'evaluation_work',:locals => {:student_work => @work, :index => 1}) %>");
$("#work_num_<%= @work.id%>").html(num);
<% end%>
$("#student_work_count").html("<%=@count %>");

View File

@ -72,6 +72,7 @@
l(:button_delete),
{:controller => 'issues',:action => 'delete_journal', :id => activity_id,:journal_id=>comment.id, :user_activity_id => user_activity_id},
:method => 'get',
:confirm => l(:text_are_you_sure),
:remote=>true,
:class => 'fr mr20',
:title => l(:button_delete)

View File

@ -29,7 +29,7 @@
发帖时间:<%= format_time(activity.created_on) %>
</div>
<div class="homepagePostDate fl ml15">
更新时间:<%= format_time(ForgeActivity.where("forge_act_type='#{activity.class}' and forge_act_id =#{activity.id}").first.updated_at) %>
更新时间:<%= get_forge_act_message(activity, activity.class.to_s) %>
</div>
<div class="cl"></div>
<% if activity.parent_id.nil? %>

View File

@ -1,11 +1,12 @@
<% if ma.class == AppliedMessage %>
<!--申请加入项目-->
<!-- 申请添加单位 -->
<% if ma.applied_type == "ApplyAddSchools" %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);">
<% if ma.status == 0 %>
<%= link_to image_tag(url_to_avatar(ma.user), :width => "30", :height => "30"), user_path(ma.user), :target => '_blank' %>
<% applied_user = User.find(ma.applied_user_id) %>
<%= link_to image_tag(url_to_avatar(applied_user), :width => "30", :height => "30"), user_path(applied_user), :target => '_blank' %>
<% else %>
<%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %>
<% end %>
@ -19,6 +20,7 @@
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</li>
</ul>
<!-- 申请加入项目 -->
<% elsif ma && ma.applied_type == "AppliedProject" %>
<ul class="homepageNewsList fl" id="applied_project_<%= ma.id %>">
<%= render :partial => "users/applied_project_content", :locals =>{:ma => ma} %>

View File

@ -17,7 +17,8 @@
window.g_debug = false; //调试标志,如果在本地请置为true
window.apiUrl = '/api/v1/';
window.g_redirect_path = '<%= @path %>';
window.g_localhost = "<%= Setting.protocol%>://"+"<%= Setting.host_name%>";
window.g_localhost = "<%= Setting.protocol %>"+ "://"+"<%= Setting.host_name%>";
window.g_appid = "<%= @appid %>";
<% if @course_id %>
window.g_courseid = <%= @course_id %>;
<% elsif @project_id %>

View File

@ -2156,6 +2156,6 @@ zh:
label_blog_comment_template: 您的博客有新回复了。
label_new_blog_template: 有新博客了。
label_new_issue_template: 有新的问题动态了。
label_new_notice_template: 您的课程有新通知了。
label_new_notice_template: 您的班级有新通知了。
#edit yk
label_code_work_tests: 代码测试列表

View File

@ -1343,6 +1343,7 @@ RedmineApp::Application.routes.draw do
get :user_activities
post :bind
post :get_bind
post :is_bind
end
end

View File

@ -23,6 +23,11 @@ default: &default
create_class_notice: "2GtJJGzzNlNy2i0UrsjEDlvfSVIUXQfSo47stpcQAVw"
create_project_notice: "jYu0iimbDpgWYZaTLXioZe2lvqoWTdKnUPyphTJ1mxs"
project_review_notice: "kdb-8UlMjTc3z51Qcf8g2vY4i_nE4OGKZAucdQma_2E"
join_project_notice: "TtXvy0XMIQyCgpnXHhoB8t-x0QIfy-78gAJXsGf9afg"
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="
auto_openid_url_3: "&connect_redirect=1#wechat_redirect"
production:
<<: *default

View File

@ -23,6 +23,11 @@ default: &default
create_class_notice: "9CDIvHIKiGwPEQWRw_-wieec1o50tMXQPPZIfECKu0I"
create_project_notice: "R2ZaQKJfDJgujPcHWPzadKHIRkIyj2CjX2o_qIuRqig"
project_review_notice: "ip192wVXTav3qchgUn9_7B6lFfTlCZjwL7A1tncTOuc"
join_project_notice: "3KnMQEMUCmQWkB5JvzrpmguEwnN8bvUHUdpOTudxv_M"
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="
auto_openid_url_3: "&connect_redirect=1#wechat_redirect"
production:
<<: *default

View File

@ -0,0 +1,5 @@
class AddBindtypeToUserWechats < ActiveRecord::Migration
def change
add_column :user_wechats, :bindtype, :integer, :default => 0
end
end

View File

@ -7,6 +7,7 @@ module Wechat
class Api < ApiBase
API_BASE = 'https://api.weixin.qq.com/cgi-bin/'
OAUTH2_BASE = 'https://api.weixin.qq.com/sns/oauth2/'
OAUTH2_USERINFO = 'https://api.weixin.qq.com/sns/'
def initialize(appid, secret, token_file, timeout, skip_verify_ssl, jsapi_ticket_file)
@client = Client.new(API_BASE, timeout, skip_verify_ssl)
@ -120,5 +121,23 @@ module Wechat
}
get 'access_token', params: params, base: OAUTH2_BASE
end
def web_auth_access_token(web_access_token, openid)
get 'auth', params: { access_token: web_access_token, openid: openid }, base: OAUTH2_BASE
end
def web_refresh_access_token(user_refresh_token)
params = {
appid: access_token.appid,
grant_type: 'refresh_token',
refresh_token: user_refresh_token
}
get 'refresh_token', params: params, base: OAUTH2_BASE
end
def web_userinfo(web_access_token, openid, lang = 'zh_CN')
get 'userinfo', params: { access_token: web_access_token, openid: openid, lang: lang }, base: OAUTH2_USERINFO
end
end
end

View File

@ -1,6 +1,6 @@
module Wechat
class ApiBase
attr_reader :access_token, :client, :jsapi_ticket
attr_reader :access_token, :client, :jsapi_ticket, :auth_access_token
MP_BASE = 'https://mp.weixin.qq.com/cgi-bin/'
@ -42,7 +42,7 @@ module Wechat
def with_access_token(params = {}, tries = 2)
params ||= {}
yield(params.merge(access_token: access_token.token))
yield(params.reverse_merge(access_token: access_token.token))
rescue AccessTokenExpiredError
access_token.refresh
retry unless (tries -= 1).zero?

View File

@ -0,0 +1,21 @@
require 'wechat/token/access_token_base'
module Wechat
module Token
class AuthAccessToken < AccessTokenBase
# def refresh
# params = {
# appid: access_token.appid,
# grant_type: 'refresh_token',
# refresh_token: user_refresh_token
# }
# data = client.get 'oauth2/refresh_token', params: params, base: OAUTH2_BASE
# write_token_to_file(data)
# read_token_from_file
# end
end
end
end

View File

@ -26,8 +26,7 @@
<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-dynamic-author hidden fl">
<span ng-if="act.author.realname != ' '">{{act.author.realname}}</span>
<span ng-if="act.author.realname == ' '">{{act.author.nickname}}</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/female.png" width="14" class="ml5" />
</div>
@ -64,8 +63,7 @@
<div dataID = "{{act.act_id}}" ng-click="goDetail('course_notice',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-dynamic-author hidden fl">
<span ng-if="act.author.realname != ' '">{{act.author.realname}}</span>
<span ng-if="act.author.realname == ' '">{{act.author.nickname}}</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/female.png" width="14" class="ml5" />
</div>
@ -100,8 +98,7 @@
<div dataID = "{{act.act_id}}" ng-click="goDetail('course_discussion',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-dynamic-author hidden fl">
<span ng-if="act.author.realname != ' '">{{act.author.realname}}</span>
<span ng-if="act.author.realname == ' '">{{act.author.nickname}}</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/female.png" width="14" class="ml5" />
</div>
@ -136,7 +133,7 @@
<div class="post-wrapper">
<div class="post-main">
<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-title hidden mb5"><span class="c-grey3 f13 fb mr10">{{act.author.realname}}</span>创建了<span class="c-grey3 f13 fb ml10">{{act.course_project_name}} | 班级</span></div>
<div class="post-title hidden mb5"><span class="c-grey3 f13 fb mr10">{{act.author.real_name}}</span>创建了<span class="c-grey3 f13 fb ml10">{{act.course_project_name}} | 班级</span></div>
<div class="post-title hidden"><span class="mr10">{{act.latest_update}}</span></div>
<div class="cl"></div>
</div>
@ -153,8 +150,7 @@
<div dataID = "{{act.act_id}}" ng-click="goDetail('issues',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-dynamic-author hidden fl">
<span ng-if="act.author.realname != ' '">{{act.author.realname}}</span>
<span ng-if="act.author.realname == ' '">{{act.author.nickname}}</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/female.png" width="14" class="ml5" />
</div>
@ -192,8 +188,7 @@
<div dataID = "{{act.act_id}}" ng-click="goDetail('project_discussion',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-dynamic-author hidden fl">
<span ng-if="act.author.realname != ' '">{{act.author.realname}}</span>
<span ng-if="act.author.realname == ' '">{{act.author.nickname}}</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/female.png" width="14" class="ml5" />
</div>
@ -226,7 +221,7 @@
<div class="post-wrapper">
<div class="post-main">
<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-title hidden mb5"><span class="c-grey3 f13 fb mr10">{{act.author.realname}}</span>创建了<span class="c-grey3 f13 fb ml10">{{act.course_project_name}} | 项目</span></div>
<div class="post-title hidden mb5"><span class="c-grey3 f13 fb mr10">{{act.author.real_name}}</span>创建了<span class="c-grey3 f13 fb ml10">{{act.course_project_name}} | 项目</span></div>
<div class="post-title hidden"><span class="mr10">{{act.latest_update}}</span></div>
<div class="cl"></div>
</div>
@ -243,8 +238,7 @@
<div dataID = "{{act.act_id}}" ng-click="goDetail('journal_for_message',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-dynamic-author hidden fl">
<span ng-if="act.author.realname != ' '">{{act.author.realname}}</span>
<span ng-if="act.author.realname == ' '">{{act.author.nickname}}</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/female.png" width="14" class="ml5" />
</div>
@ -280,8 +274,7 @@
<div dataID = "{{act.act_id}}" ng-click="goDetail('blog_comment',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-dynamic-author hidden fl">
<span ng-if="act.author.realname != ' '">{{act.author.realname}}</span>
<span ng-if="act.author.realname == ' '">{{act.author.nickname}}</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/female.png" width="14" class="ml5" />
</div>
@ -326,8 +319,7 @@
<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-dynamic-author hidden fl">
<span ng-if="act.author.realname != ' '">{{act.author.realname}}</span>
<span ng-if="act.author.realname == ' '">{{act.author.nickname}}</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/female.png" width="14" class="ml5" />
</div>
@ -364,8 +356,7 @@
<div dataID = "{{act.act_id}}" ng-click="goDetail('course_notice',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-dynamic-author hidden fl">
<span ng-if="act.author.realname != ' '">{{act.author.realname}}</span>
<span ng-if="act.author.realname == ' '">{{act.author.nickname}}</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/female.png" width="14" class="ml5" />
</div>
@ -400,8 +391,7 @@
<div dataID = "{{act.act_id}}" ng-click="goDetail('course_discussion',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-dynamic-author hidden fl">
<span ng-if="act.author.realname != ' '">{{act.author.realname}}</span>
<span ng-if="act.author.realname == ' '">{{act.author.nickname}}</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/female.png" width="14" class="ml5" />
</div>
@ -436,7 +426,7 @@
<div class="post-wrapper">
<div class="post-main">
<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-title hidden mb5"><span class="c-grey3 f13 fb mr10">{{act.author.realname}}</span>创建了<span class="c-grey3 f13 fb ml10">{{act.course_project_name}} | 班级</span></div>
<div class="post-title hidden mb5"><span class="c-grey3 f13 fb mr10">{{act.author.real_name}}</span>创建了<span class="c-grey3 f13 fb ml10">{{act.course_project_name}} | 班级</span></div>
<div class="post-title hidden"><span class="mr10">{{act.latest_update}}</span></div>
<div class="cl"></div>
</div>
@ -460,8 +450,7 @@
<div dataID = "{{act.act_id}}" ng-click="goDetail('issues',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-dynamic-author hidden fl">
<span ng-if="act.author.realname != ' '">{{act.author.realname}}</span>
<span ng-if="act.author.realname == ' '">{{act.author.nickname}}</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/female.png" width="14" class="ml5" />
</div>
@ -499,8 +488,7 @@
<div dataID = "{{act.act_id}}" ng-click="goDetail('project_discussion',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-dynamic-author hidden fl">
<span ng-if="act.author.realname != ' '">{{act.author.realname}}</span>
<span ng-if="act.author.realname == ' '">{{act.author.nickname}}</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/female.png" width="14" class="ml5" />
</div>
@ -533,7 +521,7 @@
<div class="post-wrapper">
<div class="post-main">
<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-title hidden mb5"><span class="c-grey3 f13 fb mr10">{{act.author.realname}}</span>创建了<span class="c-grey3 f13 fb ml10">{{act.course_project_name}} | 项目</span></div>
<div class="post-title hidden mb5"><span class="c-grey3 f13 fb mr10">{{act.author.real_name}}</span>创建了<span class="c-grey3 f13 fb ml10">{{act.course_project_name}} | 项目</span></div>
<div class="post-title hidden"><span class="mr10">{{act.latest_update}}</span></div>
<div class="cl"></div>
</div>

View File

@ -37,6 +37,8 @@
<script src="/javascripts/wechat/directives/input_auto.js"></script>
<script src="/javascripts/wechat/directives/loading_spinner.js"></script>
<script src="/javascripts/wechat/directives/ellipsis.js"></script>
<script src="/javascripts/wechat/directives/input_focus.js"></script>
<script src="/javascripts/wechat/directives/at_delete_link.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

@ -8,7 +8,7 @@
<div class="post-avatar fl mr10"><img ng-src="{{blog.user.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-dynamic-author hidden fl">
{{blog.user.realname}}
{{blog.user.real_name}}
<img ng-if="blog.user.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="blog.user.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
@ -25,20 +25,20 @@
<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">
<div 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>
<div class="cl"></div>
</div>
<div class="mb50" id="all_blog_reply">
<div class="mb50" id="all_blog_reply" at-delete-link>
<div ng-if="blog.all_children == ''" style="border-top:1px solid #ccc;"></div>
<div class="post-reply-wrap" ng-repeat="journal in blog.all_children">
<div class="post-reply-row" ng-class="['post-reply-row',{'border-bottom-none' : $last}]">
<div class="post-avatar fl mr10"><img ng-src="{{journal.user.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-reply-author hidden fl">
{{journal.user.realname}}
{{journal.user.real_name}}
</div>
<div class="post-reply-time fr f12">{{journal.lasted_comment}}</div>
<div class="cl"></div>
@ -48,7 +48,7 @@
<div ng-click="showMoreReply(1,journal)" ng-show="journal.parents_reply_top.length + journal.parents_reply_bottom.length < journal.parents_count" class="mult-reply-hide"><span class="mult-reply-arrow" >&darr; </span><span class="mult-reply-arrow" style="display:none;" > &uarr;</span>点击展开更多楼层</div>
<div ng-repeat="reply_bottom in journal.parents_reply_bottom" class="ml5 mr5">
<div class="post-reply-author hidden fl ng-binding">
{{reply_bottom.user.realname}}
{{reply_bottom.user.real_name}}
</div>
<div class="post-reply-time fr f12">{{reply_bottom.lasted_comment}}</div>
<div class="cl"></div>
@ -73,7 +73,7 @@
<div class="post-reply-row border-bottom-none">
<div class="post-input-container">
<div class="copy-input-container"><textarea class="copy-input"></textarea></div>
<textarea input-auto type="text" class="post-reply-input" id="postInput1" ng-model="formData.comment" placeholder="输入回复内容~" /></textarea>
<textarea input-auto type="text" class="post-reply-input" id="postInput1" ng-model="formData.comment" placeholder="{{replytip}}" /></textarea>
<button ng-click="addReply(formData)" ng-disabled="formData.disabled" ng-hide="formData.disabled" class="post-reply-submit fr border-radius">提交</button>
<button ng-disabled="formData.disabled" ng-hide="!formData.disabled" class="post-reply-submit bg-grey fr border-radius">提交</button>
<div class="cl"></div>

View File

@ -31,7 +31,7 @@
<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="/images/wechat/{{teacher.gender==0 ? 'male' : 'female'}}.jpg" width="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 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)" />
<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>
@ -39,7 +39,7 @@
</div>
<div ng-show ="course.is_creator" class="class-member-row f13 c-grey3" ng-repeat="reviewer in reviewers|filter:searchText">
<img ng-src="/images/wechat/{{reviewer.gender==0 ? 'male' : 'female'}}.jpg" width="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{reviewer.name}}</span><img ng-src="/images/wechat/{{reviewer.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
<img ng-src="{{reviewer.img_url}}" width="30" height="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{reviewer.name}}</span><img ng-src="/images/wechat/{{reviewer.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
<span ng-click="review(reviewer)" class = "fr mr10 mt5 c-red">待审批 ▶</span>
<div class="cl"></div>
</div>
@ -47,7 +47,7 @@
<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="/images/wechat/{{student.gender==0 ? 'male' : 'female'}}.jpg" width="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 = "course.is_creator" width="15" class="class-list-setting" ng-click="onSetting(student)" />
<div class="cl"></div>
</div>

View File

@ -10,7 +10,7 @@
<li ng-show="course.id" ng-click="goClass(course.id)" ng-repeat="course in syllabus.courses" ng-class="{'border-bottom-none': $last}">
<img src="/images/wechat/dot.png" width="15px" class="class-list-dot" />
<span class="fl ml10 class-list-name hidden">{{course.name}}</span>
<span class="fr c-grey4">&gt;</span>
<span class="fr c-grey4 amount-arrow">&gt;</span>
<span class="students-amount f12 fr mt10 mr5">{{course.member_count}}人</span>
</li>
</ul>
@ -25,7 +25,7 @@
<li ng-show="course.id" ng-click="goClass(course.id)" ng-repeat="course in syllabus.courses" ng-class="{'border-bottom-none': $last}">
<img src="/images/wechat/dot.png" width="15px" class="class-list-dot" />
<span class="fl ml10 class-list-name hidden">{{course.name}}</span>
<span class="fr c-grey4">&gt;</span>
<span class="fr c-grey4 amount-arrow">&gt;</span>
<span class="students-amount f12 fr mt10 mr5">{{course.member_count}}人</span>
</li>
</ul>

View File

@ -5,10 +5,11 @@
<div class="post-container">
<div loading-spinner></div>
<div class="post-wrapper" style="margin-top:0;">
<div ng-show="is_public == 0" class="tac f16 fb c-black" style="padding-top:10px;">私有内容,请谨慎传播</div>
<div class="post-main">
<div class="post-avatar fl mr10"><img ng-src="{{discussion.user.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-dynamic-author hidden fl">
{{discussion.user.realname}}
{{discussion.user.real_name}}
<img ng-if="discussion.user.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="discussion.user.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
@ -23,20 +24,20 @@
<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">
<div 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>
<div class="cl"></div>
</div>
</div>
<div class="mb50" id="all_course_message_reply">
<div class="mb50" id="all_course_message_reply" at-delete-link>
<div ng-if="discussion.all_children == ''" style="border-top:1px solid #ccc;"></div>
<div class="post-reply-wrap" ng-repeat="journal in discussion.all_children">
<div class="post-reply-row">
<div class="post-avatar fl mr10"><img ng-src="{{journal.user.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-reply-author hidden fl">
{{journal.user.realname}}
{{journal.user.real_name}}
</div>
<div class="post-reply-time fr f12">{{journal.lasted_comment}}</div>
<div class="cl"></div>
@ -47,7 +48,7 @@
<div ng-click="showMoreReply(1,journal)" ng-show="journal.parents_reply_top.length + journal.parents_reply_bottom.length < journal.parents_count" class="mult-reply-hide"><span class="mult-reply-arrow" >&darr; </span><span class="mult-reply-arrow" style="display:none;" > &uarr;</span>点击展开更多楼层</div>
<div class="mt10" ng-repeat="reply_bottom in journal.parents_reply_bottom">
<div class="post-reply-author hidden fl ng-binding">
{{reply_bottom.user.realname}}
{{reply_bottom.user.real_name}}
</div>
<div class="post-reply-time fr f12">{{reply_bottom.lasted_comment}}</div>
<div class="cl"></div>

View File

@ -4,10 +4,11 @@
<div ng-if="news.act_type == 'News'">
<div class="post-container">
<div class="post-wrapper" style="margin-top:0;">
<div ng-show="is_public == 0 || is_public == false" class="tac f16 fb c-black" style="padding-top:10px;">私有内容,请谨慎传播</div>
<div class="post-main">
<div class="post-avatar fl mr10"><img ng-src="{{news.author.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-dynamic-author hidden fl">
{{news.author.realname}}
{{news.author.real_name}}
<img ng-if="news.author.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="news.author.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
@ -22,20 +23,20 @@
<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">
<div 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>
<div class="cl"></div>
</div>
</div>
<div class="mb50" id="all_news_reply">
<div class="mb50" id="all_news_reply" at-delete-link>
<div ng-if="news.comments == ''" style="border-top:1px solid #ccc;"></div>
<div class="post-reply-wrap" ng-repeat="comments in news.comments">
<div class="post-reply-row">
<div class="post-avatar fl mr10"><img ng-src="{{comments.author.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-reply-author hidden fl">
{{comments.author.realname}}
{{comments.author.real_name}}
</div>
<div class="post-reply-time fr f12">{{comments.created_on}}</div>
<div class="cl"></div>

View File

@ -2,7 +2,7 @@
<div loading-spinner></div>
<div ng-show="current_edit_member" class="post-container" style="padding-bottom:50px;">
<div class="blue-title">角色变更</div>
<div class="class-detail-row f13 c-grey3"><img ng-src="/images/wechat/{{current_edit_member.user.gender==0 ? 'male' : 'female'}}.jpg" 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"><span class="fl ml10">角色</span></div>
<ul class="class-list f13 c-grey3">
<li><span class="fl ml10 class-list-name hidden">教师</span><span ng-click="selectRole(9)" ng-class="['login-box', 'fr', 'mr10', 'mt12', {'bg-grey':assistant,'checked': teacher}]"></span></li>

View File

@ -2,7 +2,7 @@
<div loading-spinner></div>
<div ng-show="current_edit_member" class="post-container" style="padding-bottom:50px;">
<div class="blue-title">角色变更</div>
<div class="class-detail-row f13 c-grey3"><img ng-src="/images/wechat/{{current_edit_member.user.gender==0 ? 'male' : 'female'}}.jpg" 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="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">
<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>

View File

@ -4,10 +4,11 @@
<div ng-if="homework.act_type == 'HomeworkCommon'">
<div class="post-container">
<div class="post-wrapper" style="margin-top:0;">
<div ng-show="is_public == 0" class="tac f16 fb c-black" style="padding-top:10px;">私有内容,请谨慎传播</div>
<div class="post-main">
<div class="post-avatar fl mr10"><img ng-src="{{homework.author.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-dynamic-author hidden fl">
{{homework.author.realname}}
{{homework.author.real_name}}
<img ng-if="homework.author.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="homework.author.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
@ -27,20 +28,20 @@
<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">
<div 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>
<div class="cl"></div>
</div>
<div class="mb50" id="all_homework_reply">
<div class="mb50" id="all_homework_reply" at-delete-link>
<div ng-if="homework.all_children == ''" style="border-top:1px solid #ccc;"></div>
<div class="post-reply-wrap" ng-repeat="journal in homework.all_children">
<div class="post-reply-row">
<div class="post-avatar fl mr10"><img ng-src="{{journal.user.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-reply-author hidden fl">
{{journal.user.realname}}
{{journal.user.real_name}}
</div>
<div class="post-reply-time fr f12">{{journal.lasted_comment}}</div>
<div class="cl"></div>
@ -51,7 +52,7 @@
<div ng-click="showMoreReply(1,journal)" ng-show="journal.parents_reply_top.length + journal.parents_reply_bottom.length < journal.parents_count" class="mult-reply-hide"><span class="mult-reply-arrow" >&darr; </span><span class="mult-reply-arrow" style="display:none;" > &uarr;</span>点击展开更多楼层</div>
<div class="ml5 mr5 mt10" ng-repeat="reply_bottom in journal.parents_reply_bottom">
<div class="post-reply-author hidden fl ng-binding">
{{reply_bottom.user.realname}}
{{reply_bottom.user.real_name}}
</div>
<div class="post-reply-time fr f12">{{reply_bottom.lasted_comment}}</div>
<div class="cl"></div>
@ -73,7 +74,7 @@
<div class="post-reply-row border-bottom-none">
<div class="post-input-container">
<div class="copy-input-container"><textarea class="copy-input"></textarea></div>
<textarea input-auto type="text" class="post-reply-input" id="postInput1" ng-model="formData.comment" placeholder="输入回复内容~" /></textarea>
<textarea input-auto type="text" class="post-reply-input" id="postInput1" ng-model="formData.comment" placeholder="{{replytip}}" /></textarea>
<button ng-click="addReply(formData)" ng-disabled="formData.disabled" ng-hide="formData.disabled" class="post-reply-submit fr border-radius">提交</button>
<button ng-disabled="formData.disabled" ng-hide="!formData.disabled" class="post-reply-submit bg-grey fr border-radius">提交</button>
<div class="cl"></div>

View File

@ -11,6 +11,8 @@
<p/>
<div class="share-code-instruction"> 1.点击右上角"发送给朋友",邀请同学加入班级<br />
2.长按二维码,通过“识别图中二维码”功能加入班级<br />
3.通过“加入班级”菜单输入邀请码加入班级(长按邀请码可以复制哦~</div>
3.通过“加入班级”菜单输入邀请码加入班级(长按邀请码可以复制哦~<br/>
4.扫码默认以学生身份加入班级
</div>
</div>
</div>

View File

@ -4,11 +4,12 @@
<div ng-if="issue.act_type == 'Issue'">
<div class="post-container">
<div class="post-wrapper" style="margin-top:0;">
<div ng-show="is_public == false" class="tac f16 fb c-black" style="padding-top:10px;">私有内容,请谨慎传播</div>
<div class="post-main">
<div class="post-avatar fl mr10"><img ng-src="{{issue.author.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-dynamic-author hidden fl">
{{issue.author.realname}}
{{issue.author.real_name}}
<img ng-if="issue.author.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="issue.author.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
@ -28,20 +29,20 @@
<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">
<div 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>
<div class="cl"></div>
</div>
</div>
<div class="mb50" id="all_issue_reply">
<div class="mb50" id="all_issue_reply" at-delete-link>
<div ng-if="issue.issue_journals == ''" style="border-top:1px solid #ccc;"></div>
<div class="post-reply-wrap" ng-repeat="journal in issue.issue_journals">
<div class="post-reply-row">
<div class="post-avatar fl mr10"><img ng-src="{{journal.user.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-reply-author hidden fl">
{{journal.user.realname}}
{{journal.user.real_name}}
</div>
<div class="post-reply-time fr f12">{{journal.created_on}}</div>
<div class="cl"></div>

View File

@ -9,6 +9,13 @@
<li><span class="fl ml10 class-list-name hidden">开发人员</span><span ng-click="selectRole(4)" ng-class="['login-box', 'fr', 'mr10', 'mt12','img-circle', {'checked': role_id == 4}]"></span></li>
<li class="border-bottom-none"><span class="fl ml10 class-list-name hidden">报告人员</span><span ng-click="selectRole(5)" ng-class="['login-box', 'fr', 'mr10', 'mt12','img-circle', {'checked': role_id == 5}]"></span></li>
</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>
</ul>
</div>
<div class="bottom-tab-wrap mt10">
<a href="javascript:void(0);" ng-click="cancel()" class="weixin-tab c-grey border-top">取消</a>
<a href="javascript:void(0);" ng-click="join_project()" class="weixin-tab link-blue2 border-top">确定</a>

View File

@ -3,11 +3,12 @@
<div ng-if="message.act_type == 'JournalsForMessage'">
<div class="post-container">
<div class="post-wrapper" style="margin-top:0;">
<div ng-show="is_public == 0 && is_public == false" class="tac f16 fb c-black" style="padding-top:10px;">私有内容,请谨慎传播</div>
<div class="post-main">
<div class="post-avatar fl mr10"><img ng-src="{{message.user.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-dynamic-author hidden fl">
{{message.user.realname}}
{{message.user.real_name}}
<img ng-if="message.user.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="message.user.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
@ -22,21 +23,21 @@
<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">
<div 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>
<div class="cl"></div>
</div>
</div>
<div class="mb50" id="all_message_reply">
<div class="mb50" id="all_message_reply" at-delete-link>
<div ng-if="message.child_reply == ''" style="border-top:1px solid #ccc;"></div>
<div class="post-reply-wrap" ng-repeat="journal in message.all_children">
<div class="post-reply-row">
<div class="post-avatar fl mr10"><img ng-src="{{journal.user.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-reply-author hidden fl">
{{journal.user.realname}}
{{journal.user.real_name}}
</div>
<div class="post-reply-time fr f12">{{journal.lasted_comment}}</div>
<div class="cl"></div>
@ -46,7 +47,7 @@
<div ng-click="showMoreReply(1,journal)" ng-show="journal.parents_reply_top.length + journal.parents_reply_bottom.length < journal.parents_count" class="mult-reply-hide"><span class="mult-reply-arrow" >&darr; </span><span class="mult-reply-arrow" style="display:none;" > &uarr;</span>点击展开更多楼层</div>
<div class="mt10 ml5 mr5" ng-repeat="reply_bottom in journal.parents_reply_bottom">
<div class="post-reply-author hidden fl ng-binding">
{{reply_bottom.user.realname}}
{{reply_bottom.user.real_name}}
</div>
<div class="post-reply-time fr f12">{{reply_bottom.lasted_comment}}</div>
<div class="cl"></div>

View File

@ -17,7 +17,7 @@
</div>
<div class="login-wrap mt5"><a href="javascript:void(0);" ng-class="['btn1', 'bg-blue', 'f18', {'btn-disabled':!loginFrm.$valid} ]" ng-click="login(loginFrm, user)">确定绑定</a></div>
<div class="forget-psw-wrap"><a href="javascript:void(0);" class="f12 forget-psw" ng-click="showBox()">忘记密码?</a></div>
<div class="forget-psw-wrap"><a href="javascript:void(0);" class="f12 c-grey5" ng-click="showBox()">忘记密码?</a></div>
<my-alert message="findPwdDialog.message" title="findPwdDialog.title" visible="findPwdDialog.visible"></my-alert>
</form>
</div>

View File

@ -0,0 +1,13 @@
<div class="post-container">
<div loading-spinner></div>
<div class="blue-title">提示</div>
<div class="ac-wrap">
<ul class="ac-content f13 c-grey3">
<li class="mt30 mb15"><span class="project-intro-dot"></span>您的回复内容已提交</li>
<li class="mb15"><span class="project-intro-dot"></span>想要实时接收动态、加入社区?<br/>长按二维码,关注公众号</li>
<li class="mb20" style="text-align:center;"><img src="/images/wechat/trustie_QR.jpg" width="150" class="inline-block" /></li>
</ul>
</div>
</div>

View File

@ -15,8 +15,7 @@
<div dataID = "{{act.act_id}}" ng-click="goDetail('issues',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-dynamic-author hidden fl">
<span ng-if="act.author.realname != ' '">{{act.author.realname}}</span>
<span ng-if="act.author.realname == ' '">{{act.author.nickname}}</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/female.png" width="14" class="ml5" />
</div>
@ -54,8 +53,7 @@
<div dataID = "{{act.act_id}}" ng-click="goDetail('project_discussion',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-dynamic-author hidden fl">
<span ng-if="act.author.realname != ' '">{{act.author.realname}}</span>
<span ng-if="act.author.realname == ' '">{{act.author.nickname}}</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/female.png" width="14" class="ml5" />
</div>
@ -88,7 +86,7 @@
<div class="post-wrapper">
<div class="post-main">
<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-title hidden mb5"><span class="c-grey3 f13 fb mr10">{{act.author.realname}}</span>创建了<span class="c-grey3 f13 fb ml10">{{act.course_project_name}} | 项目</span></div>
<div class="post-title hidden mb5"><span class="c-grey3 f13 fb mr10">{{act.author.real_name}}</span>创建了<span class="c-grey3 f13 fb ml10">{{act.course_project_name}} | 项目</span></div>
<div class="post-title hidden"><span class="mr10">{{act.latest_update}}</span></div>
<div class="cl"></div>
</div>
@ -110,30 +108,30 @@
</div>
<div class="member-banner f13 c-grey3">管理人员({{project_master_members.length}})</div>
<div class="class-member-row f13 c-grey3" ng-repeat="master in project_master_members|filter:searchText">
<img ng-src="/images/wechat/{{master.user.gender==0 ? 'male' : 'female'}}.jpg" width="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{master.user.real_name == "" ? master.user.name : master.user.real_name }}</span><img ng-src="/images/wechat/{{master.user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
<img ng-src="{{master.user.img_url}}" width="30" height="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{master.user.real_name == "" ? master.user.name : master.user.real_name }}</span><img ng-src="/images/wechat/{{master.user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
<img src="/images/wechat/setting.png" ng-show = "master.user.id != project.user_id && project.can_setting" width="15" class="class-list-setting" ng-click="onSetting(master)" />
<div class="cl"></div>
</div>
<div ng-show="project.can_setting" class="class-member-row f13 c-grey3" ng-repeat="user in review_master_members|filter:searchText">
<img ng-src="/images/wechat/{{user.gender==0 ? 'male' : 'female'}}.jpg" width="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{user.real_name == "" ? user.name : user.real_name }}</span><span class="fr mr10 c-grey2"></span><img ng-src="/images/wechat/{{user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
<img ng-src="{{user.img_url}}" width="30" height="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{user.real_name == "" ? user.name : user.real_name }}</span><span class="fr mr10 c-grey2"></span><img ng-src="/images/wechat/{{user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
<span ng-click="review(user)" class = "fr mr10 mt5 c-red">待审批 ▶</span>
<div class="cl"></div>
</div>
<div class="member-banner f13 mt10 c-grey3">开发人员({{project_develop_members.length}})</div>
<div class="class-member-row f13 c-grey3" ng-repeat="develop in project_develop_members|filter:searchText">
<img ng-src="/images/wechat/{{develop.user.gender==0 ? 'male' : 'female'}}.jpg" width="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{develop.user.real_name == "" ? develop.user.name : develop.user.real_name}}</span><img ng-src="/images/wechat/{{develop.user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
<img ng-src="{{develop.user.img_url}}" width="30" height="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{develop.user.real_name == "" ? develop.user.name : develop.user.real_name}}</span><img ng-src="/images/wechat/{{develop.user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
<img src="/images/wechat/setting.png" ng-show = "master.user.id != project.user_id && project.can_setting " width="15" class="class-list-setting" ng-click="onSetting(develop)" />
<div class="cl"></div>
</div>
<div ng-show="project.can_setting" class="class-member-row f13 c-grey3" ng-repeat="user in review_develop_members|filter:searchText">
<img ng-src="/images/wechat/{{user.gender==0 ? 'male' : 'female'}}.jpg" width="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{user.real_name == "" ? user.name : user.real_name}}</span><img ng-src="/images/wechat/{{user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
<img ng-src="{{user.img_url}}" width="30" height="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{user.real_name == "" ? user.name : user.real_name}}</span><img ng-src="/images/wechat/{{user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
<span ng-click="review(user)" class = "fr mr10 mt5 c-red">待审批 ▶</span>
<div class="cl"></div>
</div>
<div class="member-banner f13 mt10 c-grey3">报告人员({{project_report_members.length}})</div>
<div class="class-member-row f13 c-grey3" ng-repeat="report in project_report_members|filter:searchText">
<img ng-src="/images/wechat/{{report.user.gender==0 ? 'male' : 'female'}}.jpg" width="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{report.user.real_name == "" ? report.user.name : report.user.real_name}}</span><img ng-src="/images/wechat/{{report.user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
<img ng-src="{{report.user.img_url}}" width="30" height="30" class="fl ml10 img-circle" /><span class="fl ml10 mt5">{{report.user.real_name == "" ? report.user.name : report.user.real_name}}</span><img ng-src="/images/wechat/{{report.user.gender==0 ? 'male' : 'female'}}.png" width="15" class="fl ml10 mt5" />
<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>

View File

@ -4,10 +4,11 @@
<div ng-if="discussion.act_type == 'Message'">
<div class="post-container">
<div class="post-wrapper" style="margin-top:0;">
<div ng-show="is_public == false" class="tac f16 fb c-black" style="padding-top:10px;">私有内容,请谨慎传播</div>
<div class="post-main">
<div class="post-avatar fl mr10"><img ng-src="{{discussion.user.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-dynamic-author hidden fl">
{{discussion.user.realname}}
{{discussion.user.real_name}}
<img ng-if="discussion.user.gender == '0'" src="images/wechat/male.png" width="14" class="ml5" />
<img ng-if="discussion.user.gender != '0'" src="images/wechat/female.png" width="14" class="ml5" />
</div>
@ -23,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">
<div 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>
@ -31,13 +32,13 @@
</div>
</div>
<div class="mb50" id="all_course_message_reply">
<div class="mb50" id="all_course_message_reply" at-delete-link>
<div ng-if="discussion.all_children == ''" style="border-top:1px solid #ccc;"></div>
<div class="post-reply-wrap" ng-repeat="journal in discussion.all_children">
<div class="post-reply-row">
<div class="post-avatar fl mr10"><img ng-src="{{journal.user.img_url}}" width="30" height="30" class="border-radius img-circle" /></div>
<div class="post-reply-author hidden fl">
{{journal.user.realname}}
{{journal.user.real_name}}
</div>
<div class="post-reply-time fr f12">{{journal.lasted_comment}}</div>
<div class="cl"></div>
@ -47,7 +48,7 @@
<div ng-click="showMoreReply(1,journal)" ng-show="journal.parents_reply_top.length + journal.parents_reply_bottom.length < journal.parents_count" class="mult-reply-hide"><span class="mult-reply-arrow" >&darr; </span><span class="mult-reply-arrow" style="display:none;" > &uarr;</span>点击展开更多楼层</div>
<div class="mt10 ml5 mr5" ng-repeat="reply_bottom in journal.parents_reply_bottom">
<div class="post-reply-author hidden fl ng-binding">
{{reply_bottom.user.realname}}
{{reply_bottom.user.real_name}}
</div>
<div class="post-reply-time fr f12">{{reply_bottom.lasted_comment}}</div>
<div class="cl"></div>

View File

@ -11,6 +11,8 @@
<p/>
<div class="share-code-instruction"> 1.点击右上角"发送给朋友",邀请朋友加入项目<br />
2.长按二维码,通过“识别图中二维码”功能加入项目<br />
3.通过“加入项目”菜单输入邀请码加入项目(长按邀请码可以复制哦~</div>
3.通过“加入项目”菜单输入邀请码加入项目(长按邀请码可以复制哦~<br/>
4.扫码默认以报告人员身份加入项目
</div>
</div>
</div>

View File

@ -7,7 +7,7 @@
<div ng-repeat="project in projects" style="position:relative;">
<div ng-click="goProject(project.id)" ng-show="project.is_creator" class="course-list-row f13 c-grey3 border-top-none">
<span class="fl ml15 class-list-name hidden">{{project.name}}</span>
<span class="fr c-grey4 mr10">&gt;</span>
<span class="fr c-grey4 mr10 amount-arrow">&gt;</span>
<span class="students-amount f12 fr mt10 mr5">{{project.member_count}}人</span>
</div>
@ -20,7 +20,7 @@
<div ng-click="goProject(project.id)" ng-repeat="project in projects" style="position:relative;">
<div ng-show="!project.is_creator" class="course-list-row f13 c-grey3 border-top-none">
<span class="fl ml15 class-list-name hidden">{{project.name}}</span>
<span class="fr c-grey4 mr10">&gt;</span>
<span class="fr c-grey4 mr10 amount-arrow">&gt;</span>
<span class="students-amount f12 fr mt10 mr5">{{project.member_count}}人</span>
</div>

View File

@ -27,9 +27,10 @@
</div>
</div>
<div class="input-box-wrap login-wrap mb20">
<input class="input-box" required ng-model="user.username" name="username" placeholder="输入用户登录名"/>
<input class="input-box" required ng-model="user.username" name="username" placeholder="输入登录名(英文字母、数字和下划线)" unconfirm/>
<div ng-show="regFrm.$submitted || regFrm.username.$touched">
<span class="f12 c-red fl" ng-show="regFrm.username.$error.required">用户名不能为空</span>
<span class="f12 c-red fl" ng-show="regFrm.username.$error.required">登录名不能为空</span>
<span class="f12 c-red fl" ng-show="regFrm.username.$error.unconfirm">不能以下划线开头不能包括中文长度不超过25个字符</span>
</div>
</div>

View File

@ -3,7 +3,7 @@
<div ng-show="current_course && current_review_member " class="post-container" style="padding-bottom:50px;">
<div ng-show="status==0">
<div class="blue-title">{{current_course.name}}</div>
<div class="class-detail-row f13 c-grey3"><img ng-src="/images/wechat/{{current_review_member.gender==0 ? 'male' : 'female'}}.jpg" 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>
<ul class="class-list f13 c-grey3">
<li><span class="fl ml10 class-list-name hidden">教师</span><span ng-class="['login-box', 'fr', 'mr10', 'mt12', {'bg-grey':current_review_member.roles_id == 7,'checked': current_review_member.roles_id == 9}]"></span></li>

View File

@ -3,7 +3,7 @@
<div ng-show="current_project && current_review_member" class="post-container" style="padding-bottom:50px;">
<div ng-show="status==1">
<div class="blue-title">{{current_project.name}}</div>
<div class="class-detail-row f13 c-grey3"><img ng-src="/images/wechat/{{current_review_member.gender==0 ? 'male' : 'female'}}.jpg" 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>
<ul class="class-list f13 c-grey3">
<li><span class="fl ml10 class-list-name hidden">管理人员</span><span ng-class="['login-box', 'fr', 'mr10', 'mt12','img-circle',{'bg-grey':current_review_member.roles_id == 4,'checked': current_review_member.roles_id == 3}]"></span></li>

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -38,7 +38,6 @@ function edit_user_introduction(url){
function show_more_course(url){
$.get(
url,
{ page: $("#course_page_num").val() },
function (data) {
}
);
@ -48,7 +47,6 @@ function show_more_course(url){
function show_more_project(url){
$.get(
url,
{ page: $("#project_page_num").val() },
function (data) {
}

View File

@ -607,11 +607,11 @@ function regexTopicDescription()
$("#message_content_span").css('color','#ff0000');
return false;
}
else if(name.length >=6000){
$("#message_content_span").text("描述最多3000个汉字(或6000个英文字符)");
$("#message_content_span").css('color','#ff0000');
return false;
}
// else if(name.length >=6000){
// $("#message_content_span").text("描述最多3000个汉字(或6000个英文字符)");
// $("#message_content_span").css('color','#ff0000');
// return false;
// }
else
{
$("#message_content_span").text("填写正确");
@ -621,11 +621,11 @@ function regexTopicDescription()
}
function submit_topic_project()
{
// if(regexTopicSubject() && regexTopicDescription())
// {
if(regexTopicSubject() && regexTopicDescription())
{
message_content_editor.sync();
$("#message-form-project").submit();
// }
}
}
function reset_topic(){

View File

@ -2,7 +2,6 @@
function show_more_course(url){
$.get(
url,
{ page: $("#course_page_num").val() },
function (data) {
}
);

View File

@ -2,6 +2,10 @@
app.controller('ActivityController',
['$anchorScroll', '$location','$scope', '$http', '$timeout', 'auth', 'rms', 'common','alertService',
function($anchorScroll, $location,$scope, $http, $timeout, auth, rms, common, alertService){
// common.checkLogin();
$scope.replaceUrl = function(url){
return url;
};
@ -142,7 +146,7 @@ app.controller('ActivityController',
rms.save("activities",$scope.activities);
rms.save("course_activities",$scope.course_activities);
rms.save("project_activities",$scope.project_activities);
$location.path('/'+type+'/'+act_id);
$location.path("/"+type).search({id: act_id});
};
$scope.addPraise = function(act){

View File

@ -7,6 +7,7 @@ app.controller('BlogController',
scope: $scope,
type: 'blog_comments',
replyType: 'BlogComment',
urlName: 'blog_comment',
loadCallback: function(data){
console.log(data.data);

View File

@ -1,181 +1,185 @@
app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location','$routeParams','alertService','rms', function($scope, config, $http, auth, $location, $routeParams,alertService,rms){
var vm = $scope;
var courseid = $routeParams.id;
var tag = $routeParams.tag;
var getUsers = function(){
if(vm.teachers.length<=0){
$http.get(config.apiUrl + 'courses/teachers?token='+auth.token()+'&course_id='+courseid).then(
function(response) {
console.log(response.data);
vm.teachers = response.data.data;
}
)
}
if(vm.course.is_creator){
if(vm.reviewers.length<=0){
$http.get(config.apiUrl + 'courses/reviewers?token='+auth.token()+'&course_id='+courseid).then(
function(response) {
console.log(response.data);
vm.reviewers = response.data.data;
}
)
}
}
if(vm.students.length<=0){
$http.get(config.apiUrl + 'courses/students?token='+auth.token()+'&course_id='+courseid).then(
function(response) {
console.log(response.data);
vm.students = response.data.data;
}
)
}
}
var getResources = function(){
if(vm.resources.length<=0){
$http.post(config.apiUrl + "courses/"+courseid+"/attachments",
{token: auth.token(), name: ''}
).then(function(response){
vm.resources = response.data.data;
vm.resources_tag = true;
});
}
}
var getHomeworks = function(){
if(vm.homeworks.length <=0){
$http.get(config.apiUrl + "courses/homeworks/"+courseid+"?token="+auth.token()).then(function(response){
vm.homeworks = response.data.data;
console.log(response.data);
vm.homeworks_tag = true;
});
}
}
var getExercises = function(){
if(vm.exercises.length <=0){
$http.get(config.apiUrl + "courses/"+courseid+"/exercises?token="+auth.token()).then(function(response){
vm.exercises = response.data.data;
console.log(response.data);
vm.exercises_tag = true;
});
}
}
vm.isTeacher = false;
vm.currentTab = 1;
vm.tab = function(index){
vm.currentTab = index;
vm.searchText = '';
vm.showClassMate = false;
vm.showResources = false;
vm.showHomework = false;
vm.showTestcase = false;
vm.resources_tag = false;
vm.homeworks_tag = false;
vm.exercises_tag = false;
if(vm.isTeacher){
if(index == 1){ //课件
getResources();
vm.showResources = true;
} else if(index==2){ //作业
getHomeworks();
vm.showHomework = true;
} else if(index==3){ //小测验
getExercises();
vm.showTestcase = true;
} else if(index==4){ //学生管理
getUsers();
vm.showClassMate = true;
}
} else {
if(index == 2){
getUsers();
vm.showClassMate = true;
} else if(index==1){
getResources();
vm.showResources = true;
}
}
}
vm.course = {};
vm.students = [];
vm.teachers = [];
vm.reviewers = []; //待审批
vm.resources = [];
vm.homeworks = [];
vm.exercises = [];
//发送类别 1课件 2作业 3测验
vm.myresource_sendIndex = rms.get('myresource_sendIndex') || 1;
vm.alertService = alertService.create();
vm.invite = function(){
$location.path("/invite_code").search({id: courseid});
};
vm.sendFile = function(r,index){
vm.myresource_sendIndex = index;
rms.save('myresource_sendIndex',index);
$location.path("/send_class_list").search({id: r.id});
}
$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;
resetMenu(vm.course.current_user_is_teacher);
if(tag){
vm.tab(4);
tag = null;
}
else{
vm.tab(1);
}
}
else{
vm.alertService.showMessage('提示', response.data.message);
}
}
);
var resetMenu = function(is_teacher){
vm.isTeacher = is_teacher;
if(is_teacher){
vm.menus = ["课件", "作业", "测验", "成员管理"];
} else {
vm.menus = ['课件', "我的同学"];
}
}
vm.onSetting = function(user){
rms.save('current_edit_member', user);
$location.path("/edit_class_member").search({id: courseid,user_id: user.id});
};
vm.review = function(user){
rms.save('current_review_member', user);
rms.save('current_course', vm.course);
$location.path("/review_class_member").search({id: courseid,user_id: user.id});
}
app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location','$routeParams','alertService','rms','common', function($scope, config, $http, auth, $location, $routeParams,alertService,rms,common){
// common.checkLogin();
var vm = $scope;
var courseid = $routeParams.id;
var tag = $routeParams.tag;
var getUsers = function(){
if(vm.teachers.length<=0){
$http.get(config.apiUrl + 'courses/teachers?token='+auth.token()+'&course_id='+courseid).then(
function(response) {
console.log(response.data);
vm.teachers = response.data.data;
}
)
}
if(vm.course.is_creator){
if(vm.reviewers.length<=0){
$http.get(config.apiUrl + 'courses/reviewers?token='+auth.token()+'&course_id='+courseid).then(
function(response) {
console.log(response.data);
vm.reviewers = response.data.data;
}
)
}
}
if(vm.students.length<=0){
$http.get(config.apiUrl + 'courses/students?token='+auth.token()+'&course_id='+courseid).then(
function(response) {
console.log(response.data);
vm.students = response.data.data;
}
)
}
}
var getResources = function(){
if(vm.resources.length<=0){
$http.post(config.apiUrl + "courses/"+courseid+"/attachments",
{token: auth.token(), name: ''}
).then(function(response){
vm.resources = response.data.data;
vm.resources_tag = true;
});
}
}
var getHomeworks = function(){
if(vm.homeworks.length <=0){
$http.get(config.apiUrl + "courses/homeworks/"+courseid+"?token="+auth.token()).then(function(response){
vm.homeworks = response.data.data;
console.log(response.data);
vm.homeworks_tag = true;
});
}
}
var getExercises = function(){
if(vm.exercises.length <=0){
$http.get(config.apiUrl + "courses/"+courseid+"/exercises?token="+auth.token()).then(function(response){
vm.exercises = response.data.data;
console.log(response.data);
vm.exercises_tag = true;
});
}
}
vm.isTeacher = false;
vm.currentTab = 1;
vm.tab = function(index){
vm.currentTab = index;
vm.searchText = '';
vm.showClassMate = false;
vm.showResources = false;
vm.showHomework = false;
vm.showTestcase = false;
vm.resources_tag = false;
vm.homeworks_tag = false;
vm.exercises_tag = false;
if(vm.isTeacher){
if(index == 1){ //课件
getResources();
vm.showResources = true;
} else if(index==2){ //作业
getHomeworks();
vm.showHomework = true;
} else if(index==3){ //小测验
getExercises();
vm.showTestcase = true;
} else if(index==4){ //学生管理
getUsers();
vm.showClassMate = true;
}
} else {
if(index == 2){
getUsers();
vm.showClassMate = true;
} else if(index==1){
getResources();
vm.showResources = true;
}
}
rms.save("tab_num",index);
}
vm.tabRecord = rms.get('tab_num') || 1;
vm.course = {};
vm.students = [];
vm.teachers = [];
vm.reviewers = []; //待审批
vm.resources = [];
vm.homeworks = [];
vm.exercises = [];
//发送类别 1课件 2作业 3测验
vm.myresource_sendIndex = rms.get('myresource_sendIndex') || 1;
vm.alertService = alertService.create();
vm.invite = function(){
$location.path("/invite_code").search({id: courseid});
};
vm.sendFile = function(r,index){
vm.myresource_sendIndex = index;
rms.save('myresource_sendIndex',index);
$location.path("/send_class_list").search({id: r.id});
}
$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;
resetMenu(vm.course.current_user_is_teacher,vm.tabRecord);
if(tag){
vm.tab(4);
tag = null;
}
else{
vm.tab(vm.tabRecord);
}
}
else{
vm.alertService.showMessage('提示', response.data.message);
}
}
);
var resetMenu = function(is_teacher){
vm.isTeacher = is_teacher;
if(is_teacher){
vm.menus = ["课件", "作业", "测验", "成员管理"];
} else {
vm.menus = ['课件', "我的同学"];
}
}
vm.onSetting = function(user){
rms.save('current_edit_member', user);
$location.path("/edit_class_member").search({id: courseid,user_id: user.id});
};
vm.review = function(user){
rms.save('current_review_member', user);
rms.save('current_course', vm.course);
$location.path("/review_class_member").search({id: courseid,user_id: user.id});
}
}]);

View File

@ -3,8 +3,10 @@
*/
app.controller('ClassListController', ['$scope', 'config', 'auth', '$http', '$location', 'alertService','rms',
function ($scope, config, auth, $http, $location, alertService,rms) {
app.controller('ClassListController', ['$scope', 'config', 'auth', '$http', '$location', 'alertService','rms','common',
function ($scope, config, auth, $http, $location, alertService,rms,common) {
// common.checkLogin();
var vm = $scope;
vm.syllabuses = rms.get('syllabuses') || [];

View File

@ -6,8 +6,10 @@ app.controller('CourseNoticeController', ['$scope', '$http', '$routeParams', 'au
scope: $scope,
type: 'newss',
replyType: 'News',
urlName: 'course_notice',
loadCallback: function(data){
$scope.news = data.data;
$scope.is_public = data.is_public;
},
replyCallback: function(){
}

View File

@ -5,6 +5,7 @@ app.controller('DiscussionController', ['$scope', '$http', '$routeParams', 'auth
scope: $scope,
type: 'messages',
replyType: 'Message',
urlName: 'discussion',
loadCallback: function(data){
console.log(data.data);
@ -16,6 +17,7 @@ app.controller('DiscussionController', ['$scope', '$http', '$routeParams', 'auth
if (page == 0){
$scope.discussion = data.data;
$scope.page = 0;
$scope.is_public = data.is_public;
}
else{
$scope.discussion.all_children = $scope.discussion.all_children.concat(data.data.all_children);

View File

@ -1,6 +1,8 @@
app.controller('EditClassController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms', function($scope, $http, auth, config, alertService, $location,$routeParams, rms){
app.controller('EditClassController', ['$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.syllabus = rms.get('current_edit_syllobus');

View File

@ -1,6 +1,8 @@
app.controller('EditClassMemberController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms', function($scope, $http, auth, config, alertService, $location,$routeParams, rms){
app.controller('EditClassMemberController', ['$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_edit_member = rms.get('current_edit_member');

Some files were not shown because too many files have changed in this diff Show More