Merge branches 'dev_aliyun' and 'dev_item_bank' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_item_bank

dev_jupyter
杨树明 5 years ago
commit cdeb7d5168

@ -24,8 +24,8 @@ class ApplicationController < ActionController::Base
# 所有请求必须合法签名 # 所有请求必须合法签名
def check_sign def check_sign
Rails.logger.info("66666 #{params}") Rails.logger.info("66666 #{params}")
suffix = request.url.split(".").last suffix = request.url.split(".").last.split("?").first
suffix_arr = ["xls", "xlsx"] # excel文件先注释 suffix_arr = ["xls", "xlsx", "pdf"] # excel文件先注释
unless suffix_arr.include?(suffix) unless suffix_arr.include?(suffix)
if params[:client_key].present? if params[:client_key].present?
randomcode = params[:randomcode] randomcode = params[:randomcode]

@ -14,14 +14,14 @@ class DiscussesController < ApplicationController
@disscuss_count = Discuss.where(:dis_id => @container.id, :dis_type => @container.class.to_s, :root_id => nil).count @disscuss_count = Discuss.where(:dis_id => @container.id, :dis_type => @container.class.to_s, :root_id => nil).count
disscusses = Discuss.where(:dis_id => @container.id, :dis_type => @container.class.to_s, disscusses = Discuss.where(:dis_id => @container.id, :dis_type => @container.class.to_s,
:root_id => nil) :root_id => nil)
@discusses = disscusses.limit(LIMIT).joins("left join games on discusses.challenge_id = games.challenge_id and discusses.user_id = games.user_id") @discusses = disscusses.joins("left join games on discusses.challenge_id = games.challenge_id and discusses.user_id = games.user_id")
.select("discusses.*, games.identifier").includes(:user, :praise_treads).offset(offset) .select("discusses.*, games.identifier").includes(:user, :praise_treads)
else else
disscusses = Discuss.where("dis_id = :dis_id and dis_type = :dis_type and root_id is null and disscusses = Discuss.where("dis_id = :dis_id and dis_type = :dis_type and root_id is null and
(discusses.hidden = :hidden or discusses.user_id = :user_id)", (discusses.hidden = :hidden or discusses.user_id = :user_id)",
{dis_id: @container.id, dis_type: @container.class.to_s, hidden: false, user_id: current_user.id}) {dis_id: @container.id, dis_type: @container.class.to_s, hidden: false, user_id: current_user.id})
@disscuss_count = disscusses.count("discusses.id") @disscuss_count = disscusses.count("discusses.id")
@discusses = disscusses.limit(LIMIT).includes(:user, :praise_treads).offset(offset) @discusses = disscusses.includes(:user, :praise_treads).limit(LIMIT).offset(offset)
end end
@current_user = current_user @current_user = current_user

@ -1,5 +1,5 @@
class GitsController < ApplicationController class GitsController < ApplicationController
skip_before_action :check_sign
# 说明: # 说明:
# 以下Git认证只针对新版gitGitlab的Git认证不走该控制器 # 以下Git认证只针对新版gitGitlab的Git认证不走该控制器
# 思路: # 思路:
@ -39,7 +39,7 @@ class GitsController < ApplicationController
# 用户是否对对象拥有权限 # 用户是否对对象拥有权限
system_user = User.find_by_login(input_username) || User.find_by_mail(input_username) || User.find_by_phone(input_username) system_user = User.find_by_login(input_username) || User.find_by_mail(input_username) || User.find_by_phone(input_username)
# 如果用户名密码错误 # 如果用户名密码错误
if system_user && !system_user.check_password?(input_password) if system_user.blank? || system_user && !system_user.check_password?(input_password)
uid_logger_error("git start: password is wrong") uid_logger_error("git start: password is wrong")
result = false result = false
else else

