mast_item_banktwo
杨树林 5 years ago
commit b11ba8c004

@ -0,0 +1,74 @@
$(document).on('turbolinks:load', function() {
if ($('body.admins-salesmans-index-page').length > 0) {
// ============= 添加销售人员 ==============
var $addMemberModal = $('.admin-add-salesman-customer-user-modal');
var $addMemberForm = $addMemberModal.find('.admin-add-salesman-customer-user-form');
var $memberSelect = $addMemberModal.find('.salesman-user-select');
// var $salesmanIdInput = $addMemberForm.find('input[name="salesman_id"]')
$addMemberModal.on('show.bs.modal', function(event){
var $link = $(event.relatedTarget);
var salesmanId = $link.data('salesman-id');
$salesmanIdInput.val(salesmanId);
$memberSelect.select2('val', ' ');
});
$memberSelect.select2({
theme: 'bootstrap4',
placeholder: '请输入要添加的销售姓名',
multiple: true,
minimumInputLength: 1,
ajax: {
delay: 500,
url: '/admins/users',
dataType: 'json',
data: function(params){
return { name: params.term };
},
processResults: function(data){
return { results: data.users }
}
},
templateResult: function (item) {
if(!item.id || item.id === '') return item.text;
return $("<span>" + item.real_name + " <span class='font-12'>" + item.school_name + ' ' + item.hidden_phone + "</span></span>");
},
templateSelection: function(item){
if (item.id) {
}
return item.real_name || item.text;
}
});
$addMemberModal.on('click', '.submit-btn', function(){
$addMemberForm.find('.error').html('');
// var salesmanId = $salesmanIdInput.val();
var memberIds = $memberSelect.val();
if (memberIds && memberIds.length > 0) {
$.ajax({
method: 'POST',
dataType: 'json',
url: '/admins/salesman_customers/batch_add',
data: { user_ids: memberIds },
success: function(){
$.notify({ message: '创建成功' });
$addMemberModal.modal('hide');
setTimeout(function(){
window.location.reload();
}, 500);
},
error: function(res){
var data = res.responseJSON;
$form.find('.error').html(data.message);
}
});
} else {
$addMemberModal.modal('hide');
}
});
}
});

@ -0,0 +1,99 @@
$(document).on('turbolinks:load', function() {
if ($('body.admins-salesmans-index-page').length > 0) {
// ============= 添加销售人员 ==============
var $addMemberModal = $('.admin-add-salesman-user-modal');
var $addMemberForm = $addMemberModal.find('.admin-add-salesman-user-form');
var $memberSelect = $addMemberModal.find('.salesman-user-select');
// var $salesmanIdInput = $addMemberForm.find('input[name="salesman_id"]')
$addMemberModal.on('show.bs.modal', function(event){
var $link = $(event.relatedTarget);
// var salesmanId = $link.data('salesman-id');
// $salesmanIdInput.val(salesmanId);
$memberSelect.select2('val', ' ');
});
$memberSelect.select2({
theme: 'bootstrap4',
placeholder: '请输入要添加的销售姓名',
multiple: true,
minimumInputLength: 1,
ajax: {
delay: 500,
url: '/admins/users',
dataType: 'json',
data: function(params){
return { name: params.term };
},
processResults: function(data){
return { results: data.users }
}
},
templateResult: function (item) {
if(!item.id || item.id === '') return item.text;
return $("<span>" + item.real_name + " <span class='font-12'>" + item.school_name + ' ' + item.hidden_phone + "</span></span>");
},
templateSelection: function(item){
if (item.id) {
}
return item.real_name || item.text;
}
});
$addMemberModal.on('click', '.submit-btn', function(){
$addMemberForm.find('.error').html('');
// var salesmanId = $salesmanIdInput.val();
var memberIds = $memberSelect.val();
if (memberIds && memberIds.length > 0) {
$.ajax({
method: 'POST',
dataType: 'json',
url: '/admins/salesmans/batch_add',
data: { user_ids: memberIds },
success: function(){
$.notify({ message: '创建成功' });
$addMemberModal.modal('hide');
setTimeout(function(){
window.location.reload();
}, 500);
},
error: function(res){
var data = res.responseJSON;
$form.find('.error').html(data.message);
}
});
} else {
$addMemberModal.modal('hide');
}
});
$(".salesman-list-container").on("change", '.salesman-sync-course', function () {
var s_id = $(this).attr("data-id");
var json = {};
$.ajax({
url: "/admins/salesmans/" + s_id + "/update_sync_course",
type: "POST",
dataType:'script',
data: json
})
});
$(".salesman-list-container").on("change", '.salesman-sync-form', function () {
var s_id = $(this).attr("data-id");
var s_value = $(this).val();
var s_name = $(this).attr("name");
var json = {};
json[s_name] = s_value;
$.ajax({
url: "/admins/salesmans/" + s_id,
type: "PUT",
dataType:'script',
data: json
});
});
}
});

