自动授权列表

This commit is contained in:
XuCheng642 2017-09-29 16:18:41 +08:00
parent 93f39cd85c
commit cbb648dd40
19 changed files with 522 additions and 112 deletions

View File

@ -7,6 +7,80 @@ class ManagementsController < ApplicationController
include UsersHelper
include ApplicationHelper
#用户修改
def account
@user = User.find(params[:user_id])
ue = @user.user_extensions
# @trail_authentication = ApplyAction.where(:user_id => @user.id, :container_type => "TrialAuthorization").order("created_at desc").first
# @authentication = @user.authentication
# if @user.nickname.nil? || @user.lastname.nil? || ue.try(:identity).nil? || ue.try(:location).nil? || ue.try(:location).nil?
# @require_auth = true
# else
# if User.current.certification != 1 && (@trail_authentication.blank? || (@trail_authentication.status == 2 && (@trail_authentication.updated_at.to_i + 5*60) < Time.now.to_i))
# @require_trail_auth = true
# end
# end
# @s_message = AppliedMessage.where(:status => 3, :user_id => User.current.id, :viewed => 0, :applied_type => 'ApplyAddSchools').first
# @d_message = AppliedMessage.where(:status => 3, :user_id => User.current.id, :viewed => 0, :applied_type => 'ApplyAddDepartment').first
# AppliedMessage.where(:status => 3, :user_id => User.current.id, :viewed => 0, :applied_type => 'ApplyAddSchools').update_all(:viewed => true)
# AppliedMessage.where(:status => 3, :user_id => User.current.id, :viewed => 0, :applied_type => 'ApplyAddDepartment').update_all(:viewed => true)
lg = @user.login
@pref = @user.pref
diskfile = disk_filename('User', @user.id)
diskfile1 = diskfile + 'temp'
begin
if request.post?
@user.nickname = params[:nickname]
@user.lastname = params[:lastname]
@user.firstname = ""
@user.show_realname = params[:show_realname] ? 0 : 1
@user.pref.attributes = params[:pref]
@user.mail = params[:mail]
@user.phone = params[:phone]
@user.password = params[:new_password]
@user.pref[:no_self_notified] = (params[:no_self_notified] == '1')
@se = @user.extensions
@se.school_id = params[:occupation]
@se.department_id = params[:department_id]
@se.gender = params[:sex]
@se.location = params[:province] if params[:province]
@se.location_city = params[:city] if params[:city]
@se.identity = params[:identity].to_i if params[:identity]
if @se.identity == 0
@se.technical_title = params[:te_technical_title] if params[:te_technical_title]
@se.student_id = nil
elsif @se.identity == 1
@se.student_id = params[:no] if params[:no]
@se.technical_title = nil
elsif @se.identity == 2
@se.technical_title = params[:pro_technical_title] if params[:pro_technical_title]
@se.student_id = nil
end
@se.brief_introduction = params[:brief_introduction]
if @user.save && @se.save
reward_grade(@user, @user.id, 'Account', 500)
# 头像保存
FileUtils.mv diskfile1, diskfile, force: true if File.exist? diskfile1
@user.pref.save
@user.notified_project_ids = (@user.mail_notification == 'selected' ? params[:notified_project_ids] : [])
set_language_if_valid @user.language
flash[:notice] = l(:notice_account_updated)
return
else
@user.login = lg
end
end
# 不管前面是否有异常,如果文件已存在就删除
ensure
File.delete(diskfile1) if File.exist?(diskfile1)
end
@setting_type = 1
end
# 镜像管理
def mirror_repository
@menu_type = 3
@ -480,15 +554,27 @@ end
end
def save_school
uploaded_io = params[:logo]
# uploaded_io = params[:logo]
sl = School.create(:name => params[:schoolname],:province => params[:province],:city => params[:city],:address => params[:address])
# sl = School.create(:name => params[:school],:province => params[:schollProvince],:city => params[:schoolCity],:address => params[:address])
unless uploaded_io.nil?
File.new(Rails.root.join('public', 'images', 'school', sl.id.to_s+'.png'), 'wb').write(sl.id)
# unless uploaded_io.nil?
# File.new(Rails.root.join('public', 'images', 'school', sl.id.to_s+'.png'), 'wb').write(sl.id)
# File.new(Rails.root.join('public', 'images', 'school', sl.id.to_s+'.png'), 'wb') do |file|
# file.write(uploaded_io.read)
# end
sl.logo_link = '/images/school/'+sl.id.to_s+'.png'
# sl.logo_link = '/images/school/'+sl.id.to_s+'.png'
# end
@user = User.current
@se = @user.extensions
if @user.save && @se.save
diskfile1 = disk_filename('school', sl.id , 'id')
diskfileID = diskfile1 + 'temp'
begin
FileUtils.mv diskfileID, diskfile1, force: true if File.exist? diskfileID
ensure
File.delete(diskfileID) if File.exist?(diskfileID)
end
end
redirect_to departments_part_managements_path
end
@ -1105,19 +1191,31 @@ end
def auto_users_trial
@menu_type = 7
@sub_type = 3
@schools = School.where("0=0")
@schools_count = @schools.count
@apply_action = School.where(:auto_users_trial => 1).order('updated_at desc')
@apply_action_count = @apply_action.count
limit = 20
@is_remote = true
@schools_pages = Paginator.new @schools_count, limit, params['page'] || 1
@offset ||= @schools_pages.offset
@schools = paginateHelper @schools, limit
@apply_action_pages = Paginator.new @apply_action_count, limit, params['page'] || 1
@offset ||= @apply_action_pages.offset
@apply_action = paginateHelper @apply_action, limit
respond_to do |format|
format.html
format.js
end
end
# 添加
def create_auto_users_trial
School.where(:id => params[:school]).update_all(:auto_users_trial => 1)
redirect_to auto_users_trial_managements_path
end
# 删除
def update_auto_users_trial
School.where(:id => params[:school]).update_all(:auto_users_trial => 0)
redirect_to auto_users_trial_managements_path
end
def search_user
=begin
@ -1358,7 +1456,14 @@ end
user = User.find(apply_user.user_id)
apply_user.update_attribute(:status, 1)
user.update_attribute(:authentication, true)
@unapproved_user = ApplyUserAuthentication.where(:status => 0, :auth_type => 1).order("updated_at desc")
@unapproved_user_count = @unapproved_user.count
@limit = 15
@is_remote = true
@unapproved_user_pages = Paginator.new @unapproved_user_count, @limit, params['page'] || 1
@offset ||= @unapproved_user_pages.offset
@unapproved_user = paginateHelper @unapproved_user, @limit
respond_to do |format|
format.js
end
@ -1369,6 +1474,7 @@ end
apply_user = ApplyUserAuthentication.where(:id => params[:apply_id], :auth_type => 2).first
reason = apply_user.update_attributes(:status => 2, :remarks => params[:reject_reason])
render :json => {success: reason}
end
# 同意职业认证
@ -1378,6 +1484,12 @@ end
apply_user.update_attribute(:status, 1)
user.update_attribute(:professional_certification, true)
@unapproved_user = ApplyUserAuthentication.where(:status => 0, :auth_type => 2).order("updated_at desc")
@unapproved_user_count = @unapproved_user.count
@limit = 15
@is_remote = true
@unapproved_user_pages = Paginator.new @unapproved_user_count, @limit, params['page'] || 1
@offset ||= @unapproved_user_pages.offset
@unapproved_user = paginateHelper @unapproved_user, @limit
respond_to do |format|
format.js
end
@ -1406,7 +1518,8 @@ end
@menu_type = 10
@sub_type = 5
@type = trial_authorization_status params[:type]
@authorizations = ApplyAction.where(:container_type => "ApplyShixun", :status => @type).order("created_at desc")
# sql = select * from apply_actions where dealer_id is null
@authorizations = ApplyAction.where(:container_type => "ApplyShixun", :status => @type,:dealer_id =>'').order("created_at desc")
search = params[:search]
unless search.blank?
@authorizations = @authorizations.where(:container_id => Shixun.where(:id => @authorizations.map(&:container_id)).where("name like '%#{search}%'").map(&:id)).order("created_at desc")

