Merge branch 'dev_aliyun' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun
commit
002a07e8e9
@ -0,0 +1,50 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-subjects-index-page').length > 0) {
|
||||
var $form = $('.subject-list-form');
|
||||
|
||||
// ************** 学校选择 *************
|
||||
$form.find('.school-select').select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: '请选择创建者单位',
|
||||
minimumInputLength: 1,
|
||||
ajax: {
|
||||
delay: 500,
|
||||
url: '/api/schools/for_option.json',
|
||||
dataType: 'json',
|
||||
data: function(params){
|
||||
return { keyword: params.term };
|
||||
},
|
||||
processResults: function(data){
|
||||
return { results: data.schools }
|
||||
}
|
||||
},
|
||||
templateResult: function (item) {
|
||||
if(!item.id || item.id === '') return item.text;
|
||||
return item.name;
|
||||
},
|
||||
templateSelection: function(item){
|
||||
if (item.id) {
|
||||
}
|
||||
return item.name || item.text;
|
||||
}
|
||||
});
|
||||
|
||||
// 清空
|
||||
$form.on('click', '.clear-btn', function(){
|
||||
$form.find('select[name="status"]').val('');
|
||||
$form.find('.school-select').val('').trigger('change');
|
||||
$form.find('input[name="keyword"]').val('');
|
||||
$form.find('#homepage_show').attr('checked', false);
|
||||
$form.find('#excellent').attr('checked', false);
|
||||
$form.find('input[type="submit"]').trigger('click');
|
||||
})
|
||||
|
||||
// 上传图片
|
||||
$('.modal.admin-upload-file-modal').on('upload:success', function(e, data){
|
||||
var $imageElement = $('.subject-image-' + data.source_id);
|
||||
$imageElement.attr('src', data.url);
|
||||
$imageElement.show();
|
||||
$imageElement.next().html('重新上传');
|
||||
})
|
||||
}
|
||||
});
|
@ -0,0 +1,8 @@
|
||||
class Admins::SubjectsController < Admins::BaseController
|
||||
def index
|
||||
default_sort('created_at', 'desc')
|
||||
|
||||
subjects = Admins::SubjectQuery.call(params)
|
||||
@subjects = paginate subjects.includes(:repertoire, :subject_level_system, user: { user_extension: :school })
|
||||
end
|
||||
end
|
@ -0,0 +1,11 @@
|
||||
module Admins::SubjectsHelper
|
||||
def display_subject_status(subject)
|
||||
style =
|
||||
case subject.status
|
||||
when 0 then 'text-secondary'
|
||||
when 1 then 'text-warning'
|
||||
when 2 then 'text-success'
|
||||
end
|
||||
raw content_tag(:span, t("subject.status.#{subject.status}"), class: style)
|
||||
end
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
class SubjectLevelSystem < ApplicationRecord
|
||||
default_scope { order(level: :asc) }
|
||||
|
||||
has_many :subjects, dependent: :nullify
|
||||
end
|
@ -0,0 +1,45 @@
|
||||
class Admins::SubjectQuery < ApplicationQuery
|
||||
include CustomSortable
|
||||
|
||||
attr_reader :params
|
||||
|
||||
sort_columns :created_at, default_by: :created_at, default_direction: :desc, default_table: 'subjects'
|
||||
|
||||
def initialize(params)
|
||||
@params = params
|
||||
end
|
||||
|
||||
def call
|
||||
subjects = Subject.all
|
||||
|
||||
# 状态过滤
|
||||
status =
|
||||
case params[:status].to_s.strip
|
||||
when 'pending' then 0
|
||||
when 'applying' then 1
|
||||
when 'published' then 2
|
||||
end
|
||||
subjects = subjects.where(status: status) if status
|
||||
|
||||
# 创建者单位
|
||||
if params[:school_id].present?
|
||||
subjects = subjects.joins(user: :user_extension).where(user_extensions: { school_id: params[:school_id] })
|
||||
end
|
||||
|
||||
# 首页展示、金课
|
||||
%i[homepage_show excellent].each do |column|
|
||||
if params[column].present? && params[column].to_s == 'true'
|
||||
subjects = subjects.where(column => true)
|
||||
end
|
||||
end
|
||||
|
||||
# 关键字
|
||||
keyword = params[:keyword].to_s.strip
|
||||
if keyword
|
||||
sql = 'CONCAT(lastname, firstname) LIKE :keyword OR subjects.name LIKE :keyword'
|
||||
subjects = subjects.joins(:user).where(sql, keyword: "%#{keyword}%")
|
||||
end
|
||||
|
||||
custom_sort(subjects, params[:sort_by], params[:sort_direction])
|
||||
end
|
||||
end
|
@ -0,0 +1,39 @@
|
||||
<% define_admin_breadcrumbs do %>
|
||||
<% add_admin_breadcrumb('课程配置') %>
|
||||
<% end %>
|
||||
|
||||
<div class="box search-form-container subject-list-form">
|
||||
<%= form_tag(admins_subjects_path, method: :get, class: 'form-inline search-form flex-1', remote: true) do %>
|
||||
<div class="form-group mr-1">
|
||||
<label for="status">状态:</label>
|
||||
<% status_options = [['全部', ''], ['编辑中', 'pending'], ['审核中', 'applying'], ['已发布', 'published']] %>
|
||||
<%= select_tag(:status, options_for_select(status_options), class: 'form-control') %>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-12 col-md-3">
|
||||
<label for="school_name">单位:</label>
|
||||
<%= select_tag :school_id, options_for_select([''], params[:school_id]), class: 'form-control school-select flex-1' %>
|
||||
</div>
|
||||
|
||||
<%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-12 col-md-2 mr-3', placeholder: '创建者/课程名称检索') %>
|
||||
|
||||
<div class="form-check mr-2">
|
||||
<%= hidden_field_tag(:homepage_show, false, id:'') %>
|
||||
<%= check_box_tag(:homepage_show, true, params[:homepage_show].to_s == 'true', class: 'form-check-input') %>
|
||||
<label class="form-check-label" for="homepage_show">只看首页展示</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check mr-2">
|
||||
<%= hidden_field_tag(:excellent, false, id:'') %>
|
||||
<%= check_box_tag(:excellent, true, params[:excellent].to_s == 'true', class: 'form-check-input') %>
|
||||
<label class="form-check-label" for="excellent">只看金课</label>
|
||||
</div>
|
||||
|
||||
<%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %>
|
||||
<input type="reset" class="btn btn-secondary clear-btn" value="清空"/>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="box subject-list-container">
|
||||
<%= render partial: 'admins/subjects/shared/list', locals: { subjects: @subjects } %>
|
||||
</div>
|
@ -0,0 +1 @@
|
||||
$('.subject-list-container').html("<%= j( render partial: 'admins/subjects/shared/list', locals: { subjects: @subjects } ) %>");
|
@ -0,0 +1,73 @@
|
||||
<table class="table table-hover text-center subject-list-table">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th width="14%" class="text-left">名称</th>
|
||||
<th width="6%">阶段数</th>
|
||||
<th width="6%">实训数</th>
|
||||
<th width="8%">技术体系</th>
|
||||
<th width="8%">等级体系</th>
|
||||
<th width="8%">封面</th>
|
||||
<th width="8%">创建者</th>
|
||||
<th width="10%">单位</th>
|
||||
<th width="8%">开课人数</th>
|
||||
<th width="10%"><%= sort_tag('创建时间', name: 'created_at', path: admins_subjects_path) %></th>
|
||||
<th width="7%">状态</th>
|
||||
<th width="14%">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if subjects.present? %>
|
||||
<% subjects.each do |subject| %>
|
||||
<tr class="subject-item-<%= subject.id %>">
|
||||
<td class="text-left">
|
||||
<%= link_to(subject.name, subject_path(subject), target: '_blank') %>
|
||||
<span class="badge badge-pill badge-success homepage-show-badge" style="<%= subject.homepage_show? ? '' : 'display:none' %>">首页</span>
|
||||
<span class="badge badge-pill badge-info excellent-badge" style="<%= subject.excellent? ? '' : 'display:none' %>">金课</span>
|
||||
</td>
|
||||
<td><%= subject.stages_count %></td>
|
||||
<td><%= subject.shixuns_count %></td>
|
||||
<td><%= display_text subject.repertoire&.name %></td>
|
||||
<td><%= display_text subject.subject_level_system&.name %></td>
|
||||
<td>
|
||||
<% image_exists = Util::FileManage.exists?(subject) %>
|
||||
<%= image_tag(image_exists ? Util::FileManage.source_disk_file_url(subject) : '', height: 40, class: "w-100 preview-image subject-image-#{subject.id}", style: image_exists ? '' : 'display:none') %>
|
||||
<%= javascript_void_link image_exists ? '重新上传' : '上传图片', class: 'action upload-image-action', data: { source_id: subject.id, source_type: 'Subject', toggle: 'modal', target: '.admin-upload-file-modal' } %>
|
||||
</td>
|
||||
<td><%= subject.user.real_name %></td>
|
||||
<td><%= subject.user.school_name %></td>
|
||||
<td><%= subject.student_count %></td>
|
||||
<td><%= subject.created_at&.strftime('%Y-%m-%d %H:%M') %></td>
|
||||
<td>
|
||||
<%= display_subject_status(subject) %>
|
||||
</td>
|
||||
<td>
|
||||
<%#= javascript_void_link('编辑', class: 'edit-action') %>
|
||||
|
||||
<%#= javascript_void_link('隐藏', class: 'hide-action', style: subject.hidden? ? 'display:none' : '') %>
|
||||
<%#= javascript_void_link('取消隐藏', class: 'active-action', style: subject.hidden? ? '' : 'display:none') %>
|
||||
|
||||
<%# if subject.published? %>
|
||||
<!-- <div class="d-inline">-->
|
||||
<%#= javascript_void_link('更多', class: 'action dropdown-toggle', 'data-toggle': 'dropdown', 'aria-haspopup': true, 'aria-expanded': false) %>
|
||||
<!-- <div class="dropdown-menu more-action-dropdown">-->
|
||||
<%#= javascript_void_link('首页展示', class: 'dropdown-item homepage-show-action', style: subject.homepage_show? ? 'display:none' : '') %>
|
||||
<%#= javascript_void_link('取消首页展示', class: 'dropdown-item homepage-hide-action', style: subject.homepage_show? ? '' : 'display:none') %>
|
||||
|
||||
<%#= javascript_void_link('选为金课', class: 'dropdown-item excellent-action', style: subject.excellent? ? 'display:none' : '') %>
|
||||
<%#= javascript_void_link('取消金课', class: 'dropdown-item cancel-excellent-action', style: subject.excellent? ? '' : 'display:none') %>
|
||||
|
||||
<%#= delete_link '删除', admins_subjects_path(subject, element: ".subject-item-#{subject.id}"), class: 'delete-subject-action' %>
|
||||
<!-- </div>-->
|
||||
<!-- </div>-->
|
||||
<%# end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= render 'admins/shared/no_data_for_table' %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= render partial: 'admins/shared/paginate', locals: { objects: subjects } %>
|
||||
<%= render partial: 'admins/shared/modal/upload_file_modal', locals: { title: '上传图片', accept: 'image/*' } %>
|
@ -0,0 +1,6 @@
|
||||
'zh-CN':
|
||||
subject:
|
||||
status:
|
||||
'0': 编辑中
|
||||
'1': 审核中
|
||||
'2': 已发布
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 303 KiB After Width: | Height: | Size: 306 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,67 @@
|
||||
.height-60{
|
||||
line-height: 60px;
|
||||
height:60px;
|
||||
background:rgba(255,208,88,1);
|
||||
border-radius:4px 4px 0px 0px;
|
||||
}
|
||||
.height-40{
|
||||
line-height: 40px;
|
||||
height:40px;
|
||||
background:rgba(224,229,234,1);
|
||||
border-radius:4px 0px 0px 0px;
|
||||
}
|
||||
.height-20{
|
||||
line-height: 20px;
|
||||
height:20px;
|
||||
background:rgba(229,168,102,1);
|
||||
border-radius:0px 4px 0px 0px;
|
||||
}
|
||||
.Statisticscenter{
|
||||
text-align: center;
|
||||
}
|
||||
.Statisticscenter div:nth-child(1){
|
||||
margin-top: 5px;
|
||||
font-size:12px;
|
||||
color:rgba(51,51,51,1);
|
||||
}
|
||||
|
||||
.Statisticscenter div:nth-child(2){
|
||||
margin-top: 5px;
|
||||
font-size: 12px;
|
||||
color: rgba(153,153,153,1);
|
||||
}
|
||||
|
||||
.rankingss {
|
||||
text-align: center;
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
.rankingss a img {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
border-radius: 50%;
|
||||
box-shadow: 0px 0px 12px rgba(0,0,0,0.2);
|
||||
}
|
||||
|
||||
.huangguans{
|
||||
position: absolute;
|
||||
top: -30px;
|
||||
left: 72px;
|
||||
}
|
||||
|
||||
.relatives{
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.statisticsTabs{
|
||||
padding: 30px;
|
||||
padding-top: 0px;
|
||||
}
|
||||
|
||||
.statisticsTabs .ant-tabs-tab{
|
||||
height: 80px;
|
||||
text-align: center;
|
||||
line-height: 61px;
|
||||
font-size: 16px;
|
||||
color: rgba(80,145,255,1);
|
||||
}
|
@ -0,0 +1,138 @@
|
||||
import React,{ Component } from "react";
|
||||
import {Table, Pagination,Tooltip,Spin, Row, Col ,Tabs} from "antd";
|
||||
import { WordsBtn,on, off, trigger } from 'educoder';
|
||||
import {BrowserRouter as Router,Route,Switch,Link} from 'react-router-dom';
|
||||
import axios from'axios';
|
||||
import './Statistics.css';
|
||||
const { TabPane } = Tabs;
|
||||
class Statistics extends Component{
|
||||
constructor(props){
|
||||
super(props);
|
||||
this.state={
|
||||
nd1:60,
|
||||
nd2:40,
|
||||
nd3:20
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.setState({
|
||||
isSpin:true,
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
callback=(key)=>{
|
||||
console.log(key);
|
||||
}
|
||||
|
||||
render(){
|
||||
let {nd1,nd2,nd3}=this.state;
|
||||
|
||||
return(
|
||||
<React.Fragment >
|
||||
<div>
|
||||
<div className="edu-back-white">
|
||||
<p className="clearfix padding30">
|
||||
<Row gutter={24}>
|
||||
<Col>
|
||||
明星学员
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<Row type="flex" justify="center" align="bottom">
|
||||
<Col span={3}>
|
||||
<li className="pr rankingss">
|
||||
<a href="https://test-newweb.educoder.net/users/cao_jl" className="color-dark">
|
||||
<img src="https://test-newweb.educoder.net/images/avatars/User/g"/>
|
||||
</a>
|
||||
</li>
|
||||
</Col>
|
||||
|
||||
<Col span={5}>
|
||||
<li className="pr rankingss">
|
||||
<a href="https://test-newweb.educoder.net/users/cao_jl" className="color-dark">
|
||||
<img src="https://test-newweb.educoder.net/images/avatars/User/g" className={"mb10"}/>
|
||||
</a>
|
||||
</li>
|
||||
<Col className={`height-${nd2}`}>
|
||||
|
||||
</Col>
|
||||
</Col>
|
||||
|
||||
<Col span={5} className={"relatives"}>
|
||||
<li className="pr rankingss">
|
||||
<img src="https://test-newweb.educoder.net/images/educoder/huangguan.png" className="huangguans mb5" />
|
||||
<a href="https://test-newweb.educoder.net/users/cao_jl" className="color-dark">
|
||||
<img src="https://test-newweb.educoder.net/images/avatars/User/g" className={"mb10"}/>
|
||||
</a>
|
||||
</li>
|
||||
<Col className={`height-${nd1}`}>
|
||||
|
||||
</Col>
|
||||
</Col>
|
||||
|
||||
<Col span={5}>
|
||||
<li className="pr rankingss">
|
||||
<a href="https://test-newweb.educoder.net/users/cao_jl" className="color-dark">
|
||||
<img src="https://test-newweb.educoder.net/images/avatars/User/g" className={"mb10"}/>
|
||||
</a>
|
||||
</li>
|
||||
<Col className={`height-${nd3}`}>
|
||||
|
||||
</Col>
|
||||
</Col>
|
||||
|
||||
<Col span={3}>
|
||||
<li className="pr rankingss">
|
||||
<a href="https://test-newweb.educoder.net/users/cao_jl" className="color-dark">
|
||||
<img src="https://test-newweb.educoder.net/images/avatars/User/g"/>
|
||||
</a>
|
||||
</li>
|
||||
</Col>
|
||||
|
||||
</Row>
|
||||
|
||||
|
||||
<Row className="mt10" type="flex" justify="center" align="bottom">
|
||||
<Col span={3} className={"Statisticscenter"}>
|
||||
<Col>威震江湖</Col>
|
||||
<Col>4th</Col>
|
||||
</Col>
|
||||
<Col span={5} className={"Statisticscenter"}>
|
||||
<Col>神魔遮天</Col>
|
||||
<Col>2th</Col>
|
||||
</Col>
|
||||
<Col span={5} className={"Statisticscenter"}>
|
||||
<Col>雄霸天下</Col>
|
||||
<Col>1th</Col>
|
||||
</Col>
|
||||
<Col span={5} className={"Statisticscenter"}>
|
||||
<Col>不灭战神</Col>
|
||||
<Col>3th</Col>
|
||||
</Col>
|
||||
<Col span={3} className={"Statisticscenter"}>
|
||||
<Col>霸气初现</Col>
|
||||
<Col>5th</Col>
|
||||
</Col>
|
||||
</Row>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="mt20 edu-back-white">
|
||||
<Tabs className="statisticsTabs" defaultActiveKey="1" onChange={this.callback}>
|
||||
<TabPane tab="学习成绩" key="1" className={"statisticsTabs1"}>
|
||||
Content of Tab Pane 1
|
||||
</TabPane>
|
||||
<TabPane tab="课堂活跃度" key="2">
|
||||
Content of Tab Pane 2
|
||||
</TabPane>
|
||||
</Tabs>
|
||||
</div>
|
||||
</div>
|
||||
</React.Fragment>
|
||||
)
|
||||
}
|
||||
}
|
||||
export default Statistics;
|
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 303 KiB After Width: | Height: | Size: 306 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue