dev_trainings
p31729568 6 years ago
commit e5dd2e40b7

@ -4161,7 +4161,7 @@ end
sheet1 = book.create_worksheet :name => "sheet"
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
sheet1.row(0).default_format = blue
sheet1.row(0).concat(["姓名", "手机号","邮箱","单位名称", "职位","专业", "学号", "支付方式","支付状态","支付时间", "发票类型", "发票抬头","税务登记号", "发票内容", "备注", "微信支付单号", "报名时间"])
sheet1.row(0).concat(["姓名", "手机号","邮箱","单位名称", "职位","专业", "学号", '培训类型', '授课/研究领域' "支付方式","支付状态","支付时间", "发票类型", "发票抬头","税务登记号", "发票内容", "备注", "微信支付单号", "报名时间"])
count_row = 1
trainings.find_each do |t|
sheet1[count_row, 0] = t.name
@ -4171,16 +4171,18 @@ end
sheet1[count_row, 4] = t.position
sheet1[count_row, 5] = t.major
sheet1[count_row, 6] = t.student_id
sheet1[count_row, 7] = t.training_payinfo.try(:pay_type_str)
sheet1[count_row, 8] = t.training_payinfo.try(:pay_status_str)
sheet1[count_row, 9] = format_time t.training_payinfo.try(:pay_time)
sheet1[count_row, 10] = t.training_payinfo.try(:invoice_title).present? ? '需要' : '不需要'
sheet1[count_row, 11] = t.training_payinfo.try(:invoice_title)
sheet1[count_row, 12] = t.training_payinfo.try(:invoice_no)
sheet1[count_row, 13] = t.training_payinfo.try(:invoice_content)
sheet1[count_row, 14] = t.training_payinfo.try(:info)
sheet1[count_row, 15] = t.training_payinfo.try(:out_trade_no)
sheet1[count_row, 16] = format_time t.created_at
sheet1[count_row, 7] = t.training_category
sheet1[count_row, 8] = t.research_field
sheet1[count_row, 9] = t.training_payinfo.try(:pay_type_str)
sheet1[count_row, 10] = t.training_payinfo.try(:pay_status_str)
sheet1[count_row, 11] = format_time t.training_payinfo.try(:pay_time)
sheet1[count_row, 12] = t.training_payinfo.try(:invoice_title).present? ? '需要' : '不需要'
sheet1[count_row, 13] = t.training_payinfo.try(:invoice_title)
sheet1[count_row, 14] = t.training_payinfo.try(:invoice_no)
sheet1[count_row, 15] = t.training_payinfo.try(:invoice_content)
sheet1[count_row, 16] = t.training_payinfo.try(:info)
sheet1[count_row, 17] = t.training_payinfo.try(:out_trade_no)
sheet1[count_row, 18] = format_time t.created_at
count_row += 1
end
book.write xls_report