View File

@ -2,6 +2,5 @@
class ApplyAction < ActiveRecord::Base
default_scope :order => 'updated_at desc'
attr_accessible :container_id, :container_type, :dealer_id, :reason, :user_id, :status, :apply_reason
belongs_to :user
end

View File

@ -1,6 +1,6 @@
class School < ActiveRecord::Base
default_scope :order => 'created_at desc'
attr_accessible :name, :province, :pinyin, :city, :address, :logo_link
attr_accessible :name, :province, :pinyin, :city, :address, :logo_link,:auto_users_trial
has_many :courses
has_many :departments, :dependent => :destroy

View File

@ -100,9 +100,9 @@
</li>
<li class="fl edu-admin-nav-li edu-position <%= 'active' if @menu_type == 9 %>">
<a href="javascript:void(0);" class="edu-admin-nav-a">留言</a>
<ul class="edu-admin-nav-inner edu-absolute">
<li><%= link_to "实训留言", shixun_feedback_managements_path %></li>
</ul>
<!--<ul class="edu-admin-nav-inner edu-absolute">-->
<!--<li><%#= link_to "实训留言", shixun_feedback_managements_path %></li>-->
<!--</ul>-->
</li>
<li class="fl edu-admin-nav-li edu-position <%= 'active' if @menu_type == 10 %>"><a href="javascript:void(0);" class="edu-admin-nav-a">审批</a>
<ul class="edu-admin-nav-inner">

View File

