阿里云合并到自己的分支

dev_cs
杨树林 6 years ago
commit fa4500de7a

@ -5,6 +5,8 @@ class Admins::BaseController < ApplicationController
layout 'admin' layout 'admin'
skip_before_action :verify_authenticity_token
before_action :require_login, :require_admin! before_action :require_login, :require_admin!
after_action :rebind_event_if_ajax_render_partial after_action :rebind_event_if_ajax_render_partial

@ -12,7 +12,7 @@ class TaskBanksController < ApplicationController
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
begin begin
@bank.update_attributes(gtask_bank_params) @bank.update_attributes(gtask_bank_params)
Attachment.associate_container(params[:attachment_ids], @bank.id, @bank.class) if params[:attachment_ids].blank? Attachment.associate_container(params[:attachment_ids], @bank.id, @bank.class) if params[:attachment_ids]
normal_status(0, "更新成功") normal_status(0, "更新成功")
rescue Exception => e rescue Exception => e
uid_logger(e.message) uid_logger(e.message)

@ -1,11 +1,12 @@
class Users::QuestionBanksController < Users::BaseController class Users::QuestionBanksController < Users::BaseController
before_action :require_login before_action :require_login
before_action :private_user_resources! skip_before_action :check_observed_user_exists!
# before_action :private_user_resources!
before_action :check_query_params! before_action :check_query_params!
before_action :check_user_permission! before_action :check_user_permission!
def index def index
service = Users::QuestionBankService.new(observed_user, query_params) service = Users::QuestionBankService.new(User.current, query_params)
question_banks = service.call question_banks = service.call
@count = question_banks.count @count = question_banks.count

@ -1,35 +1,33 @@
#coding=utf-8 #coding=utf-8
module SessionExtenstions module SessionExtenstions
module EntryExtension module EntryExtension
def compressed? def compressed?
@compressed @compressed
end end
def value def value
if @value if @value
begin begin
Marshal.load(compressed? ? Zlib::Inflate.inflate(@value) : @value) Marshal.load(compressed? ? Zlib::Inflate.inflate(@value) : @value)
rescue TypeError rescue TypeError
compressed? ? Zlib::Inflate.inflate(@value) : @value compressed? ? Zlib::Inflate.inflate(@value) : @value
end end
end end
end end
def size def size
if @value.nil? if @value.nil?
0 0
else else
@value.bytesize @value.bytesize
end end
end end
end end
end end
ActiveSupport::Cache::Entry.const_set("DEFAULT_COMPRESS_LIMIT", 1) ActiveSupport::Cache::Entry.const_set("DEFAULT_COMPRESS_LIMIT", 1)
ActiveSupport::Cache::Entry.send(:prepend, SessionExtenstions::EntryExtension) ActiveSupport::Cache::Entry.send(:prepend, SessionExtenstions::EntryExtension)

@ -55,12 +55,14 @@ Rails.application.routes.draw do
get :homepage_info get :homepage_info
end end
get :question_banks, on: :collection, to: 'users/question_banks#index'
scope module: :users do scope module: :users do
resources :courses, only: [:index] resources :courses, only: [:index]
resources :shixuns, only: [:index] resources :shixuns, only: [:index]
resources :projects, only: [:index] resources :projects, only: [:index]
resources :subjects, only: [:index] resources :subjects, only: [:index]
resources :question_banks, only: [:index] # resources :question_banks, only: [:index]
resource :experience_records, only: [:show] resource :experience_records, only: [:show]
resource :grade_records, only: [:show] resource :grade_records, only: [:show]
resource :watch, only: [:create, :destroy] resource :watch, only: [:create, :destroy]