@ -5,9 +5,12 @@ class TrainingsController < ApplicationController
skip_before_filter :verify_signature, only: [:show, :create, :test]
ROOT_URL = ENV["wechat_url"] || "#{Setting.protocol}://#{Setting.host_name}"
# ROOT_URL = ENV["wechat_url"] || "#{Setting.protocol}://#{Setting.host_name}"
#
# before_filter :authenticate, except: [:auth, :auth_callback, :pay_callback]
#
before_filter :find_tag_id
before_filter :authenticate, except: [:auth, :auth_callback, :pay_callback]
before_filter :find_training, only: [:show, :test]
before_filter :valid_training, only: [:pay, :result, :pay_js]
@ -15,18 +18,18 @@ class TrainingsController < ApplicationController
layout 'base_trainings'
TAG_ID = 'bigdata_hnjcxy_2019'
# TAG_ID = 'bigdata_hnjcxy_2019'
def show
@training = current_training
url = nil
if @training && !@training.pay?
url = enroll_training_path(id: TAG_ID)
url = enroll_training_path(id: @tag_id)
elsif @training && @training.pay?
url = result_training_path(id: TAG_ID)
url = result_training_path(id: @tag_id)
else
url = enroll_training_path(id: TAG_ID)
url = enroll_training_path(id: @tag_id)
end
redirect_to url
@ -34,6 +37,9 @@ class TrainingsController < ApplicationController
def enroll
@training = current_training || Training.new
Rails.logger.info("##########training_type:#{@training_type}")
@training_title = @training_type == 3 ? "信息技术新工科产学研联盟师资培训班" : "工程教育认证"
Rails.logger.info("##########training_title:#{@training_title}")
end
@ -45,7 +51,7 @@ class TrainingsController < ApplicationController
# 防止重复支付,对于已支付过的,不应该再到这个页来
if @training.payed?
redirect_to result_training_path(id: TAG_ID)
redirect_to result_training_path(id: @tag_id)
return
end
@ -100,11 +106,16 @@ class TrainingsController < ApplicationController
def create
@training = current_training || Training.new(params)
@training.training_type = Training::Training_Type
@training.training_type = @training_type
if @training_type == 3
@training.research_field = params[:research_field].select(&:present?).uniq.join(",")
@training.training_category = params[:training_category]
end
@training.openid = session[:wechat_open_id]
@training.save!
redirect_to pay_training_path(id: TAG_ID)
redirect_to enroll_training_path(id: @tag_id)
# redirect_to pay_training_path(id: @tag_id)
end
@ -115,8 +126,15 @@ class TrainingsController < ApplicationController
return
end
@training.update_attributes(params)
redirect_to pay_training_path(id: TAG_ID)
@training.assign_attributes(params)
if @training.training_type == 3
@training.research_field = params[:research_field].select(&:present?).uniq.join(",")
@training.training_category = params[:training_category]
end
@training.save!
redirect_to enroll_training_path(id: @tag_id)
# redirect_to pay_training_path(id: @tag_id)
end
@ -168,7 +186,7 @@ class TrainingsController < ApplicationController
if params[:js] == 'true'
_pay_js(training_info.fee)
else
redirect_to url = result_training_path(id: TAG_ID)
redirect_to url = result_training_path(id: @tag_id)
end
end
@ -232,11 +250,11 @@ class TrainingsController < ApplicationController
url = ''
if !@training
url = training_path(id: TAG_ID)
url = training_path(id: @tag_id)
elsif !@training.pay?
url = enroll_training_path(id: TAG_ID)
url = enroll_training_path(id: @tag_id)
else
url = result_training_path(id: TAG_ID)
url = result_training_path(id: @tag_id)
end
redirect_to url
@ -262,8 +280,15 @@ class TrainingsController < ApplicationController
end
end
def find_tag_id
@tag_id = params[:tag_id] || params[:id]
Rails.logger.info("##########TAG_ID:#{@tag_id}")
@training_type = @tag_id == "aeee0601_2019" ? 3 : @tag_id == "ceeaa06_2019" ? 4 : 0
render_404 if @training_type == 0
end
def find_training
if params[:id] == TAG_ID
if params[:id] == @tag_id
@training = current_training
else
render_404
@ -271,18 +296,16 @@ class TrainingsController < ApplicationController
end
def current_training
Training.where(openid: session[:wechat_open_id], training_type: Training::Training_Type).first
Rails.logger.info("##########openid:#{session[:wechat_open_id]}, training_type: #{@training_type}")
Training.where(openid: session[:wechat_open_id], training_type: @training_type).first
end
def valid_training
unless current_training
redirect_to training_path(id: TAG_ID)
redirect_to training_path(id: @tag_id)
end
end
private
def js_function_call
begin
yield if block_given?

@ -3,7 +3,7 @@ class Training < ActiveRecord::Base
attr_accessible :address, :email, :name, :phone, :position, :school, :sex, :openid, :training_type,
:major, :student_id
# training_type 1 2018-培训会 2 警察学院大数据培训会
# training_type 1 2018-培训会 2 警察学院大数据培训会 3 大数据和人工智能 4 工程教育认证
has_one :training_payinfo
@ -21,4 +21,8 @@ class Training < ActiveRecord::Base
pay? && training_payinfo.payed?
end
def research_field_include?(str)
research_field.present? && research_field.split(',').include?(str)
end
end