@ -0,0 +1,13 @@
class Admins::SalesmanCustomersController < Admins::BaseController
before_action :set_salesman
def index
@customers = @salesman.salesman_customers.includes(:user, :school)
end
private
def set_salesman
@salesman = Salesman.find params[:salesman_id]
end
end

@ -0,0 +1,29 @@
class Admins::SalesmansController < Admins::BaseController
before_action :set_salesman, except: [:index, :batch_add]
def index
@salesmans = Salesman.all
end
def destroy
@salesman.destroy!
end
# 批量增加销售人员
def batch_add
salesman_user_ids = Salesman.where(id: params[:user_ids]).pluck(:user_id)
user_ids = params[:user_ids] - salesman_user_ids
user_ids.each do |user_id|
user = User.find_by(id: user_id)
next if user.blank?
Salesman.create!(user_id: user.id, name: user.real_name)
end
render_ok
end
private
def set_salesman
@salesman = Salesman.find params[:id]
end
end

@ -308,7 +308,7 @@ class ApplicationController < ActionController::Base
end end
if !User.current.logged? && Rails.env.development? if !User.current.logged? && Rails.env.development?
User.current = User.find 1 User.current = User.find 8686
end end

@ -23,6 +23,9 @@ class MainController < ApplicationController
if params[:path] && params[:path]&.include?("educoderh5") && params[:path].split("/").first == "educoderh5" if params[:path] && params[:path]&.include?("educoderh5") && params[:path].split("/").first == "educoderh5"
render file: 'public/h5build/index.html', :layout => false render file: 'public/h5build/index.html', :layout => false
# TODO: 这块之后需要整合到上面去或者架构重新变化统一跳转到index后再路由分发
elsif params[:path] && params[:path]&.include?("h5educoderbuild") && params[:path].split("/").first == "h5educoderbuild"
render file: 'public/h5educoderbuild/index.html', :layout => false
else else
render file: 'public/react/build/index.html', :layout => false render file: 'public/react/build/index.html', :layout => false
end end

