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 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 $memberSelect = $addMemberModal.find('.salesman-channel-user-select');
var $salesmanIdInput = $('.salesman-channel-list-form').find(".btn-primary");
var $start_time = $('#start_time');
var $end_time = $('#end_time');
var $form = $addMemberModal.find('form.admin-add-salesman-user-form');
// 搜索
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', ' ');
});
@ -52,23 +48,24 @@ $(document).on('turbolinks:load', function() {
// var salesmanId = $salesmanIdInput.val();
var memberIds = $memberSelect.val();
if (memberIds && memberIds.length > 0) {
alert(start_time);
var url = $form.data('url');
$.ajax({
method: 'POST',
dataType: 'json',
url: '/admins/salesman_channels/batch_add',
data: { salesman_id: $salesmanIdInput.data("salesman-id"), school_ids: memberIds },
url: url,
data: $form.serialize(),
success: function(){
$.notify({ message: '创建成功' });
$addMemberModal.modal('hide');
searchscForm.find('input[name="keyword"]').val('');
setTimeout(function(){
window.location.reload();
submitForm();
}, 500);
},
error: function(res){
var data = res.responseJSON;
$form.find('.error').html(data.message);
$addMemberForm.find('.error').html(data.message);
}
});
} 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 = {
autoclose: true,
@ -102,8 +107,8 @@ $(document).on('turbolinks:load', function() {
});
var submitForm = function(){
var url = searchscForm.data('search-form-url');
var form = searchscForm;
var url = "/admins/salesman_channels";
$.ajax({
url: url,
data: form.serialize(),

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

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

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

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

@ -7,13 +7,13 @@
<% end %>
<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="form-group grow-date-container">
<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: '开始时间' %>
<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>
@ -21,9 +21,10 @@
<%= 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: '' %>
<input type="reset" class="btn btn-secondary clear-btn ml-3" value="清空"/>
</form>
<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>

@ -8,13 +8,12 @@
</button>
</div>
<div class="modal-body">
<form class="admin-add-salesman-user-form">
<%= hidden_field_tag(:salesman_id, nil) %>
<form class="admin-add-salesman-user-form" data-url="<%= batch_add_admins_salesman_channels_path(salesman_id: @salesman.id) %>">
<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-channel-user-select"></select>
<select id="school_ids" name="school_ids[]" class="form-control salesman-channel-user-select"></select>
</div>
</div>

@ -19,16 +19,16 @@
<span><%= channel.school_name %></span>
</td>
<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 class="text-left">
<span><%= channel.student_count(@start_time, @end_time, @keyword) %></span>
<span><%= channel.student_count(@start_time, @end_time) %></span>
</td>
<td>
<%= channel.course_count(@start_time, @end_time, @keyword) %>
<%= channel.course_count(@start_time, @end_time) %>
</td>
<td>
<%= channel.shixuns_count(@start_time, @end_time, @keyword) %>
<%= channel.shixuns_count(@start_time, @end_time) %>
</td>
<td>
<%= 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>
<%= sidebar_item_group('#running_data', '运营数据', icon: 'bar-chart') do %>
<li><%= sidebar_item(admins_salesmans_path, '销售数据列表', icon: 'columns', controller: 'admins-salesman') %></li>
<%= sidebar_item_group('#running-data', '运营数据', icon: 'bar-chart') do %>
<li><%= sidebar_item(admins_salesmans_path, '销售数据列表', icon: 'columns', controller: 'admins-salesmans') %></li>
<% end %>
</li>
<li>
<%= 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 %>
</li>

@ -1,7 +1,8 @@
class SyncSubjectdsMobile < ActiveRecord::Migration[5.2]
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

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 moment from 'moment';
import Modals from '../../modals/Modals';
import AuthenModel from '../coursmodel/AuthenModel'
import {WordsBtn, ActionBtn} from 'educoder';
@ -49,7 +50,9 @@ class CoursesNew extends Component {
addonAfteronelentwo:0,
bordebool:false,
smallspinning:false,
bottonloading:false
bottonloading:false,
authenmodels:false,
authenmodelsinde:1,
}
}
componentDidMount() {
@ -388,15 +391,35 @@ class CoursesNew extends Component {
});
}
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);
}
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);
}
Searchvalue=(value)=>{
@ -552,6 +575,27 @@ class CoursesNew extends Component {
showApplyForAddOrgModal = () => {
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() {
let {datatime,school,searchlistscholl,bordebool,dataname} = this.state;
const {getFieldDecorator} = this.props.form;
@ -604,6 +648,26 @@ class CoursesNew extends Component {
</style>
<ApplyForAddOrgModal ref="applyForAddOrgModal" wrappedComponentRef={(form) => this.applyForAddOrgForm = form} schoolName={school}
{...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
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">{moment(item.send_time).fromNow()}</span>
</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>
@ -208,4 +217,4 @@ class MessagePrivate extends Component{
)
}
}
export default MessagePrivate;
export default MessagePrivate;

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

Loading…
Cancel
Save