Merge branch 'dev_aliyun' into develop

dev_cs
cxt 5 years ago
commit 3c63a2dece

@ -378,6 +378,7 @@ DEPENDENCIES
kaminari (~> 1.1, >= 1.1.1)
listen (>= 3.0.5, < 3.2)
mysql2 (>= 0.4.4, < 0.6.0)
newrelic_rpm
oauth2
pdfkit
puma (~> 3.11)

@ -14,6 +14,7 @@ class ApplicationController < ActionController::Base
#before_action :check_account
DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z)
OPENKEY = "79e33abd4b6588941ab7622aed1e67e8"
helper_method :current_user
@ -246,6 +247,16 @@ class ApplicationController < ActionController::Base
User.current = find_current_user
uid_logger("user_setup: " + (User.current.logged? ? "#{User.current.try(:login)} (id=#{User.current.try(:id)})" : "anonymous"))
# 开放课程通过链接访问的用户
if !User.current.logged? && !params[:chinaoocTimestamp].blank? && !params[:websiteName].blank? && !params[:chinaoocKey].blank?
content = "#{OPENKEY}#{params[:websiteName]}#{params[:chinaoocTimestamp]}"
if Digest::MD5.hexdigest(content) == params[:chinaoocKey]
user = User.open_class_user
start_user_session(user) if user
User.current = user
end
end
if !User.current.logged? && Rails.env.development?
User.current = User.find 1
end

@ -610,6 +610,29 @@ class User < ApplicationRecord
admin? || business?
end
# 149课程的评审用户数据创建包含创建课堂学生
def open_class_user
user = User.find_by(login: "OpenClassUser")
unless user
ActiveRecord::Base.transaction do
user_params = {status: 1, login: "OpenClassUser", lastname: "开放课程",
nickname: "开放课程", professional_certification: 1, certification: 1, grade: 0,
password: "12345678", phone: "11122223333", profile_completed: 1}
user = User.create!(user_params)
UserExtension.create!(user_id: user.id, gender: 0, school_id: 117, :identity => 1, :student_id => "openclassuser")
subject = Subject.find_by(id: 149)
if subject
subject.courses.each do |course|
CourseMember.create!(course_id: course.id, role: 4, user_id: user.id) if !course.course_students.exists?(user_id: user.id)
end
end
end
end
user
end
protected
def validate_password_length
# 管理员的初始密码是5位

@ -63,7 +63,7 @@ export { default as Clappr } from './components/media/Clappr'
export { default as AliyunUploader } from './components/media/AliyunUploader'
export { default as ImageLayerHook } from './hooks/ImageLayerHook'
export { default as ImageLayer2 } from './hooks/ImageLayer2'
// 外部
export { default as CBreadcrumb } from '../modules/courses/common/CBreadcrumb'