@ -1,8 +1,8 @@
class Weapps::CoursesController < Weapps::BaseController class Weapps::CoursesController < Weapps::BaseController
before_action :require_login before_action :require_login
before_action :set_course, except: [:create] before_action :set_course, except: [:create, :check_invite_code]
before_action :user_course_identity, except: [:basic_info, :create] before_action :user_course_identity, except: [:basic_info, :create, :check_invite_code]
before_action :check_account, only: [:create] before_action :check_account, only: [:create, :check_invite_code]
before_action :teacher_allowed, only: [:edit, :update] before_action :teacher_allowed, only: [:edit, :update]
before_action :teacher_or_admin_allowed, only: [:change_member_roles, :delete_course_teachers] before_action :teacher_or_admin_allowed, only: [:change_member_roles, :delete_course_teachers]
@ -38,6 +38,23 @@ class Weapps::CoursesController < Weapps::BaseController
@categories = current_course.shixun_course_modules.first&.course_second_categories @categories = current_course.shixun_course_modules.first&.course_second_categories
end end
def check_invite_code
tip_exception(-1, "邀请码不能为空") if params[:invite_code].blank?
invite_code = params[:invite_code]
course = Course.find_by(invite_code: invite_code, is_delete: 0, invite_code_halt: 0)
course_group = CourseGroup.find_by(invite_code: invite_code)
if course.blank?
tip_exception(-1, "邀请码无效") if course_group.blank?
course = Course.find_by(id: course_group.course_id, is_delete: 0, invite_code_halt: 0)
tip_exception(-1, "邀请码无效") if course.blank?
end
tip_exception(-1, "课堂已结束,无法加入") if course.is_end
render_ok
end
# 教师列表 # 教师列表
def teachers def teachers
@course = current_course @course = current_course
@ -184,11 +201,11 @@ class Weapps::CoursesController < Weapps::BaseController
private private
def course_params def course_params
params.permit(:name, :course_list_name, :credit, course_module_types: []) params.permit(:name, :course_list_name, :credit, :end_date, course_module_types: [])
end end
def update_course_params def update_course_params
params.permit(:name, :course_list_name, :credit) params.permit(:name, :course_list_name, :credit, :end_date)
end end
def current_course def current_course

@ -7,8 +7,6 @@ class ItemBanks::SaveItemForm
validates :sub_discipline_id, presence: true validates :sub_discipline_id, presence: true
validates :item_type, presence: true, inclusion: {in: %W(SINGLE MULTIPLE JUDGMENT COMPLETION SUBJECTIVE PRACTICAL PROGRAM)} validates :item_type, presence: true, inclusion: {in: %W(SINGLE MULTIPLE JUDGMENT COMPLETION SUBJECTIVE PRACTICAL PROGRAM)}
validates :difficulty, presence: true, inclusion: {in: 1..3}, numericality: { only_integer: true } validates :difficulty, presence: true, inclusion: {in: 1..3}, numericality: { only_integer: true }
validates :name, presence: true, length: { maximum: 1000, too_long: "不能超过1000个字符" }
validates :analysis, length: { maximum: 1000, too_long: "不能超过1000个字符" }
def validate! def validate!
super super
@ -27,7 +25,6 @@ class ItemBanks::SaveItemForm
attr_accessor :choice_text, :is_answer attr_accessor :choice_text, :is_answer
validates :choice_text, presence: true, length: { maximum: 500, too_long: "不能超过500个字符" }
validates :is_answer, presence: true, inclusion: {in: 0..1}, numericality: { only_integer: true } validates :is_answer, presence: true, inclusion: {in: 0..1}, numericality: { only_integer: true }
end end
end end

@ -2,7 +2,7 @@ class Weapps::CreateCourseForm
include ActiveModel::Model include ActiveModel::Model
attr_accessor :course attr_accessor :course
attr_accessor :name, :course_list_name, :credit, :course_module_types attr_accessor :name, :course_list_name, :credit, :course_module_types, :end_date
validates :name, presence: true validates :name, presence: true
validates :course_list_name, presence: true validates :course_list_name, presence: true

@ -2,7 +2,7 @@ class Weapps::UpdateCourseForm
include ActiveModel::Model include ActiveModel::Model
attr_accessor :course attr_accessor :course
attr_accessor :name, :course_list_name, :credit attr_accessor :name, :course_list_name, :credit, :end_date
validates :name, presence: true validates :name, presence: true
validates :course_list_name, presence: true validates :course_list_name, presence: true

@ -1,3 +1,4 @@
class ItemAnalysis < ApplicationRecord class ItemAnalysis < ApplicationRecord
belongs_to :item_bank, touch: true belongs_to :item_bank, touch: true
validates :analysis, length: { maximum: 5000, too_long: "不能超过5000个字符" }
end end

@ -13,6 +13,7 @@ class ItemBank < ApplicationRecord
has_many :tag_disciplines, through: :tag_discipline_containers has_many :tag_disciplines, through: :tag_discipline_containers
belongs_to :container, polymorphic: true, optional: true belongs_to :container, polymorphic: true, optional: true
validates :name, presence: true, length: { maximum: 1000, too_long: "不能超过1000个字符" }
def analysis def analysis
item_analysis&.analysis item_analysis&.analysis

