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

video_log
daiao 5 years ago
commit 0d6488e581

@ -27,14 +27,16 @@ class Weapps::AttendancesController < ApplicationController
tip_exception(403) if @user_course_identity >= Course::STUDENT tip_exception(403) if @user_course_identity >= Course::STUDENT
current_date = Date.current current_date = Date.current
current_end_time = Time.current.strftime("%H:%M:%S") current_end_time = Time.current.strftime("%H:%M:%S")
@current_attendance = @course.course_attendances.where("attendance_date = '#{current_date}' and start_time <= '#{current_end_time}' and end_time > '#{current_end_time}'").take @current_attendance = @course.course_attendances.where("attendance_date = '#{current_date}' and end_time > '#{current_end_time}'").take
all_attendances = @course.course_attendances all_attendances = @course.course_attendances.where("attendance_date < '#{current_date}' or (attendance_date = '#{current_date}' and end_time < '#{current_end_time}')")
@all_member_attendances = CourseMemberAttendance.where(course_attendance_id: all_attendances)
if params[:group_id].present? if params[:group_id].present?
all_attendances = all_attendances.where(course_group_id: [params[:group_id], 0]) all_attendances = all_attendances.joins(:course_attendance_groups).where(course_attendance_groups: {course_group_id: [params[:group_id], 0]})
@all_member_attendances = @all_member_attendances.joins(:course_member).where(course_members: {course_group_id: params[:group_id]})
end end
@history_attendances = all_attendances.where("attendance_date < '#{current_date}' or (attendance_date = '#{current_date}' and end_time < '#{current_end_time}')").order("id asc") @history_attendances = all_attendances.order("id asc")
@all_history_count = @history_attendances.size @all_history_count = @history_attendances.size
end end

@ -9,4 +9,12 @@ module Weapps::AttendancesHelper
course_member_ids = group.course_members.pluck(:id) course_member_ids = group.course_members.pluck(:id)
attendances.select{|attendance| course_member_ids.include?(attendance.course_member_id) && attendance.attendance_status == "NORMAL"}.size attendances.select{|attendance| course_member_ids.include?(attendance.course_member_id) && attendance.attendance_status == "NORMAL"}.size
end end
def history_member_count member_attendances, status, attendance_id
member_attendances.select{|member_attendance| member_attendance.attendance_status == status && member_attendance.course_attendance_id == attendance_id}.size
end
def cal_rate base, sum
sum == 0 ? 0 : (base.to_f / sum)
end
end end

@ -1,11 +1,21 @@
json.current_attendance do json.current_attendance do
json.(@current_attendance, :id, :normal_count, :all_count) json.(@current_attendance, :id, :normal_count, :all_count) if @current_attendance
end end
json.history_attendances @history_attendances do |attendance| all_normal_rate = []
all_absence_rate = []
json.history_attendances @history_attendances.each_with_index.to_a do |attendance, index|
normal_count = history_member_count(@all_member_attendances, "NORMAL", attendance.id)
absence_count = history_member_count(@all_member_attendances, "ABSENCE", attendance.id)
all_count = @all_member_attendances.select{|member_attendance| member_attendance.course_attendance_id == attendance.id}.size
json.index index + 1
json.normal_rate cal_rate(normal_count, all_count)
all_normal_rate << cal_rate(normal_count, all_count)
json.absence_rate cal_rate(absence_count, all_count)
all_absence_rate << cal_rate(absence_count, all_count)
end end
json.all_history_count @all_history_count json.all_history_count @all_history_count
json.normal_count @normal_count json.avg_normal_rate @all_history_count == 0 ? 0 : all_normal_rate.sum / @all_history_count
json.leave_count @leave_count json.avg_absence_rate @all_history_count == 0 ? 0 : all_absence_rate.sum / @all_history_count
json.absence_count @absence_count

@ -3,6 +3,7 @@ json.leave_count @leave_count
json.absence_count @absence_count json.absence_count @absence_count
json.all_count @all_count json.all_count @all_count
json.code @attendance.attendance_code json.code @attendance.attendance_code
json.mode @attendance.mode
json.edit_auth @user_course_identity < Course::PROFESSOR || @attendance.user_id == User.current.id json.edit_auth @user_course_identity < Course::PROFESSOR || @attendance.user_id == User.current.id
json.course_groups @groups do |group| json.course_groups @groups do |group|
json.(group, :id, :name, :course_members_count) json.(group, :id, :name, :course_members_count)