@ -0,0 +1,91 @@
<div style="width:400px" class="task-popup">
<div class="task-popup-title clearfix ">
<h3 class="fl color-grey mt10 ml5">新增自动授权单位</h3>
<a href="javascript:void(0);" class="pop_close"><i class="fa fa-times-circle font-18 link-color-grey fr mt5"></i></a>
</div>
<div class="mt10 ml30">
<span class="fl font-16 color-grey mr10 mt3 ">单位名称:</span>
<input nhname="tag" name="school" class="task-height-40 panel-box-sizing fl" type="text" placeholder="请输入单位名称" style="width: 260px" value="<%= @schools %>" />
<input nhname="tag" nh_tag_5="true" class="fl" id="school_id" name="school_id" style="display:none;" type="text" value="<%= @school_id %>"/> <!-- 单位名称的test框选中下拉列表框的id -->
<div class="cl"></div>
<span class="color-orange fl none" id="school_id_notice" style="margin-left:20%;"><i class="fa fa-exclamation-circle mr5" ></i>请选择单位</span>
</div>
<div id="search_school_result_list" style="width: 260px;line-height: 1.5;min-height:20px; max-height: 200px; height: auto !important;display:none;background: white;overflow: scroll;border: solid 1px #cccccc; overflow-x: hidden; overflow-y: auto;">
</div>
<div id="schools_list" class="mt10 mb20 ml40 mr40">
</div>
<span id="choose_courses_notice" class="c_red"></span>
<div class="task-popup-submit clearfix ml25">
<a href="javascript:void(0);" onclick="hideModal();" class="task-btn fl pop_close mr10">取消</a>
<a href="javascript:void(0);" onfocus='this.blur();' onclick="school_submit();" class="task-btn task-btn-blue fr" >确定</a>
</div>
<div class="cl"></div>
</div>
<script type="text/javascript">
$("input[name='school']").on('input', function (e) {
throttle(department_search_fn, window, e);
});
var d_lastSearchCondition = '';
var d_page = 1; //唯一控制页码 变量
var d_count = 0; //查询结果的总量
var d_maxPage = 0;//最大页面值
function department_search_fn(e) {
if($(e.target).val().trim() == ''){
$("#search_school_result_list").hide();
$("input[name='school_id']").val("");
return;
}
if ($(e.target).val().trim() == d_lastSearchCondition && $(e.target).val().trim() != '') {//如果输入框没有改变或者输入框为空就返回
return;
}
d_lastSearchCondition = $(e.target).val().trim();
page = 1; //有新的搜索页面重置为1
$.ajax({
url: '<%= url_for(:controller => 'school',:action => 'on_search') %>' + '?name=' + e.target.value + '&school_id=' + $("input[name='occupation']").val() + '&page=' + d_page,
type: 'post',
success: function (data) {
d_schoolsResult = data.schools;
count = data.count;
maxPage = Math.ceil(count / 100); //最大页码值
if (d_schoolsResult.length != undefined && d_schoolsResult.length != 0) {
var i = 0;
$("#search_school_result_list").html('');
for (; i < d_schoolsResult.length; i++) {
link = '<a onclick="window.changeSchoolValue(\'' + d_schoolsResult[i].school.name.replace(/\s/g, " ") + '\',\'' + d_schoolsResult[i].school.id + '\')" href="javascript:void(0)">' + d_schoolsResult[i].school.name + '</a><br/>';
$("#search_school_result_list").append(link);
}
$("#search_school_result_list").css('left',108);
$("#search_school_result_list").css('top',113);
$("#search_school_result_list").css("position", "absolute");
$("#search_school_result_list").show();
} else {
$("#search_school_result_list").css('left', 108);
$("#search_school_result_list").css('top',113);
$("#search_school_result_list").css("position", "absolute");
$("#search_school_result_list").html('你的学校不在列表中?请确认后输入');
$("#search_school_result_list").show();
}
}
});
}
function changeSchoolValue(value, data) {
$("input[name='school']").val(value);
$("input[name='school_id']").val(data);
$("#search_school_result_list").hide();
};
function school_submit(){
var school=$("input[name='school_id']").val();
console.log(school);
if($("input[name='school']").val() == ""){
$("#school_id_notice").show();
} else{
$.ajax({
url: '/managements/create_auto_users_trial',
type: 'post',
dataType: 'script',
data:{school:school}
});
hideModal();
}
}
</script>

View File

@ -10,15 +10,15 @@
</tr>
</thead>
<tbody>
<% @schools.each_with_index do |school,index| %>
<% @apply_action.each_with_index do |apply_action,index| %>
<tr>
<td><%= index + 1 %></td>
<td><%= school.name %></td>
<td><%= UserExtensions.where(:school_id =>school.id).count %></td>
<td><%= User.where(:status => 1) && UserExtensions.where(:school_id =>school.id).count %></td>
<td></td>
<td><%= apply_action.name %></td>
<td><%= UserExtensions.where(:school_id => apply_action.id).count %></td>
<td><%= ApplyAction.where(:user_id => UserExtensions.where(:school_id => apply_action.id).map(&:user_id), :container_type => "TrialAuthorization" ,:status => 1).count %></td>
<td><%= format_time(apply_action.updated_at) %></td>
<td>
<a href="script:void(0)">删除</a>
<a href="javascript:void(0)" onclick="delete_confirm_box('<%= update_auto_users_trial_managements_path(:school =>apply_action.id)%>','您是否确定删除?')">删除</a>
</td>
</tr>
<% end %>
@ -28,7 +28,7 @@
<div style="text-align:center;" class="new_expand">
<div class="pages_user_show" style="width:auto; display:inline-block;margin:18px 0;">
<ul id="homework_pository_ref_pages">
<%= pagination_links_full @schools_pages, @schools_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>
<%= pagination_links_full @apply_action_pages, @apply_action_count, :per_page_links => false, :remote => @is_remote, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>

View File

@ -23,8 +23,8 @@
</td>
<td><%= format_time(jour.created_on) %></td>
<td class="edu-txt-left" style="white-space:nowrap; overflow:hidden; text-overflow:ellipsis;">
<%= jour.m_parent_id.nil? ? strip_html(jour.notes) : 'RE: ' + strip_html(jour.notes) %>
</td>
<%= link_to jour.m_parent_id.nil? ? strip_html(jour.notes) : 'RE: ' + strip_html(jour.notes),student_work_path(jour.jour_id) %>
</td>
<td>
<% replys = JournalsForMessage.where(:m_parent_id => jour.id) %>
<%= replys.nil? ? 0 : replys.count %>

View File