@ -1,3 +1,5 @@
class ItemChoice < ApplicationRecord class ItemChoice < ApplicationRecord
belongs_to :item_bank, touch: true belongs_to :item_bank, touch: true
validates :choice_text, presence: true, length: { maximum: 500, too_long: "不能超过500个字符" }
end end

@ -0,0 +1,7 @@
class Salesman < ApplicationRecord
belongs_to :user
# 渠道
has_many :salesman_channels, dependent: :destroy
# 客户
has_many :salesman_customers, dependent: :destroy
end

@ -0,0 +1,3 @@
class SalesmanChannel < ApplicationRecord
belongs_to :salesman, :touch => true, counter_cache: true
end

@ -0,0 +1,22 @@
class SalesmanCustomer < ApplicationRecord
belongs_to :salesman, :touch => true, counter_cache: true
belongs_to :school
belongs_to :user
def name
user.real_name
end
def school_name
school.name
end
def courses_count
CourseMember.where(user_id: id).teachers_and_admin.count
end
def shixuns_count
ShixunMember.where(user_id: id, role: [1, 2]).count
end
end

@ -14,6 +14,7 @@ class Weapps::CreateCourseService < ApplicationService
course.school_id = course.teacher&.school_id course.school_id = course.teacher&.school_id
course.is_public = 0 course.is_public = 0
course.credit = params[:credit].blank? ? nil : params[:credit] course.credit = params[:credit].blank? ? nil : params[:credit]
course.end_date = params[:end_date].blank? ? nil : params[:end_date]
course_list = CourseList.find_by(name: params[:course_list_name].to_s.strip) course_list = CourseList.find_by(name: params[:course_list_name].to_s.strip)
if course_list if course_list
course.course_list_id = course_list.id course.course_list_id = course_list.id
@ -21,6 +22,8 @@ class Weapps::CreateCourseService < ApplicationService
new_course_list = CourseList.create!(name: params[:course_list_name].to_s.strip, user_id: course.tea_id, is_admin: 0) new_course_list = CourseList.create!(name: params[:course_list_name].to_s.strip, user_id: course.tea_id, is_admin: 0)
course.course_list_id = new_course_list.id course.course_list_id = new_course_list.id
end end
course.is_end = course.end_date.present? && course.end_date < Date.today
course.save! course.save!
course.generate_invite_code course.generate_invite_code

@ -12,6 +12,7 @@ class Weapps::UpdateCourseService < ApplicationService
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
course.name = params[:name].to_s.strip course.name = params[:name].to_s.strip
course.credit = params[:credit].blank? ? nil : params[:credit] course.credit = params[:credit].blank? ? nil : params[:credit]
course.end_date = params[:end_date].blank? ? nil : params[:end_date]
course_list = CourseList.find_by(name: params[:course_list_name].to_s.strip) course_list = CourseList.find_by(name: params[:course_list_name].to_s.strip)
if course_list if course_list
course.course_list_id = course_list.id course.course_list_id = course_list.id
@ -19,6 +20,7 @@ class Weapps::UpdateCourseService < ApplicationService
new_course_list = CourseList.create!(name: params[:course_list_name].to_s.strip, user_id: course.tea_id, is_admin: 0) new_course_list = CourseList.create!(name: params[:course_list_name].to_s.strip, user_id: course.tea_id, is_admin: 0)
course.course_list_id = new_course_list.id course.course_list_id = new_course_list.id
end end
course.is_end = course.end_date.present? && course.end_date < Date.today
course.save! course.save!
end end
course course

