微信细节优化

This commit is contained in:
yuanke 2016-08-10 16:08:30 +08:00
parent 66357c4024
commit 57737ff15d
25 changed files with 236 additions and 68 deletions

View File

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

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

@ -352,14 +352,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]
@ -382,11 +382,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

@ -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,37 @@ 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
if role_id == 10 && result == 0
title = "恭喜您加入班级成功。"
ws.join_class_notice user.id, "class", course.id,title, course.syllabus.name,course.name,course.teacher.show_name, "点击查看班级详情。"
else
role_name = role_id == 7 ? "助教" : "教师"
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
end
#多个角色加入课程
def join_course_roles params,current_user
course = Course.find_by_invite_code(params[:invite_code]) if params[:invite_code]
@ -587,6 +622,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 +631,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

@ -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]
@ -146,6 +167,7 @@ class ProjectsService
project.project_infos << project_info
status = 0
send_wechat_join_project_notice current_user,project,5,0
else
if !AppliedProject.where(:project_id => project.id, :user_id => current_user.id).first.nil?
status = 8
@ -271,6 +293,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,
@ -280,6 +304,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

@ -72,7 +72,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

@ -111,11 +111,15 @@ 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}"
if uid && uid != 0
tmpurl = "#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities#/#{type}?id=#{id}"+ "&user_id="+uid.to_s
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: {
@ -292,6 +296,19 @@ 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?
@ -383,4 +400,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

@ -23,6 +23,8 @@ default: &default
create_class_notice: "2GtJJGzzNlNy2i0UrsjEDlvfSVIUXQfSo47stpcQAVw"
create_project_notice: "jYu0iimbDpgWYZaTLXioZe2lvqoWTdKnUPyphTJ1mxs"
project_review_notice: "kdb-8UlMjTc3z51Qcf8g2vY4i_nE4OGKZAucdQma_2E"
join_class_notice: "0V2vhhp5co7drgoyqn3WXUUTQ9xwYrnVcMma7ika6o0"
join_project_notice: "TtXvy0XMIQyCgpnXHhoB8t-x0QIfy-78gAJXsGf9afg"
production:
<<: *default

View File

@ -23,6 +23,8 @@ default: &default
create_class_notice: "9CDIvHIKiGwPEQWRw_-wieec1o50tMXQPPZIfECKu0I"
create_project_notice: "R2ZaQKJfDJgujPcHWPzadKHIRkIyj2CjX2o_qIuRqig"
project_review_notice: "ip192wVXTav3qchgUn9_7B6lFfTlCZjwL7A1tncTOuc"
join_class__notice: "umHZyT8n6KPf3emf4sTJ66I8OB_TJTzjYhxDbJUgUis"
join_project_notice: "3KnMQEMUCmQWkB5JvzrpmguEwnN8bvUHUdpOTudxv_M"
production:
<<: *default

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

@ -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>
@ -38,7 +38,7 @@
<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>

View File

@ -8,7 +8,7 @@
<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>
@ -36,7 +36,7 @@
<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 +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" 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

@ -7,7 +7,7 @@
<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>
@ -35,7 +35,7 @@
<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

@ -7,7 +7,7 @@
<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>
@ -40,7 +40,7 @@
<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 +51,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>

View File

@ -8,7 +8,7 @@
<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>
@ -41,7 +41,7 @@
<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

@ -7,7 +7,7 @@
<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>
@ -36,7 +36,7 @@
<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 +46,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

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>

View File

@ -7,7 +7,7 @@
<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>
@ -37,7 +37,7 @@
<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 +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

@ -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">登录名为1-25个英文字母、数字和下划线</span>
</div>
</div>

View File

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

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

@ -7,4 +7,18 @@ 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

@ -95,6 +95,18 @@ app.factory('rms', function(){
app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$location', function($http, auth, $routeParams,rms,config,wx,$location){
var addCommonReply = function(id, type, data, 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;