@ -1,13 +1,67 @@
<div class="col-width-10 mt20" style="padding:20px 0 0 300px">
<%= form_tag save_school_managements_path(),method: "post",:id => "save_school" do %>
<div class="clearfix ml30">
<input type="hidden" value="<%= @school_name%>" name="school_name" class="w150">
<%= image_tag('', id: "avatar_image", :class=>"school_avatar ml25") %>
<a type="button" onclick="$('#file').click();" style="margin: 90px 0 0 0px;padding: 2px 5px;cursor: pointer;text-decoration: none;width: 70px;" class="fl color-grey">上传图片</a>
<%= file_field_tag 'logo',:style => "display:none;", :id => "file", :onchange => "showPreview(this)"%>
<a type="button"style="margin: 90px 0 0 0px;padding: 2px 5px;cursor: pointer;text-decoration: none;width: 70px;" class="fl color-grey" >删除图片</a>
<div class="cl"></div>
</div>
<!--<div class="clearfix ml30">-->
<!--<input type="hidden" value="<%#= @school_name%>" name="school_name" class="w150">-->
<!--<%##= image_tag('', id: "avatar_image", :class=>"school_avatar ml25") %>-->
<!--<a type="button" onclick="$('#file').click();" style="margin: 90px 0 0 0px;padding: 2px 5px;cursor: pointer;text-decoration: none;width: 70px;" class="fl color-grey">上传图片</a>-->
<!--<%#= file_field_tag 'logo',:style => "display:none;", :id => "file", :onchange => "showPreview(this)"%>-->
<!--<a type="button"style="margin: 90px 0 0 0px;padding: 2px 5px;cursor: pointer;text-decoration: none;width: 70px;" class="fl color-grey" >删除图片</a>-->
<!--<div class="cl"></div>-->
<!--</div>-->
<div class="clearfix ml30">
<%= file_field_tag 'account/avatar[image]',
:id => "upload_img_id",
:style => 'display:none;',
:size => "1",
:multiple => false,
:onchange => 'addInputAvatar(this);',
:data => {
:max_file_size => Setting.authentication_img_max_size.to_i.kilobytes,
:max_file_size_message => l(:error_user_auth_too_big, :max_size => number_to_human_size(Setting.authentication_img_max_size.to_i.kilobytes)),
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
:file_type => Redmine::Configuration['pic_types'].to_s,
:type_support_message => l(:error_pic_type),
:upload_path => upload_avatar_path(:format => 'js'),
:description_placeholder => nil ,# l(:label_optional_description)
:source_type => 'school',
:source_id => @user.id.to_s,
:is_direct => 1
} %>
<input type="hidden" value="0" id="upload_img_id_sign" />
<a href="javascript:void(0);" onclick="$('#upload_img_id').click();" class="course-bth-blue mt5">+选择文件</a>
</div>
<div class="clearfix ml30">
<label class="rz-label fl">&nbsp;</label>
<div class="color-grey fl font-12 pr" id="shili_image">
<%= image_tag(url_to_auth_img(0, 'ID'), :width => 200, :height => 150, :id => 'nh_source_id') %>
<br/>
</div>
</div>
<script>
$(function(){
var image = $("#nh_source_id");
var element = $("<a></a>").attr("href", image.attr('src')+".png");
image.wrap(element);
$("#nh_source_id").parent().colorbox({rel: 'nofollow', close: "关闭", returnFocus: false});
});
</script>
<div class="">
<div class="panel-form mr15">
<ul>

View File

@ -4,8 +4,14 @@
<a href="javascript:void(0);" class="fl task-btn task-btn-blue ml5 mt5" onclick="$('#management_search_user').submit();">搜索</a>
<a href="javascript:void(0);" class="fl task-btn ml5 mt5" id="clear_contents">清除</a>
</div>
<a href="javascript:void(0)" class="task-btn task-btn-green fr mt6 mr30" onclick="add_auto_users_trial()">新增</a>
</div>
<div class="edu-con-bg01 mt15">
<%= render :partial => "auto_users_authorization_list" %>
</div>
<script>
function add_auto_users_trial(){
var htmlvalue = "<%= escape_javascript( render :partial => 'managements/add_auto_users_trial') %>";
pop_box_new(htmlvalue, 400, 260);
}
</script>

View File

@ -3,7 +3,6 @@
<input class="fl task-form-20 task-height-30 ml35" id="shixun_Look_name" name="search" maxlength="" placeholder="输入关键字进行搜索" type="text" style="height: 21px;">
<a href="javascript:void(0);" class="fl task-btn task-btn-blue ml5 mt2" onclick="$('#department_part_search').submit();">搜索</a>
<a href="javascript:clearSearchCondition();" class="fl task-btn ml5 mt2" id="clear_contents">清除</a>
<% link_to "新建单位", :class => "task-btn task-btn-green fr mt6 mr30" %>
<%#= link_to "新建单位",add_departments_part_managements_path(),:class => "task-btn task-btn-green fr mt6 mr30" %>
<input name="sx_order" type="hidden">
</div>

View File

@ -19,7 +19,7 @@
</div>
<div class="cl"></div>
<div id="authentication_list">
<%= render :partial => "admin/authentication_list" %>
<%= render :partial => "authentication_list" %>
</div>
</div>
</div>

View File

@ -0,0 +1 @@
$("#pro_authentication_list").html("<%= j( render :partial => "pro_authentication_list" ) %>");

View File