@ -1,27 +0,0 @@
<table class="table table-hover text-center repertoires-list-table">
<thead class="thead-light">
<tr>
<th width="6%">序号</th>
<th width="54%" class="text-left">技术体系</th>
<th width="16%">操作</th>
</tr>
</thead>
<tbody>
<% if @repertoires.present? %>
<% @repertoires.each_with_index do |repertoire, index| %>
<tr class="repertoire-item discipline-item-<%= repertoire.id %>">
<td><%= index + 1 %></td>
<td class="text-left">
<span><%= link_to repertoire.name, admins_sub_repertoires_path(repertoire_id: repertoire), :title => repertoire.name %></span>
</td>
<td>
<%= link_to '编辑', edit_admins_repertoire_path(repertoire), remote: true, class: 'action' %>
<%= delete_link '删除', admins_repertoire_path(repertoire, element: ".repertoire-item-#{repertoire.id}"), class: 'delete-repertoire-action' %>
</td>
</tr>
<% end %>
<% else %>
<%= render 'admins/shared/no_data_for_table' %>
<% end %>
</tbody>
</table>

@ -0,0 +1,15 @@
<% define_admin_breadcrumbs do %>
<% add_admin_breadcrumb("#{@salesman.name}的客户", admins_salesmans_path) %>
<% end %>
<div class="box search-form-container salesman-customer-list-form rig">
<div class="flex-1">
<%= javascript_void_link '新增客户', class: 'btn btn-primary', data: {salesman_id: @salesman.id, toggle: 'modal', target: '.admin-add-salesman-customer-user-modal' } %>
</div>
</div>
<div class="box admin-list-container salesman-customer-list-container">
<%= render(partial: 'admins/salesman_customers/shared/list') %>
</div>
<%= render 'admins/salesman_customers/shared/add_salesman_customers_user_modal' %>

@ -1,18 +1,25 @@
<div class="modal fade admin-edit-repertoire-modal" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal fade admin-add-salesman-customer-user-modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title">编辑技术体系</h5> <h5 class="modal-title">添加客户</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<%= simple_form_for([:admins, repertoire], html: { class: 'admin-edit-repertoire-form' }, defaults: { wrapper_html: { class: 'offset-md-1 col-md-10' } }) do |f| %> <form class="admin-add-salesman-user-form">
<%= f.input :name, as: :string, label: '名称' %> <%= hidden_field_tag(:salesman_id, nil) %>
<div class="form-group d-flex">
<label class="col-form-label">姓名:</label>
<div class="d-flex flex-column-reverse w-75">
<select id="user_ids" name="user_ids" class="form-control salesman-customer-user-select"></select>
</div>
</div>
<div class="error text-danger"></div> <div class="error text-danger"></div>
<% end %> </form>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>

@ -0,0 +1,34 @@
<table class="table table-hover text-center salesman-customer-list-table">
<thead class="thead-light">
<tr>
<th width="6%">序号</th>
<th width="20%" class="text-left">名称</th>
<th width="30%" class="text-left">单位</th>
<th width="22%" class="text-left">课堂数</th>
<th width="22%">实训数</th>
</tr>
</thead>
<tbody>
<% if @customers.present? %>
<% @customers.each_with_index do |customer, index| %>
<tr class="customer-item salesman-customer-item-<%= customer.id %>">
<td><%= index + 1 %></td>
<td class="text-left">
<span><%= link_to customer.name, user_path(customer), :title => customer.name %></span>
</td>
<td class="text-left">
<span><%= customer.school_name %></span>
</td>
<td class="text-left">
<span><%= customer.courses_count %></span>
</td>
<td>
<%= customer.shixuns_count %>
</td>
</tr>
<% end %>
<% else %>
<%= render 'admins/shared/no_data_for_table' %>
<% end %>
</tbody>
</table>

@ -0,0 +1,3 @@
$.notify({ message: '操作成功' },{ type: 'success' });
console.log()
$(".salesman-item-<%= params[:id]%>").remove();

