实训的导出下载

dev_aliyun_beta
SylorHuang 6 years ago
commit d046d35b17

@ -19,6 +19,13 @@
//= require_tree ./i18n //= require_tree ./i18n
//= require_tree ./admins //= require_tree ./admins
$.ajaxSetup({
beforeSend: function(xhr) {
xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'));
}
});
// ******** select2 global config ******** // ******** select2 global config ********
$.fn.select2.defaults.set('theme', 'bootstrap4'); $.fn.select2.defaults.set('theme', 'bootstrap4');
$.fn.select2.defaults.set('language', 'zh-CN'); $.fn.select2.defaults.set('language', 'zh-CN');
@ -53,7 +60,6 @@ $(document).on("turbolinks:before-cache", function () {
$('[data-toggle="tooltip"]').tooltip('hide'); $('[data-toggle="tooltip"]').tooltip('hide');
$('[data-toggle="popover"]').popover('hide'); $('[data-toggle="popover"]').popover('hide');
}); });
// var progressBar = new Turbolinks.ProgressBar(); // var progressBar = new Turbolinks.ProgressBar();
// $(document).on('ajax:send', function(event){ // $(document).on('ajax:send', function(event){

@ -27,10 +27,11 @@ $(document).on('turbolinks:load', function() {
}); });
// modal visited fire // modal visited fire
$refuseModal.on('shown.bs.modal', function(){ $refuseModal.on('shown.bs.modal', function(){
$refuseModal.find('.modal-body input[name="reason"]').focus(); $refuseModal.find('.modal-body textarea[name="reason"]').focus();
}); });
$refuseModal.on('hide.bs.modal', function () { $refuseModal.on('hide.bs.modal', function () {
$applyIdInput.val(''); $applyIdInput.val('');
$refuseModal.find('.modal-body textarea[name="reason"]').val('');
$form.data('url', ''); $form.data('url', '');
}) })

@ -127,7 +127,7 @@ class ExerciseBankQuestionsController < ApplicationController
normal_status("创建成功") normal_status("创建成功")
rescue Exception => e rescue Exception => e
uid_logger_error(e.message) uid_logger_error(e.message)
tip_exception("试卷问题创建失败!") tip_exception(e.message)
raise ActiveRecord::Rollback raise ActiveRecord::Rollback
end end
end end
@ -311,7 +311,7 @@ class ExerciseBankQuestionsController < ApplicationController
normal_status(0,"试卷更新成功") normal_status(0,"试卷更新成功")
rescue Exception => e rescue Exception => e
uid_logger_error(e.message) uid_logger_error(e.message)
tip_exception("页面调用失败!") tip_exception(e.message)
raise ActiveRecord::Rollback raise ActiveRecord::Rollback
end end
end end
@ -347,7 +347,7 @@ class ExerciseBankQuestionsController < ApplicationController
end end
rescue Exception => e rescue Exception => e
uid_logger_error(e.message) uid_logger_error(e.message)
tip_exception("问题移动失败!") tip_exception(e.message)
end end
end end
end end
@ -364,7 +364,7 @@ class ExerciseBankQuestionsController < ApplicationController
normal_status(0, "删除成功") normal_status(0, "删除成功")
rescue Exception => e rescue Exception => e
uid_logger_error(e.message) uid_logger_error(e.message)
tip_exception("删除失败") tip_exception(e.message)
end end
end end
end end
@ -372,7 +372,7 @@ class ExerciseBankQuestionsController < ApplicationController
private private
def bank_admin def bank_admin
tip_exception(403, "无权限") unless @bank.user_id == current_user.id || current_user.admin? tip_exception(403, "无权限") unless @exercise.user_id == current_user.id || current_user.admin?
end end
def get_exercise def get_exercise

@ -54,7 +54,7 @@ class PollBankQuestionsController < ApplicationController
normal_status("创建成功") normal_status("创建成功")
rescue Exception => e rescue Exception => e
uid_logger_error(e.message) uid_logger_error(e.message)
tip_exception("问卷的问题创建失败!") tip_exception(e.message)
raise ActiveRecord::Rollback raise ActiveRecord::Rollback
end end
end end
@ -67,6 +67,7 @@ class PollBankQuestionsController < ApplicationController
p_answer = params[:question_answers] p_answer = params[:question_answers]
p_other_answer = params[:question_other_answer] p_other_answer = params[:question_other_answer]
p_answer_count = p_answer.count p_answer_count = p_answer.count
@poll_current_answers = @poll_question.exercise_bank_choices.count
@poll_question.exercise_bank_choices.each do |an| @poll_question.exercise_bank_choices.each do |an|
if (p_answer_count < @poll_current_answers) && (p_answer_count..@poll_current_answers).to_a.include?(an.choice_position) if (p_answer_count < @poll_current_answers) && (p_answer_count..@poll_current_answers).to_a.include?(an.choice_position)
an.destroy an.destroy
@ -104,7 +105,7 @@ class PollBankQuestionsController < ApplicationController
normal_status("问卷更新成功") normal_status("问卷更新成功")
rescue Exception => e rescue Exception => e
uid_logger_error(e.message) uid_logger_error(e.message)
tip_exception("更新失败") tip_exception(e.message)
raise ActiveRecord::Rollback raise ActiveRecord::Rollback
end end
end end
@ -113,7 +114,7 @@ class PollBankQuestionsController < ApplicationController
private private
def bank_admin def bank_admin
tip_exception(403, "无权限") unless @bank.user_id == current_user.id || current_user.admin? tip_exception(403, "无权限") unless @poll.user_id == current_user.id || current_user.admin?
end end
def get_poll def get_poll

@ -8,14 +8,14 @@
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<form class="admin-common-refuse-form"> <%= form_tag(admins_path, method: :post, class: 'admin-common-refuse-form') do %>
<%= hidden_field_tag(:apply_id, nil) %> <%= hidden_field_tag(:apply_id, nil) %>
<div class="form-group"> <div class="form-group">
<label for="reason" class="col-form-label">原因:</label> <label for="reason" class="col-form-label">原因:</label>
<%= text_area_tag(:reason, nil, class: 'form-control', placeholder: '我得说点儿什么最多200字') %> <%= text_area_tag(:reason, nil, class: 'form-control', placeholder: '我得说点儿什么最多200字') %>
</div> </div>
<div class="error text-danger"></div> <div class="error text-danger"></div>
</form> <% end %>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button> <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>

@ -1,2 +1 @@
json.content @content json.url "/shixuns/#{@shixun.identifier}/repository/master/shixun_show/#{@path}"
json.path @path

@ -2,6 +2,7 @@ json.homework_common_id @homework.id
json.category @homework.category_info json.category @homework.category_info
json.course_name @course.name json.course_name @course.name
json.work_id @work.id json.work_id @work.id
json.work_efficiency @homework.work_efficiency
if @shixun if @shixun
json.shixun_name @shixun.name json.shixun_name @shixun.name
# 总体评价 # 总体评价

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,7 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import {Link} from 'react-router-dom' import {Link} from 'react-router-dom'
const map={"blue":"blueFull","greyBack":"greyBack","grey":"greyWidthFixed","green":"greenBack",'greyLine':"greyLine", const map={"blue":"blueFull","greyBack":"greyBack","grey":"greyWidthFixed","green":"greenBack",'greyLine':"greyLine",'orangeLine':"orangeLine",
'colorBlue': 'colorBlue', // 蓝字白底 'colorBlue': 'colorBlue', // 蓝字白底
} }
class ActionBtn extends Component { class ActionBtn extends Component {

@ -822,9 +822,7 @@ class Fileslists extends Component{
max-height:350px; max-height:350px;
overflow-y: auto; overflow-y: auto;
} }
.drop_down_menu li {
overflow: visible;
}
.courseSecond{ .courseSecond{
margin-left: 10px; margin-left: 10px;
padding: 10px; padding: 10px;

@ -186,23 +186,26 @@ class BoardsNew extends Component{
}); });
} }
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
confirm({ if(file.response!=undefined){
// title: '确定要删除这个附件吗?', confirm({
title: '是否确认删除?', // title: '确定要删除这个附件吗?',
title: '是否确认删除?',
okText: '确定',
cancelText: '取消', okText: '确定',
// content: 'Some descriptions', cancelText: '取消',
onOk: () => { // content: 'Some descriptions',
this.deleteAttachment(file) onOk: () => {
}, this.deleteAttachment(file)
onCancel() { },
console.log('Cancel'); onCancel() {
}, console.log('Cancel');
}); },
});
return false;
}
return false;
} }
deleteAttachment = (file) => { deleteAttachment = (file) => {
// 初次上传不能直接取uid // 初次上传不能直接取uid
@ -275,7 +278,7 @@ class BoardsNew extends Component{
console.log('beforeUpload', file.name); console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150; const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) { if (!isLt150M) {
message.error('文件大小必须小于150MB!'); this.props.showNotification('文件大小必须小于150MB!');
} }
return isLt150M; return isLt150M;
}, },

