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

This commit is contained in:
huang 2016-08-14 11:30:54 +08:00
commit ea3ba1f71e
96 changed files with 1245 additions and 535 deletions

View File

@ -50,16 +50,16 @@ gem 'elasticsearch-model'
gem 'elasticsearch-rails'
#rails 3.2.22.2 bug
gem "test-unit", "~>3.0"
# gem "test-unit", "~>3.0"
### profile
gem 'oneapm_rpm'
# gem 'oneapm_rpm'
group :development do
gem 'grape-swagger'
gem 'better_errors', '~> 1.1.0'
# gem "query_reviewer"
gem 'rack-mini-profiler', '~> 0.9.3'
# gem 'rack-mini-profiler', '~> 0.9.3'
if RUBY_PLATFORM =~ /w32/
gem 'win32console'
end

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,187 @@ 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?
refreshinfo = Wechat.api.web_refresh_access_token(refresh_token)
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})
user.update_attributes(:lastname=>name)
raise user.errors.full_messages.first if user.new_record?
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 +215,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.login+"("+user.show_name+")", Time.now.strftime("%Y-%m-%d"))
present status: 0, message: '您已成功绑定Trustie平台'
end
@ -53,22 +58,29 @@ 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 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.login+"("+user.show_name+")", 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

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

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

@ -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.login+"("+user.show_name+")", format_time(Time.now))
render :json => {status:0, msg: "绑定成功"}
rescue Exception=>e
render :json => {status: -1, msg: e.message}
@ -399,9 +416,9 @@ class WechatsController < ActionController::Base
render 'wechats/open_wechat', layout: nil and return
end
unless user_binded?(open_id)
@path = '/login'
else
# unless user_binded?(open_id)
# @path = '/login'
# else
if params[:state] == 'myclass'
@course_id = params[:id];
elsif params[:state] == 'myproject'
@ -410,9 +427,16 @@ 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
# end
render 'wechats/user_activities', layout: nil
end
@ -421,10 +445,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 +470,7 @@ class WechatsController < ActionController::Base
def user_binded?(openid)
uw = UserWechat.where(openid: openid).first
uw && uw.bindtype == 0
end
def current_url

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,26 @@
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)
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

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