@ -1377,12 +1377,12 @@ class HomeworkCommonsController < ApplicationController
tip_exception(-1, "作业还未发布,不能评阅") if @homework_detail_manual.comment_status == 0 tip_exception(-1, "作业还未发布,不能评阅") if @homework_detail_manual.comment_status == 0
tip_exception("请至少输入一个评阅") if params[:comment].blank? && params[:hidden_comment].blank? tip_exception("请至少输入一个评阅") if params[:comment].blank? && params[:hidden_comment].blank?
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
work_ids = @homework.student_works.where(user_id: @course.teacher_group_user_ids(current_user.id)).pluck(:id) work_ids = @homework.student_works.where(work_status: [1, 2], user_id: @course.teacher_group_user_ids(current_user.id)).pluck(:id)
has_comment_ids = ShixunWorkComment.where(challenge_id: 0, student_work_id: work_ids, batch_comment: 0).pluck(:student_work_id) has_comment_ids = ShixunWorkComment.where(challenge_id: 0, student_work_id: work_ids, batch_comment: 0).pluck(:student_work_id)
batch_comment_works = ShixunWorkComment.where(challenge_id: 0, student_work_id: work_ids, batch_comment: 1) batch_comment_works = ShixunWorkComment.where(challenge_id: 0, student_work_id: work_ids, batch_comment: 1)
batch_comment_works.update_all(comment: params[:comment], hidden_comment: params[:hidden_comment]) batch_comment_works.update_all(comment: params[:comment], hidden_comment: params[:hidden_comment])
work_ids = work_ids - has_comment_ids - batch_comment_works.pluck(:student_work_id) work_ids = work_ids - has_comment_ids - batch_comment_works.pluck(:student_work_id)
@homework.student_works.where(work_status: 0, id: work_ids).update_all(work_status: 1, commit_time: @homework.end_time, update_time: Time.now, work_score: 0, final_score: 0) # @homework.student_works.where(work_status: 0, id: work_ids).update_all(work_status: 1, commit_time: @homework.end_time, update_time: Time.now, work_score: 0, final_score: 0)
HomeworkBatchCommentJob.perform_later(params[:comment], params[:hidden_comment], work_ids, @homework.id, current_user.id) HomeworkBatchCommentJob.perform_later(params[:comment], params[:hidden_comment], work_ids, @homework.id, current_user.id)
normal_status("评阅成功") normal_status("评阅成功")
end end

@ -792,12 +792,12 @@ class PollsController < ApplicationController
if the_group_setting_status == 2 if the_group_setting_status == 2
poll_group_params = { poll_group_params = {
:publish_time => the_group_setting.publish_time, :publish_time => the_group_setting.publish_time,
:end_time => poll_end_time :end_time => poll_end_time < Time.now ? the_group_setting.end_time : poll_end_time
} }
elsif the_group_setting_status == 3 elsif the_group_setting_status == 3
poll_group_params = { poll_group_params = {
:publish_time => the_group_setting.publish_time, :publish_time => the_group_setting.publish_time,
:end_time => the_group_setting.end_time :end_time => poll_end_time
} }
end end
the_group_setting.update_attributes(poll_group_params) the_group_setting.update_attributes(poll_group_params)

