diff --git a/app/controllers/trainings_controller.rb b/app/controllers/trainings_controller.rb
index cd555249..0f291f4e 100644
--- a/app/controllers/trainings_controller.rb
+++ b/app/controllers/trainings_controller.rb
@@ -57,7 +57,11 @@ class TrainingsController < ApplicationController
return
end
- @training.training_payinfo ||= TrainingPayinfo.new
+ @training.training_payinfo ||= begin
+ payinfo = TrainingPayinfo.new
+ payinfo.fee = @training.registration_fee # 默认值价格不对
+ payinfo
+ end
end
def pay_callback
@@ -114,8 +118,7 @@ class TrainingsController < ApplicationController
flash[:message] = '提交成功'
- redirect_to enroll_training_path(id: @tag_id)
- # redirect_to pay_training_path(id: @tag_id)
+ redirect_to pay_training_path(id: @tag_id)
end
@@ -134,8 +137,7 @@ class TrainingsController < ApplicationController
flash[:message] = '提交成功'
- redirect_to enroll_training_path(id: @tag_id)
- # redirect_to pay_training_path(id: @tag_id)
+ redirect_to pay_training_path(id: @tag_id)
end
@@ -163,7 +165,7 @@ class TrainingsController < ApplicationController
training_info = TrainingPayinfo.new(params)
end
- training_info.num = params[:enlistN].to_i < 1 ? 1 : params[:enlistN].to_i
+ training_info.num = params[:enlistNum].to_i < 1 ? 1 : params[:enlistNum].to_i
training_info.fee = @training.registration_fee(training_info.num)
diff --git a/app/views/trainings/enroll.html.erb b/app/views/trainings/enroll.html.erb
index 6b898691..84a88510 100644
--- a/app/views/trainings/enroll.html.erb
+++ b/app/views/trainings/enroll.html.erb
@@ -152,57 +152,25 @@
name="position"
value="<%= @training.position %>"/>
+
+ 手机号码
+
+
+
<% if @training_type == 3 %>
- 您的授课/研究领域(最少选1项)
-
- 机器学习/深度学习
-
- id="check_1" class="magic-checkbox">
-
-
-
-
- 计算机结构与组成
-
- id="check_2" class="magic-checkbox">
-
-
-
-
- 计算机系统
-
- id="check_3" class="magic-checkbox">
-
-
-
-
- 计算机软件技术和应用
-
- id="check_4" class="magic-checkbox">
-
-
-
-
- 计算机理论
-
- id="check_5" class="magic-checkbox">
-
-
-
-
- 计算机应用与学科交叉
-
- id="check_6" class="magic-checkbox">
-
-
-
-
- 其他
-
- id="check_7" class="magic-checkbox">
-
-
-
+ 您关注的课程类型(最少选1项)
+
+ <% %w(程序设计 操作系统 数据库 软件工程 云计算 大数据 人工智能 计算机网络 物联网 信息安全 其他).each_with_index do |name, index| %>
+
+ <%= name %>
+
+ id="check_<%= index %>" class="magic-checkbox">
+
+
+
+ <% end %>
<% end %>
@@ -214,12 +182,6 @@
-
- 手机号码
-
-
@@ -258,40 +220,40 @@
//下一步
function NextStep() {
- var username = $("#username").val();
- var userMajor = $("#userMajor").val();
- var userphone = $("#userphone").val();
- var userID = $("#userID").val();
+ var username = $("#username").val();
+ var userUnit = $("#userUnit").val();
+ var userPositional = $("#userPositional").val();
+ var userphone = $("#userphone").val();
- if (username == '') {
- alert("请输入真实姓名");
- return;
- }
- if (userMajor == '') {
- alert("请输入专业");
- return;
- }
+ if (username == '') {
+ alert("请输入姓名");
+ return;
+ }
+ if (userUnit == '') {
+ alert("请输入单位名称或者学校");
+ return;
+ }
- if (userID == '') {
- alert("请输入学号");
- return;
- }
+ if (userPositional == '') {
+ 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;
+ }
<% if @training_type == 3 %>
if ($("input[type='checkbox'][name='research_field[]']:checked").length == 0) {
- alert('请选择授课类型/研究领域');
+ alert('请选择您关注的课程类型');
return;
}
<% end %>
- 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();
}
diff --git a/app/views/trainings/pay.html.erb b/app/views/trainings/pay.html.erb
index 875845f7..8474233f 100644
--- a/app/views/trainings/pay.html.erb
+++ b/app/views/trainings/pay.html.erb
@@ -1,13 +1,16 @@