@ -1,4 +1,5 @@
<div>
<% if false %>
<div>
<p class="collegeInfo">湖南警察学院大数据培训缴费</p>
<%= form_for @training do |f| %>
<p class="subtitle">基本信息</p>
@ -11,7 +12,7 @@
<span class="left_tag fl">性别</span>
<label class="fr" id="sexl" style="margin-right: 24px;"><%= @training.sex == 1 ? '男' : '女' %></label>
<i class="iconfont icon-youjiantou rightArrow"></i>
<input type="hidden" id="sex" name="sex" value="<%= @training.sex ==1 ?1 : 2 %>">
<input type="hidden" id="sex" name="sex" value="<%= @training.sex == 1 ? 1 : 2 %>">
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">专业</span>
@ -63,6 +64,191 @@
<p style="height: 50px;"></p>
<a href="javascript:void(0)" class="EnrollNext" onclick="NextStep();">下一步</a>
<% end %>
</div>
<div class="sexDownNav downNav">
<li>男</li>
<li>女</li>
</div>
<script>
$(function () {
var down = $('#userSex');
var downNav = $(".sexDownNav");
showNav(down, downNav, "down");
$(".sexDownNav li").on("click", function () {
$(down).find("#sexl").html($(this).html());
hideNav(downNav);
if ($(this).html() == '男') {
$('#sex').val("1");
} else {
$('#sex').val("2");
}
})
})
//下一步
function NextStep() {
var username = $("#username").val();
var userMajor = $("#userMajor").val();
var userphone = $("#userphone").val();
var userID = $("#userID").val();
if (username == '') {
alert("请输入真实姓名");
return;
}
if (userMajor == '') {
alert("请输入专业");
return;
}
if (userID == '') {
alert("请输入学号");
return;
}
if (userphone == '') {
alert("请输入手机号码");
return;
} else if (!/^1\d{10}$/.test(userphone) && !/^[a-zA-Z0-9]+([.\-_\\]*[a-zA-Z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/.test(userphone)) {
alert("请输入正确的手机号码");
return;
}
$('form').submit();
}
</script>
<% end %>
<div>
<p class="collegeInfo"><%= @training_title %></p>
<%= form_for @training do |f| %>
<%= hidden_field_tag(:tag_id, @tag_id) %>
<p class="subtitle">基本信息</p>
<li class="clearfix infoBar">
<span class="left_tag fl">姓名</span>
<input type="text" class="right_input" id="username" name="name"
placeholder="请输入真实姓名" value="<%= @training.name %>"/>
</li>
<li class="clearfix infoBar" id="userSex" NavShow>
<span class="left_tag fl">性别</span>
<label class="fr" id="sexl" style="margin-right: 24px;"><%= @training.sex == 1 ? '男' : '女' %></label>
<i class="iconfont icon-youjiantou rightArrow"></i>
<input type="hidden" id="sex" name="sex" value="<%= @training.sex == 1 ? 1 : 2 %>">
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">单位</span>
<input type="text" class="right_input" id="userUnit" placeholder="请输入单位名称或者学校"
name="school"
value="<%= @training.school %>"/>
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">职称</span>
<input type="text" class="right_input" id="userPositional" placeholder="请输入职称"
name="position"
value="<%= @training.position %>"/>
</li>
<% if @training_type == 3 %>
<p class="subtitle">培训类型</p>
<li class="clearfix infoBar">
<span class="left_tag fl">大数据方向</span>
<span class="fr">
<%= radio_button_tag(:training_category, '大数据方向', @training.training_category == '大数据方向', id: 'type_1', class: 'magic-radio') %>
<label for="type_1" style="top:8px">&nbsp;</label>
</span>
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">人工智能方向</span>
<span class="fr">
<%= radio_button_tag(:training_category, '人工智能方向', @training.training_category == '人工智能方向', id: 'type_2', class: 'magic-radio') %>
<label for="type_2" style="top:8px">&nbsp;</label>
</span>
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">大数据+人工智能方向</span>
<span class="fr">
<%= radio_button_tag(:training_category, '大数据+人工智能方向', @training.training_category == '大数据+人工智能方向', id: 'type_3', class: 'magic-radio') %>
<label for="type_3" style="top:8px">&nbsp;</label>
</span>
</li>
<p class="subtitle">您的授课/研究领域最少选1项</p>
<li class="clearfix infoBar">
<span class="left_tag fl">机器学习/深度学习</span>
<span class="fr">
<input type="checkbox" name="research_field[]" value="机器学习/深度学习" <%= @training.research_field_include?("机器学习/深度学习") ? "checked" : "" %> id="check_1" class="magic-checkbox">
<label for="check_1" style="top:8px">&nbsp;</label>
</span>
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">计算机结构与组成</span>
<span class="fr">
<input type="checkbox" name="research_field[]" value="计算机结构与组成" <%= @training.research_field_include?("计算机结构与组成") ? "checked" : "" %> id="check_2" class="magic-checkbox">
<label for="check_2" style="top:8px">&nbsp;</label>
</span>
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">计算机系统</span>
<span class="fr">
<input type="checkbox" name="research_field[]" value="计算机系统" <%= @training.research_field_include?("计算机系统") ? "checked" : "" %> id="check_3" class="magic-checkbox">
<label for="check_3" style="top:8px">&nbsp;</label>
</span>
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">计算机软件技术和应用</span>
<span class="fr">
<input type="checkbox" name="research_field[]" value="计算机软件技术和应用" <%= @training.research_field_include?("计算机软件技术和应用") ? "checked" : "" %> id="check_4" class="magic-checkbox">
<label for="check_4" style="top:8px">&nbsp;</label>
</span>
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">计算机理论</span>
<span class="fr">
<input type="checkbox" name="research_field[]" value="计算机理论" <%= @training.research_field_include?("计算机理论") ? "checked" : "" %> id="check_5" class="magic-checkbox">
<label for="check_5" style="top:8px">&nbsp;</label>
</span>
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">计算机应用与学科交叉</span>
<span class="fr">
<input type="checkbox" name="research_field[]" value="计算机应用与学科交叉" <%= @training.research_field_include?("计算机应用与学科交叉") ? "checked" : "" %> id="check_6" class="magic-checkbox">
<label for="check_6" style="top:8px">&nbsp;</label>
</span>
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">其他</span>
<span class="fr">
<input type="checkbox" name="research_field[]" value="其他" <%= @training.research_field_include?("其他") ? "checked" : "" %> id="check_7" class="magic-checkbox">
<label for="check_7" style="top:8px">&nbsp;</label>
</span>
</li>
<% end %>
<p class="subtitle">通讯地址</p>
<li class="clearfix infoBar">
<!--<div class="clearfix" id="userArea" NavShow>-->
<!--<span class="left_tag fl">地区</span>-->
<!--<input type="text" class="right_input" id="usertitle" placeholder="填写区域"/>-->
<!--<i class="iconfont icon-youjiantou rightArrow"></i>-->
<!--</div>-->
<textarea class="DetailAddress" placeholder="请输入详细地址" name="address" id="DetailAdd" style="margin-top: 15px;"><%= @training.address %></textarea>
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">手机号码</span>
<input type="text" class="right_input" placeholder="请输入手机号" id="userphone"
name="phone"
value="<%= @training.phone %>"/>
</li>
<li class="clearfix infoBar">
<span class="left_tag fl">Email</span>
<input type="text" class="right_input" placeholder="请输入Email" id="userEmail" name="email" value="<%= @training.email %>"/>
</li>
<p style="height: 50px;"></p>
<a href="javascript:void(0)" class="EnrollNext" onclick="NextStep();">完成</a>
<% end %>
</div>
<div class="sexDownNav downNav">
@ -79,7 +265,7 @@
$(down).find("#sexl").html($(this).html());
hideNav(downNav);
if ($(this).html()=='男'){
if ($(this).html() == '男') {
$('#sex').val("1");
} else {
$('#sex').val("2");
@ -108,6 +294,19 @@
return;
}
<% if @training_type == 3 %>
var trainingCategory = $('input[type="radio"][name="training_category"]:checked').val();
if (trainingCategory == undefined || trainingCategory == '') {
alert('请选择培训类型');
return;
}
if ($("input[type='checkbox'][name='research_field[]']:checked").length == 0) {
alert('请选择授课类型/研究领域');
return;
}
<% end %>
if (userphone == '') {
alert("请输入手机号码");
return;

@ -15,22 +15,22 @@
<div class="flex1 accountRight">
<li class="df">
<label class="fl">账&nbsp;&nbsp;&nbsp;号:</label>
<p class="fl flex1 break-word">800190320609016</p>
<p class="fl flex1 break-word">1901008009200085901</p>
</li>
<li class="df">
<label class="fl">户&nbsp;&nbsp;&nbsp;名:</label>
<p class="fl flex1">湖南酷得网络科技有限公司</p>
<p class="fl flex1">长沙智擎信息技术有限公司</p>
</li>
<li class="df">
<label class="fl">开户行:</label>
<p class="fl flex1">长沙银行股份有限公司四方支行</p>
<p class="fl flex1">工商银行长沙市岳麓山支行</p>
</li>
</div>
</div>
<p class="payTip">完成线下支付后,请将支付截图粘贴到备注中,以便财务审核</p>
</div>
</div>
<!--发票<div class="infoBar mb10">
<div class="infoBar mb10">
<p class="clearfix" id="billLine" NavShow>
<span class="grey fl">发票</span>
<label class="fr" id="billDemand" status=2 style="margin-right: 24px;">不需要</label>
@ -41,7 +41,7 @@
<input type="text" name="invoice_content" class="right_input"
value="<%#= @training.training_payinfo.invoice_content.presence || '会议注册费' %>"/>
</p>
</div>-->
</div>
<div class="infoBar mb10">
<p>备注</p>
<textarea class="remarkAccount" name="info" id="info"><%= @training.training_payinfo.info %></textarea>
@ -137,20 +137,20 @@
// invoiceNo: '<%#= @training.training_payinfo.invoice_no %>'
// };
//点击弹出发票弹框
//aboutBillType(userInfo);
aboutBillType(userInfo);
//点击弹出支付方式弹框
aboutPayType();
//初始化发票类型
/*InitBill(userInfo);*/
InitBill(userInfo);
//切换发票类型
/*$(".billType li").on("click", function () {
$(".billType li").on("click", function () {
$(".billType li").removeClass("active");
$(this).addClass("active");
billTypeShowFun(parseInt($(this).index()),userInfo);
})*/
})
//关闭弹窗
$(".billClose").on("click", function () {
hideNav($(".downNav"));
@ -257,7 +257,7 @@
})
})
//页面加载时,初始化发票类型
/*function InitBill(userInfo){
function InitBill(userInfo){
var index=2;
$("#billDemand").html("不需要").attr("status",2);
if(userInfo.invoiceTitle != "" && userInfo.invoiceNo != ""){
@ -271,7 +271,7 @@
$(".billType li").removeClass("active");
$(".billType li").eq(index).addClass("active");
billTypeShowFun(index,userInfo);
}*/
}
function billTypeShowFun(index,userInfo){
if (parseInt(index) == 0) {
$(".needWrite").removeClass("none");
@ -288,11 +288,11 @@
}
//点击弹出发票类型弹框
/*function aboutBillType(userInfo){
function aboutBillType(userInfo){
var bill = $("#billLine");
var billNav = $(".billDownNav");
showNav(bill, billNav, "down");
}*/
}
//点击弹出支付方式弹框
function aboutPayType() {

@ -0,0 +1,5 @@
class AddReseachFieldToTrainings < ActiveRecord::Migration
def change
add_column :trainings, :research_field, :string
end
end

@ -0,0 +1,5 @@
class AddTrainingCategoryToTrainings < ActiveRecord::Migration
def change
add_column :trainings, :training_category, :string
end
end

File diff suppressed because one or more lines are too long

@ -120,8 +120,15 @@ input::-ms-input-placeholder,textarea::-ms-input-placeholder {color:#cccccc;}
span.left_tag{font-weight:bold; }
input[type='text'].right_input{
float: right;border: none;text-align: right;height: 44px;line-height: 44px;outline: none;
font-size: 1.4rem;width: 70%;margin-right: 24px;
font-size: 1.4rem;width: 70%;/*margin-right: 24px;*/
}
.PositionalRight .magic-radio + label:before,.PositionalRight .magic-checkbox + label:before{
top:13px!important;
}
.PositionalRight .magic-radio + label:after{
top: 18px!important;
}
.mr15{margin-right: 15px;}
.infoBar label.right_tag{
float: right;color: #cccccc;font-size: 1.4rem;margin-right: 24px;
}

Loading…
Cancel
Save