@ -128,7 +128,13 @@ export function getTaskUrlById(id) {
export function getRandomcode(url) { export function getRandomcode(url) {
Railsgettimes() Railsgettimes()
let anewopens=md5(newopens+newtimestamp); let anewopens=md5(newopens+newtimestamp);
return `${url}?randomcode=${newtimestamp}&client_key=${anewopens}`
if (url.indexOf('?') == -1) {
return `${url}?randomcode=${newtimestamp}&client_key=${anewopens}`
}else {
return `${url}&randomcode=${newtimestamp}&client_key=${anewopens}`
}
} }
export function htmlEncode(str) { export function htmlEncode(str) {

@ -132,6 +132,7 @@ class Exercisesetting extends Component{
// 已有设置数据的查询 // 已有设置数据的查询
getSettingInfo=()=>{ getSettingInfo=()=>{
this.props.Commonheadofthetestpapers()
let Id=this.props.match.params.Id; let Id=this.props.match.params.Id;
let url=`/exercises/${Id}/exercise_setting.json`; let url=`/exercises/${Id}/exercise_setting.json`;
axios.get(url).then((result)=>{ axios.get(url).then((result)=>{

@ -61,7 +61,7 @@ class Testpapersettinghomepage extends Component{
} }
//试卷公用头部 //试卷公用头部
Commonheadofthetestpaper=()=>{ Commonheadofthetestpaper=()=>{
console.log("Commonheadofthetestpaper 试卷公用头部"); // console.log("Commonheadofthetestpaper 试卷公用头部");
var exercise_id = this.props.match.params.Id; var exercise_id = this.props.match.params.Id;
var url = `/exercises/${exercise_id}/common_header.json`; var url = `/exercises/${exercise_id}/common_header.json`;
axios.get(url).then((response) => { axios.get(url).then((response) => {
@ -475,7 +475,7 @@ class Testpapersettinghomepage extends Component{
} }
{ {
parseInt(tab[0])==3 ? <WrappedExercisesetting Commonheadofthetestpaper={this.state.Commonheadofthetestpaper} {...this.props} {...this.state} triggerRef={this.bindRef}></WrappedExercisesetting>:"" parseInt(tab[0])==3 ? <WrappedExercisesetting Commonheadofthetestpaper={this.state.Commonheadofthetestpaper} {...this.props} {...this.state} triggerRef={this.bindRef} Commonheadofthetestpapers={this.Commonheadofthetestpaper}></WrappedExercisesetting>:""
} }
</div> </div>
</div> </div>

@ -5,7 +5,7 @@ import CourseLayoutcomponent from '../../common/CourseLayoutComponent'
import Titlesearchsection from '../../common/titleSearch/TitleSearchSection' import Titlesearchsection from '../../common/titleSearch/TitleSearchSection'
import DownloadMessageysl from "../../../modals/DownloadMessageysl"; import DownloadMessageysl from "../../../modals/DownloadMessageysl";
import { WordsBtn } from 'educoder' import { WordsBtn ,getRandomcode} from 'educoder'
import NoneData from '../../coursesPublic/NoneData' import NoneData from '../../coursesPublic/NoneData'
import Modals from "../../../modals/Modals" import Modals from "../../../modals/Modals"
import axios from 'axios' import axios from 'axios'
@ -353,7 +353,7 @@ onBoardsNew=()=>{
} }
}else { }else {
this.props.showNotification(`正在下载中`); this.props.showNotification(`正在下载中`);
window.open("/api"+url, '_blank'); window.open(getRandomcode("/api"+url), '_blank');
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)

@ -68,6 +68,23 @@ class PollDetailIndex extends Component{
} }
} }
newgetPollInfo=()=>{
// console.log(this.props);
let pollId=this.props.match.params.pollId;
let url=`/polls/${pollId}/common_header.json`
axios.get(url).then((result)=>{
if(result.status==200){
this.setState({
pollDetail:result.data,
user_permission:result.data.user_permission,
polls_status:result.data.polls_status,
})
}
}).catch((error)=>{
console.log(error);
})
}
componentDidMount(){ componentDidMount(){
const query =this.props.location.search; const query =this.props.location.search;
@ -259,7 +276,7 @@ class PollDetailIndex extends Component{
} }
{ {
//设置 //设置
parseInt(tab[0])==3 && <PollTabForth {...this.props} {...this.state} triggerRef={this.bindRef} user_permission={user_permission} getPollInfo={this.getPollInfo}></PollTabForth> parseInt(tab[0])==3 && <PollTabForth {...this.props} {...this.state} triggerRef={this.bindRef} user_permission={user_permission} getPollInfo={this.getPollInfo} newgetPollInfo={this.newgetPollInfo}></PollTabForth>
} }
</div> </div>

@ -112,7 +112,7 @@ class PollDetailTabForth extends Component{
// 已有设置数据的查询 // 已有设置数据的查询
getSettingInfo=()=>{ getSettingInfo=()=>{
this.props.getPollInfo(); this.props.newgetPollInfo();
let pollId=this.props.match.params.pollId; let pollId=this.props.match.params.pollId;
let url=`/polls/${pollId}/poll_setting.json`; let url=`/polls/${pollId}/poll_setting.json`;
axios.get(url).then((result)=>{ axios.get(url).then((result)=>{
@ -197,6 +197,7 @@ class PollDetailTabForth extends Component{
this.props.form.validateFieldsAndScroll((err, values) => { this.props.form.validateFieldsAndScroll((err, values) => {
if(!err){ if(!err){
// 第一次进行问卷设置或者勾选了统一设置 // 第一次进行问卷设置或者勾选了统一设置
let{unitSetting}=this.state let{unitSetting}=this.state
if(unitSetting==true){ if(unitSetting==true){

@ -1,6 +1,6 @@
import React, {Component} from "react"; import React, {Component} from "react";
import CoursesListType from '../coursesPublic/CoursesListType'; import CoursesListType from '../coursesPublic/CoursesListType';
import {WordsBtn, ActionBtn, sortDirections} from 'educoder'; import {WordsBtn, getRandomcode, sortDirections} from 'educoder';
import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal'; import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal';
import HomeworkModal from "../coursesPublic/HomeworkModal"; import HomeworkModal from "../coursesPublic/HomeworkModal";
import OneSelfOrderModal from "../coursesPublic/OneSelfOrderModal"; import OneSelfOrderModal from "../coursesPublic/OneSelfOrderModal";
@ -622,7 +622,7 @@ class ShixunStudentWork extends Component {
} }
}else { }else {
this.props.showNotification(`正在下载中`); this.props.showNotification(`正在下载中`);
window.open("/api"+url, '_blank'); window.open(getRandomcode("/api"+url), '_blank');
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)

@ -1,5 +1,5 @@
import React, {Component} from "react"; import React, {Component} from "react";
import {WordsBtn,markdownToHTML,ActionBtn,queryString,downloadFile,getImageUrl} from 'educoder'; import {WordsBtn,markdownToHTML,getRandomcode,queryString,downloadFile,getImageUrl} from 'educoder';
import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal, Table, Divider,InputNumber, Tag,DatePicker,Radio,Tooltip,Spin} from "antd"; import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal, Table, Divider,InputNumber, Tag,DatePicker,Radio,Tooltip,Spin} from "antd";
import {Link,Switch,Route,Redirect} from 'react-router-dom'; import {Link,Switch,Route,Redirect} from 'react-router-dom';
import axios from 'axios'; import axios from 'axios';
@ -76,7 +76,7 @@ class ShixunWorkReport extends Component {
// this.props.slowDownload(url) // this.props.slowDownload(url)
// //
// this.props.showNotification(`正在下载中`); // this.props.showNotification(`正在下载中`);
window.open("/api"+url+"?disposition=inline", '_blank'); window.open(getRandomcode("/api"+url+"?disposition=inline"), '_blank');
this.setState({ isspinning: false }) this.setState({ isspinning: false })
} }
}).catch((error) => { }).catch((error) => {

@ -1,7 +1,7 @@
import React, {Component} from "react"; import React, {Component} from "react";
import CoursesListType from '../coursesPublic/CoursesListType'; import CoursesListType from '../coursesPublic/CoursesListType';
import HomeworkModal from "../coursesPublic/HomeworkModal"; import HomeworkModal from "../coursesPublic/HomeworkModal";
import {WordsBtn, ActionBtn, handleDateString, getImageUrl} from 'educoder'; import {WordsBtn, getRandomcode, handleDateString, getImageUrl} from 'educoder';
import PollDetailTabForthRules from '../poll/PollDetailTabForthRules'; import PollDetailTabForthRules from '../poll/PollDetailTabForthRules';
import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal'; import ShixunWorkModal from './Shixunworkdetails/ShixunWorkModal';
import { import {
@ -2263,7 +2263,7 @@ class Trainingjobsetting extends Component {
} }
} else { } else {
this.props.showNotification(`正在下载中`); this.props.showNotification(`正在下载中`);
window.open("/api" + url, '_blank'); window.open(getRandomcode("/api" + url), '_blank');
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)

@ -1,6 +1,6 @@
import React, {Component} from "react"; import React, {Component} from "react";
import CoursesListType from '../coursesPublic/CoursesListType'; import CoursesListType from '../coursesPublic/CoursesListType';
import {WordsBtn, ActionBtn, markdownToHTML} from 'educoder'; import {WordsBtn, getRandomcode, markdownToHTML} from 'educoder';
import { import {
Form, Form,
Select, Select,
@ -413,7 +413,7 @@ class Workquestionandanswer extends Component {
} }
}else { }else {
this.props.showNotification(`正在下载中`); this.props.showNotification(`正在下载中`);
window.open("/api"+url, '_blank'); window.open(getRandomcode("/api"+url), '_blank');
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)

@ -1,7 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
import {getRandomcode} from 'educoder';
import axios from 'axios'; import axios from 'axios';
import { Select,message,Modal,Input,Spin,Icon,Tooltip } from 'antd'; import { Select,message,Modal,Input,Spin,Icon,Tooltip } from 'antd';
@ -550,7 +550,7 @@ class CourseSupports extends Component {
} }
}else { }else {
this.props.showNotification(`正在下载中`); this.props.showNotification(`正在下载中`);
window.open("/api"+url, '_blank'); window.open(getRandomcode("/api"+url), '_blank');
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)

@ -1,5 +1,5 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import {getImageUrl} from 'educoder'; import {getRandomcode} from 'educoder';
import { Modal} from 'antd'; import { Modal} from 'antd';
import axios from 'axios'; import axios from 'axios';
@ -57,7 +57,7 @@ class DownloadMessage extends Component {
} }
}else { }else {
this.props.showNotification(`正在下载中`); this.props.showNotification(`正在下载中`);
window.open("/api"+url, '_blank'); window.open(getRandomcode("/api"+url), '_blank');
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)

@ -41,6 +41,7 @@ class MainContent extends Component {
hideCodeEvaluate = () => { hideCodeEvaluate = () => {
const vncContainer = this.refs['vncContainer'] const vncContainer = this.refs['vncContainer']
if (vncContainer) { if (vncContainer) {
// console.log('点击的关闭按钮')
vncContainer.onBottomDrawerClose && vncContainer.onBottomDrawerClose() vncContainer.onBottomDrawerClose && vncContainer.onBottomDrawerClose()
} }
} }
@ -124,7 +125,7 @@ class MainContent extends Component {
</div> </div>
} }
></VNCContainer> ></VNCContainer>
<div id="actionView" className="-layout-h -center -bg-grey-90 -grey-20 -bg-darkblack" style={{height:'48px'}}> <div id="actionView" className="-layout-h -center -bg-grey-90 -grey-20 -bg-darkblack">
<ActionView {...this.props} <ActionView {...this.props}
onRunCodeTest={onRunCodeTest} onRunCodeTest={onRunCodeTest}
></ActionView> ></ActionView>
@ -179,7 +180,9 @@ class MainContent extends Component {
</div> </div>
</div> </div>
<div id="actionView" className="-layout-h -center -bg-grey-90 -grey-20 -bg-darkblack" style={{height:'48px'}}> <div id="actionView"
style={{ position: 'absolute', width: '100%', bottom: '0', height: '51px'}}
className="-layout-h -center -bg-grey-90 -grey-20 -bg-darkblack">
<ActionView {...this.props} onRunCodeTest={onRunCodeTest}></ActionView> <ActionView {...this.props} onRunCodeTest={onRunCodeTest}></ActionView>
</div> </div>

@ -39,6 +39,47 @@
user-select: none; user-select: none;
} }
.btn_test_case,
.btn_test_case_active{
display: inline-block;
position: absolute;
width: 56px;
height: 28px;
bottom: 23px;
line-height: 28px;
background: rgba(42,58,79,1);
z-index: 10;
left: 50%;
margin-left: -28px;
border-bottom-left-radius: 100px;
border-bottom-right-radius: 100px;
color: #fff;
text-align: center;
cursor: pointer;
opacity: .4;
transition: all .3s;
}
.btn_test_case:hover,
.btn_test_case_active:hover{
opacity: 1;
}
.btn_test_case .btn-arrow{
position: relative;
font-size: 12px;
line-height: 28px;
bottom: 2px;
}
.btn_test_case_active{
bottom: 203px;
z-index: 10000;
}
.btn_test_case_active .btn-arrow{
bottom: 4px;
}
@keyframes mymove @keyframes mymove
{ {
from {right:0px;} from {right:0px;}

@ -204,6 +204,10 @@ class VNCContainer extends Component {
render() { render() {
const { challenge, vnc_url, git_url } = this.props const { challenge, vnc_url, git_url } = this.props
const _classCtx = this.state.bottomDrawer ? 'btn_test_case_active' : 'btn_test_case';
const _classes = this.state.bottomDrawer
? `iconfont icon-xiajiantou btn-arrow`
: 'iconfont icon-shangjiantou btn-arrow';
const secondDrawerChildren = this.renderSecondDrawerChildren(); const secondDrawerChildren = this.renderSecondDrawerChildren();
return ( return (
<React.Fragment> <React.Fragment>
@ -352,9 +356,16 @@ class VNCContainer extends Component {
> >
{ this.props.codeEvaluate } { this.props.codeEvaluate }
</Drawer> </Drawer>
<FloatButton onClick={this.swtichBottomDrawer} {/* <FloatButton onClick={this.swtichBottomDrawer}
className="codeEvaluateFloatButton" className="codeEvaluateFloatButton"
>测试集</FloatButton> >测试集</FloatButton> */}
<div
className={_classCtx}
onClick={this.swtichBottomDrawer}
>
{/* <span className="iconfont icon-shangjiantou btn-arrow"></span> */}
<span className={_classes}></span>
</div>
</VNCDisplay> </VNCDisplay>

@ -135,11 +135,13 @@ class VNCDisplay extends Component {
<div className="vncDisply" style={{height: '100%'}}> <div className="vncDisply" style={{height: '100%'}}>
<style>{` <style>{`
.vncDisply #top_bar { .vncDisply #top_bar {
position: absolute;
background-color: #6e84a3; background-color: #6e84a3;
color: white; color: white;
font: bold 12px Helvetica; font: bold 12px Helvetica;
padding: 6px 5px 4px 5px; padding: 6px 5px 4px 5px;
border-bottom: 1px outset; border-bottom: 1px outset;
width: 100%;
} }
.vncDisply #status { .vncDisply #status {
text-align: center; text-align: center;
@ -166,7 +168,7 @@ class VNCDisplay extends Component {
<div id="status">Loading</div> <div id="status">Loading</div>
<div id="sendCtrlAltDelButton">Send CtrlAltDel</div> <div id="sendCtrlAltDelButton">Send CtrlAltDel</div>
</div> </div>
<div id="screen"> <div id="screen" style={{ height: 'calc(100vh - 105px)' }}>
</div> </div>
{this.props.children} {this.props.children}

Loading…
Cancel
Save