@ -2,7 +2,7 @@ import React, { useState, useEffect, memo } from 'react';
import ImageLayer from '../../modules/page/layers/ImageLayer';
import { isImageExtension } from 'educoder';
const $ = window.$;
function ImageLayerHook(props) {
function ImageLayer2(props) {
const [showImage, setShowImage] = useState(false)
const [imageSrc, setImageSrc] = useState('')
@ -45,4 +45,4 @@ function ImageLayerHook(props) {
)
}
export default memo(ImageLayerHook)
export default memo(ImageLayer2)

@ -122,11 +122,11 @@ export function configShareForCourses () {
export function configShareForCustom (title, desc, imgUrl, path) {
requestForSignatrue(() => {
console.log('configShareForCustom', host)
const _path = window.location.href.split('#')[0];
const _url = window.location.href.split('#')[0];
var shareData = {
title: title,
desc: desc,
link: `${host}/${path || _path}`,
link: path ? `${host}/${path}` : _url,
imgUrl: imgUrl || window.__testImageUrl
|| host + '/react/build/images/share_logo_icon.jpg'
};

@ -2,7 +2,7 @@ import React,{Component} from "React";
import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal, Table, Divider, Tag,DatePicker,Radio,Tooltip} from "antd";
import {Link} from 'react-router-dom';
import locale from 'antd/lib/date-picker/locale/zh_CN';
import { WordsBtn, MarkdownToHtml, markdownToHTML } from 'educoder';
import { WordsBtn, MarkdownToHtml, markdownToHTML, ImageLayer2 } from 'educoder';
import axios from 'axios';
import Modals from '../../modals/Modals';
import CoursesListType from '../coursesPublic/CoursesListType';
@ -197,6 +197,7 @@ class CommonWorkAppraise extends Component{
border-bottom: none !important;
}
`}</style>
<ImageLayer2 parentSel=".workAppraise" childSel="a.imageTarget"></ImageLayer2>
<div className={"workAppraise"}>
{(description || (attachments && attachments.length != 0)) && <div className={"stud-class-set edu-back-white padding20-30"}>
<div className={"color-grey-6 mb15 font-16"}>

@ -73,7 +73,6 @@ class NewWorkForm extends Component{
setTimeout(() => {
this.contentMdRef.current.setValue(data.description || '')
this.answerMdRef.current.setValue(data.reference_answer || '')
}, 2000)
this.props.form.setFieldsValue({
@ -86,8 +85,13 @@ class NewWorkForm extends Component{
} else { // new
}
this._scrollToTop()
}
_scrollToTop = () => {
setTimeout(() => {
$("html").animate({ scrollTop: 0 })
}, 1500)
}
// 输入title
changeTitle=(e)=>{
@ -289,6 +293,7 @@ class NewWorkForm extends Component{
}
componentDidMount() {
window.$('.groupSetting .ant-form-item-label > label').addClass('ant-form-item-required')
this._scrollToTop()
}
render(){

@ -5,7 +5,7 @@ import {
} from "antd";
import axios from 'axios';
import moment from 'moment';
import {getImageUrl,markdownToHTML,ImageLayerHook} from 'educoder';
import {getImageUrl,markdownToHTML,ImageLayer2} from 'educoder';
import "../css/messagemy.css"
import WriteaprivateletterModal from '../messagemodal/WriteaprivateletterModal';
//私信页面
@ -51,8 +51,8 @@ class Leftdialogue extends Component{
</a>
<div className="fl pr OtherSide-info">
<span className="trangle"></span>
<ImageLayerHook parentSel={`#Leftdialogue${this.props.keys}`} parentSel={`#Leftdialogue${this.props.keys}`}>
</ImageLayerHook>
<ImageLayer2 parentSel={`#Leftdialogue${this.props.keys}`} parentSel={`#Leftdialogue${this.props.keys}`}>
</ImageLayer2>
<div className="sms break_word markdown-body" id={`Leftdialogue${this.props.keys}`} dangerouslySetInnerHTML={{__html: markdownToHTML(this.props.objeysl.content).replace(/▁/g, "▁▁▁")}}></div>
<div className="edu-txt-right mt5">
<a className="color-grey-c" onClick={()=>this.mydelete(this.props.objeysl.sender.id,this.props.objeysl.id)} >删除</a>

@ -5,7 +5,7 @@ import {
} from "antd";
import axios from 'axios';
import moment from 'moment';
import {getImageUrl,markdownToHTML,ImageLayerHook} from 'educoder';
import {getImageUrl,markdownToHTML,ImageLayer2} from 'educoder';
import "../css/messagemy.css"
import WriteaprivateletterModal from '../messagemodal/WriteaprivateletterModal';
//私信页面
@ -51,8 +51,8 @@ class Rightdialogue extends Component{
</a>
<div className="fr pr ThisSide-info">
<span className="trangle"></span>
<ImageLayerHook parentSel={`#Rightdialogue${this.props.keys}`} parentSel={`#Rightdialogue${this.props.keys}`}>
</ImageLayerHook>
<ImageLayer2 parentSel={`#Rightdialogue${this.props.keys}`} parentSel={`#Rightdialogue${this.props.keys}`}>
</ImageLayer2>
<div className="sms break_word markdown-body" id={`Rightdialogue${this.props.keys}`} dangerouslySetInnerHTML={{__html: markdownToHTML(this.props.objeysl.content).replace(/▁/g, "▁▁▁")}}></div>
<div className="edu-txt-left mt5">
<a className="color-grey-c" onClick={()=>this.mydelete(this.props.objeysl.sender.id,this.props.objeysl.id)}

@ -1,5 +1,5 @@
import React, { Component } from 'react';
import {getImageUrl,markdownToHTML} from 'educoder';
import {getImageUrl,markdownToHTML, configShareForCustom} from 'educoder';
import DetailTop from './DetailTop.js';
import DetailCards from './DetailCards.js'
import AddCollaborators from "./addCollaborators.js";
@ -164,6 +164,7 @@ class PathDetailIndex extends Component{
// window.location.href = "/403";
return;
}
configShareForCustom(result.data.name, result.data.description)
if(result.data.allow_visit===true){
this.setState({

@ -1,203 +1,212 @@
import React,{ Component } from "react";
import {Pagination} from 'antd';
import axios from 'axios';
const $ = window.$;
const echarts = require('echarts');
function InitChapterUsageSituation(_data){
var Color = ['#49A9EE', '#FFD86E', '#98D87D', '#8996E6','#F3857B', '#B97BF3','#4DE8B4','#f76d0c','#510cf7','#def70c','#3bf70c','#0cf7e1'];
var option = {
title: {
show:false
},
tooltip : {
trigger: 'item',
formatter: "{d}%"
},
legend: {
//orient: 'vertical',
// top: 'middle',
bottom: 30,
//left: 20,
data:["第1章", "第2章", "第3章", "第4章", "第5章"],
selectedMode:false
},
series : [{
name: '使用情况',
type: 'pie',
radius : '50%',
center: ['50%', '40%'],
selectedMode: 'single',
label: {
normal: {
// {abg|}
// {a|{a}}\n
formatter: ' {b|{b}} ',
backgroundColor: '#eee',
borderColor: '#aaa',
borderWidth: 1,
borderRadius: 4,
rich: {
a: {
color: '#999',
lineHeight: 22,
align: 'center'
},
hr: {
borderColor: '#aaa',
width: '100%',
borderWidth: 0.5,
height: 0
},
b: {
fontSize: 16,
lineHeight: 33
},
per: {
color: '#eee',
backgroundColor: '#334455',
padding: [2, 4],
borderRadius: 2
}
}
},
},
data: _data,
// [{"value":19,"name":"\u7b2c1\u7ae0"},{"value":45,"name":"\u7b2c2\u7ae0"},{"value":16,"name":"\u7b2c3\u7ae0"},{"value":10,"name":"\u7b2c4\u7ae0"},{"value":10,"name":"\u7b2c5\u7ae0"}],
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
},
normal:{
show: true,
color: function(params) {
return Color[params.dataIndex]
}
}
}
}]
};
var myChart = echarts.init(document.getElementById('chapterUsageSituation'));
myChart.setOption(option);
}
class FirstTab extends Component{
constructor(props){
super(props);
this.state = {
page:1,
total:undefined
}
}
onChange=(pageNumber)=>{
this.setState({
page:pageNumber
})
this.getData(pageNumber);
}
getData=(page)=>{
var pathId = this.props.match.params.pathId;
const url = `/paths/${pathId}/statistics.json?page=`+page;
axios.get(url, {
})
.then((response) => {
// TODO 没用404返回的error
if (response.data.status == 404) {
this.props.showSnackbar('未找到对应数据,请查看地址是否正确。')
return
}
this.setState({ ...response.data })
const _data = response.data.stage_info.map( (item, index) => {
return {
value: item.value,
name: item.stage_no
}
})
InitChapterUsageSituation(_data);
const { course_count, learn_count, school_total_count, subject_name, subject_id } = response.data
this.props.initBannerData({
course_count,
learn_count,
school_total_count,
subject_name,
subject_id
})
this.setState({
total:response.data.school_total_count
})
})
.catch(function (error) {
console.log(error);
});
}
componentDidMount(){
let {page}=this.state;
this.getData(page);
}
render(){
const { schools, stage_info,page,total } = this.state;
return(
<div className="clearfix panelForm-1">
<div className="with60 pr40 fl">
<div className="static_shadow edu-back-white">
<p className="padding30-20 clearfix"><span className="font-24 fl">课堂使用概况</span><span className="fr color-grey-9">{total}</span></p>
<div className="minH-440">
<table className="edu-pop-table head-color edu-txt-center bor-top-greyE" cellSpacing="0" cellPadding="0">
<thead>
<tr><th>序号</th>
<th className="edu-txt-left" width="35%">所属院校</th>
<th>课堂</th>
<th>学生</th>
<th>选用实训</th>
</tr></thead>
{/*
course_count: 30
homework_count: 117
name: "国防科技大学"
student_count: 2700
*/}
<tbody>
{
schools && schools.map( (school, index) => {
return (
<tr>
<td>{ index + 1 }</td>
<td className="edu-txt-left task-hide" style={{"maxWidth":"238px"}}>{school.name}</td>
<td>{school.course_count}</td>
<td>{school.student_count}</td>
<td><span className="color-blue mr3">{school.homework_count}</span></td>
</tr>)
})
}
</tbody>
</table>
</div>
<div className="pt35 edu-txt-center" style={{"height":"102px"}}>
{
total > 10 &&
<Pagination showQuickJumper defaultCurrent={page} pageSize={10} total={total} onChange={this.onChange} />
}
</div>
</div>
</div>
<div className="with40 fl static_shadow edu-back-white">
<p className="font-24 padding30-20">章节使用情况</p>
<div id="chapterUsageSituation" style={{"width":"480px","height":"542px"}}></div>
</div>
</div>
)
}
}
import React,{ Component } from "react";
import {Pagination} from 'antd';
import axios from 'axios';
const $ = window.$;
const echarts = require('echarts');
function InitChapterUsageSituation(_data){
var myChart = echarts.init(document.getElementById('chapterUsageSituation'));
myChart.showLoading({
text: "数据获取中",
effect: 'whirling'
})
var Color = ['#49A9EE', '#FFD86E', '#98D87D', '#8996E6','#F3857B', '#B97BF3','#4DE8B4','#f76d0c','#510cf7','#def70c','#3bf70c','#0cf7e1'];
var option = {
title: {
show:false
},
tooltip : {
trigger: 'item',
formatter: "{d}%"
},
legend: {
//orient: 'vertical',
// top: 'middle',
bottom: 30,
//left: 20,
data:["第1章", "第2章", "第3章", "第4章", "第5章"],
selectedMode:false
},
series : [{
name: '使用情况',
type: 'pie',
radius : '50%',
center: ['50%', '40%'],
selectedMode: 'single',
label: {
normal: {
// {abg|}
// {a|{a}}\n
formatter: ' {b|{b}} ',
backgroundColor: '#eee',
borderColor: '#aaa',
borderWidth: 1,
borderRadius: 4,
rich: {
a: {
color: '#999',
lineHeight: 22,
align: 'center'
},
hr: {
borderColor: '#aaa',
width: '100%',
borderWidth: 0.5,
height: 0
},
b: {
fontSize: 16,
lineHeight: 33
},
per: {
color: '#eee',
backgroundColor: '#334455',
padding: [2, 4],
borderRadius: 2
}
}
},
},
data: _data,
// [{"value":19,"name":"\u7b2c1\u7ae0"},{"value":45,"name":"\u7b2c2\u7ae0"},{"value":16,"name":"\u7b2c3\u7ae0"},{"value":10,"name":"\u7b2c4\u7ae0"},{"value":10,"name":"\u7b2c5\u7ae0"}],
itemStyle: {
emphasis: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
},
normal:{
show: true,
color: function(params) {
return Color[params.dataIndex]
}
}
}
}]
};
setTimeout(() => {
myChart.setOption(option);
myChart.hideLoading();
}, 1000)
}
class FirstTab extends Component{
constructor(props){
super(props);
this.state = {
page:1,
total:undefined
}
}
onChange=(pageNumber)=>{
this.setState({
page:pageNumber
})
this.getData(pageNumber);
}
getData=(page)=>{
var pathId = this.props.match.params.pathId;
const url = `/paths/${pathId}/statistics.json?page=`+page;
axios.get(url, {
})
.then((response) => {
// TODO 没用404返回的error
if (response.data.status == 404) {
this.props.showSnackbar('未找到对应数据,请查看地址是否正确。')
return
}
this.setState({ ...response.data })
const _data = response.data.stage_info.map( (item, index) => {
return {
value: item.value,
name: item.stage_no
}
})
InitChapterUsageSituation(_data);
const { course_count, learn_count, school_total_count, subject_name, subject_id } = response.data
this.props.initBannerData({
course_count,
learn_count,
school_total_count,
subject_name,
subject_id
})
this.setState({
total:response.data.school_total_count
})
})
.catch(function (error) {
console.log(error);
});
}
componentDidMount(){
let {page}=this.state;
this.getData(page);
}
render(){
const { schools, stage_info,page,total } = this.state;
return(
<div className="clearfix panelForm-1">
<div className="with60 pr40 fl">
<div className="static_shadow edu-back-white">
<p className="padding30-20 clearfix"><span className="font-24 fl">课堂使用概况</span><span className="fr color-grey-9">{total}</span></p>
<div className="minH-440">
<table className="edu-pop-table head-color edu-txt-center bor-top-greyE" cellSpacing="0" cellPadding="0">
<thead>
<tr><th>序号</th>
<th className="edu-txt-left" width="35%">所属院校</th>
<th>课堂</th>
<th>学生</th>
<th>选用实训</th>
</tr></thead>
{/*
course_count: 30
homework_count: 117
name: "国防科技大学"
student_count: 2700
*/}
<tbody>
{
schools && schools.map( (school, index) => {
return (
<tr>
<td>{ index + 1 }</td>
<td className="edu-txt-left task-hide" style={{"maxWidth":"238px"}}>{school.name}</td>
<td>{school.course_count}</td>
<td>{school.student_count}</td>
<td><span className="color-blue mr3">{school.homework_count}</span></td>
</tr>)
})
}
</tbody>
</table>
</div>
<div className="pt35 edu-txt-center" style={{"height":"102px"}}>
{
total > 10 &&
<Pagination showQuickJumper defaultCurrent={page} pageSize={10} total={total} onChange={this.onChange} />
}
</div>
</div>
</div>
<div className="with40 fl static_shadow edu-back-white">
<p className="font-24 padding30-20">章节使用情况</p>
<div id="chapterUsageSituation" style={{"width":"480px","height":"542px"}}></div>
</div>
</div>
)
}
}
export default FirstTab;

@ -1,271 +1,281 @@
import React,{ Component } from "react";
import axios from 'axios';
const $ = window.$;
const echarts = require('echarts');
function InitShixunStudyStatistics(yAxisMonth_a, barData_a, mapByNumber, myChart){
let yAxisMonth = yAxisMonth_a
// [
// "1-1", "1-2", "1-3", "1-4", "2-1", "2-2", "2-3", "3-1",
// "1-1", "1-2", "1-3", "1-4", "2-1", "2-2", "2-3", "3-1",
// "1-1", "1-2", "1-3", "1-4", "2-1", "2-2", "2-3", "3-1", "3-2"];
let barData = barData_a
// [
// 1164, 739, 784, 720, 726, 556, 381, 432,
// 1164, 739, 784, 720, 726, 556, 381, 432,
// 1164, 739, 784, 720, 726, 556, 381, 432, 239];
// let yAxisMonth = yAxisMonth_a;
// let barData = barData_a;
let barDataTwo = [];
let coordData2 = [];
let coordData = [];
for (let i = 0; i < barData.length; i++) {
barDataTwo.push(Math.max.apply(Math, barData) + 5000);
coordData.push({
"coord": [Number(barData[i]) - 1, i]
});
coordData2.push({
"coord": [Math.max.apply(Math, barData) + 5000, i]
})
}
var option = {
backgroundColor: "#fff",
title: {
text: ''
},
legend: null,
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'none'
},
formatter: function(params) {
return params[0].name + ":" + (mapByNumber[params[0].name] && mapByNumber[params[0].name].shixun_name) + "<br/>" + '学习人数: ' + params[0].value;
}
},
grid: {
containLabel: true,
left: "30px",
top: "0",
bottom:"10px"
},
yAxis: [{
data: yAxisMonth,
inverse: true,
axisLine: {
show: false
},
axisTick: {
show: false
},
axisLabel: {
margin: 10,
textStyle: {
fontSize: 12,
color: '#747A7F'
},
formatter: function(value) {
return '{Sunny|' + value + '}';
},
rich: {
value: {
lineHeight: 20
},
Sunny: {
height: 25,
padding: [0, 8, 0, 8],
align: 'center',
backgroundColor: '#fff'
}
}
}
},{
data: yAxisMonth,
inverse: true,
axisLine: {
show: false
},
axisTick: {
show: false
},
axisLabel: {
show: false
}
}
],
xAxis: [{
type: "value",
splitLine: {
show: false
},
axisLabel: {
show: false
},
axisTick: {
show: false
},
axisLine: {
show: false
}
}, {
type: "value",
splitLine: {
show: false
},
axisLabel: {
show: false
},
axisTick: {
show: false
},
axisLine: {
show: false
}
}],
series: [{
z: 10,
xAxisIndex: 0,
yAxisIndex: 0,
name: '',
type: 'pictorialBar',
data: barData,
barCategoryGap: '90%',
label: {
normal: {
show: true,
position: 'inside',
textStyle: {
fontSize: 12,
color: '#666'
}
}
},
symbolRepeat: false,
symbolSize: ['100%', 25],
symbolOffset: [-16.5, 0],
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: '#FFD86E'
}], false),
borderRadius:'10'
}
},
symbolClip: true,
symbolPosition: 'end',
symbol: 'rect'
}]
};
myChart.setOption(option);
}
class SecondTab extends Component{
constructor(props){
super(props);
this.state = {
}
}
componentDidMount(){
var pathId = this.props.match.params.pathId;
var myChart = echarts.init(document.getElementById('shixunStudyStatistics'));
myChart.showLoading({
text: "数据获取中",
effect: 'whirling'
})
const url = `/paths/${pathId}/shixun_report.json`
axios.get(url, {
})
.then((response) => {
// TODO 没用404返回的error
if (response.data.status == 404) {
this.props.showSnackbar('未找到对应数据,请查看地址是否正确。')
return
}
/**
let yAxisMonth = ["1-1", "1-2", "1-3", "1-4", "2-1", "2-2", "2-3", "3-1", "3-2"];
let barData = [1164, 739, 784, 720, 726, 556, 381, 432, 239];
{
"number": "6-1",
"shixun_name": "网页抓取及信息提取",
"member_count": 0,
"school_count": 0
}
*/
let yAxisMonth = []
let barData = []
let shixunList = []
let mapByNumber = {}
const _data = response.data.shixun_lists.forEach( (ar, index) => {
ar.forEach( (item, itemIndex) => {
shixunList.push(item)
yAxisMonth.push(item.number)
barData.push(item.member_count)
mapByNumber[item.number] = item
})
})
this.setState({ shixunList }, () => {
InitShixunStudyStatistics(yAxisMonth, barData, mapByNumber, myChart);
myChart.hideLoading()
})
})
.catch(function (error) {
console.log(error);
});
}
render(){
const { shixunList } = this.state;
return(
<div className="clearfix panelForm-2">
<div className="with60 pr40 fl">
<div className="static_shadow edu-back-white">
<p className="font-24 padding30-20">实训使用详情</p>
<div className="minH-440" id="tableHeight">
<table className="edu-pop-table head-color edu-txt-center bor-top-greyE" cellSpacing="0" cellPadding="0">
<thead>
<tr>
<th>章节</th>
<th className="edu-txt-left" width="40%">实训名称</th>
<th>学习人数</th>
<th>受用院校</th>
</tr>
</thead>
<tbody>
{
shixunList && shixunList.map( (shixun, index) => {
return (
<tr>
<td>{shixun.number}</td>
<td className="edu-txt-left task-hide" style={{"maxWidth":"272px"}}>{shixun.shixun_name}</td>
<td>{shixun.member_count}</td>
<td className="color-blue">{shixun.school_count}</td>
</tr>)
})
}
</tbody>
</table>
</div>
</div>
</div>
<div className="with40 fl static_shadow edu-back-white">
<p className="font-24 padding30-20">实训学习统计</p>
<div id="shixunStudyStatistics"
style={{"width":"480px","height": shixunList ? `${shixunList.length * 35 + 100}px` : "440px"}}></div>
</div>
</div>
)
}
}
import React,{ Component } from "react";
import axios from 'axios';
const $ = window.$;
const echarts = require('echarts');
function InitShixunStudyStatistics(yAxisMonth_a, barData_a, mapByNumber, myChart){
let yAxisMonth = yAxisMonth_a
// [
// "1-1", "1-2", "1-3", "1-4", "2-1", "2-2", "2-3", "3-1",
// "1-1", "1-2", "1-3", "1-4", "2-1", "2-2", "2-3", "3-1",
// "1-1", "1-2", "1-3", "1-4", "2-1", "2-2", "2-3", "3-1", "3-2"];
let barData = barData_a
// [
// 1164, 739, 784, 720, 726, 556, 381, 432,
// 1164, 739, 784, 720, 726, 556, 381, 432,
// 1164, 739, 784, 720, 726, 556, 381, 432, 239];
// let yAxisMonth = yAxisMonth_a;
// let barData = barData_a;
let barDataTwo = [];
let coordData2 = [];
let coordData = [];
for (let i = 0; i < barData.length; i++) {
barDataTwo.push(Math.max.apply(Math, barData) + 5000);
coordData.push({
"coord": [Number(barData[i]) - 1, i]
});
coordData2.push({
"coord": [Math.max.apply(Math, barData) + 5000, i]
})
}
var option = {
backgroundColor: "#fff",
title: {
text: ''
},
legend: null,
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'none'
},
formatter: function(params) {
return params[0].name + ":" + (mapByNumber[params[0].name] && mapByNumber[params[0].name].shixun_name) + "<br/>" + '学习人数: ' + params[0].value;
}
},
grid: {
containLabel: true,
left: "30px",
top: "0",
bottom:"10px"
},
yAxis: [{
data: yAxisMonth,
inverse: true,
axisLine: {
show: false
},
axisTick: {
show: false
},
axisLabel: {
margin: 10,
textStyle: {
fontSize: 12,
color: '#747A7F'
},
formatter: function(value) {
return '{Sunny|' + value + '}';
},
rich: {
value: {
lineHeight: 20
},
Sunny: {
height: 25,
padding: [0, 8, 0, 8],
align: 'center',
backgroundColor: '#fff'
}
}
}
},{
data: yAxisMonth,
inverse: true,
axisLine: {
show: false
},
axisTick: {
show: false
},
axisLabel: {
show: false
}
}
],
xAxis: [{
type: "value",
splitLine: {
show: false
},
axisLabel: {
show: false
},
axisTick: {
show: false
},
axisLine: {
show: false
}
}, {
type: "value",
splitLine: {
show: false
},
axisLabel: {
show: false
},
axisTick: {
show: false
},
axisLine: {
show: false
}
}],
series: [{
z: 10,
xAxisIndex: 0,
yAxisIndex: 0,
name: '',
type: 'pictorialBar',
data: barData,
barCategoryGap: '90%',
label: {
normal: {
show: true,
position: 'inside',
textStyle: {
fontSize: 12,
color: '#666'
}
}
},
symbolRepeat: false,
symbolSize: ['100%', 25],
symbolOffset: [-16.5, 0],
itemStyle: {
normal: {
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
offset: 0,
color: '#FFD86E'
}], false),
borderRadius:'10'
}
},
symbolClip: true,
symbolPosition: 'end',
symbol: 'rect'
}]
};
myChart.setOption(option);
}
class SecondTab extends Component{
constructor(props){
super(props);
this.state = {
}
}
componentDidMount(){
var pathId = this.props.match.params.pathId;
var myCharts = echarts.init(document.getElementById('showloding'));
myCharts.showLoading({
text: "数据获取中",
effect: 'whirling'
})
const url = `/paths/${pathId}/shixun_report.json`
axios.get(url, {
})
.then((response) => {
// TODO 没用404返回的error
if (response.data.status == 404) {
this.props.showSnackbar('未找到对应数据,请查看地址是否正确。')
return
}
/**
let yAxisMonth = ["1-1", "1-2", "1-3", "1-4", "2-1", "2-2", "2-3", "3-1", "3-2"];
let barData = [1164, 739, 784, 720, 726, 556, 381, 432, 239];
{
"number": "6-1",
"shixun_name": "网页抓取及信息提取",
"member_count": 0,
"school_count": 0
}
*/
let yAxisMonth = []
let barData = []
let shixunList = []
let mapByNumber = {}
const _data = response.data.shixun_lists.forEach( (ar, index) => {
ar.forEach( (item, itemIndex) => {
shixunList.push(item)
yAxisMonth.push(item.number)
barData.push(item.member_count)
mapByNumber[item.number] = item
})
})
this.setState({
shixunList
})
var myChart = echarts.init(document.getElementById('shixunStudyStatistics'));
myChart.showLoading({
text: "数据获取中",
effect: 'whirling'
})
setTimeout(() => {
InitShixunStudyStatistics(yAxisMonth, barData, mapByNumber, myChart);
myCharts.hideLoading();
myChart.hideLoading();
}, 1000)
})
.catch(function (error) {
console.log(error);
});
}
render(){
const { shixunList } = this.state;
return(
<div className="clearfix panelForm-2">
<div className="with60 pr40 fl">
<div className="static_shadow edu-back-white">
<p className="font-24 padding30-20">实训使用详情</p>
<div className="minH-440" id="tableHeight">
<table className="edu-pop-table head-color edu-txt-center bor-top-greyE" cellSpacing="0" cellPadding="0">
<thead>
<tr>
<th>章节</th>
<th className="edu-txt-left" width="40%">实训名称</th>
<th>学习人数</th>
<th>受用院校</th>
</tr>
</thead>
<tbody>
{
shixunList && shixunList.map( (shixun, index) => {
return (
<tr>
<td>{shixun.number}</td>
<td className="edu-txt-left task-hide" style={{"maxWidth":"272px"}}>{shixun.shixun_name}</td>
<td>{shixun.member_count}</td>
<td className="color-blue">{shixun.school_count}</td>
</tr>)
})
}
</tbody>
</table>
</div>
</div>
</div>
<div className="with40 fl static_shadow edu-back-white">
<p className="font-24 padding30-20">实训学习统计</p>
{shixunList===undefined?<div id="showloding"
style={{"width":"480px","height":"440px"}}></div>:""}
{shixunList===undefined?"":<div id="shixunStudyStatistics"
style={{"width":"480px","minHeight":`${shixunList&&shixunList.length *50}px`}}></div>}
</div>
</div>
)
}
}
export default SecondTab;

