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

sso
cxt 6 years ago
commit 858e854887

@ -13,7 +13,7 @@ class CoursesController < ApplicationController
end end
before_action :require_login, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups, before_action :require_login, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups,
:left_banner, :top_banner, :informs, :online_learning, :course_groups] :left_banner, :top_banner, :informs, :online_learning, :course_groups, :search_slim]
before_action :check_account, only: [:new, :create, :apply_to_join_course, :join_excellent_course] before_action :check_account, only: [:new, :create, :apply_to_join_course, :join_excellent_course]
before_action :check_auth, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups, before_action :check_auth, except: [:index, :show, :students, :teachers, :board_list, :mine, :all_course_groups,
:left_banner, :top_banner, :apply_to_join_course, :exit_course, :course_groups] :left_banner, :top_banner, :apply_to_join_course, :exit_course, :course_groups]

@ -20,11 +20,8 @@ class MainController < ApplicationController
uid_logger("main start is #{cookies[:_educoder_session]}") uid_logger("main start is #{cookies[:_educoder_session]}")
end end
# TODO: 这块之后需要整合者架构重新变化统一跳转到index后再路由分发
if params[:path] && params[:path]&.include?("educoderh5") && params[:path].split("/").first == "educoderh5" if params[:path] && params[:path]&.include?("h5educoderbuild") && params[:path].split("/").first == "h5educoderbuild"
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 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

@ -1,5 +1,4 @@
class Weapps::ShixunListsController < ApplicationController class Weapps::ShixunListsController < ApplicationController
before_action :require_login
def index def index
results = Weapps::ShixunSearchService.call(search_params, current_laboratory) results = Weapps::ShixunSearchService.call(search_params, current_laboratory)

@ -1,5 +1,5 @@
class Weapps::SubjectsController < Weapps::BaseController class Weapps::SubjectsController < Weapps::BaseController
before_action :require_login before_action :require_login, except: [:index, :show]
before_action :find_subject, except: [:index] before_action :find_subject, except: [:index]
# 首页 # 首页

@ -1,3 +1,4 @@
class HackCode < ApplicationRecord class HackCode < ApplicationRecord
# 编程题代码相关 # 编程题代码相关
belongs_to :hack
end end

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

@ -2,12 +2,32 @@
<% add_admin_breadcrumb("#{@salesman.name}的渠道", admins_salesmans_path) %> <% add_admin_breadcrumb("#{@salesman.name}的渠道", admins_salesmans_path) %>
<% end %> <% end %>
<div class="box search-form-container salesman-channel-list-form rig"> <% define_admin_breadcrumbs do %>
<div class="flex-1"> <% add_admin_breadcrumb('数据变化报表', admins_school_statistics_path) %>
<% 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 %>">
<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: '结束时间' %>
</div>
</div>
</div>
<%= 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: '' %>
</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: {salesman_id: @salesman.id, toggle: 'modal', target: '.admin-add-salesman-channel-user-modal' } %>
</div> </div>
</div> </div>
<div class="box admin-list-container salesman-channel-list-container"> <div class="box admin-list-container salesman-channel-list-container">
<%= render(partial: 'admins/salesman_channels/shared/list') %> <%= render(partial: 'admins/salesman_channels/shared/list') %>
</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 %></span> <span><%= channel.teacher_count(@start_time, @end_time, @keyword) %></span>
</td> </td>
<td class="text-left"> <td class="text-left">
<span><%= channel.student_count %></span> <span><%= channel.student_count(@start_time, @end_time, @keyword) %></span>
</td> </td>
<td> <td>
<%= channel.course_count %> <%= channel.course_count(@start_time, @end_time, @keyword) %>
</td> </td>
<td> <td>
<%= channel.shixuns_count %> <%= channel.shixuns_count(@start_time, @end_time, @keyword) %>
</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' %>

@ -1,7 +1,7 @@
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| SubDisciplineContainer.where(container_type: "Subject").find_each do |sc|
Subject.find(sc.container_id).update_column('show_mobile', true) Subject.find(sc.container_id).update_column("show_mobile", true)
end end
end end
end end