@ -62,7 +62,7 @@ module.exports = {
// We generate sourcemaps in production. This is slow but gives good results. // We generate sourcemaps in production. This is slow but gives good results.
// You can exclude the *.map files from the build during deployment. // You can exclude the *.map files from the build during deployment.
// devtool: shouldUseSourceMap ? 'nosources-source-map' : false, //正式版 // devtool: shouldUseSourceMap ? 'nosources-source-map' : false, //正式版
devtool: shouldUseSourceMap ? 'source-map' : 'source-map',//测试版 devtool: shouldUseSourceMap ? 'source-map' : false,//测试版
// In production, we only want to load the polyfills and the app code. // In production, we only want to load the polyfills and the app code.
entry: [require.resolve('./polyfills'), paths.appIndexJs], entry: [require.resolve('./polyfills'), paths.appIndexJs],
output: { output: {

@ -100,6 +100,7 @@ class NewWorkForm extends Component{
const courseId = this.state.course_id || this.props.match.params.coursesId ; const courseId = this.state.course_id || this.props.match.params.coursesId ;
this.props.form.validateFieldsAndScroll((err, values) => { this.props.form.validateFieldsAndScroll((err, values) => {
if(err && err.personNum) delete err.personNum;
console.log(values) console.log(values)
const mdContnet = this.contentMdRef.current.getValue().trim(); const mdContnet = this.contentMdRef.current.getValue().trim();
console.log(mdContnet) console.log(mdContnet)
@ -135,7 +136,7 @@ class NewWorkForm extends Component{
} }
// const errKeys = Object.keys(err); // || errKeys.length == 1 && errKeys[0] == 'content' && mdContnet // const errKeys = Object.keys(err); // || errKeys.length == 1 && errKeys[0] == 'content' && mdContnet
if (!err) { if (!err || Object.keys(err).length == 0) {
if (this.state.isEdit) { if (this.state.isEdit) {
this.doEdit(courseId, values) this.doEdit(courseId, values)
} else { } else {
@ -451,12 +452,12 @@ class NewWorkForm extends Component{
> >
{getFieldDecorator('personNum', { {getFieldDecorator('personNum', {
validateTrigger: 'onNone', validateTrigger: 'onNone',
rules: [{ // rules: [{
// required: true, // required: true,
// message: '人数不能为空' // message: '人数不能为空'
// validator: this.personNumValidator // validator: this.personNumValidator
// required: true, message: '请输入最小人数和最大人数' // required: true, message: '请输入最小人数和最大人数'
}], // }],
})( })(
<div> <div>
<p className="clearfix"> <p className="clearfix">

@ -62,6 +62,8 @@ class ExerciseDisplay extends Component{
response.data.exercise.exercise_status = response.data.exercise.exercise_status == undefined ? 1 : response.data.exercise.exercise_status response.data.exercise.exercise_status = response.data.exercise.exercise_status == undefined ? 1 : response.data.exercise.exercise_status
this.setState({...response.data}) this.setState({...response.data})
this.props.detailFetchCallback && this.props.detailFetchCallback(response); this.props.detailFetchCallback && this.props.detailFetchCallback(response);
} else {
this.props.detailFetchCallback && this.props.detailFetchCallback(response);
} }
}) })
.catch(function (error) { .catch(function (error) {

@ -216,9 +216,9 @@ class Bullsubdirectory extends Component{
let{description,whethertoeditysl,addonAfter,eduintits,informs,isSpinysl} =this.state; let{description,whethertoeditysl,addonAfter,eduintits,informs,isSpinysl} =this.state;
let{myname,mydescription,id}=this.props; let{myname,mydescription,id}=this.props;
const {getFieldDecorator} = this.props.form; const {getFieldDecorator} = this.props.form;
console.log("Bullsubdirectory"); // console.log("Bullsubdirectory");
console.log(this.props.isAdmin()); // console.log(this.props.isAdmin());
console.log(this.props.yslbool); // console.log(this.props.yslbool);
return( return(
<React.Fragment > <React.Fragment >
<div > <div >

@ -231,7 +231,7 @@ class Eduinforms extends Component{
<p style={{height: '20px'}}> <p style={{height: '20px'}}>
<span className="font-18 fl color-dark-21">公告栏</span> <span className="font-18 fl color-dark-21">公告栏</span>
{ {
this.props.isClassManagement() === true? this.props.isClassManagement()===true?
(this.state.yslbool===false? (this.state.yslbool===false?
<li className="btn colorblue font-16 fr bluebkbk pointer" <li className="btn colorblue font-16 fr bluebkbk pointer"
onClick={() => this.bianji(true)}> onClick={() => this.bianji(true)}>

@ -67,10 +67,22 @@ class GroupPackage extends Component {
<span className="ysltextcolor05">{datas&&datas.min_num}~ {datas&&datas.max_num} 学生提交作品时需要关联同组成员组内成员作品共享</span> <span className="ysltextcolor05">{datas&&datas.min_num}~ {datas&&datas.max_num} 学生提交作品时需要关联同组成员组内成员作品共享</span>
</p> </p>
} }
<p>
<span className="ysltextcolor66">基于项目实施</span> {
<span className="ysltextcolor05">学生必须在本平台创建项目项目管理员可以提交作品</span> datas===undefined?"":datas.base_on_project===undefined?"":
</p> datas.base_on_project===true?
<p>
<span className="ysltextcolor66">基于项目实施</span>
<span className="ysltextcolor05">学生必须在本平台创建项目项目管理员可以提交作品</span>
</p>
:datas.base_on_project===false?
<p>
<span className="ysltextcolor66">不基于项目</span>
<span className="ysltextcolor05">无需在平台创建项目任意小组成员均可以提交作品</span>
</p>
:""
}
</div> </div>
:<div className="ml47text"> :<div className="ml47text">
{ {

@ -91,6 +91,7 @@ function CourseGroupChooserModal({ course_groups = [], isAdminOrCreator, item, i
} }
.courseGroupChooserModal .drop_down_menu .mainGroup.ant-checkbox-group { .courseGroupChooserModal .drop_down_menu .mainGroup.ant-checkbox-group {
width: 100%; width: 100%;
max-height: 300px!important;
height: 300px; height: 300px;
} }
.courseGroupChooserModal .drop_down_search { .courseGroupChooserModal .drop_down_search {

@ -663,7 +663,7 @@ class studentsList extends Component{
<style>{` <style>{`
/* CourseGroupChooser */ /* CourseGroupChooser */
.drop_down_menu .mainGroup.ant-checkbox-group { .drop_down_menu .mainGroup.ant-checkbox-group {
max-height: 380px; max-height: 170px;
overflow-y: auto; overflow-y: auto;
} }
.task_menu_ul .ant-menu-item, .task_menu_ul .ant-menu-submenu-title{ .task_menu_ul .ant-menu-item, .task_menu_ul .ant-menu-submenu-title{

@ -48,7 +48,8 @@ class CoursesNew extends Component {
addonAfteronelenone:0, addonAfteronelenone:0,
addonAfteronelentwo:0, addonAfteronelentwo:0,
bordebool:false, bordebool:false,
smallspinning:false smallspinning:false,
bottonloading:false
} }
} }
componentDidMount() { componentDidMount() {
@ -217,7 +218,9 @@ class CoursesNew extends Component {
if (!err) { if (!err) {
this.setState({
bottonloading:true
})
// console.log('Received values of form: ', values); // console.log('Received values of form: ', values);
@ -240,7 +243,7 @@ class CoursesNew extends Component {
if (response.data.status === 0) { if (response.data.status === 0) {
// this.goback() // this.goback()
window.location.href=first_category_url; window.location.href=first_category_url;
if(this.state.boolxinjian===true) { if(this.state.boolxinjian===true) {
var yslGuideone = window.localStorage.getItem('yslGuideone'); var yslGuideone = window.localStorage.getItem('yslGuideone');
try { try {
@ -257,11 +260,19 @@ class CoursesNew extends Component {
} }
} }
} }else{
this.setState({
bottonloading:false
})
}
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}) })
} }else{
this.setState({
bottonloading:false
})
}
}); });
} else { } else {
this.props.form.validateFields((err, values) => { this.props.form.validateFields((err, values) => {
@ -283,6 +294,9 @@ class CoursesNew extends Component {
// debugger // debugger
//新建 //新建
// console.log('Received values of form: ', values); // console.log('Received values of form: ', values);
this.setState({
bottonloading:true
})
let url = "/courses.json"; let url = "/courses.json";
axios.post(url, { axios.post(url, {
@ -300,6 +314,7 @@ class CoursesNew extends Component {
).then((response) => { ).then((response) => {
if (response.status === 200) { if (response.status === 200) {
// this.goback // this.goback
window.location.href=response.data.first_category_url; window.location.href=response.data.first_category_url;
if(this.state.boolxinjian===true){ if(this.state.boolxinjian===true){
var yslGuideone = window.localStorage.getItem('yslGuideone'); var yslGuideone = window.localStorage.getItem('yslGuideone');
@ -318,11 +333,19 @@ class CoursesNew extends Component {
} }
} }else{
this.setState({
bottonloading:false
})
}
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}) })
} }else{
this.setState({
bottonloading:false
})
}
}); });
} }
@ -934,7 +957,7 @@ class CoursesNew extends Component {
<div className={"FAFAFA"}> <div className={"FAFAFA"}>
<Form.Item > <Form.Item >
<div className="clearfix mt40 mb30"> <div className="clearfix mt40 mb30">
<Button type="primary" htmlType="submit" className="defalutSubmitbtn fl mr20"> <Button type="primary" htmlType="submit" loading={this.state.bottonloading} className="defalutSubmitbtn fl mr20">
提交 提交
</Button> </Button>
{/*<a className="defalutSubmitbtn fl mr20">提交</a>*/} {/*<a className="defalutSubmitbtn fl mr20">提交</a>*/}

@ -55,7 +55,8 @@ class Goldsubject extends Component {
addonAfteronelentwo:"", addonAfteronelentwo:"",
Whethertocreateanewclassroom:true, Whethertocreateanewclassroom:true,
bordebool:false, bordebool:false,
smallspinning:false smallspinning:false,
bottonloading:false
} }
} }
// disabledEndDate= endValue => { // disabledEndDate= endValue => {
@ -351,7 +352,9 @@ class Goldsubject extends Component {
}catch (e) { }catch (e) {
} }
this.setState({
bottonloading:true
})
let url = "/courses/" + coursesId + ".json"; let url = "/courses/" + coursesId + ".json";
axios.put(url, axios.put(url,
datasysl datasysl
@ -372,12 +375,21 @@ class Goldsubject extends Component {
return return
} }
}catch (e) { }catch (e) {
this.setState({
bottonloading:false
})
} }
}else{
this.setState({
bottonloading:false
})
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
this.setState({
bottonloading:false
})
}) })
} }
@ -424,20 +436,15 @@ class Goldsubject extends Component {
course_module_types: values.checkboxgroup, course_module_types: values.checkboxgroup,
school:values.school school:values.school
}; };
try {
// console.log("提交的ysldatas数据");
// console.log(ysldatas);
// console.log(JSON.stringify(ysldatas));
// console.log(moment(values.starttime).format("YYYY-MM-DD"));
// console.log(moment(values.endtime).format("YYYY-MM-DD"));
}catch (e) {
}
this.setState({
bottonloading:true
})
axios.post(url, axios.post(url,
ysldatas ysldatas
).then((response) => { ).then((response) => {
if (response.status === 200) { if (response.status === 200) {
// this.goback // this.goback
window.location.href=response.data.first_category_url; window.location.href=response.data.first_category_url;
var yslGuideone = window.localStorage.getItem('yslGuideone'); var yslGuideone = window.localStorage.getItem('yslGuideone');
@ -451,11 +458,16 @@ class Goldsubject extends Component {
return return
} }
}catch (e) { }catch (e) {
this.setState({
bottonloading:false
})
} }
} }
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
this.setState({
bottonloading:false
})
}) })
} }
}); });
@ -1074,9 +1086,11 @@ class Goldsubject extends Component {
<div className={"FAFAFA"}> <div className={"FAFAFA"}>
<Form.Item > <Form.Item >
<div className="clearfix mt40 mb30"> <div className="clearfix mt40 mb30">
<Button type="primary" htmlType="submit" className="defalutSubmitbtn fl mr20">
<Button type="primary" htmlType="submit" loading={this.state.bottonloading} className="defalutSubmitbtn fl mr20">
提交 提交
</Button> </Button>
{/*<a className="defalutSubmitbtn fl mr20">提交</a>*/} {/*<a className="defalutSubmitbtn fl mr20">提交</a>*/}
<a className="defalutCancelbtn fl" onClick={this.goback}>取消</a> <a className="defalutCancelbtn fl" onClick={this.goback}>取消</a>
</div> </div>

@ -16,6 +16,7 @@ class AboutUs extends React.Component {
} }
componentDidMount(){ componentDidMount(){
window.document.title = "关于我们";
this.getContent(); this.getContent();
} }

@ -16,6 +16,7 @@ class Agreement extends React.Component {
} }
componentDidMount(){ componentDidMount(){
window.document.title = "服务协议";
this.getContent(); this.getContent();
} }

@ -17,6 +17,7 @@ class ContactUs extends React.Component {
} }
componentDidMount(){ componentDidMount(){
window.document.title = "联系我们";
this.getData(); this.getData();
} }

@ -21,6 +21,7 @@ class Cooperatives extends React.Component {
} }
componentDidMount(){ componentDidMount(){
window.document.title = "合作伙伴";
this.getCooperatives(); this.getCooperatives();
} }

@ -13,6 +13,10 @@ class Feedback extends React.Component {
super(props); super(props);
} }
componentDidMount() {
window.document.title = "意见反馈";
}
componentDidUpdate(prevProps) { componentDidUpdate(prevProps) {
if (prevProps.current_user !== this.props.current_user) { if (prevProps.current_user !== this.props.current_user) {
if(!this.props.checkIfLogin()) { if(!this.props.checkIfLogin()) {

@ -16,6 +16,7 @@ class HelpCenter extends React.Component {
} }
componentDidMount(){ componentDidMount(){
window.document.title = "帮助中心";
this.getContent(); this.getContent();
} }

@ -31,8 +31,22 @@ class MainContent extends Component {
onResizeButtonClick = () => { onResizeButtonClick = () => {
// console.log('onResizeButtonClick') // console.log('onResizeButtonClick')
} }
onRunCodeTest = () => {
const vncContainer = this.refs['vncContainer']
if (vncContainer) {
vncContainer.showCodeEvaluate && vncContainer.showCodeEvaluate()
}
this.props.onRunCodeTest();
}
hideCodeEvaluate = () => {
const vncContainer = this.refs['vncContainer']
if (vncContainer) {
vncContainer.onBottomDrawerClose && vncContainer.onBottomDrawerClose()
}
}
render() { render() {
const { challenge, output_sets, onRunCodeTest, latest_output, record, st, readRepoTimeout, const onRunCodeTest = this.onRunCodeTest
const { challenge, output_sets, latest_output, record, st, readRepoTimeout,
onTestSetHeaderClick, loading, codeLoading, shixun, vnc_url} = this.props onTestSetHeaderClick, loading, codeLoading, shixun, vnc_url} = this.props
// if (output_sets && output_sets.test_sets) { // if (output_sets && output_sets.test_sets) {
@ -97,11 +111,23 @@ class MainContent extends Component {
{ showIframeContent && vnc_url ? { showIframeContent && vnc_url ?
<CodeRepositoryViewContainer { ...this.props } isOnlyContainer={true}> <CodeRepositoryViewContainer { ...this.props } isOnlyContainer={true}>
<VNCContainer <VNCContainer
ref="vncContainer"
vnc_url={vnc_url} vnc_url={vnc_url}
{...this.props} {...this.props}
codeEvaluate={
<div id="games_valuation_contents">
<CodeEvaluateView output_sets={output_sets} latest_output={latest_output}
record={record} onTestSetHeaderClick={onTestSetHeaderClick}
{...this.props} inDrawer={true}
hideCodeEvaluate={this.hideCodeEvaluate}
></CodeEvaluateView>
</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" style={{height:'48px'}}>
<ActionView onRunCodeTest={onRunCodeTest} {...this.props}></ActionView> <ActionView {...this.props}
onRunCodeTest={onRunCodeTest}
></ActionView>
</div> </div>
</CodeRepositoryViewContainer> </CodeRepositoryViewContainer>
: :
@ -158,7 +184,7 @@ class MainContent extends Component {
</div> </div>
<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" style={{height:'48px'}}>
<ActionView onRunCodeTest={onRunCodeTest} {...this.props}></ActionView> <ActionView {...this.props} onRunCodeTest={onRunCodeTest}></ActionView>
</div> </div>
</React.Fragment> </React.Fragment>

@ -10,6 +10,8 @@ import RepoTree from './component/repo/RepoTree'
import TPIMonaco from './component/monaco/TPIMonaco' import TPIMonaco from './component/monaco/TPIMonaco'
import notEditablePathImg from '../../images/tpi/notEditablePath.png' import notEditablePathImg from '../../images/tpi/notEditablePath.png'
import { Drawer } from "antd";
import './VNC.css' import './VNC.css'
const $ = window.$; const $ = window.$;
const firstDrawerWidth = 260; const firstDrawerWidth = 260;
@ -103,6 +105,16 @@ class VNCContainer extends Component {
} }
} }
} }
onBottomDrawerClose = () => {
this.setState({ bottomDrawer: false })
}
swtichBottomDrawer = () => {
this.setState({ bottomDrawer: !this.state.bottomDrawer })
}
showCodeEvaluate = () => {
this.setState({ bottomDrawer: true })
}
/* /*
selectedKeys={fileTreeSelectedKeys} selectedKeys={fileTreeSelectedKeys}
onSelect={onTreeSelect} onSelect={onTreeSelect}
@ -125,6 +137,23 @@ class VNCContainer extends Component {
secondDrawerClassName="codeInDrawer" secondDrawerClassName="codeInDrawer"
> >
<style>{` <style>{`
/* 评测结果 */
.codeEvaluateDrawer #game_test_set_results {
height: 198px;
}
.codeEvaluateDrawer .ant-drawer-body {
padding: 0px;
}
.codeEvaluateFloatButton {
bottom: 180px !important;
left: unset;
right: 0px;
top: unset;
}
.codeEvaluateFloatButton .text {
left: 10px;
}
.vncDrawer .ant-drawer-body { .vncDrawer .ant-drawer-body {
padding: 0px; padding: 0px;
} }
@ -173,10 +202,36 @@ class VNCContainer extends Component {
></RepoTree> ></RepoTree>
</SecondDrawer> </SecondDrawer>
<FloatButton></FloatButton> {/* <FloatButton></FloatButton> */}
<VNCDisplay <VNCDisplay
{...this.props} {...this.props}
></VNCDisplay> >
<Drawer
mask={true}
title=""
width={firstDrawerWidth}
// closable={false}
onClose={this.onBottomDrawerClose}
visible={this.state.bottomDrawer}
className={'codeEvaluateDrawer'}
placement="bottom"
getContainer={false}
style={{ position: 'absolute', bottom: '25px', zIndex: 1 }}
afterVisibleChange={(visible) => {
if (visible) {
const canvas = $('.vncDisply canvas')[0]
canvas && canvas.focus()
}
}}
>
{ this.props.codeEvaluate }
</Drawer>
<FloatButton onClick={this.swtichBottomDrawer}
className="codeEvaluateFloatButton"
>测试集</FloatButton>
</VNCDisplay>
</React.Fragment> </React.Fragment>

@ -165,7 +165,10 @@ 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> <div id="screen">
</div>
{this.props.children}
</div> </div>
); );
} }

@ -8,10 +8,10 @@ class FloatButton extends Component {
} }
render() { render() {
const { challenge, vnc_url, children } = this.props const { challenge, vnc_url, children, className } = this.props
return ( return (
<div className="float_button" onClick={this.props.onClick}> <div className={`float_button ${className}` } onClick={this.props.onClick}>
<style>{` <style>{`
`}</style> `}</style>

@ -127,4 +127,11 @@
height: 10px; height: 10px;
margin: 5px 0; margin: 5px 0;
float: right; float: right;
}
.-task-ces-info .inputTitle {
line-height: 16px;
}
.-task-ces-info .inputTitle .input{
white-space: pre-wrap;
} }

@ -227,7 +227,12 @@ class CodeEvaluateView extends Component {
<div className="clearfix df inputTitle"> <div className="clearfix df inputTitle">
<span className="fl fb color-grey">测试输入</span> <span className="fl fb color-grey">测试输入</span>
<div className="fl color-blue" style={{flex:1}} dangerouslySetInnerHTML={{__html: item.input.replace(/\r\n/g,"</br>")}}></div> <div className="fl color-blue input" style={{flex:1}}
// dangerouslySetInnerHTML={{__html: (item.input.replace(/\r\n/g,"</br>"))}}
>
{item.input}
</div>
</div> </div>
</div> </div>
@ -307,14 +312,21 @@ class CodeEvaluateView extends Component {
<a href="javascript:void(0);" className="tab_type tab_color">测试结果</a> <a href="javascript:void(0);" className="tab_type tab_color">测试结果</a>
</li> </li>
<Tooltip id="tooltip-icon-expand" title={ evaluateViewExpanded ? "收起" : "展开"}> {this.props.inDrawer ? <Tooltip id="tooltip-icon-expand" title={ "收起" }>
{/*TODO 按钮大小改造css*/}
{/* icon-guanbi */}
<a className="iconButton fr mr15 mt4" onClick={this.props.hideCodeEvaluate} id="extend_and_zoom" >
<i className={ "font-18 iconfont icon-guanbi" }></i>
</a>
</Tooltip> : <Tooltip id="tooltip-icon-expand" title={ evaluateViewExpanded ? "" : ""}>
{/*TODO 按钮大小改造css*/} {/*TODO 按钮大小改造css*/}
<a className="iconButton fr mr15" onClick={this.onEvaluateViewExpand} id="extend_and_zoom" > <a className="iconButton fr mr15" onClick={this.onEvaluateViewExpand} id="extend_and_zoom" >
<i className={ evaluateViewExpanded ? "font-18 iconfont icon-shousuo" : "iconfont icon-zhankai font-18" }></i> <i className={ evaluateViewExpanded ? "font-18 iconfont icon-shousuo" : "iconfont icon-zhankai font-18" }></i>
</a> </a>
</Tooltip> </Tooltip>}
<div className="cl"></div> <div className="cl"></div>
</ul> </ul>

@ -1,7 +1,7 @@
import React,{ Component } from "react"; import React,{ Component } from "react";
import {getUrl,markdownToHTML} from 'educoder'; import {getUrl,markdownToHTML} from 'educoder';
import {Input} from 'antd'; import {Input,Button} from 'antd';
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
import axios from 'axios'; import axios from 'axios';
@ -86,7 +86,8 @@ class PathNew extends Component{
pathName:"", pathName:"",
description:"", description:"",
point:"", point:"",
flag_name:true flag_name:true,
bottonloading:false
} }
} }
@ -124,6 +125,9 @@ class PathNew extends Component{
return; return;
} }
if (this.isEditPage == true) { if (this.isEditPage == true) {
this.setState({
bottonloading:true
})
let pathId = this.props.match.params.pathId; let pathId = this.props.match.params.pathId;
const editUrl = `/paths/${pathId}.json` const editUrl = `/paths/${pathId}.json`
@ -135,11 +139,21 @@ class PathNew extends Component{
// console.log(response.data.subject_id); // console.log(response.data.subject_id);
if (response.data.subject_id) { if (response.data.subject_id) {
this.props.history.push(`/paths/${response.data.subject_id}`) this.props.history.push(`/paths/${response.data.subject_id}`)
} }else{
this.setState({
bottonloading:false
})
}
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
this.setState({
bottonloading:false
})
}) })
} else { } else {
this.setState({
bottonloading:true
})
let url="/paths.json" let url="/paths.json"
axios.post(url,{ axios.post(url,{
name:pathName, name:pathName,
@ -149,9 +163,16 @@ class PathNew extends Component{
// console.log(response.data.subject_id); // console.log(response.data.subject_id);
if (response.data.subject_id) { if (response.data.subject_id) {
this.props.history.push(`/paths/${response.data.subject_id}`) this.props.history.push(`/paths/${response.data.subject_id}`)
} }else{
this.setState({
bottonloading:false
})
}
}).catch((error)=>{ }).catch((error)=>{
console.log(error); console.log(error);
this.setState({
bottonloading:false
})
}) })
} }
@ -267,7 +288,7 @@ class PathNew extends Component{
</div> </div>
<div className="clearfix mb30 mt30"> <div className="clearfix mb30 mt30">
<a href="javascript:void(0)" className="defalutSubmitbtn fl mr20" onClick={this.submitNewPath}>提交</a> <Button className="defalutSubmitbtn fl mr20" loading={this.state.bottonloading} onClick={this.submitNewPath}>提交</Button>
{this.isEditPage ? {this.isEditPage ?
<Link to={`/paths/${this.props.match.params.pathId}`} <Link to={`/paths/${this.props.match.params.pathId}`}
className="defalutCancelbtn fl">取消</Link> className="defalutCancelbtn fl">取消</Link>

@ -233,7 +233,8 @@ class Newshixuns extends Component {
systemenvironmenttype:false, systemenvironmenttype:false,
testcoderunmodetype:false, testcoderunmodetype:false,
attachmentidstype:false, attachmentidstype:false,
datalisttype:false datalisttype:false,
bottonloading:false
} }
} }
@ -494,6 +495,9 @@ class Newshixuns extends Component {
} else { } else {
newmulti_webssh = "" newmulti_webssh = ""
} }
this.setState({
bottonloading:true
})
axios.post(Url, { axios.post(Url, {
name: name, name: name,
can_copy: can_copy, can_copy: can_copy,
@ -513,9 +517,16 @@ class Newshixuns extends Component {
if (response.status === 200) { if (response.status === 200) {
window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges"; window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges";
// window.open("/shixuns/"+response.data.shixun_identifier+"/challenges"); // window.open("/shixuns/"+response.data.shixun_identifier+"/challenges");
} }else{
this.setState({
bottonloading:false
})
}
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
this.setState({
bottonloading:false
})
}) })
} }
@ -1321,7 +1332,9 @@ class Newshixuns extends Component {
<div className="clearfix mt30"> <div className="clearfix mt30">
<a className="defalutSubmitbtn fl mr20" onClick={this.submit_new_shixun}>提交</a> <Button className="defalutSubmitbtn fl mr20" loading={this.state.bottonloading} onClick={this.submit_new_shixun}>
提交
</Button>
<a href="/shixuns" className="defalutCancelbtn fl">取消</a> <a href="/shixuns" className="defalutCancelbtn fl">取消</a>
</div> </div>

@ -384,4 +384,14 @@ a.white-btn.use_scope-btn:hover{
.ml82{ .ml82{
margin-left: 82px; margin-left: 82px;
}
.ant-btn-primary.active, .ant-btn-primary:active {
color: #fff;
background-color: #096dd9;
border-color: #096dd9;
}
.ant-btn:hover, .ant-btn:focus, .ant-btn:active, .ant-btn.active{
background-color: #4CACFF;
} }

@ -6,9 +6,6 @@
margin-left: 32%; margin-left: 32%;
} }
.square-Item{
/*min-height: 324px;*/
}
.square-img{ .square-img{
min-height: 210px; min-height: 210px;
} }