@ -320,8 +320,11 @@ class CommonWorkPost extends Component{
// ModalSave: ()=>this.deleteAttachment(file), // ModalSave: ()=>this.deleteAttachment(file),
// ModalCancel:this.cancelAttachment // ModalCancel:this.cancelAttachment
// }) // })
this.deleteAttachment(file) if(file.response!=undefined){
return false; this.deleteAttachment(file)
return false;
}
} }
cancelAttachment=()=>{ cancelAttachment=()=>{
@ -594,7 +597,7 @@ render(){
console.log('beforeUpload', file.name); console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150; const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) { if (!isLt150M) {
message.error('文件大小必须小于150MB!'); this.props.showNotification('文件大小必须小于150MB!');
} }
return isLt150M; return isLt150M;
}, },

@ -243,19 +243,22 @@ class NewWork extends Component{
} }
onAttachmentRemove = (file, stateName) => { onAttachmentRemove = (file, stateName) => {
this.props.confirm({ if(file.response!=undefined){
content: '是否确认删除?', this.props.confirm({
content: '是否确认删除?',
onOk: () => {
this.deleteAttachment(file, stateName)
},
onCancel() {
console.log('Cancel');
},
});
onOk: () => {
this.deleteAttachment(file, stateName)
},
onCancel() {
console.log('Cancel');
},
});
return false;
}
return false;
} }
deleteAttachment = (file, stateName) => { deleteAttachment = (file, stateName) => {
// 初次上传不能直接取uid // 初次上传不能直接取uid
@ -335,7 +338,7 @@ class NewWork extends Component{
console.log('beforeUpload', file.name); console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150; const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) { if (!isLt150M) {
message.error('文件大小必须小于150MB!'); this.props.showNotification('文件大小必须小于150MB!');
} }
return isLt150M; return isLt150M;
}, },
@ -354,7 +357,7 @@ class NewWork extends Component{
console.log('beforeUpload', file.name); console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150; const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) { if (!isLt150M) {
message.error('文件大小必须小于150MB!'); this.props.showNotification('文件大小必须小于150MB!');
} }
return isLt150M; return isLt150M;
}, },

@ -73,8 +73,9 @@ class AccessoryModal extends Component{
// ModalCancel:this.cancelAttachment // ModalCancel:this.cancelAttachment
// }) // })
// return false; // return false;
if(file.response!=undefined){
this.deleteAttachment(file); this.deleteAttachment(file);
}
} }
@ -256,7 +257,7 @@ class AccessoryModal extends Component{
console.log('beforeUpload', file.name); console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150; const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) { if (!isLt150M) {
message.error('文件大小必须小于150MB!'); this.props.showNotification('文件大小必须小于150MB!');
} }
return isLt150M; return isLt150M;
}, },

@ -64,8 +64,10 @@ class AccessoryModal2 extends Component{
// ModalCancel:this.cancelAttachment // ModalCancel:this.cancelAttachment
// }) // })
// return false; // return false;
if(file.response!=undefined){
this.deleteAttachment(file);
}
this.deleteAttachment(file);
} }
@ -178,7 +180,7 @@ class AccessoryModal2 extends Component{
console.log('beforeUpload', file.name); console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150; const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) { if (!isLt150M) {
message.error('文件大小必须小于150MB!'); this.props.showNotification('文件大小必须小于150MB!');
} }
return isLt150M; return isLt150M;
}, },

@ -296,37 +296,44 @@ class Selectsetting extends Component{
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
if(file.response!=undefined){
const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
axios.delete(url, {
})
.then((response) => {
if (response.data) {
const { status } = response.data;
if (status == 0) {
// const url = `/attachments/${file.response ? file.response.id : file.uid}.json` this.setState({
const url = `/attachments/${file.response ? file.response.id : file.uid}.json` fileListtype:false,
axios.delete(url, { fileList:[]
}) })
.then((response) => { // this.setState((state) => {
if (response.data) { // const index = state.fileList.indexOf(file);
const { status } = response.data; // const newFileList = state.fileList.slice();
if (status == 0) { // newFileList.splice(index, 1);
// return {
this.setState({ // fileList: newFileList,
fileListtype:false, // };
fileList:[] // });
}) }
// this.setState((state) => {
// const index = state.fileList.indexOf(file);
// const newFileList = state.fileList.slice();
// newFileList.splice(index, 1);
// return {
// fileList: newFileList,
// };
// });
} }
} })
.catch(function (error) {
console.log(error);
});
this.setState({
fileListtype:false,
}) })
.catch(function (error) { }else{
console.log(error); this.setState({
}); fileListtype:false,
this.setState({ fileList:[]
fileListtype:false, })
}) }
// const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
} }
onChangeTimepublishs= (date, dateString,key) => { onChangeTimepublishs= (date, dateString,key) => {
@ -389,7 +396,7 @@ class Selectsetting extends Component{
console.log('beforeUpload', file.name); console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150; const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) { if (!isLt150M) {
message.error('文件大小必须小于150MB!'); this.props.showNotification('文件大小必须小于150MB!');
} }
return isLt150M; return isLt150M;
}, },

@ -132,28 +132,34 @@ class Sendresource extends Component{
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
debugger if(file.response!=undefined){
const url = `/attachments/${file.response ? file.response.id : file.uid}.json` const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
axios.delete(url, { axios.delete(url, {
}) })
.then((response) => { .then((response) => {
if (response.data) { if (response.data) {
const { status } = response.data; const { status } = response.data;
if (status == 0) { if (status == 0) {
this.setState({ this.setState({
fileListtype:false, fileListtype:false,
fileList:[] fileList:[]
}) })
} }
} }
}) })
.catch(function (error) { .catch(function (error) {
console.log(error); console.log(error);
}); });
this.setState({ this.setState({
fileListtype:false, fileListtype:false,
}) })
}else{
this.setState({
fileListtype:false,
fileList:[]
})
}
} }
ModalCancelModalCancel=()=>{ ModalCancelModalCancel=()=>{
@ -338,7 +344,7 @@ debugger
// console.log('beforeUpload', file.name); // console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150; const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) { if (!isLt150M) {
message.error('文件大小必须小于150MB!'); this.props.showNotification('文件大小必须小于150MB!');
} }
return isLt150M; return isLt150M;
}, },