@ -45,13 +45,6 @@ class CommonWorkAppraise extends Component{
} }
exportMdtoHtml=(md)=> { exportMdtoHtml=(md)=> {
let newmd=md; let newmd=md;
newmd=newmd.replace(/TOC/g, '');
newmd=newmd.replace(/\[|]/g,'');
newmd=newmd.replace(/`/g, '');
newmd=newmd.replace(/`/g, '');
newmd=newmd.replace(/"/g, '');
newmd=newmd.replace(/"/g, '');
newmd=newmd.replace(/"/g, '');
const converter = new showdown.Converter({ const converter = new showdown.Converter({
extensions: [ extensions: [
showdownKatex({ showdownKatex({
@ -182,7 +175,7 @@ class CommonWorkAppraise extends Component{
<div className={"color-grey-6 mb15 font-16"}> <div className={"color-grey-6 mb15 font-16"}>
内容 内容
</div> </div>
<div className="markdown-body ml20" dangerouslySetInnerHTML={{__html: this.exportMdtoHtml(description)}}> <div className="markdown-body ml20" dangerouslySetInnerHTML={{__html: markdownToHTML(description)}}>
</div> </div>
{attachments.map((item,key)=>{ {attachments.map((item,key)=>{

@ -160,13 +160,6 @@ class CCommentItem extends Component{
exportMdtoHtml=(md)=> { exportMdtoHtml=(md)=> {
let newmd=md; let newmd=md;
newmd=newmd.replace(/TOC/g, '');
newmd=newmd.replace(/\[|]/g,'');
newmd=newmd.replace(/`/g, '');
newmd=newmd.replace(/`/g, '');
newmd=newmd.replace(/"/g, '');
newmd=newmd.replace(/"/g, '');
newmd=newmd.replace(/"/g, '');
const converter = new showdown.Converter({ const converter = new showdown.Converter({
extensions: [ extensions: [
showdownKatex({ showdownKatex({
@ -269,7 +262,7 @@ class CCommentItem extends Component{
<div className="comment_content clearfix" id={`reply_content_${item.id}`}> <div className="comment_content clearfix" id={`reply_content_${item.id}`}>
<div className="color-grey-3" id={`reply_content_${item.id}`}> <div className="color-grey-3" id={`reply_content_${item.id}`}>
<div className={"markdown-body"} <div className={"markdown-body"}
dangerouslySetInnerHTML={{__html:this.exportMdtoHtml(item.content)}}></div> dangerouslySetInnerHTML={{__html:markdownToHTML(item.content)}}></div>
<div className="cl"></div> <div className="cl"></div>
</div> </div>
</div> </div>
@ -285,7 +278,7 @@ class CCommentItem extends Component{
render(){ render(){
let { item, commentIndex, homework_status, is_author }=this.props; let { item, commentIndex, homework_status, is_author }=this.props;
let { show_reply, show_appeal }=this.state; let { show_reply, show_appeal }=this.state;
const _content = item.content ? this.exportMdtoHtml(item.content) : '' const _content = item.content ? markdownToHTML(item.content): ''
const isAnonymous = homework_status && homework_status.indexOf('匿评中') != -1 const isAnonymous = homework_status && homework_status.indexOf('匿评中') != -1
const isAppealing = homework_status && homework_status.indexOf('申诉中') != -1 const isAppealing = homework_status && homework_status.indexOf('申诉中') != -1
const attachments = item.attachments; const attachments = item.attachments;

@ -463,7 +463,7 @@ class PollDetailTabForthRules extends Component{
disabledTime={disabledDateTime} disabledTime={disabledDateTime}
disabledDate={disabledDate} disabledDate={disabledDate}
disabled={ disabled={
this.props.isAdmin()===true? this.props.isAdmin()===true?this.props.type==="Shixun"?false:
this.props.type==="Exercise"||this.props.type==="polls"? this.props.type==="Exercise"||this.props.type==="polls"?
rule.e_timeflag === undefined ? rule.publish_time === null ? false : moment(rule.end_time, dataformat) <= moment() ?this.props.isAdmin()?!flagPageEdit: true : !flagPageEdit : rule.e_timeflag == true ? this.props.isAdmin()?!flagPageEdit :true : !flagPageEdit: rule.e_timeflag === undefined ? rule.publish_time === null ? false : moment(rule.end_time, dataformat) <= moment() ?this.props.isAdmin()?!flagPageEdit: true : !flagPageEdit : rule.e_timeflag == true ? this.props.isAdmin()?!flagPageEdit :true : !flagPageEdit:
rule.e_timeflag === undefined ? rule.publish_time === null ? false : moment(rule.end_time, dataformat) <= moment() ? true : !flagPageEdit : rule.e_timeflag == true ? true : !flagPageEdit:true rule.e_timeflag === undefined ? rule.publish_time === null ? false : moment(rule.end_time, dataformat) <= moment() ? true : !flagPageEdit : rule.e_timeflag == true ? true : !flagPageEdit:true

@ -2065,7 +2065,7 @@ class Trainingjobsetting extends Component {
} }
//截止时间 //截止时间
if (moment(datas.data.end_time, "YYYY-MM-DD HH:mm") <= moment()) { if (moment(datas.data.end_time, "YYYY-MM-DD HH:mm") <= moment()) {
deadline = false; // deadline = false;
} }
//结束时间 //结束时间
if (moment(datas.data.late_time, "YYYY-MM-DD HH:mm") <= moment()) { if (moment(datas.data.late_time, "YYYY-MM-DD HH:mm") <= moment()) {
@ -2554,6 +2554,7 @@ class Trainingjobsetting extends Component {
}} }}
teacherdatapage={this.props.teacherdatapage} teacherdatapage={this.props.teacherdatapage}
rules={rules} rules={rules}
type={"Shixun"}
moduleName={"作业"} moduleName={"作业"}
course_group={rulest} course_group={rulest}
flagPageEdit={flagPageEdit} flagPageEdit={flagPageEdit}

@ -1,7 +1,7 @@
/* /*
* @Description: * @Description:
* @Author: tangjiang * @Author: tangjiang
* @Github: * @Github:
* @Date: 2020-01-14 13:39:12 * @Date: 2020-01-14 13:39:12
* @LastEditors : tangjiang * @LastEditors : tangjiang
* @LastEditTime : 2020-01-14 16:30:05 * @LastEditTime : 2020-01-14 16:30:05
@ -70,7 +70,7 @@ const DisplayTableData = (props) => {
dataSource={datas} dataSource={datas}
pagination={false} pagination={false}
loading={loading} loading={loading}
scroll={{y: 500}} // scroll={{y: 500}}
ref={(ref)=>tableEl=ref} ref={(ref)=>tableEl=ref}
footer={total ? () => renderFooter(total) : ''} footer={total ? () => renderFooter(total) : ''}
/> />

@ -173,39 +173,39 @@ const App = (props) => {
title: '通关实训数', title: '通关实训数',
dataIndex: 'passed_myshixun_count', dataIndex: 'passed_myshixun_count',
align: 'center', align: 'center',
with: 170, with: 130,
render: (val) => val + '', render: (val) => val + '',
sorter: (a, b) => a.passed_myshixun_count - b.passed_myshixun_count sorter: (a, b) => a.passed_myshixun_count - b.passed_myshixun_count
}, },
{ {
title: '完成关卡', title: '完成关卡',
dataIndex: 'passed_games_count', dataIndex: 'passed_games_count',
align: 'center', align: 'center',
with: 170, with: 130,
render: (val) => val + '', render: (val) => val + '',
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: 170, 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',
align: 'center', align: 'center',
with: 170, with: 130,
render: (val) => val + '', render: (val) => val + '',
sorter: (a, b) => a.evaluate_count - b.evaluate_count sorter: (a, b) => a.evaluate_count - b.evaluate_count
}, },
{ {
title: '所用时间', title: '所用时间',
dataIndex: 'cost_time', dataIndex: 'cost_time',
align: 'center', align: 'center',
// with: 180, with: 200,
render: (text) => (text && moment(text).format('HH:mm:ss')) || '-', render: (text) => (text && moment(text).format('HH:mm:ss')) || '-',
sorter: (a, b) => a.cost_time - b.cost_time sorter: (a, b) => a.cost_time - b.cost_time
} }

Loading…
Cancel
Save