@ -793,37 +793,37 @@ class App extends Component {
render={ render={
(props) => (<Paperreview {...this.props} {...props} {...this.state} />) (props) => (<Paperreview {...this.props} {...props} {...this.state} />)
}/> }/>
<Route path="/paperlibrary/edit/:id" {/*<Route path="/paperlibrary/edit/:id"*/}
render={ {/* render={*/}
(props) => (<Paperlibraryeditid {...this.props} {...props} {...this.state} />) {/* (props) => (<Paperlibraryeditid {...this.props} {...props} {...this.state} />)*/}
}/> {/* }/>*/}
<Route path="/paperlibrary/see/:id" {/*<Route path="/paperlibrary/see/:id"*/}
render={ {/* render={*/}
(props) => (<Paperlibraryseeid {...this.props} {...props} {...this.state} />) {/* (props) => (<Paperlibraryseeid {...this.props} {...props} {...this.state} />)*/}
}/> {/* }/>*/}
<Route path="/myproblems/:id/:tab?" <Route path="/myproblems/:id/:tab?"
render={ render={
(props) => (<StudentStudy {...this.props} {...props} {...this.state} />) (props) => (<StudentStudy {...this.props} {...props} {...this.state} />)
} /> } />
<Route path="/question/edit/:id" {/*<Route path="/question/edit/:id"*/}
render={ {/* render={*/}
(props) => (<Questionitem_banks {...this.props} {...props} {...this.state} />) {/* (props) => (<Questionitem_banks {...this.props} {...props} {...this.state} />)*/}
} /> {/* } />*/}
<Route path="/question/newitem" {/*<Route path="/question/newitem"*/}
render={ {/* render={*/}
(props) => (<Questionitem_banks {...this.props} {...props} {...this.state} />) {/* (props) => (<Questionitem_banks {...this.props} {...props} {...this.state} />)*/}
} /> {/* } />*/}
<Route path="/question/:type" {/*<Route path="/question/:type"*/}
render={ {/* render={*/}
(props) => (<Headplugselection {...this.props} {...props} {...this.state} />) {/* (props) => (<Headplugselection {...this.props} {...props} {...this.state} />)*/}
} /> {/* } />*/}
<Route path="/paperlibrary" {/*<Route path="/paperlibrary"*/}
render={ {/* render={*/}
(props) => (<Testpaperlibrary {...this.props} {...props} {...this.state} />) {/* (props) => (<Testpaperlibrary {...this.props} {...props} {...this.state} />)*/}
}/> {/* }/>*/}
<Route path="/Integeneration" <Route path="/Integeneration"
render={ render={
@ -835,15 +835,19 @@ class App extends Component {
(props) => (<Developer {...this.props} {...props} {...this.state} />) (props) => (<Developer {...this.props} {...props} {...this.state} />)
}/> }/>
<Route path="/question" {/*<Route path="/question"*/}
render={ {/* render={*/}
(props) => (<Headplugselection {...this.props} {...props} {...this.state} />) {/* (props) => (<Headplugselection {...this.props} {...props} {...this.state} />)*/}
}/> {/* }/>*/}
{/*<Route path="/wxcode/:identifier?" component={WXCode}*/} {/*<Route path="/wxcode/:identifier?" component={WXCode}*/}
{/* render={*/} {/* render={*/}
{/* (props)=>(<WXCode {...this.props} {...props} {...this.state}></WXCode>)*/} {/* (props)=>(<WXCode {...this.props} {...props} {...this.state}></WXCode>)*/}
{/* }*/} {/* }*/}
{/*/>*/} {/*/>*/}
<Route exact path="/" <Route exact path="/"
// component={ShixunsHome} // component={ShixunsHome}
render={ render={

@ -9,7 +9,7 @@ import axios from 'axios';
const { TextArea } = Input; const { TextArea } = Input;
const { Option } = Select; const { Option } = Select;
const array=['腾讯课堂','B站','斗鱼','威佰通']; const array=['腾讯课堂','斗鱼直播','Bilibili','威佰通'];
function range(start, end) { function range(start, end) {
const result = []; const result = [];

@ -525,7 +525,6 @@ class Coursesleftnav extends Component{
} }
saveNavmodapost=(url,value,positiontype,coursesId)=>{ saveNavmodapost=(url,value,positiontype,coursesId)=>{
debugger;
axios.post(url, axios.post(url,
{name:value}).then((result)=>{ {name:value}).then((result)=>{
if(result!=undefined){ if(result!=undefined){

@ -228,7 +228,7 @@ class GraduateTopicDetailTable extends Component{
</Modal> </Modal>
<Modal <Modal
visible={visible} visible={visible}
title="新建分班2" title="新建分班"
closable={false} closable={false}
footer={null} footer={null}
destroyOnClose={true} destroyOnClose={true}

@ -66,7 +66,7 @@ function CourseGroupListTable(props) {
className:"color-grey-6", className:"color-grey-6",
render: (name, record, index) => { render: (name, record, index) => {
return <WordsBtn title={name.length > 11 ? name : ''} onClick={() => onGoDetail(record)} style={''} return <WordsBtn title={name.length > 11 ? name : ''} onClick={() => onGoDetail(record)} style={''}
className="overflowHidden1" style2={{maxWidth: '180px', verticalAlign: 'bottom'}}> className="overflowHidden1 color-dark" style2={{maxWidth: '180px', verticalAlign: 'bottom'}}>
{name}</WordsBtn> {name}</WordsBtn>
} }
}, },
@ -154,7 +154,7 @@ function CourseGroupListTable(props) {
{!isCourseEnd && isAdmin && <WordsBtn style2={{ marginRight: '12px' }} onClick={() => onDelete(record)} style={'grey'}>删除分班</WordsBtn>} {!isCourseEnd && isAdmin && <WordsBtn style2={{ marginRight: '12px' }} onClick={() => onDelete(record)} style={'grey'}>删除分班</WordsBtn>}
{isStudent && <WordsBtn style2={{ marginRight: '12px' }} onClick={() => addToDir(record)} style={''}>加入分班</WordsBtn>} {isStudent && <WordsBtn style2={{ marginRight: '12px' }} onClick={() => addToDir(record)} style={''}>加入分班</WordsBtn>}
<WordsBtn onClick={() => onGoDetail(record)} style={''}>查看</WordsBtn> <WordsBtn onClick={() => onGoDetail(record)} style={''} className="color-dark">查看</WordsBtn>
</React.Fragment> </React.Fragment>
} }
}) })

@ -1,34 +1,16 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal} from 'antd'; import { getUploadActionUrl, getUrl } from 'educoder';
import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom";
// import "antd/dist/antd.css";
import { getImageUrl, getUploadActionUrl, getUrl } from 'educoder';
import '../../courses/css/Courses.css' import '../../courses/css/Courses.css'
import axios from 'axios';
import './css/TPMchallengesnew.css'; import './css/TPMchallengesnew.css';
require('codemirror/lib/codemirror.css'); require('codemirror/lib/codemirror.css');
let origin = getUrl();
let path = '/editormd/lib/' let path = '/editormd/lib/'
path = getUrl("/editormd/lib/") path = getUrl("/editormd/lib/")
const $ = window.$; const $ = window.$;
let timeout;
let currentValue;
const Option = Select.Option;
const RadioGroup = Radio.Group;
// 保存数据 // 保存数据
function md_add_data(k, mdu, d) { function md_add_data(k, mdu, d) {
@ -107,7 +89,7 @@ function create_editorMD(id, width, high, placeholder, imageUrl, callback, initV
var editorName = window.editormd(id, { var editorName = window.editormd(id, {
width: width, width: width,
height: high === undefined ? 400 : high, height: high === undefined ? 400 : high,
path: path, // "/editormd/lib/" path: getUrl("/editormd/lib/"), // "/editormd/lib/"
markdown: initValue, markdown: initValue,
dialogLockScreen: false, dialogLockScreen: false,
@ -123,21 +105,35 @@ function create_editorMD(id, width, high, placeholder, imageUrl, callback, initV
sequenceDiagram: true, sequenceDiagram: true,
autoFocus: false, autoFocus: false,
// mine
toolbarIcons: function (mdEditor) { toolbarIcons: function (mdEditor) {
let react_id = `react_${mdEditor.id}`; let react_id = `react_${mdEditor.id}`;
const __that = window[react_id] const __that = window[react_id]
// Or return editormd.toolbarModes[name]; // full, simple, mini
// Using "||" set icons align right. // Using "||" set icons align right.
const icons = ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "link", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"]; const icons = ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "link", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "line-break", "watch", "clear"];
// 试卷处用到的填空题新增按钮 // 试卷处用到的填空题新增按钮
if (__that.props.showNullButton) { if (__that.props.showNullButton) {
icons.push('nullBtton') icons.push('nullBtton')
} }
return icons return icons
}, },
toolbarIconsClass: {
"line-break": "fa-minus"
},
toolbarHandlers: {
/**
* @param {Object} cm CodeMirror对象
* @param {Object} icon 图标按钮jQuery元素对象
* @param {Object} cursor CodeMirror的光标对象可获取光标所在行和位置
* @param {String} selection 编辑器选中的文本
*/
"line-break": function (cm, icon, cursor, selection) {
// 如果当前没有选中的文本,将光标移到要输入的位置
if (selection === "") {
cm.setCursor(cursor.line, cursor.ch + 1)
}
cm.replaceSelection("<br/>");
}
},
toolbarCustomIcons: { toolbarCustomIcons: {
testIcon: "<a type=\"inline\" class=\"latex\" ><div class='zbg'></div></a>", testIcon: "<a type=\"inline\" class=\"latex\" ><div class='zbg'></div></a>",
testIcon1: "<a type=\"latex\" class=\"latex\" ><div class='zbg_latex'></div></a>", testIcon1: "<a type=\"latex\" class=\"latex\" ><div class='zbg_latex'></div></a>",
@ -157,9 +153,6 @@ function create_editorMD(id, width, high, placeholder, imageUrl, callback, initV
let _editorName = this; let _editorName = this;
let react_id = `react_${_editorName.id}`; let react_id = `react_${_editorName.id}`;
const __that = window[react_id] const __that = window[react_id]
// this.previewing();
// let _id = id;
$("#" + _id + " [type=\"latex\"]").bind("click", function () { $("#" + _id + " [type=\"latex\"]").bind("click", function () {
_editorName.cm.replaceSelection("```latex"); _editorName.cm.replaceSelection("```latex");
_editorName.cm.replaceSelection("\n"); _editorName.cm.replaceSelection("\n");
@ -180,19 +173,12 @@ function create_editorMD(id, width, high, placeholder, imageUrl, callback, initV
if (__that.props.showNullButton) { if (__that.props.showNullButton) {
const NULL_CH = '▁' const NULL_CH = '▁'
// const NULL_CH = ''
// const NULL_CH = '🈳'
$("#" + _id + " [type=\"nullBtton\"]").bind("click", function () { $("#" + _id + " [type=\"nullBtton\"]").bind("click", function () {
_editorName.cm.replaceSelection(NULL_CH); _editorName.cm.replaceSelection(NULL_CH);
// var __Cursor = _editorName.cm.getDoc().getCursor();
// _editorName.cm.setCursor(__Cursor.line - 1, 0);
}); });
} }
if (noStorage == true) { if (!noStorage == true) {
} else {
md_elocalStorage(_editorName, `MDEditor__${_id}`, _id); md_elocalStorage(_editorName, `MDEditor__${_id}`, _id);
} }

@ -208,7 +208,7 @@ render() {
<div className="educontent"> <div className="educontent">
<div className="pt_b_26"> <div className="pt_b_26">
<div className="clearfix mb20 shaiContent"> <div className="clearfix mb20 shaiContent">
<span className="shaiTitle fl mt3">方向</span> <span className="shaiTitle fl">方向</span>
<div className="fl pr shaiAllItem"> <div className="fl pr shaiAllItem">
<li className={shixunsearchAllvalue==="a"?"shaiItem shixun_repertoire active":"shaiItem shixun_repertoire"} value= "a" onClick={this.shixunsearchall}>全部</li> <li className={shixunsearchAllvalue==="a"?"shaiItem shixun_repertoire active":"shaiItem shixun_repertoire"} value= "a" onClick={this.shixunsearchall}>全部</li>
<style> <style>
@ -223,6 +223,7 @@ render() {
margin-right: 20px; margin-right: 20px;
color: #999; color: #999;
cursor: pointer; cursor: pointer;
margin-bottom:10px;
} }
.ant-dropdown-menu-item, .ant-dropdown-menu-submenu-title{ .ant-dropdown-menu-item, .ant-dropdown-menu-submenu-title{
padding: 0px 12px; padding: 0px 12px;
@ -249,12 +250,23 @@ render() {
</div> </div>
</div> </div>
<div className="clearfix"> <div className="clearfix">
<span className="shaiTitle fl mt6">筛选</span> <span className="shaiTitle fl">筛选</span>
{ {
<style> <style>
{` {`
.shaiContent li.shaiItem{
padding:0px 15px;
line-height:32px;
height:32px
}
.shaiTitle{
height:32px;
line-height:32px;
}
.shaiItems{ .shaiItems{
padding: 3px 15px; padding:0px 15px;
line-height:32px;
height:32px;
float: left; float: left;
border-radius: 4px; border-radius: 4px;
color: #4C4C4C; color: #4C4C4C;

@ -396,7 +396,7 @@ class ShixunsIndex extends Component {
} }
.myshixin-head{ .myshixin-head{
width: 100%; width: 100%;
height: 300px; height: 240px;
background-image: url(${getImageUrl(this.props.mygetHelmetapi && this.props.mygetHelmetapi.shixun_banner_url === null ?`images/educoder/courses/courses.jpg`:this.props.mygetHelmetapi&&this.props.mygetHelmetapi.shixun_banner_url)}); background-image: url(${getImageUrl(this.props.mygetHelmetapi && this.props.mygetHelmetapi.shixun_banner_url === null ?`images/educoder/courses/courses.jpg`:this.props.mygetHelmetapi&&this.props.mygetHelmetapi.shixun_banner_url)});
background-color: #081C4B; background-color: #081C4B;
background-position: center; background-position: center;

Loading…
Cancel
Save