@ -708,7 +708,14 @@ a.white-btn.use_scope-btn:hover{
color: #999!important; color: #999!important;
padding:0px 10px; padding:0px 10px;
} }
.orangeLine{
background: #fff;
border:1px solid #FE944B;
color: #FE944B!important;
padding:0px 10px;
line-height: 28px;
border-radius: 4px;
}
.colorFF6800{ .colorFF6800{
color:#FF6800; color:#FF6800;

@ -332,17 +332,17 @@ class Testpapersettinghomepage extends Component{
<div className="fl task_menu_ul"> <div className="fl task_menu_ul">
{this.props.isAdmin()===true? {this.props.isAdmin()===true?
<Menu mode="horizontal" selectedKeys={tab} onClick={this.changeTab}> <Menu mode="horizontal" selectedKeys={tab} onClick={this.changeTab}>
<Menu.Item key="0">答题列表</Menu.Item> <Menu.Item key="0" className={"exercisesafonts"}>答题列表</Menu.Item>
<Menu.Item key="1">统计结果</Menu.Item> <Menu.Item key="1" className={"exercisesafonts"}>统计结果</Menu.Item>
<Menu.Item key="2">试卷预览</Menu.Item> <Menu.Item key="2" className={"exercisesafonts"}>试卷预览</Menu.Item>
<Menu.Item key="3">设置</Menu.Item> <Menu.Item key="3" className={"exercisesafonts"}>设置</Menu.Item>
</Menu> </Menu>
: :
<Menu mode="horizontal" selectedKeys={tab} onClick={this.changeTab}> <Menu mode="horizontal" selectedKeys={tab} onClick={this.changeTab}>
<Menu.Item key="0">答题列表</Menu.Item> <Menu.Item key="0" className={"exercisesafonts"}>答题列表</Menu.Item>
{Commonheadofthetestpaper&&Commonheadofthetestpaper.show_statistic===true? {Commonheadofthetestpaper&&Commonheadofthetestpaper.show_statistic===true?
<Menu.Item key="1">统计结果</Menu.Item>:""} <Menu.Item key="1" className={"exercisesafonts"}>统计结果</Menu.Item>:""}
<Menu.Item key="3">设置</Menu.Item> <Menu.Item key="3" className={"exercisesafonts"}>设置</Menu.Item>
</Menu> </Menu>
} }
</div> </div>
@ -370,7 +370,7 @@ class Testpapersettinghomepage extends Component{
padding-top: 10px; padding-top: 10px;
padding-bottom: 8px; padding-bottom: 8px;
} }
a:hover { .exercisesafonts:hover {
color:#1A0B00 !important; color:#1A0B00 !important;
} }
`} `}

@ -157,49 +157,52 @@ class GraduationTasksSubmitedit extends Component{
} }
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
let {attachments,fileList}=this.state; if(file.response!=undefined){
const url = `/attachments/${file}.json` let {attachments,fileList}=this.state;
axios.delete(url, { const url = `/attachments/${file}.json`
}) axios.delete(url, {
.then((response) => { })
if (response.data) { .then((response) => {
// const { status } = response.data; if (response.data) {
if (response.data.status === 0) { // const { status } = response.data;
console.log('--- success') if (response.data.status === 0) {
let newattachments=attachments; console.log('--- success')
if(file.uid===undefined){ let newattachments=attachments;
for(var i=0; i<newattachments.length; i++){ if(file.uid===undefined){
if(newattachments[i].id===file.id){ for(var i=0; i<newattachments.length; i++){
newattachments.splice(i, 1); if(newattachments[i].id===file.id){
} newattachments.splice(i, 1);
} }
}
} }
this.setState({ this.setState({
Modalstype:true, Modalstype:true,
Modalstopval:response.data.message, Modalstopval:response.data.message,
ModalSave:this.cancelAttachment, ModalSave:this.cancelAttachment,
Loadtype:true, Loadtype:true,
attachments:newattachments attachments:newattachments
}) })
this.setState((state) => { this.setState((state) => {
const index = state.fileList.indexOf(file); const index = state.fileList.indexOf(file);
const newFileList = state.fileList.slice(); const newFileList = state.fileList.slice();
newFileList.splice(index, 1); newFileList.splice(index, 1);
return { return {
fileList: newFileList, fileList: newFileList,
}; };
}); });
} }
} }
}) })
.catch(function (error) { .catch(function (error) {
console.log(error); console.log(error);
}); });
}
} }
inputSearchValue=(e)=>{ inputSearchValue=(e)=>{
@ -520,7 +523,7 @@ class GraduationTasksSubmitedit extends Component{
console.log('beforeUpload', file.name); console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150; const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) { if (!isLt150M) {
message.error('文件大小必须小于150MB!'); this.props.showNotification('文件大小必须小于150MB!');
} }
return isLt150M; return isLt150M;
}, },

@ -146,14 +146,16 @@ class GraduationTasksSubmitnew extends Component{
// }, // },
// }); // });
// return false; // return false;
if(file.response!=undefined){
this.setState({
Modalstype:true,
Modalstopval:'确定要删除这个附件吗?',
ModalSave: ()=>this.deleteAttachment(file),
ModalCancel:this.cancelAttachment
})
return false;
}
this.setState({
Modalstype:true,
Modalstopval:'确定要删除这个附件吗?',
ModalSave: ()=>this.deleteAttachment(file),
ModalCancel:this.cancelAttachment
})
return false;
} }
cancelAttachment=()=>{ cancelAttachment=()=>{
@ -538,7 +540,7 @@ render(){
console.log('beforeUpload', file.name); console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150; const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) { if (!isLt150M) {
message.error('文件大小必须小于150MB!'); this.props.showNotification('文件大小必须小于150MB!');
} }
return isLt150M; return isLt150M;
}, },

@ -88,21 +88,24 @@ class GraduationTasksappraiseMainEditor extends Component{
this.setState({ fileList }); this.setState({ fileList });
} }
onAttachmentRemove = (file, stateName) => { onAttachmentRemove = (file, stateName) => {
this.props.confirm({ if(file.response!=undefined){
content: '确定要删除这个附件吗?', this.props.confirm({
okText: '确定', content: '确定要删除这个附件吗?',
cancelText: '取消', okText: '确定',
// content: 'Some descriptions', cancelText: '取消',
onOk: () => { // content: 'Some descriptions',
this.deleteAttachment(file, stateName) onOk: () => {
}, this.deleteAttachment(file, stateName)
onCancel() { },
console.log('Cancel'); onCancel() {
}, console.log('Cancel');
}); },
});
return false;
}
return false;
} }
deleteAttachment = (file, stateName) => { deleteAttachment = (file, stateName) => {
// 初次上传不能直接取uid // 初次上传不能直接取uid
@ -169,7 +172,7 @@ class GraduationTasksappraiseMainEditor extends Component{
console.log('beforeUpload', file.name); console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150; const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) { if (!isLt150M) {
message.error('文件大小必须小于150MB!'); this.props.showNotification('文件大小必须小于150MB!');
} }
return isLt150M; return isLt150M;
}, },

@ -103,14 +103,16 @@ class GraduationTasksedit extends Component{
} }
// 附件相关 START // 附件相关 START
handleChange = (info) => { handleChange = (info) => {
let fileList = info.fileList; if(info.file.status == "done" || info.file.status == "uploading"){
// console.log(fileList) let fileList = info.fileList;
// for(var list of fileList ){ // console.log(fileList)
// console.log(fileList) // for(var list of fileList ){
// } // console.log(fileList)
this.setState({ // }
fileList: appendFileSizeToUploadFileAll(fileList), this.setState({
}); fileList: appendFileSizeToUploadFileAll(fileList),
});
}
} }
// onAttachmentRemove = (file) => { // onAttachmentRemove = (file) => {
@ -148,39 +150,42 @@ class GraduationTasksedit extends Component{
} }
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
// debugger if(file.response!=undefined){
this.cancelAttachment(); // debugger
const url = `/attachments/${file.response ? file.response.id : file.uid}.json` this.cancelAttachment();
// const url = `/attachments/${file}.json` const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
axios.delete(url, { // const url = `/attachments/${file}.json`
}) axios.delete(url, {
.then((response) => { })
if (response.data) { .then((response) => {
if (response.data) {
if ( response.data.status === 0) {
if ( response.data.status === 0) {
this.setState({
Modalstype:false, this.setState({
Modalstopval:response.data.message, Modalstype:false,
ModalSave:this.cancelAttachment, Modalstopval:response.data.message,
Loadtype:true, ModalSave:this.cancelAttachment,
}) Loadtype:true,
})
this.setState((state) => {
this.setState((state) => {
const index = state.fileList.indexOf(file);
const newFileList = state.fileList.slice(); const index = state.fileList.indexOf(file);
newFileList.splice(index, 1); const newFileList = state.fileList.slice();
return { newFileList.splice(index, 1);
fileList: newFileList, return {
}; fileList: newFileList,
}); };
} });
} }
}) }
.catch(function (error) { })
console.log(error); .catch(function (error) {
}); console.log(error);
});
}
} }
Commoninterface=(fileList)=>{ Commoninterface=(fileList)=>{
@ -294,7 +299,7 @@ class GraduationTasksedit extends Component{
console.log('beforeUpload', file.name); console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150; const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) { if (!isLt150M) {
message.error('文件大小必须小于150MB!'); this.props.showNotification('文件大小必须小于150MB!');
} }
return isLt150M; return isLt150M;
}, },

