Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

sso
daiao 5 years ago
commit f96aa50509

@ -3,19 +3,15 @@ $(document).on('turbolinks:load', function() {
// ============= 添加销售人员 ============== // ============= 添加销售人员 ==============
var $addMemberModal = $('.admin-add-salesman-channel-user-modal'); var $addMemberModal = $('.admin-add-salesman-channel-user-modal');
var searchscForm = $(".saleman-channel-list-form .search-form");
var scFormUrl = searchscForm.data('data-search-form-url');
var $addMemberForm = $addMemberModal.find('.admin-add-salesman-channel-user-form'); var $addMemberForm = $addMemberModal.find('.admin-add-salesman-channel-user-form');
var $memberSelect = $addMemberModal.find('.salesman-channel-user-select'); var $memberSelect = $addMemberModal.find('.salesman-channel-user-select');
var $salesmanIdInput = $('.salesman-channel-list-form').find(".btn-primary"); var $form = $addMemberModal.find('form.admin-add-salesman-user-form');
var $start_time = $('#start_time');
var $end_time = $('#end_time'); // 搜索
var searchscForm = $(".saleman-channel-list-form .search-form");
$addMemberModal.on('show.bs.modal', function(event){
var $link = $(event.relatedTarget);
// var salesmanId = $link.data('salesman_id');
// $salesmanIdInput.val(salesmanId);
$addMemberModal.on('show.bs.modal', function(event){
$memberSelect.select2('val', ' '); $memberSelect.select2('val', ' ');
}); });
@ -52,23 +48,24 @@ $(document).on('turbolinks:load', function() {
// var salesmanId = $salesmanIdInput.val(); // var salesmanId = $salesmanIdInput.val();
var memberIds = $memberSelect.val(); var memberIds = $memberSelect.val();
if (memberIds && memberIds.length > 0) { if (memberIds && memberIds.length > 0) {
alert(start_time); var url = $form.data('url');
$.ajax({ $.ajax({
method: 'POST', method: 'POST',
dataType: 'json', dataType: 'json',
url: '/admins/salesman_channels/batch_add', url: url,
data: { salesman_id: $salesmanIdInput.data("salesman-id"), school_ids: memberIds }, data: $form.serialize(),
success: function(){ success: function(){
$.notify({ message: '创建成功' }); $.notify({ message: '创建成功' });
$addMemberModal.modal('hide'); $addMemberModal.modal('hide');
searchscForm.find('input[name="keyword"]').val('');
setTimeout(function(){ setTimeout(function(){
window.location.reload(); submitForm();
}, 500); }, 500);
}, },
error: function(res){ error: function(res){
var data = res.responseJSON; var data = res.responseJSON;
$form.find('.error').html(data.message); $addMemberForm.find('.error').html(data.message);
} }
}); });
} else { } else {
@ -76,6 +73,14 @@ $(document).on('turbolinks:load', function() {
} }
}); });
// 清空
searchscForm.on('click', '.clear-btn', function () {
searchscForm.find('.start_date').val('');
searchscForm.find('.end_date').val('').trigger('change');
searchscForm.find('input[name="keyword"]').val('');
});
// 时间跨度 // 时间跨度
var baseOptions = { var baseOptions = {
autoclose: true, autoclose: true,
@ -102,8 +107,8 @@ $(document).on('turbolinks:load', function() {
}); });
var submitForm = function(){ var submitForm = function(){
var url = searchscForm.data('search-form-url');
var form = searchscForm; var form = searchscForm;
var url = "/admins/salesman_channels";
$.ajax({ $.ajax({
url: url, url: url,
data: form.serialize(), data: form.serialize(),

@ -2,10 +2,12 @@ class Admins::SalesmanChannelsController < Admins::BaseController
before_action :set_salesman before_action :set_salesman
def index def index
@channels = SalesmanChannel.all @channels = @salesman.salesman_channels
@start_time = params[:start_time] if params[:keyword].present?
@end_time = params[:end_time] || Time.now @channels = @channels.joins(:school).where("schools.name like ?", "%#{params[:keyword]}%")
@keyword = params[:keyword] end
@start_time = params[:start_date]
@end_time = params[:end_date].blank? ? Time.now : params[:end_date]
end end
def batch_add def batch_add
@ -17,6 +19,8 @@ class Admins::SalesmanChannelsController < Admins::BaseController
@salesman.salesman_channels.create!(school_id: school.id) @salesman.salesman_channels.create!(school_id: school.id)
end end
render_ok render_ok
rescue Exception => ex
render_error(ex.message)
end end
def destroy def destroy

@ -6,22 +6,20 @@ class SalesmanChannel < ApplicationRecord
school.name school.name
end end
def teacher_count(start_time, end_time, keyword) def teacher_count(start_time, end_time)
UserExtension.joins(:school).where("schools.name like '%#{keyword}%' and user_extensions.identity=0 UserExtension.where("identity = 0 and school_id = #{school_id} and created_at between '#{start_time}' and '#{end_time}'").count
and user_extensions.created_at between '#{start_time}' and '#{end_time}'").count
# UserExtension.where(school_id: school_id).where(query).count # UserExtension.where(school_id: school_id).where(query).count
end end
def student_count(start_time, end_time, keyword) def student_count(start_time, end_time)
UserExtension.joins(:school).where("schools.name like '%#{keyword}%' and user_extensions.identity=1 UserExtension.where("identity = 1 and school_id = #{school_id} and created_at between '#{start_time}' and '#{end_time}'").count
and user_extensions.created_at between '#{start_time}' and '#{end_time}'").count
end end
def course_count(start_time, end_time, keyword) def course_count(start_time, end_time)
Course.joins(:school).where("schools.name like '%#{keyword}%' and courses.created_at between '#{start_time}' and '#{end_time}'").count Course.where("school_id = #{school_id} and courses.created_at between '#{start_time}' and '#{end_time}'").count
end end
def shixuns_count(start_time, end_time, keyword) def shixuns_count(start_time, end_time)
ShixunMember.joins("join user_extensions on user_extensions.user_id = shixun_members.user_id and shixun_members.created_at between '#{start_time}' and '#{end_time}'") ShixunMember.joins("join user_extensions on user_extensions.user_id = shixun_members.user_id and shixun_members.created_at between '#{start_time}' and '#{end_time}'")
.where(user_extensions: {school_id: school_id}).pluck(:shixun_id).uniq.count .where(user_extensions: {school_id: school_id}).pluck(:shixun_id).uniq.count
end end

@ -41,6 +41,7 @@ class Subject < ApplicationRecord
scope :published, lambda{where(status: 1)} scope :published, lambda{where(status: 1)}
scope :unhidden, lambda{where(hidden: 0)} scope :unhidden, lambda{where(hidden: 0)}
scope :publiced, lambda{ where(public: 2) } scope :publiced, lambda{ where(public: 2) }
scope :show_moblied, lambda{ where(show_mobile: true) }
after_create :send_tiding after_create :send_tiding
def send_tiding def send_tiding

@ -8,7 +8,7 @@ class Weapps::SubjectQuery < ApplicationQuery
end end
def call def call
subjects = @current_laboratory.subjects.unhidden.publiced subjects = @current_laboratory.subjects.unhidden.publiced.show_moblied
# 课程体系的过滤 # 课程体系的过滤
if params[:sub_discipline_id].present? if params[:sub_discipline_id].present?

@ -7,13 +7,13 @@
<% end %> <% end %>
<div class="box search-form-container saleman-channel-list-form"> <div class="box search-form-container saleman-channel-list-form">
<form class="form-inline search-form d-flex" data-search-form-url="<%= admins_salesman_channels_path %>"> <form class="form-inline search-form d-flex" data-search-form-url="<%= admins_salesman_channels_path(salesman_id: @salesman.id) %>">
<div class="time-select"> <div class="time-select">
<div class="form-group grow-date-container"> <div class="form-group grow-date-container">
<div class="input-group input-daterange grow-date-input-daterange"> <div class="input-group input-daterange grow-date-input-daterange">
<%= text_field_tag :start_date, params[:start_date], class: 'form-control start-date mx-0', placeholder: '开始时间' %> <%= text_field_tag :start_date, params[:start_date], class: 'form-control start-date mx-0', placeholder: '开始时间' %>
<div class="input-group-prepend"><span class="input-group-text">到</span></div> <div class="input-group-prepend"><span class="input-group-text">到</span></div>
<%= text_field_tag :end_date, params[:start_date], class: 'form-control end-date mx-0', placeholder: '结束时间' %> <%= text_field_tag :end_date, params[:end_date], class: 'form-control end-date mx-0', placeholder: '结束时间' %>
</div> </div>
</div> </div>
@ -21,9 +21,10 @@
<%= text_field_tag :keyword, params[:keyword], placeholder: 'ID/单位名称检索', class: 'form-control mx-3 search-input' %> <%= text_field_tag :keyword, params[:keyword], placeholder: 'ID/单位名称检索', class: 'form-control mx-3 search-input' %>
<%= javascript_void_link '搜索', class: 'btn btn-primary search-btn', target: '' %> <%= javascript_void_link '搜索', class: 'btn btn-primary search-btn', target: '' %>
<input type="reset" class="btn btn-secondary clear-btn ml-3" value="清空"/>
</form> </form>
<div class="flex-12"> <div class="flex-12">
<%= javascript_void_link '新增渠道', class: 'btn btn-primary', data: {salesman_id: @salesman.id, toggle: 'modal', target: '.admin-add-salesman-channel-user-modal' } %> <%= javascript_void_link '新增渠道', class: 'btn btn-primary', data: {toggle: 'modal', target: '.admin-add-salesman-channel-user-modal' } %>
</div> </div>
</div> </div>

@ -8,13 +8,12 @@
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form class="admin-add-salesman-user-form"> <form class="admin-add-salesman-user-form" data-url="<%= batch_add_admins_salesman_channels_path(salesman_id: @salesman.id) %>">
<%= hidden_field_tag(:salesman_id, nil) %>
<div class="form-group d-flex"> <div class="form-group d-flex">
<label class="col-form-label">单位:</label> <label class="col-form-label">单位:</label>
<div class="d-flex flex-column-reverse w-75"> <div class="d-flex flex-column-reverse w-75">
<select id="user_ids" name="user_ids" class="form-control salesman-channel-user-select"></select> <select id="school_ids" name="school_ids[]" class="form-control salesman-channel-user-select"></select>
</div> </div>
</div> </div>

@ -19,16 +19,16 @@
<span><%= channel.school_name %></span> <span><%= channel.school_name %></span>
</td> </td>
<td class="text-left"> <td class="text-left">
<span><%= channel.teacher_count(@start_time, @end_time, @keyword) %></span> <span><%= channel.teacher_count(@start_time, @end_time) %></span>
</td> </td>
<td class="text-left"> <td class="text-left">
<span><%= channel.student_count(@start_time, @end_time, @keyword) %></span> <span><%= channel.student_count(@start_time, @end_time) %></span>
</td> </td>
<td> <td>
<%= channel.course_count(@start_time, @end_time, @keyword) %> <%= channel.course_count(@start_time, @end_time) %>
</td> </td>
<td> <td>
<%= channel.shixuns_count(@start_time, @end_time, @keyword) %> <%= channel.shixuns_count(@start_time, @end_time) %>
</td> </td>
<td> <td>
<%= delete_link '删除', admins_salesman_channel_path(channel, salesman_id: channel.salesman_id, element: ".salesman-channel-item-#{channel.id}"), class: 'delete-salesman-action' %> <%= delete_link '删除', admins_salesman_channel_path(channel, salesman_id: channel.salesman_id, element: ".salesman-channel-item-#{channel.id}"), class: 'delete-salesman-action' %>

@ -88,14 +88,14 @@
</li> </li>
<li> <li>
<%= sidebar_item_group('#running_data', '运营数据', icon: 'bar-chart') do %> <%= sidebar_item_group('#running-data', '运营数据', icon: 'bar-chart') do %>
<li><%= sidebar_item(admins_salesmans_path, '销售数据列表', icon: 'columns', controller: 'admins-salesman') %></li> <li><%= sidebar_item(admins_salesmans_path, '销售数据列表', icon: 'columns', controller: 'admins-salesmans') %></li>
<% end %> <% end %>
</li> </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-repertoires') %></li>
<% end %> <% end %>
</li> </li>

@ -1,7 +1,8 @@
class SyncSubjectdsMobile < ActiveRecord::Migration[5.2] class SyncSubjectdsMobile < ActiveRecord::Migration[5.2]
def change def change
SubDisciplineContainer.where(container_type: "Subject").find_each do |sc|
Subject.find(sc.container_id).update_column("show_mobile", true) SubDisciplineContainer.find_each do |sc|
Subject.find(sc.container_id).update_column(:show_mobile, true)
end end
end end
end end

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,49 @@
import React, { Component } from 'react';
import {getImageUrl} from 'educoder';
import { Modal} from 'antd';
import axios from 'axios';
import './authenmodels.css'
//立即申请试用
class AuthenModel extends Component {
constructor(props) {
super(props);
this.state={
}
}
render() {
return(
<Modal
keyboard={false}
closable={false}
footer={null}
destroyOnClose={true}
title="提示"
centered={true}
visible={this.props.authenmodels===undefined?false:this.props.authenmodels}
width="442px"
>
<div className="educouddiv">
{
this.props.authenmodelsinde&&this.props.authenmodelsinde===1?
<div className={"tabeltext-alignleft mt10"}><p className="titiles">选择该项后所有学员必须经过平台实名审核才能加入课堂您确定吗</p></div>
:
this.props.authenmodelsinde&&this.props.authenmodelsinde===2?
<div className={"tabeltext-alignleft mt10"}><p className="titiles">选择该项后所有学员必须经过平台职业审核才能加入课堂您确定吗</p></div>
:""
}
<div className="clearfix mt30 edu-txt-center">
<a className="task-btn mr30 w80" onClick={()=>this.props.setmodalsTypedel(false,this.props.authenmodelsinde)}>取消</a>
<a className="task-btn task-btn-orange w80" onClick={()=>this.props.setmodalsTypedel(true,this.props.authenmodelsinde)}>确定</a>
</div>
</div>
</Modal>
)
}
}
export default AuthenModel;

File diff suppressed because it is too large Load Diff

@ -6,6 +6,7 @@ import "../css/Courses.css";
import locale from 'antd/lib/date-picker/locale/zh_CN'; import locale from 'antd/lib/date-picker/locale/zh_CN';
import moment from 'moment'; import moment from 'moment';
import Modals from '../../modals/Modals'; import Modals from '../../modals/Modals';
import AuthenModel from '../coursmodel/AuthenModel'
import {WordsBtn, ActionBtn} from 'educoder'; import {WordsBtn, ActionBtn} from 'educoder';
@ -49,7 +50,9 @@ class CoursesNew extends Component {
addonAfteronelentwo:0, addonAfteronelentwo:0,
bordebool:false, bordebool:false,
smallspinning:false, smallspinning:false,
bottonloading:false bottonloading:false,
authenmodels:false,
authenmodelsinde:1,
} }
} }
componentDidMount() { componentDidMount() {
@ -388,15 +391,35 @@ class CoursesNew extends Component {
}); });
} }
onchanges =(e)=>{ onchanges =(e)=>{
this.setState({ //实名认证
Realnamecertification:e.target.checked,
}) if(e.target.checked===true){
this.setState({
authenmodels:true,
authenmodelsinde:1
})
}else{
this.setState({
Realnamecertification:e.target.checked,
})
}
// console.log(e.target.checked); // console.log(e.target.checked);
} }
onchangess=(e)=>{ onchangess=(e)=>{
this.setState({ //职业认证
Professionalcertification:e.target.checked, if(e.target.checked===true){
}) this.setState({
authenmodels:true,
authenmodelsinde:2
})
}else{
this.setState({
Professionalcertification:e.target.checked,
})
}
// console.log(e.target.checked); // console.log(e.target.checked);
} }
Searchvalue=(value)=>{ Searchvalue=(value)=>{
@ -552,6 +575,27 @@ class CoursesNew extends Component {
showApplyForAddOrgModal = () => { showApplyForAddOrgModal = () => {
this.applyForAddOrgForm.setVisible(true) this.applyForAddOrgForm.setVisible(true)
} }
setmodalsTypedel=(bool,i)=>{
if(i===1){
if(bool===true){
this.setState({
Realnamecertification:true,
})
}
}else if(i===2){
if(bool===true){
this.setState({
Professionalcertification:true,
})
}
}
this.setState({
authenmodels:false
})
}
render() { render() {
let {datatime,school,searchlistscholl,bordebool,dataname} = this.state; let {datatime,school,searchlistscholl,bordebool,dataname} = this.state;
const {getFieldDecorator} = this.props.form; const {getFieldDecorator} = this.props.form;
@ -604,6 +648,26 @@ class CoursesNew extends Component {
</style> </style>
<ApplyForAddOrgModal ref="applyForAddOrgModal" wrappedComponentRef={(form) => this.applyForAddOrgForm = form} schoolName={school} <ApplyForAddOrgModal ref="applyForAddOrgModal" wrappedComponentRef={(form) => this.applyForAddOrgForm = form} schoolName={school}
{...propsWithoutForm}></ApplyForAddOrgModal> {...propsWithoutForm}></ApplyForAddOrgModal>
{
this.state.authenmodels&&this.state.authenmodels===true?
<style>
{
`
body{
overflow:hidden !important ;
}
`
}
</style>
:""
}
{
this.state.authenmodels&&this.state.authenmodels===true?
<AuthenModel {...this.state} {...this.props} authenmodelsinde={this.state.authenmodelsinde} setmodalsTypedel={(bool,i)=>this.setmodalsTypedel(bool,i)}></AuthenModel>
:""
}
{/*提示*/} {/*提示*/}
<Modals <Modals
modalsType={this.state.Modalstype} modalsType={this.state.Modalstype}

@ -176,6 +176,15 @@ class MessagePrivate extends Component{
<span className="color-grey-c mr20">[{item.message_count}{"条"}]</span> <span className="color-grey-c mr20">[{item.message_count}{"条"}]</span>
<span className="color-grey-c">{moment(item.send_time).fromNow()}</span> <span className="color-grey-c">{moment(item.send_time).fromNow()}</span>
</p> </p>
<style>
{
`
.markdown-body p img{
width:200px;
}
`
}
</style>
<div className="color-grey-6 break_word_firefox markdown-body mt10" dangerouslySetInnerHTML={{__html: markdownToHTML(item.content).replace(/▁/g, "▁▁▁")}} ></div> <div className="color-grey-6 break_word_firefox markdown-body mt10" dangerouslySetInnerHTML={{__html: markdownToHTML(item.content).replace(/▁/g, "▁▁▁")}} ></div>
</div> </div>
@ -208,4 +217,4 @@ class MessagePrivate extends Component{
) )
} }
} }
export default MessagePrivate; export default MessagePrivate;

@ -187,14 +187,14 @@ const App = (props) => {
defaultSortOrder: 'descend', defaultSortOrder: 'descend',
sorter: (a, b) => a.passed_games_count - b.passed_games_count sorter: (a, b) => a.passed_games_count - b.passed_games_count
}, },
{ // {
title: '代码行', // title: '代码行',
dataIndex: 'code_line_count', // dataIndex: 'code_line_count',
align: 'center', // align: 'center',
with: 130, // with: 130,
render: (val) => val + '', // render: (val) => val + '',
sorter: (a, b) => a.code_line_count - b.code_line_count // sorter: (a, b) => a.code_line_count - b.code_line_count
}, // },
{ {
title: '评测次数', title: '评测次数',
dataIndex: 'evaluate_count', dataIndex: 'evaluate_count',

Loading…
Cancel
Save