@ -10,11 +10,11 @@
</div>
<div class="-task-con-data fl">
<div class="top cl">
<div class="top-left fl mt20 mb10">
<div class="top-left fl mt10 mb10">
<p class="p1 font-16" style="overflow: hidden">
<a href="<%= %>" class="user_course_filtrate fl mt20 mr30 font-14" target="_blank">
<a href="<%= feedback_path(@user, :host=> Setting.host_user) %>" class="user_course_filtrate fl mt20 mr30 font-14" target="_blank">
<span class="user_filtrate_span1">留言</span>
<span class="user_filtrate_span2 ml10"><%= %></span>
<span class="user_filtrate_span2 ml10"><%= @user.journals_for_messages.count %></span>
</a>
<a href="<%= user_watchlist_user_path(@user) %>" class="user_course_filtrate fl mt20 mr30 font-14" target="_blank">
<span class="user_filtrate_span1">关注</span>
@ -61,11 +61,6 @@
</p>
<p class="p2 font-16">
<span class="fl">
<% if !@user.user_extensions.school_id.blank? && @user.user_extensions.school %>
<%= @user.user_extensions.school.name %>
<% end %>
</span>
<ul class="fr mb10 p2">
<a href="<%= authentication_account_path %>">
<% if @user.authentication %>
@ -129,7 +124,7 @@
</ul>
</p>
<p class="sub clearfix">
<a href="<%= %>" class="fr font-14 ml10 link-color-orange">给TA留言</a>
<a href="<%= feedback_path(@user, :host=> Setting.host_user) %>" class="fr font-14 ml10 link-color-orange">给TA留言</a>
<% if (@user.watched_by?(User.current)) %>
<%= link_to "已关注",
watch_path(:object_type => 'user', :object_id => @user.id, :target_id => @user.id),
@ -152,7 +147,7 @@
</div>
<div class=" clearfix mt15">
<!--<div>-->
<%= labelled_form_for :user, @user, :url => {:controller => "my",:action => "account"}, :html => {:id => 'my_account_form', :method => :post, :remote => true} do |f| %>
<%= labelled_form_for :user, @user, :url => {:controller => "managements",:action => "account"}, :html => {:id => 'my_account_form', :method => :post, :remote => true} do |f| %>
<ul>
<li class="clearfix mb10">
<label class="panel-form-label fl mr18">ID:</label>
@ -166,20 +161,30 @@
<li class="clearfix mb10">
<label class="panel-form-label fl mr18">姓名:</label>
<input type="text" id="lastname" name="lastname" maxlength="20" nh_required="1" required="required" class="mr15 input-height task-form-20 panel-box-sizing fl" placeholder="填写您的真实姓名" value="<%= @user.lastname+@user.firstname %>">
<input type="checkbox" id="show_realname" name="show_realname" class="fl magic-checkbox" value="1" <%= User.current.show_realname ? '' : 'checked' %>>
<input type="checkbox" id="show_realname" name="show_realname" class="fl magic-checkbox" value="1" <%= @user.show_realname ? '' : 'checked' %>>
<span class="color-orange fl hint none" id="lastname_hint" style="margin-left:20px;"><i class="fa fa-exclamation-circle mr5"></i>请填写真实姓名</span>
</li>
<li class="clearfix mb10">
<label class="panel-form-label fl mr18">性别:</label>
<span class="fl mt3 mr15">
<input id="sex_0" type="radio" class="magic-radio" name="sex" value="0" checked>
<label for="sex_0">男</label>
</span>
<span class="fl mt3">
<input id="sex_1" type="radio" class="magic-radio" name="sex" value="1">
<label for="sex_1">女</label>
</span>
<% if @user.user_extensions && @user.user_extensions.gender && @user.user_extensions.gender == 1 %>
<span class="fl mt3 mr15">
<input id="sex_0" class="magic-radio" type="radio" value="0" name="sex">
<label for="sex_0">男</label>
</span>
<span class="fl mt3">
<input id="sex_1" class="magic-radio" type="radio" name="sex" value="1" checked>
<label for="sex_1">女</label>
</span>
<% else %>
<span class="fl mt3 mr15">
<input id="sex_0" type="radio" class="magic-radio" name="sex" value="0" checked>
<label for="sex_0">男</label>
</span>
<span class="fl mt3">
<input id="sex_1" type="radio" class="magic-radio" name="sex" value="1">
<label for="sex_1">女</label>
</span>
<% end %>
<div class="cl"></div>
</li>
<li class="clearfix mb10 hascontont">
@ -272,17 +277,12 @@
<p id="no_department_hint" class="none fl ml10 mt8">你的部门不在列表中?请点击<a href="javascript:void(0);" class="link-color-blue">申请添加</a></p>
<div class="cl"></div>
</li>
<li class="clearfix mb10">
<li class="clearfix mb10" >
<label class="panel-form-label fl mr18">介绍:</label>
<textarea class="task-form-80 task-height-150 panel-box-sizing fl" name="brief_introduction" style="width:82%; resize: none;" placeholder=" 一句话介绍一下自己吧~最多100个字符"><%= @user.user_extensions.brief_introduction %></textarea>
<div class="cl"></div>
</li>
</ul>
<% end %>
</div>
<div class="clearfix mt20 mb20" style="border-bottom: 1px solid #ddd;border-top:1px solid #ddd ">
<%= form_tag(my_password_path(:user_id => @user.id),:id => 'my_password_form') do %>
<li class="clearfix mb10 mt30">
<li class="clearfix mb10 mt30 user">
<label class="panel-form-label fl mr18">修改密码:</label>
<input id="new_password" type="password" name="new_password" class="input-height task-form-20 panel-box-sizing fl" placeholder="设置8-16位新密码区分大小写字母">
<i class="fa font-16 ml20" id="user_password_2_check"></i>
@ -294,29 +294,65 @@
<i class="fa font-16 ml20" id="user_password_3_check"></i>
<span class="color-orange fl hint none" id="user_password_3_notice" style="margin-left:20px;">两次密码输入不一致</span>
</li>
<li class="clearfix mb10 user">
<label class="panel-form-label fl mr18">邮箱地址:</label>
<input type="email" class="input-height task-form-20 panel-box-sizing fl" placeholder="请输入真实有效的邮箱" value="<%= @user.mail %>" id="user_email_addr" name="mail">
<i class="fa font-16 ml20 " id="user_email_check"></i>
<div class="cl"></div>
<span class="color-orange fl hint none" id="user_email_hint" style="margin-left:12%;"><i class="fa fa-exclamation-circle mr5"></i>邮箱格式不正确</span>
</li>
<li class="clearfix mb25">
<label class="panel-form-label fl mr18">手机号码:</label>
<input type="tel" class="input-height task-form-20 panel-box-sizing fl" placeholder="请输入手机号码" value="<%= @user.phone %>" id="user_phone" name="phone">
<i class="fa font-16 ml20 " id="user_phone_check"></i>
<div class="cl"></div>
<span class="color-orange fl hint none" id="user_phone_hint" style="margin-left:12%;"><i class="fa fa-exclamation-circle mr5"></i>手机号输入不正确</span>
</li>
<li class="clearfix mb20" style="margin-right:41px;">
<a href="javascript:void(0);" id="user_form_link" class="task-btn task-btn-blue fr">保存</a>
<a href="javascript:void(0);" onclick="cancel_edit_account();" class="task-btn fr mr10">取消</a>
</li>
</ul>
<% end %>
</div>
<div class="clearfix mt20">
<li class="clearfix mb10">
<label class="panel-form-label fl mr18">邮箱地址:</label>
<input type="email" class="input-height task-form-20 panel-box-sizing fl" placeholder="请输入真实有效的邮箱" value="<%= @user.mail %>" id="user_email_addr">
<i class="fa font-16 ml20 " id="user_email_check"></i>
<div class="cl"></div>
<span class="color-orange fl hint none" id="user_email_hint" style="margin-left:12%;"><i class="fa fa-exclamation-circle mr5"></i>邮箱格式不正确</span>
</li>
<li class="clearfix mb25">
<label class="panel-form-label fl mr18">手机号码:</label>
<input type="tel" class="input-height task-form-20 panel-box-sizing fl" placeholder="请输入手机号码" value="<%= @user.phone %>" id="user_phone">
<i class="fa font-16 ml20 " id="user_phone_check"></i>
<div class="cl"></div>
<span class="color-orange fl hint none" id="user_phone_hint" style="margin-left:12%;"><i class="fa fa-exclamation-circle mr5"></i>手机号输入不正确</span>
<!--<div class="clearfix mt20 mb20" style="border-bottom: 1px solid #ddd;border-top:1px solid #ddd ">-->
<!--<%#= form_tag(my_password_path(:user_id => @user.id),:id => 'my_password_form') do %>-->
<!--<li class="clearfix mb10 mt30">-->
<!--<label class="panel-form-label fl mr18">修改密码:</label>-->
<!--<input id="new_password" type="password" name="new_password" class="input-height task-form-20 panel-box-sizing fl" placeholder="设置8-16位新密码区分大小写字母">-->
<!--<i class="fa font-16 ml20" id="user_password_2_check"></i>-->
<!--<span class="color-orange fl hint none" id="user_password_2_notice" style="margin-left:20px;"> 新密码8-16位区分大小写字母</span>-->
<!--</li>-->
<!--<li class="clearfix mb30">-->
<!--<label class="panel-form-label fl mr18">确认密码:</label>-->
<!--<input id="new_password_confirmation" name="new_password_confirmation" type="password" class="input-height task-form-20 panel-box-sizing fl" placeholder="确认密码">-->
<!--<i class="fa font-16 ml20" id="user_password_3_check"></i>-->
<!--<span class="color-orange fl hint none" id="user_password_3_notice" style="margin-left:20px;">两次密码输入不一致</span>-->
<!--</li>-->
<!--<%# end %>-->
<!--</div>-->
<!--<div class="clearfix mt20">-->
<!--<li class="clearfix mb10">-->
<!--<label class="panel-form-label fl mr18">邮箱地址:</label>-->
<!--<input type="email" class="input-height task-form-20 panel-box-sizing fl" placeholder="请输入真实有效的邮箱" value="<%#= @user.mail %>" id="user_email_addr">-->
<!--<i class="fa font-16 ml20 " id="user_email_check"></i>-->
<!--<div class="cl"></div>-->
<!--<span class="color-orange fl hint none" id="user_email_hint" style="margin-left:12%;"><i class="fa fa-exclamation-circle mr5"></i>邮箱格式不正确</span>-->
<!--</li>-->
<!--<li class="clearfix mb25">-->
<!--<label class="panel-form-label fl mr18">手机号码:</label>-->
<!--<input type="tel" class="input-height task-form-20 panel-box-sizing fl" placeholder="请输入手机号码" value="<%#= @user.phone %>" id="user_phone">-->
<!--<i class="fa font-16 ml20 " id="user_phone_check"></i>-->
<!--<div class="cl"></div>-->
<!--<span class="color-orange fl hint none" id="user_phone_hint" style="margin-left:12%;"><i class="fa fa-exclamation-circle mr5"></i>手机号输入不正确</span>-->
</li>
<li class="clearfix mb20" style="margin-right:41px;">
<a href="javascript:void(0);" id="my_account_form_link" class="task-btn task-btn-blue fr">保存</a>
<a href="javascript:void(0);" onclick="cancel_edit_account();" class="task-btn fr mr10">取消</a>
</li>
</div>
<!--</li>-->
<!--<li class="clearfix mb20" style="margin-right:41px;">-->
<!--<a href="javascript:void(0);" id="my_account_form_link" class="task-btn task-btn-blue fr">保存</a>-->
<!--<a href="javascript:void(0);" onclick="cancel_edit_account();" class="task-btn fr mr10">取消</a>-->
<!--</li>-->
<!--</div>-->
<div id="search_school_result_list" style="width: 330px;line-height: 1.5;min-height:20px; max-height: 200px; height: auto !important;display: none;background: white;overflow: scroll;border: solid 1px #cccccc; overflow-x: hidden; overflow-y: auto;">
</div>
<div id="search_department_result_list" style="width: 330px;line-height: 1.5;min-height:20px; max-height: 200px; height: auto !important;display: none;background: white;overflow: scroll;border: solid 1px #cccccc; overflow-x: hidden; overflow-y: auto;">
@ -627,15 +663,93 @@
$("#userIdentity").change();
$("input[name='confirm_password']").on('blur',function(){
confirm_password = $("input[name='confirm_password']").val();
password = $("input[name='password']").val();
if(confirm_password != password){
$("#password_hint").css('display','block');
}
});
$("#new_password_confirmation").on("blur",function(){
$("#user_form_link").on("click",function(){
my_account_form_submit();
});
function my_account_form_submit(){
if ($("#nickname").val() == '') {
$("#nickname").focus();
$("#nickname_hint").show();
e.stopImmediatePropagation();
return;
} else{
$("#nickname_hint").hide();
}
//姓名不能为空
if ($("#lastname").val() == '') {
$("#lastname").focus();
$("#lastname_hint").show();
e.stopImmediatePropagation();
return;
} else{
$("#lastname_hint").hide();
}
if ($("#userIdentity").val() == -1) {
$("#identity_hint").show();
e.stopImmediatePropagation(); // 阻止事件冒泡
return;
} else{
$("#identity_hint").hide();
}
if ($("#teacher").is(":visible") == true && $("#teacher").val() == "0") {
$("#identity_hint").show();
e.stopImmediatePropagation();
return;
} else{
$("#identity_hint").hide();
}
if ($("#profession").is(":visible") == true && $("#profession").val() == "0") {
$("#identity_hint").show();
e.stopImmediatePropagation();
return;
} else{
$("#identity_hint").hide();
}
if ($("#user_student_id").parent().is(":visible") == true && $("#user_student_id").val() == "") {
$("#user_student_id").focus();
e.stopImmediatePropagation();
return;
}
if ($("#userProvince").val() == "0" || $("#userCity").val() == "0"){
$("#province_hint").show();
e.stopImmediatePropagation();
return;
} else{
$("#province_hint").hide();
}
// 单位或高校必须从下拉列表中选择
if ($("input[name='school']").val().trim() != '' && $("input[name='occupation']").val().trim() == '') { //学校名字和id不对的话
$("#school_name_hint").show();
e.stopImmediatePropagation();
return;
} else{
$("#school_name_hint").hide();
}
if ($("input[name='school']").val().trim() == '') { //学校名字必须填写
$("#school_name_hint").show();
e.stopImmediatePropagation();
return;
} else{
$("#school_name_hint").hide();
}
$("input[name='confirm_password']").on('blur',function(){
confirm_password = $("input[name='confirm_password']").val();
password = $("input[name='password']").val();
if(confirm_password != password){
$("#password_hint").css('display','block');
}
});
if($("#new_password").val().length < 8 || $("#new_password").val().length > 16){
$("#user_password_2_check").removeClass("fa-check-circle").removeClass("color-light-green").addClass("fa-times-circle").addClass("color-orange");
$("#user_password_3_check").removeClass("fa-check-circle").removeClass("color-light-green").addClass("fa-times-circle").addClass("color-orange");
@ -649,18 +763,21 @@
} else{
$("#user_password_3_check").removeClass("fa-times-circle").removeClass("color-orange").addClass("fa-check-circle").addClass("color-light-green");
$('#user_password_3_notice').hide();
$("#my_password_form").submit();
$("#my_password_form").submit();
}
}
});
$("#user_email_addr").blur(function (event) {
if (/^[a-zA-Z0-9]+([._\\]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(this.value) == false){
$('#user_phone_hint').show();
$('#user_phone_notice').show();
$("#user_email_check").removeClass("fa-check-circle").removeClass("color-light-green").addClass("fa-times-circle").addClass("color-orange");
$mail_correct = false;
return ;
}
});
$("#user_email_addr").blur(function (event) {
if (/^[a-zA-Z0-9]+([._\\]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(this.value) == false){
$('#user_phone_hint').show();
$('#user_phone_notice').show();
$("#user_email_check").removeClass("fa-check-circle").removeClass("color-light-green").addClass("fa-times-circle").addClass("color-orange");
$mail_correct = false;
return ;
}
});
$('#my_account_form').submit();
}
});
</script>