@ -57,24 +57,22 @@ class GraduationTasksnew extends Component {
} }
// if (GraduationTasksnewtype === true) { // if (GraduationTasksnewtype === true) {
this.props.form.validateFields((err, values) => { this.props.form.validateFields((err, values) => {
if (values.tasktype === undefined) {
this.ifHasAnchorJustScorll("tasktypes");
return
}
if (values.name === undefined) {
this.ifHasAnchorJustScorll("nametypes");
return
}
if (values.description === undefined) {
this.ifHasAnchorJustScorll("descriptiontypes");
return
}else if (values.description.length > 5000) {
this.ifHasAnchorJustScorll("descriptiontypes");
return
}
if (!err) { if (!err) {
if (values.tasktype === undefined) {
this.scrollToAnchors("tasktypes");
return
}
if (values.name === undefined) {
this.scrollToAnchors("nametypes");
return
}
if (values.description === undefined) {
this.scrollToAnchors("descriptiontypes");
return
} else if (values.description.length > 5000) {
this.scrollToAnchors("descriptiontypes");
return
}
// console.log('Received values of form: ', values); // console.log('Received values of form: ', values);
// console.log(fileList); // console.log(fileList);
const course_id = this.props.match.params.coursesId; const course_id = this.props.match.params.coursesId;
@ -129,14 +127,16 @@ class GraduationTasksnew extends Component {
} }
// 附件相关 START // 附件相关 START
handleChange = (info) => { handleChange = (info) => {
let fileList = info.fileList; if(info.file.status == "done" || info.file.status == "uploading"){
let fileList = info.fileList;
// for(var list of fileList ){
// console.log(list) // for(var list of fileList ){
// } // console.log(list)
this.setState({ // }
fileList: appendFileSizeToUploadFileAll(fileList), this.setState({
}); fileList: appendFileSizeToUploadFileAll(fileList),
});
}
} }
// onAttachmentRemove = (file) => { // onAttachmentRemove = (file) => {
@ -173,30 +173,33 @@ class GraduationTasksnew extends Component {
} }
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
const url = `/attachments/${file.response ? file.response.id : file.uid}.json` if(file.response!=undefined){
// const url = `/attachments/${file}.json` const url = `/attachments/${file.response ? file.response.id : file.uid}.json`
axios.delete(url, {}) // const url = `/attachments/${file}.json`
.then((response) => { axios.delete(url, {})
if (response.data) { .then((response) => {
const {status} = response.data; if (response.data) {
if (status == 0) { const {status} = response.data;
console.log('--- success') if (status == 0) {
console.log('--- success')
this.setState((state) => {
const index = state.fileList.indexOf(file); this.setState((state) => {
const newFileList = state.fileList.slice(); const index = state.fileList.indexOf(file);
newFileList.splice(index, 1); const newFileList = state.fileList.slice();
return { newFileList.splice(index, 1);
fileList: newFileList, return {
}; fileList: newFileList,
}); };
this.cancelAttachment() });
this.cancelAttachment()
}
} }
} })
}) .catch(function (error) {
.catch(function (error) { console.log(error);
console.log(error); });
}); }
} }
//滚动 //滚动
@ -271,7 +274,7 @@ class GraduationTasksnew extends Component {
console.log('beforeUpload', file.name); console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150; const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) { if (!isLt150M) {
message.error('文件大小必须小于150MB!'); this.props.showNotification('文件大小必须小于150MB!');
} }
return isLt150M; return isLt150M;
}, },

@ -215,19 +215,23 @@ class GraduateTopicNew extends Component{
this.setState({ fileList }); this.setState({ fileList });
} }
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
confirm({
title: '确定要删除这个附件吗?', if(file.response!=undefined){
okText: '确定', confirm({
cancelText: '取消', title: '确定要删除这个附件吗?',
// content: 'Some descriptions', okText: '确定',
onOk: () => { cancelText: '取消',
this.deleteAttachment(file) // content: 'Some descriptions',
}, onOk: () => {
onCancel() { this.deleteAttachment(file)
console.log('Cancel'); },
}, onCancel() {
}); console.log('Cancel');
return false; },
});
return false;
}
} }
deleteAttachment = (file) => { deleteAttachment = (file) => {
console.log(file); console.log(file);
@ -310,7 +314,7 @@ class GraduateTopicNew extends Component{
console.log('beforeUpload', file.name); console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150; const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) { if (!isLt150M) {
message.error('文件大小必须小于150MB!'); this.props.showNotification('文件大小必须小于150MB!');
} }
return isLt150M; return isLt150M;
}, },

@ -163,21 +163,25 @@ class GraduateTopicPostWorksNew extends Component{
this.setState({ fileList }); this.setState({ fileList });
} }
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
confirm({ if(file.response!=undefined){
title: '确定要删除这个附件吗?', confirm({
okText: '确定', title: '确定要删除这个附件吗?',
cancelText: '取消', okText: '确定',
// content: 'Some descriptions', cancelText: '取消',
onOk: () => { // content: 'Some descriptions',
this.deleteAttachment(file) onOk: () => {
}, this.deleteAttachment(file)
onCancel() { },
console.log('Cancel'); onCancel() {
}, console.log('Cancel');
}); },
});
return false;
}
return false;
} }
deleteAttachment = (file) => { deleteAttachment = (file) => {
const url = `/attachments/${file.id}.json` const url = `/attachments/${file.id}.json`
@ -249,7 +253,7 @@ class GraduateTopicPostWorksNew extends Component{
console.log('beforeUpload', file.name); console.log('beforeUpload', file.name);
const isLt150M = file.size / 1024 / 1024 < 150; const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) { if (!isLt150M) {
message.error('文件大小必须小于150MB!'); this.props.showNotification('文件大小必须小于150MB!');
} }
return isLt150M; return isLt150M;
}, },