@ -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,4 +1,5 @@
app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location','$routeParams','alertService','rms', function($scope, config, $http, auth, $location, $routeParams,alertService,rms){
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;
@ -106,8 +107,11 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
vm.showResources = true;
}
}
rms.save("tab_num",index);
}
vm.tabRecord = rms.get('tab_num') || 1;
vm.course = {};
vm.students = [];
vm.teachers = [];
@ -137,13 +141,13 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
if (response.data.status == 0){
vm.course = response.data.data;
resetMenu(vm.course.current_user_is_teacher);
resetMenu(vm.course.current_user_is_teacher,vm.tabRecord);
if(tag){
vm.tab(4);
tag = null;
}
else{
vm.tab(1);
vm.tab(vm.tabRecord);
}
}
else{

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

View File

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

View File

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

View File

@ -13,9 +13,12 @@ app.controller('InviteCodeController', ['$scope','$http', '$routeParams','config
console.log(response.data);
vm.course = response.data.data;
var desc = "班级邀请:"+vm.course.name+" 班级";
var desc = "您的好友邀请您加入班级:\n"+vm.course.name+"\n和小伙伴一起踏上便捷的学习之旅吧";
var link = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+window.g_appid+
"&redirect_uri="+window.g_localhost+"/wechat/user_activities?id="+vm.course.id+
"&response_type=code&scope=snsapi_base&state=invite_code&connect_redirect=1#wechat_redirect";
common.wxConfig("",desc,"");
common.wxConfig("",desc,"",link);
// wx.ready(function(){
// wx.onMenuShareTimeline({

View File

@ -5,9 +5,11 @@ app.controller('IssueController', ['$scope', '$http', '$routeParams', 'auth', 'c
scope: $scope,
type: 'issues',
replyType: 'Issue',
urlName: 'issues',
loadCallback: function(data){
console.log(data);
$scope.issue = data.data;
$scope.is_public = data.is_public;
},
replyCallback: function(){
}

View File

@ -1,6 +1,8 @@
app.controller('JoinClassController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms','wx', function($scope, $http, auth, config, alertService, $location,$routeParams, rms,wx){
app.controller('JoinClassController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms','wx','common', function($scope, $http, auth, config, alertService, $location,$routeParams, rms,wx,common){
common.checkLogin();
var vm = $scope;
// vm.current_edit_member = rms.get('current_edit_member');

View File

@ -1,6 +1,8 @@
app.controller('JoinProjectController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms','wx', function($scope, $http, auth, config, alertService, $location,$routeParams, rms,wx){
app.controller('JoinProjectController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms','wx','common', function($scope, $http, auth, config, alertService, $location,$routeParams, rms,wx,common){
common.checkLogin();
var vm = $scope;
// vm.current_edit_member = rms.get('current_edit_member');

View File

@ -4,6 +4,7 @@ app.controller('JournalsController', ['$scope', '$http', '$routeParams', 'auth',
scope: $scope,
type: 'journal_for_messages',
replyType: 'JournalsForMessage',
urlName: 'journal_for_message',
loadCallback: function(data){
console.log(data.data);
@ -15,6 +16,7 @@ app.controller('JournalsController', ['$scope', '$http', '$routeParams', 'auth',
if (page == 0){
$scope.message = data.data;
$scope.page = 0;
$scope.is_public = data.is_public;
}
else{
$scope.message.all_children = $scope.message.all_children.concat(data.data.all_children);

View File

@ -1,6 +1,8 @@
app.controller('LoginController', ['$scope', '$http', '$location', '$routeParams', 'alertService', 'config','auth','session','wx',
function ($scope, $http, $location, $routeParams, alertService, config, auth,session, wx) {
var tag = $routeParams.tag;
// 登录页不用显示菜音
wx.ready(function(){
wx.hideOptionMenu();
@ -39,7 +41,13 @@ app.controller('LoginController', ['$scope', '$http', '$location', '$routeParams
vm.loginFailed = (response.data.status != 0);
if (!$scope.loginFailed) { //绑定成功
vm.alertService.showMessage('提示', response.data.message, function(){
wx.closeWindow();
if(tag){
window.history.back();
tag = null;
}
else{
wx.closeWindow();
}
});
} else {
vm.alertService.showMessage('出错了', response.data.message);

View File

@ -0,0 +1,7 @@
app.controller('LoginTipController', ['$scope', '$http', '$location', 'alertService','$location',
function ($scope, $http, $location, alertService, $location) {
$scope.bindWx = function(){
$location.path("/login").search({tag:1});
};
}]);

View File

@ -1,4 +1,6 @@
app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$location', 'rms', function($scope, $http, auth, config, $location,rms){
app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$location', 'rms','common', function($scope, $http, auth, config, $location,rms,common){
common.checkLogin();
var vm = $scope;
// vm.menus = ['课件', '作业', '测验'];
vm.menus = ['课件', '作业'];

View File

@ -1,6 +1,8 @@
app.controller('NewClassController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','rms', function($scope, $http, auth, config, alertService, $location,rms){
app.controller('NewClassController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','rms','common', function($scope, $http, auth, config, alertService, $location,rms,common){
common.checkLogin();
var vm = $scope;
vm.alertService = alertService.create();

View File

@ -1,6 +1,8 @@
app.controller('NewProjectController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','rms', function($scope, $http, auth, config, alertService, $location,rms){
app.controller('NewProjectController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','rms','common', function($scope, $http, auth, config, alertService, $location,rms,common){
common.checkLogin();
var vm = $scope;
vm.alertService = alertService.create();

View File

@ -1,4 +1,6 @@
app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'auth','$location','$routeParams','alertService','rms','common', function($scope, config, $http,$timeout, auth, $location, $routeParams,alertService,rms,common){
common.checkLogin();
$scope.replaceUrl = function(url){
return url;
};
@ -115,7 +117,8 @@ app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'aut
rms.save("project_activities",vm.project_activities);
rms.save('project_has_more', vm.project_has_more);
rms.save("project",vm.project);
$location.path('/'+type+'/'+act_id);
// $location.path('/'+type+'/'+act_id);
$location.path("/"+type).search({id: act_id});
};
//切换 按钮

View File

@ -13,9 +13,12 @@ app.controller('ProjectInviteCodeController', ['$scope','$http', '$routeParams',
console.log(response.data);
vm.project = response.data.data;
var desc = "项目邀请:"+vm.project.name+" 项目";
var desc = "您的好友邀请您加入项目:\n"+vm.project.name+"\n和小伙伴一起踏上便捷的研发之旅吧";
var link = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+window.g_appid+
"&redirect_uri="+window.g_localhost+"/wechat/user_activities?id="+vm.project.id+
"&response_type=code&scope=snsapi_base&state=project_invite_code&connect_redirect=1#wechat_redirect";
common.wxConfig("",desc,"");
common.wxConfig("",desc,"",link);
// wx.ready(function(){
// wx.onMenuShareTimeline({

View File

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

View File

@ -1,5 +1,5 @@
app.controller('RegController', ['$scope', '$http', '$location', 'alertService','$location',
function ($scope, $http, $location, alertService, $location) {
app.controller('RegController', ['$scope', '$http', '$location', 'alertService','$location','wx',
function ($scope, $http, $location, alertService, $location,wx) {
var vm = $scope;
vm.errDialog = alertService.create();
@ -35,7 +35,8 @@ app.controller('RegController', ['$scope', '$http', '$location', 'alertService',
} else {
vm.successDialog.showMessage("提示","注册且绑定微信成功", function(){
// $location.path("/activities");
window.WeixinJSBridge.call('closeWindow');
// window.WeixinJSBridge.call('closeWindow');
wx.closeWindow();
});
}
}, function (response) {

View File

@ -1,6 +1,8 @@
app.controller('ReviewClassMemberController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms', function($scope, $http, auth, config, alertService, $location,$routeParams, rms){
app.controller('ReviewClassMemberController', ['$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');
@ -78,6 +80,11 @@ app.controller('ReviewClassMemberController', ['$scope', '$http', 'auth', 'confi
};
vm.goClassMemberList = function(){
$location.path("/class").search({id: course_id,tag: 1});
if(vm.current_course.is_member){
$location.path("/class").search({id: course_id,tag: 1});
}
else{
$location.path("/class_list");
}
};
}] );

View File

@ -1,6 +1,8 @@
app.controller('ReviewProjectMemberController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms', function($scope, $http, auth, config, alertService, $location,$routeParams, rms){
app.controller('ReviewProjectMemberController', ['$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');
@ -90,6 +92,11 @@ app.controller('ReviewProjectMemberController', ['$scope', '$http', 'auth', 'con
rms.save("review_master_members",[]);
rms.save("review_develop_members",[]);
rms.save("tab_num",null);
$location.path("/project").search({id: project_id,tag: 1});
if(vm.current_project.is_member){
$location.path("/project").search({id: project_id,tag: 1});
}
else{
$location.path("/project_list")
}
};
}] );

View File

@ -1,4 +1,6 @@
app.controller('SendClassListController', ['$scope', '$http','$routeParams', 'config','auth','alertService', 'rms', function($scope, $http, $routeParams, config, auth, alertService,rms){
app.controller('SendClassListController', ['$scope', '$http','$routeParams', 'config','auth','alertService', 'rms','common', function($scope, $http, $routeParams, config, auth, alertService,rms,common){
common.checkLogin();
var vm = $scope;
var send_id = $routeParams.id;

View File

@ -0,0 +1,17 @@
/**
* Created by ttang on 2016/8/10.
*/
app.directive('atDeleteLink',["$timeout",function(timer){
return{
restrict: 'A',
scope: {},
link: function(scope, element){
timer(function(){
$(".at a").each(function(){
var atText = $(this).text();
$(this).parent().html(atText);
});
})
}
}
}]);

View File

@ -8,3 +8,17 @@ app.directive('pwdconfirm', function(){
}
}
});
app.directive('unconfirm', function(){
return {
require: 'ngModel',
link: function(scope, elm, attrs, ctrl){
ctrl.$validators.unconfirm = function(modelValue, viewValue) {
if(viewValue == ""){
return true;
}
return (/^[a-zA-Z\d]\w{0,23}[a-zA-Z\d]{0,1}$/.test(viewValue));
}
}
}
});

View File

@ -0,0 +1,14 @@
/**
* Created by ttang on 2016/8/10.
*/
app.directive('inputFocus',function(){
return{
restrict: 'A',
scope: {},
link: function(scope, element){
element.on('click',function(){
$("#postInput1").focus();
});
}
}
});

View File

@ -93,8 +93,18 @@ app.factory('rms', function(){
return {save: save, get: get};
});
app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx', function($http, auth, $routeParams,rms,config,wx){
var addCommonReply = function(id, type, data, cb){
app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$location', function($http, auth, $routeParams,rms,config,wx,$location){
var addCommonReply = function(id, type, data,args, cb){
//先判断有没有绑定
// $http.post(
// '/wechat/is_bind',
// {} ///不用传code了,都由服务器来处理
// ).then(function(response){
// console.log(response.data);
// if(response.data.status != 0){
// $location.path("/login_tip");
// }
// });
if(!data.comment || data.comment.length<=0){
return;
@ -117,9 +127,22 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx', func
}).then(function successCallback(response) {
//alert("提交成功");
//数据提交完成,回复按钮启用
console.log(response);
if(response.data.status == -1){
console.log("回复失败!");
data.comment = "";
if(response.data.tip == 0){
args.scope.replytip = "您不是该私有班级成员,不能回复";
}
else{
args.scope.replytip = "您不是该私有项目成员,不能回复";
}
return;
}
data.disabled = false;
if(typeof cb === 'function'){
cb();
cb(response.data.subscribe);
}
//保证内外回复数一致
@ -197,6 +220,7 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx', func
};
var init = function(args){
args.scope.replytip = "输入回复内容~";
args.scope.formData = {comment: ''};
var loadData = function(id,replytype,page){
loadCommonData(id, args.type,replytype,page).then(function successCallback(response) {
@ -238,7 +262,35 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx', func
console.log("desc = "+desc);
console.log("imgUrl= "+imgUrl);
wxConfig(title,desc,imgUrl);
var link = "";
if(args.urlName == "discussion"){
var urlName = response.data.type_name + "_discussion";
link = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+window.g_appid +
"&redirect_uri="+window.g_localhost+"/wechat/user_activities?id="+response.data.data.act_id+
"&response_type=code&scope=snsapi_userinfo&state="+urlName+"&connect_redirect=1#wechat_redirect";
}
else{
link = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+window.g_appid +
"&redirect_uri="+window.g_localhost+"/wechat/user_activities?id="+response.data.data.act_id+
"&response_type=code&scope=snsapi_userinfo&state="+args.urlName+"&connect_redirect=1#wechat_redirect";
}
// if(args.urlName == "discussion"){
// var urlName = response.data.type_name + "_discussion";
// link = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d" +
// "&redirect_uri=https://test.forge.trustie.net/wechat/user_activities?id="+response.data.data.act_id+
// "&response_type=code&scope=snsapi_base&state="+urlName+"&connect_redirect=1#wechat_redirect";
// }
// else{
// link = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d" +
// "&redirect_uri=https://test.forge.trustie.net/wechat/user_activities?id="+response.data.data.act_id+
// "&response_type=code&scope=snsapi_base&state="+args.urlName+"&connect_redirect=1#wechat_redirect";
// }
console.log("link= "+link);
wxConfig(title,desc,imgUrl,link);
//--------------分享内容定制-------------
args.loadCallback(response.data);
@ -249,9 +301,16 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx', func
loadData(args.id,0,0);
args.scope.addReply = function(data){
console.log(data.comment);
addCommonReply(args.id, args.replyType, data, function(){
addCommonReply(args.id, args.replyType, data,args, function(subscribe){
args.scope.formData = {comment: ''};
loadData(args.id,0,0);
if(subscribe == 0){
$location.path("/login_tip");
return;
}
else{
loadData(args.id,0,0);
}
if(typeof args.replyCallback === 'function'){
args.replyCallback();
}
@ -345,7 +404,7 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx', func
};
var wxConfig = function(title,desc,imgUrl){
var wxConfig = function(title,desc,imgUrl,link){
if(title == null || title == ""){
title = 'Trustie创新实践平台';
@ -356,13 +415,13 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx', func
}
if(imgUrl == null || imgUrl == ""){
imgUrl = 'http://www.trustie.net/images/logo2.png';
imgUrl = window.g_localhost+'/images/wechat/wx_logo.jpg';
}
wx.ready(function(){
wx.onMenuShareTimeline({
title: title, // 分享标题
// link: 'http://www.trustie.net/', // 分享链接
link: link, // 分享链接
imgUrl: imgUrl, // 分享图标
success: function () {
console.log("share successed.");
@ -375,7 +434,7 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx', func
wx.onMenuShareAppMessage({
title: title, // 分享标题
desc: desc, // 分享描述
// link: '', // 分享链接
link: link, // 分享链接
// imgUrl: '', // 分享图标
imgUrl: imgUrl, // 分享图标
// type: '', // 分享类型,music、video或link不填默认为link
@ -390,5 +449,18 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx', func
});
};
return {init: init, addCommonReply: addCommonReply, loadCommonData: loadCommonData, addCommonPraise: addCommonPraise, decreaseCommonPraise: decreaseCommonPraise, wxConfig: wxConfig};
var checkLogin = function(){
$http.post(
'/wechat/is_bind',
{} ///不用传code了,都由服务器来处理
).then(function(response){
console.log(response.data);
if(response.data.status != 0){
$location.path("/login");
return;
}
});
};
return {init: init, addCommonReply: addCommonReply, loadCommonData: loadCommonData, addCommonPraise: addCommonPraise, decreaseCommonPraise: decreaseCommonPraise, wxConfig: wxConfig, checkLogin: checkLogin};
}]);

View File

@ -23,13 +23,13 @@ app.config(['$routeProvider',"$httpProvider", "$locationProvider",'config', func
controller: 'RegController'
})
.when('/activites', makeRoute('activities.html', 'ActivityController'))
.when('/issues/:id', makeRoute('issue_detail.html', 'IssueController'))
.when('/project_discussion/:id', makeRoute('project_discussion.html', 'DiscussionController'))
.when('/homework/:id', makeRoute('homework_detail.html', 'HomeworkController'))
.when('/course_notice/:id', makeRoute('course_notice.html', 'CourseNoticeController'))
.when('/course_discussion/:id', makeRoute('course_discussion.html', 'DiscussionController'))
.when('/journal_for_message/:id', makeRoute('jour_message_detail.html', 'JournalsController'))
.when('/blog_comment/:id', makeRoute('blog_detail.html', 'BlogController'))
.when('/issues', makeRoute('issue_detail.html', 'IssueController'))
.when('/project_discussion', makeRoute('project_discussion.html', 'DiscussionController'))
.when('/homework', makeRoute('homework_detail.html', 'HomeworkController'))
.when('/course_notice', makeRoute('course_notice.html', 'CourseNoticeController'))
.when('/course_discussion', makeRoute('course_discussion.html', 'DiscussionController'))
.when('/journal_for_message', makeRoute('jour_message_detail.html', 'JournalsController'))
.when('/blog_comment', makeRoute('blog_detail.html', 'BlogController'))
.when('/class', makeRoute('class.html', 'ClassController'))
.when('/new_class', makeRoute('new_class.html', 'NewClassController'))
.when('/edit_class', makeRoute('edit_class.html', 'EditClassController'))
@ -47,6 +47,7 @@ app.config(['$routeProvider',"$httpProvider", "$locationProvider",'config', func
.when('/project_invite_code', {templateUrl: rootPath + 'project_invite_code.html', controller: 'ProjectInviteCodeController'})
.when('/join_project', makeRoute('join_project.html', 'JoinProjectController'))
.when('/review_project_member', makeRoute('review_project_member.html', 'ReviewProjectMemberController'))
.when('/login_tip', makeRoute('login_tip.html', 'LoginTipController'))
.otherwise({
redirectTo: '/activites'
});

View File

@ -87,6 +87,7 @@ a.underline {text-decoration:underline;}
.btn-disabled {background-color:#ccc !important;}
.btn2 {width:145px; height:35px; color:#fff; font-size:15px; line-height:35px; text-align:center; vertical-align:middle; margin:18px auto 20px auto; border-radius:50px; display:block;}
.btn3 {width:145px; height:35px; color:#fff; font-size:15px; line-height:35px; text-align:center; vertical-align:middle; border-radius:50px; display:block;}
.btn4 {width:150px; height:40px; line-height:40px; vertical-align:middle; text-align:center; color:#fff; display:inline-block; border-radius:5px;}
.fixed-bottom-btn {position:fixed; bottom:5px; left:50%; transform:translate(-50%,0);}
/*tab*/
@ -178,7 +179,7 @@ a.underline {text-decoration:underline;}
.invitation-code-wrap {text-align:center; font-size:18px; color:#3b3b3b; padding:16px;}
.share-code-wrap {width:100%; background-color:#efeff4;}
.share-code-btn, .finish-btn {width:145px; height:35px; color:#fff; font-size:15px; line-height:35px; text-align:center; vertical-align:middle; background-color:#ff7239; margin:18px auto 20px auto; border-radius:50px; display:block;}
.share-code-instruction {max-width:228px; font-size:12px; color:#666; line-height:20px; margin:0 auto;}
.share-code-instruction {max-width:228px; font-size:12px; color:#666; line-height:20px; margin:20px auto 30px;}
/*20160613班级详情*/
.class-detail-name, .blue-title {width:100%; height:45px; line-height:45px; vertical-align:middle; background-color:#3b94d6; color:#fff; font-size:18px; text-align:center;}
@ -216,6 +217,7 @@ a.underline {text-decoration:underline;}
.border-bottom-none {border-bottom:none !important;}
.border-top-none {border-top:none !important;}
.students-amount {height:14px; line-height:14px; vertical-align:middle; padding:2px 5px; background-color:#e6e6e6; border-radius:10px;}
.amount-arrow {height:14px; line-height:14px; vertical-align:middle; margin-top:12px;}
.new-class-btn {font-size:15px; color:#fff; background-color:#3b94d6; padding:10px 40px; border-radius:20px; display:inline-block; margin:0 auto;}
.join-class-btn {font-size:15px; color:#444; background-color:#ccc; padding:10px 40px; border-radius:20px; display:inline-block; margin:0 auto;}
.new-class-input {width:60%; color:#555; height:16px; line-height:16px; vertical-align:middle; border:none; outline:none; padding:8px 0;}
@ -230,8 +232,7 @@ a.underline {text-decoration:underline;}
.login-box{display:inline-block; width:14px; height:14px; line-height:14px; text-align:center; vertical-align:middle; border:1px solid #ccc; background:#fff; border-radius:3px; color:#fff; cursor:pointer;}
.login-box.checked{background:#63c360; border:1px solid #63c360;}
.login-box.checked:after{content:url(/images/wechat/checked.png);}
.forget-psw-wrap {width:60px; margin:0 auto;}
.forget-psw {position:fixed; bottom:10px;}
.forget-psw-wrap {width:60px; margin:30px auto;}
/*二级回复*/
.mult-reply-container{ border:solid 1px #f3ddb3; background:#fffef4; padding:4px;color:#999;}
@ -248,3 +249,8 @@ a.underline {text-decoration:underline;}
/*新建说明*/
.new-tip {line-height:2;}
.new-tip li {position:relative; padding-left:10px;}
/*20160810绑定说明*/
.ac-wrap {text-align:center;}
.ac-content {display:inline-block; line-height:2;}
.ac-content li {position:relative; text-align:left; padding-left:5px;}