View File

@ -1 +0,0 @@
alert("修改成功");

View File

@ -36,9 +36,14 @@
<a href="javascript:void(0);" class="fr shixun-task-ban-btn mr15">已关闭</a>
<% end %>
<% if @shixun.can_copy || User.current.manager_of_shixun?(@shixun) %>
<%#= link_to "复制", copy_shixun_path(@shixun), :class => "fr shixun-task-btn task-btn-green mr15" %>
<a href="javascript:void(0);" onclick="op_confirm_box_loading('<%= copy_shixun_path(@shixun) %>', '复制将在后台执行</br>平台将为你创建一个新的同名实训和内容,请问是否继续?');" class = "fr shixun-task-btn task-btn-green mr15">复制</a>
<% end %>
<a href="<%= member_forked_project_path(@shixun) %>" class="fr pro_new_topbtn mr15 mt9 fork" title="fork成员列表"><%= Shixun.where(:fork_from => @shixun.id).count %></a>
<%= link_to "<span class='vl_fork'></span>".html_safe+"Fork", copy_shixun_path(@shixun),
:class=>"pro_new_topbtn_left fr mt9 fork", :remote => true%>
<!--<a href="javascript:void(0);" onclick="op_confirm_box_loading('<%#= copy_shixun_path(@shixun) %>', '复制将在后台执行</br>平台将为你创建一个新的同名实训和内容,请问是否继续?');" class = "fr shixun-task-btn task-btn-green mr15">复制</a>-->
<% end %>
<% end %>
<div class="cl"></div>
<% unless User.current.manager_of_shixun?(@shixun) %>