@ -31,8 +31,8 @@ class InfosBanner extends Component{
let user_type=this.props.current_user&&this.props.current_user.user_identity; let user_type=this.props.current_user&&this.props.current_user.user_identity;
let targetuserid=this.props.data&&this.props.data.id; let targetuserid=this.props.data&&this.props.data.id;
// console.log(is_current) // console.log(is_current)
// console.log(current_user) // console.log(current_user)
// console.log(current_user.is_teacher) // console.log(current_user.is_teacher)
// console.log(current_user.admin) // console.log(current_user.admin)
return( return(
@ -124,7 +124,7 @@ class InfosBanner extends Component{
</li>} </li>}
{/*自己的主页且不是学生显示题库按钮*/} {/*自己的主页且不是学生显示题库按钮*/}
{((is_current && current_user && current_user.is_teacher ) || current_user && current_user.admin) {(is_current && current_user)
&&<li className={`${moduleName == 'topics' ? 'active' : '' }`}> &&<li className={`${moduleName == 'topics' ? 'active' : '' }`}>
<Link <Link
onClick={() => this.setState({moduleName: 'topics'})} onClick={() => this.setState({moduleName: 'topics'})}

@ -103,7 +103,7 @@ class InfosCourse extends Component{
} = this.state; } = this.state;
let is_current=this.props.is_current; let is_current=this.props.is_current;
console.log(this.props.current_user&&this.props.current_user.user_identity==="学生") // console.log(this.props.current_user&&this.props.current_user.user_identity==="学生")
return( return(
<div className="educontent"> <div className="educontent">
<Spin size="large" spinning={isSpin}> <Spin size="large" spinning={isSpin}>

@ -31,33 +31,34 @@ class InfosTopics extends Component{
} }
componentDidMount(){ componentDidMount(){
let types=this.props.match.params.topicstype; // let types=this.props.match.params.topicstype;
let professional_certification=this.props.current_user&&this.props.current_user.professional_certification; // let professional_certification=this.props.current_user&&this.props.current_user.professional_certification;
//
if(professional_certification===false&&types==="publicly"){ // if(professional_certification===false&&types==="publicly"){
this.setState({ // this.setState({
isshowprofes:true // isshowprofes:true
}) // })
}else{ // }else{
this.updataslist() // this.updataslist()
} // }
} this.updataslist()
componentDidUpdate(prevProps) {
if(prevProps.current_user!=this.props.current_user){
let types=this.props.match.params.topicstype;
let professional_certification=this.props.current_user&&this.props.current_user.professional_certification;
console.log(professional_certification)
if(professional_certification===false&&types==="publicly"){
this.setState({
isshowprofes:true
})
}else{
this.updataslist()
}
}
} }
// componentDidUpdate(prevProps) {
//
// if(prevProps.current_user!=this.props.current_user){
// let types=this.props.match.params.topicstype;
// let professional_certification=this.props.current_user&&this.props.current_user.professional_certification;
//
// console.log(professional_certification)
// if(professional_certification===false&&types==="publicly"){
// this.setState({
// isshowprofes:true
// })
// }else{
// this.updataslist()
// }
// }
// }
updataslist=()=>{ updataslist=()=>{
let types=this.props.match.params.topicstype; let types=this.props.match.params.topicstype;
let { category,course_list_id,sort_by,sort_direction,page}=this.state; let { category,course_list_id,sort_by,sort_direction,page}=this.state;
@ -65,39 +66,12 @@ class InfosTopics extends Component{
} }
searchAlldata=(type,category,course_list_id,sort_by,sort_direction,page)=>{ searchAlldata=(type,category,course_list_id,sort_by,sort_direction,page)=>{
// if(this.props.current_user.login!=this.props.match.params.username){
// return
// }else{
//
// }
let types=this.props.match.params.topicstype;
let professional_certification=this.props.current_user&&this.props.current_user.professional_certification;
if(professional_certification===false&&types==="publicly"){
}else{
this.setState({ this.setState({
isSpin:true isSpin:true
}) })
let types=this.props.match.params.topicstype;
let user_id="";
if(types==="publicly"){
user_id=this.props.current_user&&this.props.current_user.login;
}else{
user_id=this.props.match.params&&this.props.match.params.username;
}
if(user_id===undefined){
user_id=1
}
let {per_page}=this.state; let {per_page}=this.state;
let url=`/users/${user_id}/question_banks.json`; let url=`/users/question_banks.json`;
axios.get(encodeURI(url),{params:{ axios.get(encodeURI(url),{params:{
type, type,
@ -109,19 +83,33 @@ class InfosTopics extends Component{
per_page per_page
} }
}).then((response) => { }).then((response) => {
this.setState({ if(response){
data:response.data, if(response.status){
checkBoxValues:[], if(response.data.status == -2){
isSpin:false this.setState({
}) isshowprofes:true,
isSpin:false
})
}else if(response.data.status === 403||response.data.status === 401||response.data.status === 500){
this.setState({
isSpin:false
})
}else{
this.setState({
data:response.data,
checkBoxValues:[],
isSpin:false
})
}
}
}
}).catch((error) => { }).catch((error) => {
this.setState({ this.setState({
isSpin:false isSpin:false
}) })
}); });
}
} }
searchCategory=(type)=>{ searchCategory=(type)=>{

@ -115,6 +115,9 @@ class NewGtaskForms extends Component{
let {data}=this.props; let {data}=this.props;
let task_type=data.task_type let task_type=data.task_type
let topicId=this.props.topicId let topicId=this.props.topicId
let attachment_ids = contentFileList.map(item => {
return item.response ? item.response.id : item.id
})
this.props.form.validateFields((err, values) => { this.props.form.validateFields((err, values) => {
const mdContnet = this.contentMdRef.current.getValue().trim(); const mdContnet = this.contentMdRef.current.getValue().trim();
@ -132,7 +135,7 @@ class NewGtaskForms extends Component{
max_num:task_type===1?undefined:max_num, max_num:task_type===1?undefined:max_num,
base_on_project: task_type===1?task_type:base_on_project===true?1:0 base_on_project: task_type===1?task_type:base_on_project===true?1:0
}, },
attachment_ids:contentFileList attachment_ids:attachment_ids
} }
).then((response) => { ).then((response) => {
if(response.data.status===0){ if(response.data.status===0){

Loading…
Cancel
Save