@ -0,0 +1,15 @@
<% define_admin_breadcrumbs do %>
<% add_admin_breadcrumb('销售数据列表', admins_salesmans_path) %>
<% end %>
<div class="box search-form-container salesman-list-form rig">
<div class="flex-1">
<%= javascript_void_link '新增销售人员', class: 'btn btn-primary', data: { toggle: 'modal', target: '.admin-add-salesman-user-modal' } %>
</div>
</div>
<div class="box admin-list-container salesman-list-container">
<%= render(partial: 'admins/salesmans/shared/list') %>
</div>
<%= render 'admins/salesmans/shared/add_salesman_user_modal' %>

@ -1,18 +1,20 @@
<div class="modal fade admin-create-repertoire-modal" tabindex="-1" role="dialog" aria-hidden="true"> <div class="modal fade admin-add-salesman-user-modal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document"> <div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title">新建课程方向</h5> <h5 class="modal-title">添加销售人员</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form class="admin-create-repertoire-form" data-url="<%= admins_repertoires_path %>"> <form class="admin-add-salesman-user-form">
<%= hidden_field_tag(:salesman_id, nil) %>
<div class="form-group d-flex"> <div class="form-group d-flex">
<label for="new_mirror_id" class="col-form-label">名称:</label> <label class="col-form-label">名:</label>
<div class="w-75 d-flex flex-column"> <div class="d-flex flex-column-reverse w-75">
<%= text_field_tag(:name, nil, class: 'form-control', placeholder: '请输入名称') %> <select id="user_ids" name="user_ids" class="form-control salesman-user-select"></select>
</div> </div>
</div> </div>

@ -0,0 +1,37 @@
<table class="table table-hover text-center salesman-list-table">
<thead class="thead-light">
<tr>
<th width="6%">序号</th>
<th width="20%" class="text-left">名称</th>
<th width="30%" class="text-left">客户数(点击数字客户列表)</th>
<th width="30%" class="text-left">渠道数(点击数字渠道列表)</th>
<th width="14%">操作</th>
</tr>
</thead>
<tbody>
<% if @salesmans.present? %>
<% @salesmans.each_with_index do |salesman, index| %>
<tr class="salesman-item salesman-item-<%= salesman.id %>">
<td><%= index + 1 %></td>
<td class="text-left">
<span><%= link_to salesman.name, admins_salesman_path(salesman), :title => salesman.name %></span>
</td>
<td class="text-left">
<span><%= link_to salesman.salesman_customers_count.to_i,
admins_salesman_customers_path(salesman_id: salesman), :title => "点击进入客户列表" %></span>
</td>
<td class="text-left">
<span><%= link_to salesman.salesman_channels_count.to_i, admins_salesman_channels_path(salesman_id: salesman),
:title => "点击进入渠道列表" %></span>
</td>
<td>
<%= delete_link '删除', admins_salesman_path(salesman, element: ".salesman-item-#{salesman.id}"),
class: 'delete-salesman-action' %>
</td>
</tr>
<% end %>
<% else %>
<%= render 'admins/shared/no_data_for_table' %>
<% end %>
</tbody>
</table>

@ -87,6 +87,12 @@
<% end %> <% end %>
</li> </li>
<li>
<%= sidebar_item_group('#running_data', '运营数据', icon: 'bar-chart') do %>
<li><%= sidebar_item(admins_salesmans_path, '销售数据列表', icon: 'columns', controller: 'admins-salesman') %></li>
<% end %>
</li>
<li> <li>
<%= sidebar_item_group('#other-submenu', '其他', icon: 'list-alt') do %> <%= sidebar_item_group('#other-submenu', '其他', icon: 'list-alt') do %>
<li><%= sidebar_item(admins_repertoires_path, '技术体系', icon: 'sitemap', controller: 'admins-repertoire') %></li> <li><%= sidebar_item(admins_repertoires_path, '技术体系', icon: 'sitemap', controller: 'admins-repertoire') %></li>

@ -1,2 +1,2 @@
json.(@course, :id, :name, :credit) json.(@course, :id, :name, :credit, :end_date)
json.course_list_name @course.course_list&.name json.course_list_name @course.course_list&.name