View File

@ -248,6 +248,10 @@ RedmineApp::Application.routes.draw do
get 'add_departments_part'
post 'save_school'
post 'update_user_message'
post 'add_auto_users_trial'
post 'create_auto_users_trial'
match 'update_auto_users_trial', :via => [:get, :post]
match 'account', :via => [:get, :post]
end
end
# Enable Grack support

View File

@ -0,0 +1,21 @@
class AddAutoUsersTrial < ActiveRecord::Migration
def up
#add_column :schools, :auto_users_trial, :boolean, :default => 0
applies = ApplyAction.where(:container_type => "TrialAuthorization", :status => 1, :dealer_id => nil)
if applies.present?
user_id = applies.map(&:user_id)
user_ex = UserExtensions.where(:user_id => user_id)
if user_ex.present?
user_school_id = user_ex.map(&:school_id)
School.where(:id => user_school_id).update_all(:auto_users_trial => true)
end
end
# sql = "select * from apply_actions where dealer_id is null && container_type ='TrialAuthorization' && status = 1"
# school_id = UserExtensions.find(sql)
# School.where(:id => school_id.school_id).update_column(:auto_users_trial, 1)
end
def down
end
end

View File

@ -99,7 +99,7 @@ a:hover.link-color-grey03{color:#3498db!important;}
.font-28{ font-size: 28px!important;}
.font-30{ font-size: 30px!important;}
/*通用内外边距*/
.mt-10{ margin-top:-10px;}.mt2{ margin-top:2px;}.mt3{ margin-top:3px;}.mt5{ margin-top:5px;}.mt6{ margin-top:6px;}.mt7{ margin-top:7px;}.mt8{ margin-top:8px;}.mt10{ margin-top:10px;}.mt12{ margin-top:12px;}.mt15{ margin-top:15px;}.mt20{ margin-top:20px;}.mt25{ margin-top:25px;}.mt30{ margin-top:30px;}.mt50{ margin-top:50px;}.mt95{ margin-top:95px;}
.mt-10{ margin-top:-10px;}.mt2{ margin-top:2px;}.mt3{ margin-top:3px;}.mt5{ margin-top:5px;}.mt6{ margin-top:6px;}.mt7{ margin-top:7px;}.mt8{ margin-top:8px;}.mt9{margin-top:9px;}.mt10{ margin-top:10px;}.mt12{ margin-top:12px;}.mt15{ margin-top:15px;}.mt20{ margin-top:20px;}.mt25{ margin-top:25px;}.mt30{ margin-top:30px;}.mt50{ margin-top:50px;}.mt95{ margin-top:95px;}
.mb5{ margin-bottom: 5px;}.mb10{ margin-bottom: 10px;}.mb15{ margin-bottom: 15px;}.mb20{ margin-bottom: 20px;}.mb25{ margin-bottom: 25px;}.mb30{ margin-bottom: 30px;}.mb40{ margin-bottom: 40px;}.mb50{ margin-bottom: 50px;}
.ml-3{ margin-left: -3px;}.ml5{ margin-left: 5px;}.ml6{ margin-left: 6px;}.ml10{ margin-left: 10px;}.ml15{ margin-left: 15px;}.ml18{ margin-left: 18px;}.ml20{ margin-left: 20px;}.ml25{ margin-left: 25px;}.ml30{ margin-left: 30px;}.ml33{ margin-left: 33px;}.ml35{ margin-left:35px;}.ml40{margin-left:40px;}.ml42{margin-left:42px;}.ml50{ margin-left: 50px;}.ml75{ margin-left: 75px;}.ml95{ margin-left: 95px;}.ml115{margin-left: 115px}.ml230{ margin-left: 230px;}
.mr3{margin-right: 3px}.mr5{ margin-right: 5px;}.mr10{ margin-right: 10px;}.mr15{ margin-right: 15px;}.mr18{ margin-right: 18px;}.mr20{ margin-right: 20px;}.mr25{ margin-right: 25px;}.mr30{ margin-right:30px;}.mr40{margin-right:40px;}.mr50{ margin-right: 50px;}.mr60{ margin-right:60px;}
@ -488,6 +488,7 @@ input::-ms-clear{display:none;}
/*在线课堂*/
.courseRefer{float:left; max-height:120px;margin-bottom:10px;overflow:auto; overflow-x:hidden;}
.logo {width: 295px;height: 30px;border-style:none;position: absolute;top:50%;left:39%;}
/*用户修改*/
.user{border-top: 1px solid #ddd;padding-top: 30px}
/*Fork*/
.task-header-info .fork{font-weight:bold;font-size:14px;color:#666}

View File

@ -413,8 +413,8 @@ a.pro_new_username { font-size: 20px; color: #3b94d6; line-height: 24px;}
a.pro_new_username_fork { font-size: 12px; color: #3b94d6; line-height: 24px;}
a.pro_new_proname{ overflow: hidden;white-space: nowrap;text-overflow:ellipsis;display: inline-block;}
a.pro_new_project_name{ width: 250px; overflow: hidden;white-space: nowrap;text-overflow:ellipsis;display: inline-block;}
a.pro_new_topbtn{ padding: 3px 7px; font-size: 12px; line-height: 20px; color: #333;vertical-align: middle;background-color: #fff; border: 1px solid #ddd; border-left: 0; border-top-right-radius: 3px; border-bottom-right-radius: 3px; color: #333;}
a.pro_new_topbtn_left { padding: 3px 10px; font-size: 12px;line-height: 20px; background-image: linear-gradient(#fcfcfc, #eee); border: 1px solid #d5d5d5;border-radius: 3px;border-top-right-radius: 0;border-bottom-right-radius: 0; color: #333;}
a.pro_new_topbtn{ padding: 4px 7px; font-size: 12px; line-height: 20px; color: #333;vertical-align: middle;background-color: #fff; border: 1px solid #ddd; border-left: 0; border-top-right-radius: 3px; border-bottom-right-radius: 3px; color: #333;}
a.pro_new_topbtn_left { padding: 4px 10px; font-size: 12px;line-height: 20px; background-image: linear-gradient(#fcfcfc, #eee); border: 1px solid #d5d5d5;border-radius: 3px;border-top-right-radius: 0;border-bottom-right-radius: 0; color: #333;}
a:hover.pro_new_topbtn_left{background-image: linear-gradient(#ededed, #dddddd);}
a.pro_new_grey_topbtn_left{padding: 3px 10px; font-size: 12px;line-height: 20px; background: #fff; border: 1px solid #d5d5d5;border-radius: 3px;border-top-right-radius: 0;border-bottom-right-radius: 0; color: #888888; cursor:default;}
.pro_new_topnav ul{border-bottom: 3px solid #fff; height: 30px; line-height: 30px;}