@ -2,7 +2,7 @@ import React, { Component } from "react";
import { message, Icon, Input, Form, Upload} from "antd";
import axios from 'axios'
import ModalWrapper from "../../courses/common/ModalWrapper"
import { City, getUploadActionUrl, getImageUrl, ImageLayerHook, getUploadActionUrlOfAuth } from 'educoder'
import { City, getUploadActionUrl, getImageUrl, ImageLayer2, getUploadActionUrlOfAuth } from 'educoder'
import '../account/common.css'
import authImg from '../../../images/account/auth.png'
@ -308,8 +308,8 @@ class RealNameCertificationModal extends Component{
<div className="df mt10 color-grey-9" style={{ justifyContent: 'center' }} >
<span className="fl mr20 edu-txt-center" style={{width:"160px"}}>示例图片</span>
<span className="fl edu-txt-center mr20" style={{width:"160px"}}>
<ImageLayerHook parentSel={'#imageLayerBtn'} parentSel={'#imageLayerBtn'}
></ImageLayerHook>
<ImageLayer2 parentSel={'#imageLayerBtn'} parentSel={'#imageLayerBtn'}
></ImageLayer2>
<a href="javascript:void(0)" id="imageLayerBtn" src={imageUrl || imageUrl2} className="color-orange" style={{borderBottom:"1px solid #ff6800"}}>查看大图</a>
</span>
</div>

@ -370,17 +370,17 @@ class InfosTopics extends Component{
{
`
::-webkit-scrollbar-thumb {
background-color: #cde5fe;
box-shadow: 0px 0px black;
}
::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0);
background-color: #fff;
}
// ::-webkit-scrollbar-thumb {
// background-color: #cde5fe;
//
// box-shadow: 0px 0px black;
// }
//
//
// ::-webkit-scrollbar-track {
// -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0);
// background-color: #fff;
// }
.shaiContent li.shaiItem {
padding: 0px 9px;

@ -429,4 +429,8 @@
.topsicinline{
display: inline-block;
}
/* 防抖 */
.educontent .square-list {
min-height: 400px;
}

@ -1,3 +1,7 @@
/* 撑开滚动条,防抖 */
.educontent > .itemWrap {
min-height: 400px;
}
.itemWrap {
display: flex;
flex-wrap: wrap;

Loading…
Cancel
Save