diff --git a/app/controllers/admins/base_controller.rb b/app/controllers/admins/base_controller.rb
index 6f89e7afa..345df3e31 100644
--- a/app/controllers/admins/base_controller.rb
+++ b/app/controllers/admins/base_controller.rb
@@ -5,6 +5,8 @@ class Admins::BaseController < ApplicationController
layout 'admin'
+ skip_before_action :verify_authenticity_token
+
before_action :require_login, :require_admin!
after_action :rebind_event_if_ajax_render_partial
diff --git a/app/controllers/task_banks_controller.rb b/app/controllers/task_banks_controller.rb
index 82ce14b0c..2b1a400ef 100644
--- a/app/controllers/task_banks_controller.rb
+++ b/app/controllers/task_banks_controller.rb
@@ -12,7 +12,7 @@ class TaskBanksController < ApplicationController
ActiveRecord::Base.transaction do
begin
@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, "更新成功")
rescue Exception => e
uid_logger(e.message)
diff --git a/app/controllers/users/question_banks_controller.rb b/app/controllers/users/question_banks_controller.rb
index 5c8e69a29..c5b837d0b 100644
--- a/app/controllers/users/question_banks_controller.rb
+++ b/app/controllers/users/question_banks_controller.rb
@@ -1,11 +1,12 @@
class Users::QuestionBanksController < Users::BaseController
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_user_permission!
def index
- service = Users::QuestionBankService.new(observed_user, query_params)
+ service = Users::QuestionBankService.new(User.current, query_params)
question_banks = service.call
@count = question_banks.count
diff --git a/config/initializers/session_extenstions.rb b/config/initializers/session_extenstions.rb
index 36a8ae8c7..cee3dfc06 100644
--- a/config/initializers/session_extenstions.rb
+++ b/config/initializers/session_extenstions.rb
@@ -1,35 +1,33 @@
-#coding=utf-8
-
-module SessionExtenstions
-
- module EntryExtension
- def compressed?
- @compressed
- end
-
- def value
- if @value
- begin
- Marshal.load(compressed? ? Zlib::Inflate.inflate(@value) : @value)
- rescue TypeError
- compressed? ? Zlib::Inflate.inflate(@value) : @value
- end
- end
- end
-
- def size
- if @value.nil?
- 0
- else
- @value.bytesize
- end
- end
- end
-
-
-end
-
-ActiveSupport::Cache::Entry.const_set("DEFAULT_COMPRESS_LIMIT", 1)
-ActiveSupport::Cache::Entry.send(:prepend, SessionExtenstions::EntryExtension)
-
-
+#coding=utf-8
+
+module SessionExtenstions
+
+ module EntryExtension
+ def compressed?
+ @compressed
+ end
+
+ def value
+ if @value
+ begin
+ Marshal.load(compressed? ? Zlib::Inflate.inflate(@value) : @value)
+ rescue TypeError
+ compressed? ? Zlib::Inflate.inflate(@value) : @value
+ end
+ end
+ end
+
+ def size
+ if @value.nil?
+ 0
+ else
+ @value.bytesize
+ end
+ end
+ end
+
+
+end
+
+ActiveSupport::Cache::Entry.const_set("DEFAULT_COMPRESS_LIMIT", 1)
+ActiveSupport::Cache::Entry.send(:prepend, SessionExtenstions::EntryExtension)
diff --git a/config/routes.rb b/config/routes.rb
index 0d1b979b1..5cf74c29a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -55,12 +55,14 @@ Rails.application.routes.draw do
get :homepage_info
end
+ get :question_banks, on: :collection, to: 'users/question_banks#index'
+
scope module: :users do
resources :courses, only: [:index]
resources :shixuns, only: [:index]
resources :projects, only: [:index]
resources :subjects, only: [:index]
- resources :question_banks, only: [:index]
+ # resources :question_banks, only: [:index]
resource :experience_records, only: [:show]
resource :grade_records, only: [:show]
resource :watch, only: [:create, :destroy]
diff --git a/public/react/config/webpack.config.prod.js b/public/react/config/webpack.config.prod.js
index d5ad7593a..8cab0465f 100644
--- a/public/react/config/webpack.config.prod.js
+++ b/public/react/config/webpack.config.prod.js
@@ -62,7 +62,7 @@ module.exports = {
// We generate sourcemaps in production. This is slow but gives good results.
// You can exclude the *.map files from the build during deployment.
// 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.
entry: [require.resolve('./polyfills'), paths.appIndexJs],
output: {
diff --git a/public/react/src/modules/courses/busyWork/NewWorkForm.js b/public/react/src/modules/courses/busyWork/NewWorkForm.js
index 1626c5c6a..f5d4d9eb4 100644
--- a/public/react/src/modules/courses/busyWork/NewWorkForm.js
+++ b/public/react/src/modules/courses/busyWork/NewWorkForm.js
@@ -100,6 +100,7 @@ class NewWorkForm extends Component{
const courseId = this.state.course_id || this.props.match.params.coursesId ;
this.props.form.validateFieldsAndScroll((err, values) => {
+ if(err && err.personNum) delete err.personNum;
console.log(values)
const mdContnet = this.contentMdRef.current.getValue().trim();
console.log(mdContnet)
@@ -135,7 +136,7 @@ class NewWorkForm extends Component{
}
// 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) {
this.doEdit(courseId, values)
} else {
@@ -451,12 +452,12 @@ class NewWorkForm extends Component{
>
{getFieldDecorator('personNum', {
validateTrigger: 'onNone',
- rules: [{
+ // rules: [{
// required: true,
// message: '人数不能为空'
// validator: this.personNumValidator
// required: true, message: '请输入最小人数和最大人数'
- }],
+ // }],
})(
diff --git a/public/react/src/modules/courses/exercise/ExerciseDisplay.js b/public/react/src/modules/courses/exercise/ExerciseDisplay.js
index cbaf38c80..42702e9cb 100644
--- a/public/react/src/modules/courses/exercise/ExerciseDisplay.js
+++ b/public/react/src/modules/courses/exercise/ExerciseDisplay.js
@@ -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
this.setState({...response.data})
this.props.detailFetchCallback && this.props.detailFetchCallback(response);
+ } else {
+ this.props.detailFetchCallback && this.props.detailFetchCallback(response);
}
})
.catch(function (error) {
diff --git a/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js b/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js
index 933044cfb..ae1ed40de 100644
--- a/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js
+++ b/public/react/src/modules/courses/gradinforms/Bullsubdirectory.js
@@ -216,9 +216,9 @@ class Bullsubdirectory extends Component{
let{description,whethertoeditysl,addonAfter,eduintits,informs,isSpinysl} =this.state;
let{myname,mydescription,id}=this.props;
const {getFieldDecorator} = this.props.form;
- console.log("Bullsubdirectory");
- console.log(this.props.isAdmin());
- console.log(this.props.yslbool);
+ // console.log("Bullsubdirectory");
+ // console.log(this.props.isAdmin());
+ // console.log(this.props.yslbool);
return(
diff --git a/public/react/src/modules/courses/gradinforms/Eduinforms.js b/public/react/src/modules/courses/gradinforms/Eduinforms.js
index 6b375fccf..32a7c8677 100644
--- a/public/react/src/modules/courses/gradinforms/Eduinforms.js
+++ b/public/react/src/modules/courses/gradinforms/Eduinforms.js
@@ -231,7 +231,7 @@ class Eduinforms extends Component{
公告栏
{
- this.props.isClassManagement() === true?
+ this.props.isClassManagement()===true?
(this.state.yslbool===false?
this.bianji(true)}>
diff --git a/public/react/src/modules/courses/groupjobbank/GroupPackage2.js b/public/react/src/modules/courses/groupjobbank/GroupPackage2.js
index 7f593c353..63fae45f8 100644
--- a/public/react/src/modules/courses/groupjobbank/GroupPackage2.js
+++ b/public/react/src/modules/courses/groupjobbank/GroupPackage2.js
@@ -67,10 +67,22 @@ class GroupPackage extends Component {
{datas&&datas.min_num}~ {datas&&datas.max_num} 人(学生提交作品时需要关联同组成员,组内成员作品共享)
}
-
- 基于项目实施
- (学生必须在本平台创建项目,项目管理员可以提交作品)
-
+
+ {
+ datas===undefined?"":datas.base_on_project===undefined?"":
+ datas.base_on_project===true?
+
+ 基于项目实施
+ (学生必须在本平台创建项目,项目管理员可以提交作品)
+
+ :datas.base_on_project===false?
+
+ 不基于项目
+ (无需在平台创建项目,任意小组成员均可以提交作品)
+
+ :""
+ }
+
:
{
diff --git a/public/react/src/modules/courses/members/modal/CourseGroupChooserModal.js b/public/react/src/modules/courses/members/modal/CourseGroupChooserModal.js
index c0c11addc..f5365433d 100644
--- a/public/react/src/modules/courses/members/modal/CourseGroupChooserModal.js
+++ b/public/react/src/modules/courses/members/modal/CourseGroupChooserModal.js
@@ -91,6 +91,7 @@ function CourseGroupChooserModal({ course_groups = [], isAdminOrCreator, item, i
}
.courseGroupChooserModal .drop_down_menu .mainGroup.ant-checkbox-group {
width: 100%;
+ max-height: 300px!important;
height: 300px;
}
.courseGroupChooserModal .drop_down_search {
diff --git a/public/react/src/modules/courses/members/teacherList.js b/public/react/src/modules/courses/members/teacherList.js
index 70b1e3bd6..18d9a1adf 100644
--- a/public/react/src/modules/courses/members/teacherList.js
+++ b/public/react/src/modules/courses/members/teacherList.js
@@ -663,7 +663,7 @@ class studentsList extends Component{
diff --git a/public/react/src/modules/page/main/CodeEvaluateView.css b/public/react/src/modules/page/main/CodeEvaluateView.css
index 137174d95..9c07c4541 100644
--- a/public/react/src/modules/page/main/CodeEvaluateView.css
+++ b/public/react/src/modules/page/main/CodeEvaluateView.css
@@ -127,4 +127,11 @@
height: 10px;
margin: 5px 0;
float: right;
+}
+
+.-task-ces-info .inputTitle {
+ line-height: 16px;
+}
+.-task-ces-info .inputTitle .input{
+ white-space: pre-wrap;
}
\ No newline at end of file
diff --git a/public/react/src/modules/page/main/CodeEvaluateView.js b/public/react/src/modules/page/main/CodeEvaluateView.js
index a121a53d5..44a98ae77 100644
--- a/public/react/src/modules/page/main/CodeEvaluateView.js
+++ b/public/react/src/modules/page/main/CodeEvaluateView.js
@@ -227,7 +227,12 @@ class CodeEvaluateView extends Component {
测试输入:
-
")}}>
+
"))}}
+
+ >
+ {item.input}
+
@@ -307,14 +312,21 @@ class CodeEvaluateView extends Component {
测试结果
-
+ {this.props.inDrawer ?
+ {/*TODO 按钮大小改造,css*/}
+ {/* icon-guanbi */}
+
+
+
+
+ :
{/*TODO 按钮大小改造,css*/}
-
+ }
diff --git a/public/react/src/modules/paths/PathNew.js b/public/react/src/modules/paths/PathNew.js
index 95e343b13..7dcef663b 100644
--- a/public/react/src/modules/paths/PathNew.js
+++ b/public/react/src/modules/paths/PathNew.js
@@ -1,7 +1,7 @@
import React,{ Component } from "react";
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 axios from 'axios';
@@ -86,7 +86,8 @@ class PathNew extends Component{
pathName:"",
description:"",
point:"",
- flag_name:true
+ flag_name:true,
+ bottonloading:false
}
}
@@ -124,6 +125,9 @@ class PathNew extends Component{
return;
}
if (this.isEditPage == true) {
+ this.setState({
+ bottonloading:true
+ })
let pathId = this.props.match.params.pathId;
const editUrl = `/paths/${pathId}.json`
@@ -135,11 +139,21 @@ class PathNew extends Component{
// console.log(response.data.subject_id);
if (response.data.subject_id) {
this.props.history.push(`/paths/${response.data.subject_id}`)
- }
+ }else{
+ this.setState({
+ bottonloading:false
+ })
+ }
}).catch((error)=>{
console.log(error);
+ this.setState({
+ bottonloading:false
+ })
})
} else {
+ this.setState({
+ bottonloading:true
+ })
let url="/paths.json"
axios.post(url,{
name:pathName,
@@ -149,9 +163,16 @@ class PathNew extends Component{
// console.log(response.data.subject_id);
if (response.data.subject_id) {
this.props.history.push(`/paths/${response.data.subject_id}`)
- }
+ }else{
+ this.setState({
+ bottonloading:false
+ })
+ }
}).catch((error)=>{
console.log(error);
+ this.setState({
+ bottonloading:false
+ })
})
}
@@ -267,7 +288,7 @@ class PathNew extends Component{
-
提交
+
{this.isEditPage ?
取消
diff --git a/public/react/src/modules/tpm/newshixuns/Newshixuns.js b/public/react/src/modules/tpm/newshixuns/Newshixuns.js
index d2e26d58b..c2c464618 100644
--- a/public/react/src/modules/tpm/newshixuns/Newshixuns.js
+++ b/public/react/src/modules/tpm/newshixuns/Newshixuns.js
@@ -233,7 +233,8 @@ class Newshixuns extends Component {
systemenvironmenttype:false,
testcoderunmodetype:false,
attachmentidstype:false,
- datalisttype:false
+ datalisttype:false,
+ bottonloading:false
}
}
@@ -494,6 +495,9 @@ class Newshixuns extends Component {
} else {
newmulti_webssh = ""
}
+ this.setState({
+ bottonloading:true
+ })
axios.post(Url, {
name: name,
can_copy: can_copy,
@@ -513,9 +517,16 @@ class Newshixuns extends Component {
if (response.status === 200) {
window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges";
// window.open("/shixuns/"+response.data.shixun_identifier+"/challenges");
- }
+ }else{
+ this.setState({
+ bottonloading:false
+ })
+ }
}).catch((error) => {
console.log(error)
+ this.setState({
+ bottonloading:false
+ })
})
}
@@ -1321,7 +1332,9 @@ class Newshixuns extends Component {
diff --git a/public/react/src/modules/tpm/newshixuns/css/Newshixuns.css b/public/react/src/modules/tpm/newshixuns/css/Newshixuns.css
index da0924b94..e241dcf0d 100644
--- a/public/react/src/modules/tpm/newshixuns/css/Newshixuns.css
+++ b/public/react/src/modules/tpm/newshixuns/css/Newshixuns.css
@@ -384,4 +384,14 @@ a.white-btn.use_scope-btn:hover{
.ml82{
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;
}
\ No newline at end of file
diff --git a/public/react/src/modules/tpm/shixuns/shixunCss/shixunCard.css b/public/react/src/modules/tpm/shixuns/shixunCss/shixunCard.css
index 4470aaec1..1ec00a26e 100644
--- a/public/react/src/modules/tpm/shixuns/shixunCss/shixunCard.css
+++ b/public/react/src/modules/tpm/shixuns/shixunCss/shixunCard.css
@@ -6,9 +6,6 @@
margin-left: 32%;
}
-.square-Item{
- /*min-height: 324px;*/
-}
.square-img{
min-height: 210px;
}
diff --git a/public/react/src/modules/user/usersInfo/InfosBanner.js b/public/react/src/modules/user/usersInfo/InfosBanner.js
index 99afce1d0..4e6492c7f 100644
--- a/public/react/src/modules/user/usersInfo/InfosBanner.js
+++ b/public/react/src/modules/user/usersInfo/InfosBanner.js
@@ -31,8 +31,8 @@ class InfosBanner extends Component{
let user_type=this.props.current_user&&this.props.current_user.user_identity;
let targetuserid=this.props.data&&this.props.data.id;
- // console.log(is_current)
- // console.log(current_user)
+ // console.log(is_current)
+ // console.log(current_user)
// console.log(current_user.is_teacher)
// console.log(current_user.admin)
return(
@@ -124,7 +124,7 @@ class InfosBanner extends Component{
}
{/*自己的主页且不是学生显示题库按钮*/}
- {((is_current && current_user && current_user.is_teacher ) || current_user && current_user.admin)
+ {(is_current && current_user)
&&
this.setState({moduleName: 'topics'})}
diff --git a/public/react/src/modules/user/usersInfo/InfosCourse.js b/public/react/src/modules/user/usersInfo/InfosCourse.js
index 0f6abc61b..f90b35d09 100644
--- a/public/react/src/modules/user/usersInfo/InfosCourse.js
+++ b/public/react/src/modules/user/usersInfo/InfosCourse.js
@@ -103,7 +103,7 @@ class InfosCourse extends Component{
} = this.state;
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(
diff --git a/public/react/src/modules/user/usersInfo/InfosTopics.js b/public/react/src/modules/user/usersInfo/InfosTopics.js
index 5b344270e..8da80aad3 100644
--- a/public/react/src/modules/user/usersInfo/InfosTopics.js
+++ b/public/react/src/modules/user/usersInfo/InfosTopics.js
@@ -31,33 +31,34 @@ class InfosTopics extends Component{
}
componentDidMount(){
- 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"){
- 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()
- }
- }
+ // 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"){
+ // this.setState({
+ // isshowprofes:true
+ // })
+ // }else{
+ // 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()
+ // }
+ // }
+ // }
updataslist=()=>{
let types=this.props.match.params.topicstype;
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)=>{
- // 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({
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 url=`/users/${user_id}/question_banks.json`;
+ let url=`/users/question_banks.json`;
axios.get(encodeURI(url),{params:{
type,
@@ -109,19 +83,33 @@ class InfosTopics extends Component{
per_page
}
}).then((response) => {
- this.setState({
- data:response.data,
- checkBoxValues:[],
- isSpin:false
- })
+ if(response){
+ if(response.status){
+ if(response.data.status == -2){
+ 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) => {
this.setState({
isSpin:false
})
});
- }
-
}
searchCategory=(type)=>{
diff --git a/public/react/src/modules/user/usersInfo/banks/NewGtaskForm.js b/public/react/src/modules/user/usersInfo/banks/NewGtaskForm.js
index 8b4cc8dbb..8c0f6474c 100644
--- a/public/react/src/modules/user/usersInfo/banks/NewGtaskForm.js
+++ b/public/react/src/modules/user/usersInfo/banks/NewGtaskForm.js
@@ -115,6 +115,9 @@ class NewGtaskForms extends Component{
let {data}=this.props;
let task_type=data.task_type
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) => {
const mdContnet = this.contentMdRef.current.getValue().trim();
@@ -132,7 +135,7 @@ class NewGtaskForms extends Component{
max_num:task_type===1?undefined:max_num,
base_on_project: task_type===1?task_type:base_on_project===true?1:0
},
- attachment_ids:contentFileList
+ attachment_ids:attachment_ids
}
).then((response) => {
if(response.data.status===0){