@ -18,11 +18,13 @@ end
json.course_count @course_count json.course_count @course_count
json.courses @courses.each do |course| json.courses @courses.each do |course|
json.(course, :id, :name, :visits, :course_members_count) json.(course, :id, :name, :visits, :course_members_count, :is_end, :invite_code_halt)
json.creator course.teacher.real_name json.creator course.teacher.real_name
json.avatar_url url_to_avatar(course.teacher) json.avatar_url url_to_avatar(course.teacher)
json.invite_code course.invite_code_halt == 0 ? course.generate_invite_code : ""
json.school course.school&.name json.school course.school&.name
course_member = @category == "study" ? course.students.where(user_id: @user.id).first : course.teachers.where(user_id: @user.id).first course_member = @category == "study" ? course.students.where(user_id: @user.id).first : course.teachers.where(user_id: @user.id).first
json.sticky course_member.sticky json.sticky course_member.sticky
json.course_identity current_user.course_identity(course)
end end

@ -1043,6 +1043,10 @@ Rails.application.routes.draw do
get :course_groups get :course_groups
get :basic_info get :basic_info
end end
collection do
get :check_invite_code
end
end end
resources :homework_commons do resources :homework_commons do
@ -1352,6 +1356,12 @@ Rails.application.routes.draw do
resources :repertoires, only: [:index, :create, :edit, :update, :destroy] resources :repertoires, only: [:index, :create, :edit, :update, :destroy]
resources :sub_repertoires, only: [:index, :create, :edit, :update, :destroy] resources :sub_repertoires, only: [:index, :create, :edit, :update, :destroy]
resources :tag_repertoires, only: [:index, :create, :edit, :update, :destroy] resources :tag_repertoires, only: [:index, :create, :edit, :update, :destroy]
resources :salesmans, only: [:index, :create, :edit, :update, :destroy] do
post :batch_add, on: :collection
end
resources :salesman_channels, only: [:index, :create, :edit, :update, :destroy]
resources :salesman_customers, only: [:index, :create, :edit, :update, :destroy]
end end
namespace :cooperative do namespace :cooperative do

@ -0,0 +1,11 @@
class CreateSalesmen < ActiveRecord::Migration[5.2]
def change
create_table :salesmen do |t|
t.references :user
t.string :name
t.integer :salesman_channels_count
t.integer :salesman_customers_count
t.timestamps
end
end
end

@ -0,0 +1,9 @@
class CreateSalesmanChannels < ActiveRecord::Migration[5.2]
def change
create_table :salesman_channels do |t|
t.references :salesman
t.references :school
t.timestamps
end
end
end

@ -0,0 +1,10 @@
class CreateSalesmanCustomers < ActiveRecord::Migration[5.2]
def change
create_table :salesman_customers do |t|
t.references :salesman
t.references :user
t.references :school
t.timestamps
end
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

@ -44,7 +44,7 @@ if (isDev) {
// 超管 // 超管
debugType="admin"; debugType="admin";
// 老师 // 老师
// debugType="teacher"; //debugType="teacher";
// 学生 // 学生
// debugType="student"; // debugType="student";

@ -542,6 +542,9 @@ const options = [{
children: [{ children: [{
value: "南宁", value: "南宁",
label: '南宁' label: '南宁'
},{
value: "来宾",
label: '来宾'
},{ },{
value: '百色', value: '百色',
label: '百色' label: '百色'
@ -810,6 +813,9 @@ const options = [{
children: [{ children: [{
value: "武汉", value: "武汉",
label: '武汉' label: '武汉'
},{
value: "天门",
label: '天门'
},{ },{
value: '恩施', value: '恩施',
label: '恩施' label: '恩施'
@ -1626,6 +1632,9 @@ const options = [{
children: [{ children: [{
value: "杭州", value: "杭州",
label: '杭州' label: '杭州'
},{
value: "温州",
label: '温州'
},{ },{
value: '安吉', value: '安吉',
label: '安吉' label: '安吉'

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe SalesmanChannel, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe SalesmanCustomer, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe Salesman, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end
Loading…
Cancel
Save