@ -73,18 +73,21 @@ class CreateGroupByImportModal extends Component{
} }
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
this.props.confirm({ if(file.response!=undefined){
content: '是否确认删除?', this.props.confirm({
content: '是否确认删除?',
onOk: () => {
this.deleteAttachment(file) onOk: () => {
}, this.deleteAttachment(file)
onCancel() { },
console.log('Cancel'); onCancel() {
}, console.log('Cancel');
}); },
});
return false;
}
return false;
} }
deleteAttachment = (file) => { deleteAttachment = (file) => {
const url = `/attachments/${file.response ? file.response.id : file.uid}.json` const url = `/attachments/${file.response ? file.response.id : file.uid}.json`

@ -280,9 +280,13 @@ class PollNew extends Component {
questionnair: true, questionnair: true,
left_banner_id:result.data.left_banner_id left_banner_id:result.data.left_banner_id
}) })
// console.log(this.state.polls_nametest) if( result.data.poll.polls_name){
// console.log(this.state.polls_descriptiontest) if( result.data.poll.polls_name.length>0){
// } this.setState({
addonAfter: result.data.poll.polls_name.length,
})
}
}
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}) })
@ -326,8 +330,13 @@ class PollNew extends Component {
polls_descriptiontest: result.data.poll.polls_description, polls_descriptiontest: result.data.poll.polls_description,
questionnair: true, questionnair: true,
}) })
if( result.data.poll.polls_name){
// } if( result.data.poll.polls_name.length>0){
this.setState({
addonAfter: result.data.poll.polls_name.length,
})
}
}
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
}) })
@ -966,18 +975,23 @@ class PollNew extends Component {
if (this.state.problemtopicbool === true) { if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic; insindex = this.state.problemtopic;
} }
this.createquestionsandanswers(object, 1, arrc, null, 0, 0, insindex); this.createquestionsandanswers(object, 1, arrc, null, 0, 0, insindex,0);
// newarrpoll.push(question); // newarrpoll.push(question);
newarrpoll.splice(thiss.state.Insertposition, 0, question); newarrpoll.splice(thiss.state.Insertposition, 0, question);
} else if (object.question.question_type === 2) { } else if (object.question.question_type === 2) {
//插入多选题 //插入多选题
if (object.question.max_choices < object.question.min_choices) { if(object.question.max_choices){
this.props.showNotification(`可选的最大限制不能小于最小限制`); if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选的最大限制不能小于最小限制`);
return; return;
}
}
} }
var questiontwo = {}; var questiontwo = {};
var other = []; var other = [];
var option = []; var option = [];
@ -1026,7 +1040,7 @@ class PollNew extends Component {
if (this.state.problemtopicbool === true) { if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic; insindex = this.state.problemtopic;
} }
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, insindex); this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, insindex,object.question.answers.length);
//插入多选题 //插入多选题
// if (object.question.max_choices > arrc.length) { // if (object.question.max_choices > arrc.length) {
// // console.log("选择题的最大可选项不能大于选项数") // // console.log("选择题的最大可选项不能大于选项数")
@ -1096,7 +1110,7 @@ class PollNew extends Component {
if (this.state.problemtopicbool === true) { if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic; insindex = this.state.problemtopic;
} }
this.createquestionsandanswers(object, 3, null, null, 0, 0, insindex); this.createquestionsandanswers(object, 3, null, null, 0, 0, insindex,0);
// newarrpoll.push(question); // newarrpoll.push(question);
newarrpoll.splice(thiss.state.Insertposition, 0, question); newarrpoll.splice(thiss.state.Insertposition, 0, question);
} }
@ -1159,23 +1173,31 @@ class PollNew extends Component {
question = {"question": questiontwo}; question = {"question": questiontwo};
if (uuk !== -1) { if (uuk !== -1) {
// console.log("修改") // console.log("修改")
this.edittotheserver(object, 1, arrc, null, 0, 0); this.edittotheserver(object, 1, arrc, null, 0, 0,0);
newarrpoll.splice(uuk, 1, question); newarrpoll.splice(uuk, 1, question);
} else { } else {
// console.log("他原来的删除掉了") // console.log("他原来的删除掉了")
this.createquestionsandanswers(object, 1, arrc, null, 0, 0, object.question.id); this.createquestionsandanswers(object, 1, arrc, null, 0, 0, object.question.id,0);
newarrpoll.push(question); newarrpoll.push(question);
} }
newarr[indexo].question.new = "new" newarr[indexo].question.new = "new"
// console.log(newarrpoll) // console.log(newarrpoll)
} else if (object.question.question_type === 2) { } else if (object.question.question_type === 2) {
//插入多选题 //插入多选题
if(object.question.max_choices){
if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选的最大限制不能小于最小限制`);
if (object.question.max_choices < object.question.min_choices) { return;
this.props.showNotification('可选的最大限制不能小于最小限制!'); }
}
return;
} }
// if (object.question.max_choices < object.question.min_choices) {
// this.props.showNotification('可选的最大限制不能小于最小限制!');
//
// return;
// }
var questiontwo = {}; var questiontwo = {};
var other = []; var other = [];
var option = []; var option = [];
@ -1230,11 +1252,11 @@ class PollNew extends Component {
// } // }
if (uuk !== -1) { if (uuk !== -1) {
// console.log("修改") // console.log("修改")
this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices); this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices,object.question.answers.length);
newarrpoll.splice(uuk, 1, question); newarrpoll.splice(uuk, 1, question);
} else { } else {
// console.log("删除") // console.log("删除")
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id); this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id,object.question.answers.length);
newarrpoll.push(question); newarrpoll.push(question);
} }
// console.log(newarrpoll) // console.log(newarrpoll)
@ -1276,11 +1298,11 @@ class PollNew extends Component {
if (uuk !== -1) { if (uuk !== -1) {
// console.log("修改") // console.log("修改")
this.edittotheserver(object, 3, null, null, 0, 0); this.edittotheserver(object, 3, null, null, 0, 0,0);
newarrpoll.splice(uuk, 1, question); newarrpoll.splice(uuk, 1, question);
} else { } else {
// console.log("删除") // console.log("删除")
this.createquestionsandanswers(object, 3, null, null, 0, 0, object.question.id); this.createquestionsandanswers(object, 3, null, null, 0, 0, object.question.id,0);
newarrpoll.push(question); newarrpoll.push(question);
} }
// console.log(newarrpoll) // console.log(newarrpoll)
@ -1448,15 +1470,24 @@ class PollNew extends Component {
if (this.state.problemtopicbool === true) { if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic; insindex = this.state.problemtopic;
} }
this.createquestionsandanswers(object, 1, arrc, null, 0, 0, insindex); this.createquestionsandanswers(object, 1, arrc, null, 0, 0, insindex,0);
newarrpoll.splice(thiss.state.Insertposition, 0, question); newarrpoll.splice(thiss.state.Insertposition, 0, question);
} else if (object.question.question_type === 2) { } else if (object.question.question_type === 2) {
//插入多选题 //插入多选题
if (object.question.max_choices < object.question.min_choices) { if(object.question.max_choices){
this.props.showNotification(`可选的最大限制不能小于最小限制`); if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选的最大限制不能小于最小限制`);
return; return;
}
}
} }
// if (object.question.max_choices < object.question.min_choices) {
// this.props.showNotification(`可选的最大限制不能小于最小限制`);
//
// return;
// }
var questiontwo = {}; var questiontwo = {};
var other = []; var other = [];
@ -1502,7 +1533,7 @@ class PollNew extends Component {
if (this.state.problemtopicbool === true) { if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic; insindex = this.state.problemtopic;
} }
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, insindex); this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, insindex,object.question.answers.length);
//插入多选题 //插入多选题
// if (object.question.max_choices > arrc.length) { // if (object.question.max_choices > arrc.length) {
@ -1550,7 +1581,7 @@ class PollNew extends Component {
if (this.state.problemtopicbool === true) { if (this.state.problemtopicbool === true) {
insindex = this.state.problemtopic; insindex = this.state.problemtopic;
} }
this.createquestionsandanswers(object, 3, null, null, 0, 0, insindex); this.createquestionsandanswers(object, 3, null, null, 0, 0, insindex,0);
// newarrpoll.push(question); // newarrpoll.push(question);
newarrpoll.splice(thiss.state.Insertposition, 0, question); newarrpoll.splice(thiss.state.Insertposition, 0, question);
} }
@ -1611,21 +1642,30 @@ class PollNew extends Component {
question = {"question": questiontwo}; question = {"question": questiontwo};
if (uuk !== -1) { if (uuk !== -1) {
// console.log("修改") // console.log("修改")
this.edittotheserver(object, 1, arrc, null, 0, 0); this.edittotheserver(object, 1, arrc, null, 0, 0,0);
newarrpoll.splice(uuk, 1, question); newarrpoll.splice(uuk, 1, question);
} else { } else {
// console.log("删除") // console.log("删除")
this.createquestionsandanswers(object, 1, arrc, null, 0, 0, object.question.id); this.createquestionsandanswers(object, 1, arrc, null, 0, 0, object.question.id,0);
newarrpoll.push(question); newarrpoll.push(question);
} }
// console.log(newarrpoll) // console.log(newarrpoll)
} else if (object.question.question_type === 2) { } else if (object.question.question_type === 2) {
//插入多选题 //插入多选题
if (object.question.max_choices < object.question.min_choices) { if(object.question.max_choices){
this.props.showNotification(`可选的最大限制不能小于最小限制`); if(object.question.max_choices>0){
if (object.question.max_choices < object.question.min_choices) {
this.props.showNotification(`可选的最大限制不能小于最小限制`);
return; return;
}
}
} }
// if (object.question.max_choices < object.question.min_choices) {
// this.props.showNotification(`可选的最大限制不能小于最小限制`);
//
// return;
// }
var questiontwo = {}; var questiontwo = {};
var other = []; var other = [];
var option = []; var option = [];
@ -1667,11 +1707,11 @@ class PollNew extends Component {
//插入多选题 //插入多选题
if (uuk !== -1) { if (uuk !== -1) {
// console.log("修改") // console.log("修改")
this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices); this.edittotheserver(object, 2, arrc, null, object.question.max_choices, object.question.min_choices,object.question.answers.length);
newarrpoll.splice(uuk, 1, question); newarrpoll.splice(uuk, 1, question);
} else { } else {
// console.log("删除") // console.log("删除")
this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id); this.createquestionsandanswers(object, 2, arrc, null, object.question.max_choices, object.question.min_choices, object.question.id,object.question.answers.length);
newarrpoll.push(question); newarrpoll.push(question);
} }
// console.log(newarrpoll) // console.log(newarrpoll)
@ -1712,11 +1752,11 @@ class PollNew extends Component {
question = {"question": questiontwo}; question = {"question": questiontwo};
if (uuk !== -1) { if (uuk !== -1) {
// console.log("修改") // console.log("修改")
this.edittotheserver(object, 3, null, null, 0, 0); this.edittotheserver(object, 3, null, null, 0, 0,0);
newarrpoll.splice(uuk, 1, question); newarrpoll.splice(uuk, 1, question);
} else { } else {
// console.log("删除") // console.log("删除")
this.createquestionsandanswers(object, 3, null, null, 0, 0, object.question.id); this.createquestionsandanswers(object, 3, null, null, 0, 0, object.question.id,0);
newarrpoll.push(question); newarrpoll.push(question);
} }
// console.log(newarrpoll) // console.log(newarrpoll)
@ -1752,7 +1792,8 @@ class PollNew extends Component {
////新增到服务器中 ////新增到服务器中
createquestionsandanswers = (object, number, option, other, max_choices, min_choices, insert_id) => { createquestionsandanswers = (object, number, option, other, max_choices, min_choices, insert_id,length) => {
var thiss = this; var thiss = this;
var poll_id = this.state.pollid; var poll_id = this.state.pollid;
var urlly = `/polls/${poll_id}/poll_questions.json` var urlly = `/polls/${poll_id}/poll_questions.json`
@ -1765,12 +1806,16 @@ class PollNew extends Component {
max_choicess = max_choices; max_choicess = max_choices;
min_choicess = min_choices; min_choicess = min_choices;
} }
console.log("createquestionsandanswers");
console.log(max_choicess);
console.log(min_choicess);
console.log(length);
axios.post(urlly, { axios.post(urlly, {
question_title: object.question.question_title, question_title: object.question.question_title,
question_type: number, question_type: number,
is_necessary: object.question.is_necessary, is_necessary: object.question.is_necessary,
max_choices: max_choicess, max_choices: max_choicess===undefined?length:max_choicess===null?length:max_choicess===0?length:max_choicess,
min_choices: min_choicess, min_choices: min_choicess===undefined?2:min_choicess===null?2:min_choicess===0?2:min_choicess,
question_answers: option, question_answers: option,
question_other_answer: null, question_other_answer: null,
insert_id: insert_id insert_id: insert_id
@ -1801,17 +1846,30 @@ class PollNew extends Component {
} }
///编辑修改到服务器当中 ///编辑修改到服务器当中
edittotheserver = (object, number, option, other, max_choices, min_choices) => { edittotheserver = (object, number, option, other, max_choices, min_choices,length) => {
// console.log("调用了edittotheserver") // console.log("调用了edittotheserver")
var url = `/poll_questions/${object.question.id}.json` var url = `/poll_questions/${object.question.id}.json`
var thiss = this; var thiss = this;
var max_choicess = null;
var min_choicess = null;
if (max_choices === 0 && min_choices === 0) {
max_choicess = null;
min_choicess = null;
} else {
max_choicess = max_choices;
min_choicess = min_choices;
}
console.log("createquestionsandanswers");
console.log(max_choicess);
console.log(min_choicess);
console.log(length);
axios.put(url, { axios.put(url, {
// debug: true, // debug: true,
question_title: object.question.question_title, question_title: object.question.question_title,
question_type: number, question_type: number,
is_necessary: object.question.is_necessary, is_necessary: object.question.is_necessary,
max_choices: max_choices, max_choices: max_choicess===undefined?length:max_choicess===null?length:max_choicess===0?length:max_choicess,
min_choices: min_choices, min_choices: min_choicess===undefined?2:min_choicess===null?2:min_choicess===0?2:min_choicess,
question_answers: option, question_answers: option,
question_other_answer: null, question_other_answer: null,
}).then((result) => { }).then((result) => {
@ -2123,6 +2181,12 @@ class PollNew extends Component {
//最小值 //最小值
HandleGradationGroupChangee = (value, index, max, length) => { HandleGradationGroupChangee = (value, index, max, length) => {
// console.log("最小值");
// console.log(value);
// console.log(index);
// console.log(max);
// console.log(length);
// debugger // debugger
var minbool = false; var minbool = false;
var maxbool = false; var maxbool = false;
@ -2137,7 +2201,7 @@ class PollNew extends Component {
if (minbool === true && maxbool === true) { if (minbool === true && maxbool === true) {
for (var i = 0; i < arr.length; i++) { for (var i = 0; i < arr.length; i++) {
if (index === i) { if (index === i) {
arr[i].question.min_choices = parseInt(value); arr[i].question.min_choices = parseInt(value);
} }
} }
this.setState({ this.setState({
@ -2146,18 +2210,8 @@ class PollNew extends Component {
} else { } else {
for (var i = 0; i < arr.length; i++) { for (var i = 0; i < arr.length; i++) {
if (index === i) { if (index === i) {
try {
if(parseInt(value)===0){
arr[i].question.min_choices = 2;
arr[i].question.max_choices = length;
}else{
arr[i].question.min_choices = parseInt(value); arr[i].question.min_choices = parseInt(value);
arr[i].question.max_choices = max; arr[i].question.max_choices = length;
}
}catch (e) {
arr[i].question.min_choices = 2;
arr[i].question.max_choices = length;
}
break; break;
} }
} }
@ -2169,19 +2223,32 @@ class PollNew extends Component {
} }
//最大值 //最大值
HandleGradationGroupChangeee = (value, index,minchoices) => { HandleGradationGroupChangeee = (value, index,minchoices,length) => {
// console.log("2112"); // console.log("2112");
// console.log(value); // console.log(value);
// console.log(minchoices); // console.log(minchoices);
// console.log("最大值");
// console.log(value);
// console.log(index);
// console.log(minchoices);
// console.log(length);
let arr = this.state.adddom; let arr = this.state.adddom;
for (var i = 0; i < arr.length; i++) { for (var i = 0; i < arr.length; i++) {
if (index === i) { if (index === i) {
if(parseInt(value)===0&&parseInt(minchoices)===0){ if(parseInt(value)===0&&parseInt(minchoices)===0){
arr[i].question.min_choices= parseInt(0);
arr[i].question.max_choices = parseInt(0);
}else if(parseInt(minchoices)===0){
arr[i].question.min_choices= parseInt(2);
arr[i].question.max_choices = parseInt(value);
}
else if(parseInt(value)===0&&parseInt(minchoices)>0){
arr[i].question.min_choices= parseInt(minchoices); arr[i].question.min_choices= parseInt(minchoices);
arr[i].question.max_choices = parseInt(value); arr[i].question.max_choices = parseInt(value);
}else { }
else {
arr[i].question.min_choices= minchoices===null?2:minchoices===undefined?2:minchoices===0?2:parseInt(minchoices); arr[i].question.min_choices= minchoices===null?2:minchoices===undefined?2:minchoices===0?2:parseInt(minchoices);
arr[i].question.max_choices = parseInt(value); arr[i].question.max_choices = parseInt(value);
} }
} }
} }
@ -2455,7 +2522,7 @@ class PollNew extends Component {
// console.log(this.state.projects===undefined?"":this.state.projects.poll_questions) // console.log(this.state.projects===undefined?"":this.state.projects.poll_questions)
var displaymysave = (mysave === true) ? "" : "display:none;"; var displaymysave = (mysave === true) ? "" : "display:none;";
return ( return (
<div> <div className="newMain">
{/*提示*/} {/*提示*/}
{Modalstype && Modalstype === true ? <Modals {Modalstype && Modalstype === true ? <Modals
modalsType={this.state.Modalstype} modalsType={this.state.Modalstype}
@ -2465,14 +2532,8 @@ class PollNew extends Component {
modalsBottomval={this.state.ModalsBottomval} modalsBottomval={this.state.ModalsBottomval}
loadtype={this.state.Loadtype} loadtype={this.state.Loadtype}
/> : ""} /> : ""}
<style>
{ <div className="educontent mb50">
`
.newMains{ margin: 0 auto; padding-bottom: 235px !important; min-width:1200px; min-height: 800px !important;}
`
}
</style>
<div className="educontent newMains">
<p className="clearfix mb20 mt10"> <p className="clearfix mb20 mt10">
<a className=" btn colorgrey fl hovercolorblue" onClick={()=>this.gotohome()}>{this.props.coursedata.name}</a> <a className=" btn colorgrey fl hovercolorblue" onClick={()=>this.gotohome()}>{this.props.coursedata.name}</a>
<span className="color-grey-9 fl ml3 mr3">&gt;</span> <span className="color-grey-9 fl ml3 mr3">&gt;</span>
@ -2874,7 +2935,7 @@ class PollNew extends Component {
value={itemo.question.min_choices === 0 || itemo.question.min_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.min_choices} value={itemo.question.min_choices === 0 || itemo.question.min_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.min_choices}
> >
<Option value={String("0")}>--</Option> <Option value={"0"}>--</Option>
{itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => { {itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => {
return ( return (
indext >= 1 ? <Option value={String(indext + 1)}>{indext + 1}</Option> : "" indext >= 1 ? <Option value={String(indext + 1)}>{indext + 1}</Option> : ""
@ -2885,10 +2946,10 @@ class PollNew extends Component {
className="ml10 mr10 color-grey-6 lineh-40 fl">~</span> className="ml10 mr10 color-grey-6 lineh-40 fl">~</span>
{/*可选最大*/} {/*可选最大*/}
<Select className="fl w100" <Select className="fl w100"
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices)} onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices,itemo.question.answers.length)}
value={itemo.question.max_choices === 0 || itemo.question.max_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.max_choices} value={itemo.question.max_choices === 0 || itemo.question.max_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.max_choices}
> >
<Option value={String("0")}>--</Option> <Option value={"0"}>--</Option>
{itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => { {itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => {
return ( return (
indext >= 1 ? <Option value={String(indext + 1)}>{indext + 1}</Option> : "" indext >= 1 ? <Option value={String(indext + 1)}>{indext + 1}</Option> : ""
@ -3128,7 +3189,7 @@ class PollNew extends Component {
className="ml10 mr10 color-grey-6 lineh-40 fl">~</span> className="ml10 mr10 color-grey-6 lineh-40 fl">~</span>
{/*可选最大*/} {/*可选最大*/}
<Select className="fl w100" <Select className="fl w100"
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices)} onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices,itemo.question.answers.length)}
value={itemo.question.max_choices === 0 || itemo.question.max_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.max_choices} value={itemo.question.max_choices === 0 || itemo.question.max_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.max_choices}
> >
<Option value={String("0")}>--</Option> <Option value={String("0")}>--</Option>
@ -3380,7 +3441,7 @@ class PollNew extends Component {
className="ml10 mr10 color-grey-6 lineh-40 fl">~</span> className="ml10 mr10 color-grey-6 lineh-40 fl">~</span>
{/*可选最大*/} {/*可选最大*/}
<Select className="fl w100" <Select className="fl w100"
onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices)} onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices,itemo.question.answers.length)}
value={itemo.question.max_choices === 0 || itemo.question.max_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.max_choices} value={itemo.question.max_choices === 0 || itemo.question.max_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.max_choices}
> >
<Option value={String("0")}>--</Option> <Option value={String("0")}>--</Option>

@ -1100,7 +1100,7 @@ class ShixunHomework extends Component{
{course_modules&&course_modules.main_category.map((item,key)=>{ {course_modules&&course_modules.main_category.map((item,key)=>{
return( return(
datas&&datas.category_id===null?"":<li key={key} id={item.main_category_id} onClick={() => this.moveTos(item.main_category_id)} title={item.main_category_name}>{item.main_category_name}</li> datas&&datas.category_id===null?"":<li key={key} id={item.main_category_id} onClick={() => this.moveTos(item.main_category_id)} title={item.main_category_name.length>18?item.main_category_name:""}>{item.main_category_name}</li>
) )
})} })}
@ -1109,10 +1109,10 @@ class ShixunHomework extends Component{
return (!this.state.dirSearchValue || item.category_name.indexOf(this.state.dirSearchValue) != -1) return (!this.state.dirSearchValue || item.category_name.indexOf(this.state.dirSearchValue) != -1)
}).map( (item,key) => { }).map( (item,key) => {
if(datas&&datas.category_id!=null&&datas&&datas.category_id===item.category_id===false){ if(datas&&datas.category_id!=null&&datas&&datas.category_id===item.category_id===false){
return <li key={key} id={item.category_id} onClick={() => this.moveTos(item.category_id )} title={item.category_name}>{item.category_name}</li> return <li key={key} id={item.category_id} onClick={() => this.moveTos(item.category_id )} title={item.category_name.length>18?item.category_name:""}>{item.category_name}</li>
} }
if(datas&&datas.category_id===null){ if(datas&&datas.category_id===null){
return <li key={key} id={item.category_id} onClick={() => this.moveTos(item.category_id )} title={item.category_name}>{item.category_name}</li> return <li key={key} id={item.category_id} onClick={() => this.moveTos(item.category_id )} title={item.category_name.length>18?item.category_name:""}>{item.category_name}</li>
} }
})} })}

@ -561,21 +561,24 @@ class MemoNew extends Component {
} }
} }
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
this.props.confirm({ if(file.response!=undefined){
// title: '确定要删除这个附件吗?', this.props.confirm({
content: '是否确认删除?', // title: '确定要删除这个附件吗?',
content: '是否确认删除?',
okText: '确定',
cancelText: '取消', okText: '确定',
// content: 'Some descriptions', cancelText: '取消',
onOk: () => { // content: 'Some descriptions',
this.deleteAttachment(file) onOk: () => {
}, this.deleteAttachment(file)
onCancel() { },
console.log('Cancel'); onCancel() {
}, console.log('Cancel');
}); },
return false; });
return false;
}
} }
deleteAttachment = (file) => { deleteAttachment = (file) => {
// 初次上传不能直接取uid // 初次上传不能直接取uid

@ -82,10 +82,10 @@ class CaseDetail extends Component{
<a href="/moop_cases" className="color-grey-9">教学案例</a> &gt; <span className="color-grey-3">{ CaseDetail.title}</span> <a href="/moop_cases" className="color-grey-9">教学案例</a> &gt; <span className="color-grey-3">{ CaseDetail.title}</span>
</p> </p>
<p className="lineh-25 mb20 clearfix"> <p className="lineh-25 mb20 clearfix">
<span className="font-22 fl mr10 task-hide" style={{maxWidth:"800px"}}> <span className="font-22 fl mr10 task-hide lineh-30" style={{maxWidth:"800px"}}>
{ CaseDetail.title} { CaseDetail.title}
</span> </span>
<span className="mt5 fl"> <span className="mt10 fl">
<Tags tags={tags}></Tags> <Tags tags={tags}></Tags>
{ {
CaseDetail.status == "pending" && <span class="edu-filter-btn fl cdefault edu-activity-green ml10">草稿</span> CaseDetail.status == "pending" && <span class="edu-filter-btn fl cdefault edu-activity-green ml10">草稿</span>

@ -47,16 +47,18 @@ class CaseNew extends Component{
// 上传附件-删除确认框 // 上传附件-删除确认框
onAttachmentRemove = (file, stateName) => { onAttachmentRemove = (file, stateName) => {
this.props.confirm({ if(file.response!=undefined){
content: '是否确认删除?', this.props.confirm({
onOk: () => { content: '是否确认删除?',
this.deleteAttachment(file, stateName) onOk: () => {
}, this.deleteAttachment(file, stateName)
onCancel() { },
console.log('Cancel'); onCancel() {
}, console.log('Cancel');
}); },
return false; });
return false;
}
} }
// 上传附件-确认删除 // 上传附件-确认删除
@ -273,7 +275,7 @@ class CaseNew extends Component{
beforeUpload: (file) => { beforeUpload: (file) => {
const isLt150M = file.size / 1024 / 1024 < 150; const isLt150M = file.size / 1024 / 1024 < 150;
if (!isLt150M) { if (!isLt150M) {
//message.error('文件大小必须小于150MB!'); //this.props.showNotification('文件大小必须小于150MB!');
this.props.define({ this.props.define({
title:'提示', title:'提示',
content:"该文件无法上传。超过文件大小限制(150MB),建议上传到百度云等其它共享工具里然后再txt文档里给出链接以及共享密码并上传" content:"该文件无法上传。超过文件大小限制(150MB),建议上传到百度云等其它共享工具里然后再txt文档里给出链接以及共享密码并上传"
@ -377,6 +379,7 @@ class CaseNew extends Component{
<ul className="fl libraries_tab"> <ul className="fl libraries_tab">
<li className={ casesTags.indexOf(1) > -1 ? "active" :"" } onClick={()=>this.changeType(1)}>获奖案例</li> <li className={ casesTags.indexOf(1) > -1 ? "active" :"" } onClick={()=>this.changeType(1)}>获奖案例</li>
<li className={ casesTags.indexOf(2) > -1 ? "active" :"" } onClick={()=>this.changeType(2)}>入库案例</li> <li className={ casesTags.indexOf(2) > -1 ? "active" :"" } onClick={()=>this.changeType(2)}>入库案例</li>
<li className={ casesTags.indexOf(3) > -1 ? "active" :"" } onClick={()=>this.changeType(3)}>企业案例</li>
</ul> </ul>
{ {
checkTag && <div class="ant-form-explain">请选择标签</div> checkTag && <div class="ant-form-explain">请选择标签</div>

@ -14,7 +14,17 @@ class CaseTags extends Component{
{ {
tags && tags.map((item,key)=>{ tags && tags.map((item,key)=>{
return( return(
<span key={key} className={item.name == "获奖案例" ? "edu-filter-btn fl cdefault edu-activity-red ml10" : "edu-filter-btn fl cdefault edu-activity-blue ml10"}>{item.name}</span> <React.Fragment>
{
item.name == "获奖案例" ?
<span key={key} className="edu-filter-btn fl cdefault edu-activity-red ml10">{item.name}</span>
:
item.name == "入库案例" ?
<span key={key} className="edu-filter-btn fl cdefault edu-activity-blue ml10">{item.name}</span>
:
<span key={key} className="edu-filter-btn fl cdefault edu-activity-orange-sub ml10">{item.name}</span>
}
</React.Fragment>
) )
}) })
} }

@ -62,6 +62,13 @@
border: 1px solid #4CACFF; border: 1px solid #4CACFF;
line-height: 17px; line-height: 17px;
} }
.edu-activity-orange-sub {
background-color: #FF781B;
color: #fff!important;
cursor: pointer;
border: 1px solid #ff6800;
line-height: 17px;
}
.pointsBtn { .pointsBtn {
width: 70px; width: 70px;

@ -481,12 +481,13 @@ export function TPMIndexHOC(WrappedComponent) {
} }
` `
}</style> }</style>
<NewHeader {...this.state} {...this.props}></NewHeader>
<Spin spinning={this.state.globalLoading} delay={0} className="globalSpin" <Spin spinning={this.state.globalLoading} delay={0} className="globalSpin"
size="large" size="large"
tip= {this._gLoadingTip || "加载中..."} tip= {this._gLoadingTip || "加载中..."}
> >
<NewHeader {...this.state} {...this.props}></NewHeader>
<div className="newContainer newContainers"> <div className="newContainer newContainers">
<WrappedComponent initCommonState={(user)=>this.initCommonState(user)} <WrappedComponent initCommonState={(user)=>this.initCommonState(user)}
{...this.props} {...this.state} {...this.props} {...this.state}
@ -497,11 +498,12 @@ export function TPMIndexHOC(WrappedComponent) {
</div> </div>
</Spin>
<NewFooter <NewFooter
Footerdown={Footerdown} Footerdown={Footerdown}
/> />
</Spin>
</div> </div>
); );
} }

@ -1384,20 +1384,23 @@ export default class TPMsettings extends Component {
} }
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
confirm({ if(file.response!=undefined){
title: '确定要删除这个附件吗?', confirm({
okText: '确定', title: '确定要删除这个附件吗?',
cancelText: '取消', okText: '确定',
// content: 'Some descriptions', cancelText: '取消',
onOk: () => { // content: 'Some descriptions',
console.log("665") onOk: () => {
this.deleteAttachment(file) console.log("665")
}, this.deleteAttachment(file)
onCancel() { },
console.log('Cancel'); onCancel() {
}, console.log('Cancel');
}); },
return false; });
return false;
}
} }
deleteAttachment = (file) => { deleteAttachment = (file) => {

@ -772,20 +772,23 @@ class Newshixuns extends Component {
} }
onAttachmentRemove = (file) => { onAttachmentRemove = (file) => {
confirm({ if(file.response!=undefined){
title: '确定要删除这个附件吗?', confirm({
okText: '确定', title: '确定要删除这个附件吗?',
cancelText: '取消', okText: '确定',
// content: 'Some descriptions', cancelText: '取消',
onOk: () => { // content: 'Some descriptions',
console.log("665") onOk: () => {
this.deleteAttachment(file) console.log("665")
}, this.deleteAttachment(file)
onCancel() { },
console.log('Cancel'); onCancel() {
}, console.log('Cancel');
}); },
return false; });
return false;
}
} }
deleteAttachment = (file) => { deleteAttachment = (file) => {
console.log(file); console.log(file);
@ -913,7 +916,7 @@ class Newshixuns extends Component {
// // console.log('beforeUpload', file.name); // // console.log('beforeUpload', file.name);
// const isLt50M = file.size / 1024 / 1024 < 50; // const isLt50M = file.size / 1024 / 1024 < 50;
// if (!isLt50M) { // if (!isLt50M) {
// message.error('文件大小必须小于150MB!'); // this.props.showNotification('文件大小必须小于150MB!');
// } // }
// return isLt50M; // return isLt50M;
// }, // },

@ -13,6 +13,7 @@ import axios from 'axios';
import { trace, trace_collapse ,getImageUrl, toPath} from "educoder"; import { trace, trace_collapse ,getImageUrl, toPath} from "educoder";
import RepositoryDirectories from './RepositoryDirectories' import RepositoryDirectories from './RepositoryDirectories'
import RepositoryAddFile from './RepositoryAddFile'
const $ = window.$; const $ = window.$;
// 点击按钮复制功能 // 点击按钮复制功能
@ -82,10 +83,10 @@ class Repository extends Component {
<a href="/forums/2784" target="_blank" <a href="/forums/2784" target="_blank"
className=" guideBtn" >Git使用指南</a> className=" guideBtn" >Git使用指南</a>
{/* <RepositoryAddFile {...this.props} {...this.state}></RepositoryAddFile> */}
<div className="fr font-12 color-grey-9 pr"> <div className="fr font-12 color-grey-9 pr">
<label className="fl">网址克隆</label> <label className="fl mt2">网址克隆</label>
<input type="text" id="copy_rep_content" className="fl url-input" <input type="text" id="copy_rep_content" className="fl url-input mt2"
defaultValue={ git_url } style={{width: 313}}/> defaultValue={ git_url } style={{width: 313}}/>
<a onClick={() => { <a onClick={() => {
jsCopy() jsCopy()

@ -0,0 +1,52 @@
import React, { Component } from 'react';
import { ActionBtn } from 'educoder'
import { Form , Modal } from 'antd'
class RepositoryAddFile extends Component {
constructor(props) {
super(props);
this.state={
visible:false
}
}
addFile = () =>{
this.setState({
visible:true
})
}
cancelAdd = () =>{
this.setState({
visible:false
})
}
render(){
let { visible } = this.state
return(
<React.Fragment>
<ActionBtn style="orangeLine" className="ml20" onClick={this.addFile}>+添加文件</ActionBtn>
<Modal
className={"RepositioryModal"}
title={'添加文件'}
visible={visible}
closable={false}
footer={null}
destroyOnClose={true}
width="550px"
>
<div className="task-popup-content">
</div>
<div className="clearfix mt30 edu-txt-center mb10">
<a className="task-btn color-white mr30" onClick={this.cancelAdd}>取消</a>
<a className="task-btn task-btn-orange">提交</a>
</div>
</Modal>
</React.Fragment>
)
}
}
const WrappedRepositoryAddFile = Form.create({name: 'taskRepositoryAddFile'})(RepositoryAddFile);
// RouteHOC()
export default (WrappedRepositoryAddFile);
Loading…
Cancel
Save