diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index 94e95adbe..a102f92de 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -1297,7 +1297,7 @@ class CoursesController < ApplicationController
@is_teacher = @user_course_identity < Course::ASSISTANT_PROFESSOR
@course_modules = @course.course_modules.where(hidden: 0)
@hidden_modules = @course.course_modules.where(hidden: 1)
- @second_category_type = ["shixun_homework", "graduation", "attachment", "board", "course_group", "video"]
+ @second_category_type = ["shixun_homework", "graduation", "attachment", "board", "course_group", "video", "common_homework", "group_homework"]
end
def board_list
diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb
index 15f5c67d9..e5d9fc495 100644
--- a/app/controllers/exercises_controller.rb
+++ b/app/controllers/exercises_controller.rb
@@ -379,6 +379,7 @@ class ExercisesController < ApplicationController
#试卷的提交设置
def commit_setting
+ tip_exception("助教无权限修改本试卷") if @user_course_identity == Course::ASSISTANT_PROFESSOR && !@exercise.assistant_auth
ActiveRecord::Base.transaction do
error_count = 0 # 判断循环里是否有已发布/已截止的,且时间更改了的分班。
# course_group_ids = @course.teacher_course_group_ids(current_user.id) #当前老师的班级id数组
@@ -398,6 +399,7 @@ class ExercisesController < ApplicationController
choice_random = params[:choice_random] ? true : false
score_open = params[:score_open] ? true : false #分数是否公开
answer_open = params[:answer_open] ? true : false #答案是否公开
+ assistant_auth = params[:assistant_auth] ? true : false # 助教权限
# 统一设置或者分班为0,则更新试卷,并删除试卷分组
if unified_setting || (course_group_ids.size == 0)
@@ -426,7 +428,8 @@ class ExercisesController < ApplicationController
:answer_open => answer_open,
:exercise_status => exercise_status_n,
:publish_time => params_publish_time,
- :end_time => params_end_time
+ :end_time => params_end_time,
+ :assistant_auth => assistant_auth
}
@exercise.update!(exercise_params)
@exercise.exercise_group_settings.destroy_all
diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb
index 4515e5482..0e3771e61 100644
--- a/app/controllers/homework_commons_controller.rb
+++ b/app/controllers/homework_commons_controller.rb
@@ -34,7 +34,7 @@ class HomeworkCommonsController < ApplicationController
module_type = @homework_type == 4 ? "shixun_homework" : @homework_type == 1 ? "common_homework" : "group_homework"
@homework_commons = @course.homework_commons.where(homework_type: @homework_type)
@main_category = @course.course_modules.find_by(module_type: module_type)
- if @homework_type == 4 && !params[:category].blank?
+ if !params[:category].blank?
@category = @main_category.course_second_categories.find_by(id: params[:category])
tip_exception("子目录id有误") if !@category.present?
@homework_commons = @homework_commons.where(course_second_category_id: params[:category])
diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb
index 0ee83e839..27444b3c9 100644
--- a/app/helpers/courses_helper.rb
+++ b/app/helpers/courses_helper.rb
@@ -89,6 +89,10 @@ module CoursesHelper
case category.category_type
when "shixun_homework"
"/classrooms/#{course.id}/shixun_homework/#{category.id}"
+ when "common_homework"
+ "/classrooms/#{course.id}/common_homework/#{category.id}"
+ when "group_homework"
+ "/classrooms/#{course.id}/group_homework/#{category.id}"
when "graduation"
if category.name == "毕设选题"
"/classrooms/#{course.id}/graduation_topics/#{category.course_module_id}"
@@ -107,6 +111,10 @@ module CoursesHelper
case category.category_type
when "shixun_homework"
get_homework_commons_count(course, 4, category.id)
+ when "common_homework"
+ get_homework_commons_count(course, 1, category.id)
+ when "group_homework"
+ get_homework_commons_count(course, 3, category.id)
when "graduation"
if category.name == "毕设选题"
course.graduation_topics_count
diff --git a/app/views/exercises/common_header.json.jbuilder b/app/views/exercises/common_header.json.jbuilder
index d43d7c3f8..7843c260e 100644
--- a/app/views/exercises/common_header.json.jbuilder
+++ b/app/views/exercises/common_header.json.jbuilder
@@ -1,5 +1,5 @@
json.course_is_end @course.is_end # true表示已结束,false表示未结束
-json.extract! @exercise, :id,:exercise_name,:exercise_description,:show_statistic
+json.extract! @exercise, :id,:exercise_name,:exercise_description,:show_statistic,:assistant_auth
json.time (@user_left_time.to_i / 60)
json.exercise_status @ex_status
diff --git a/app/views/exercises/index.json.jbuilder b/app/views/exercises/index.json.jbuilder
index c8f6cd380..e1c8bd3a4 100644
--- a/app/views/exercises/index.json.jbuilder
+++ b/app/views/exercises/index.json.jbuilder
@@ -2,7 +2,7 @@
if @exercises_count > 0
json.exercises do
json.array! @exercises do |exercise|
- json.extract! exercise, :id, :exercise_name,:is_public,:created_at
+ json.extract! exercise, :id, :exercise_name,:is_public,:created_at,:assistant_auth
if @is_teacher_or == 2
second_left = get_exercise_left_time(exercise,@current_user_)
json.time second_left.present? ? (second_left / 60) : nil
diff --git a/db/migrate/20200311082736_add_auth_to_exercise.rb b/db/migrate/20200311082736_add_auth_to_exercise.rb
new file mode 100644
index 000000000..fceb96e0c
--- /dev/null
+++ b/db/migrate/20200311082736_add_auth_to_exercise.rb
@@ -0,0 +1,5 @@
+class AddAuthToExercise < ActiveRecord::Migration[5.2]
+ def change
+ add_column :exercises, :assistant_auth, :boolean, default: 1
+ end
+end
diff --git a/public/react/src/college/College.js b/public/react/src/college/College.js
index 15b0e82f8..bc8f2a3a2 100644
--- a/public/react/src/college/College.js
+++ b/public/react/src/college/College.js
@@ -907,7 +907,7 @@ class College extends Component {
{
- teachers_count?
+ teachers_count || teachers_count===0?
{teachers_count}人
:
@@ -915,7 +915,7 @@ class College extends Component {
{
- students_count?
+ students_count || students_count===0?
{students_count}人
:
@@ -923,7 +923,7 @@ class College extends Component {
{
- courses_count?
+ courses_count || courses_count === 0?
{courses_count}个
:
@@ -931,7 +931,7 @@ class College extends Component {
{
- shixuns_count?
+ shixuns_count || shixuns_count === 0?
{shixuns_count}个
:
@@ -939,7 +939,7 @@ class College extends Component {
{
- shixun_report_count?
+ shixun_report_count || shixun_report_count===0?
{shixun_report_count}个
:
@@ -947,7 +947,7 @@ class College extends Component {
{
- shixun_time?
+ shixun_time || shixun_time === 0 ?
{shixun_time}天
:
diff --git a/public/react/src/common/hooks/ImageLayer2.js b/public/react/src/common/hooks/ImageLayer2.js
index 2b1979c74..202a7f343 100644
--- a/public/react/src/common/hooks/ImageLayer2.js
+++ b/public/react/src/common/hooks/ImageLayer2.js
@@ -16,7 +16,7 @@ function ImageLayer2(props) {
const imageSrc = event.target.src || event.target.getAttribute('src') || event.target.getAttribute('href')
// 判断imageSrc是否是图片
const fileName = event.target.innerHTML.trim()
- if (isImageExtension(imageSrc.trim()) || isImageExtension(fileName) || event.target.tagName == 'IMG' || imageSrc.indexOf('base64,') != -1) {
+ if (isImageExtension((imageSrc && imageSrc.trim())) || isImageExtension(fileName) || event.target.tagName == 'IMG' || (imageSrc && imageSrc.indexOf('base64,')) != -1) {
// 非回复里的头像图片; 非emoticons
if (imageSrc.indexOf('/images/avatars/User') === -1 &&
imageSrc.indexOf('kindeditor/plugins/emoticons') === -1 ) {
diff --git a/public/react/src/common/quillForEditor/ImageBlot.js b/public/react/src/common/quillForEditor/ImageBlot.js
index 0a9bec733..6e585f31f 100644
--- a/public/react/src/common/quillForEditor/ImageBlot.js
+++ b/public/react/src/common/quillForEditor/ImageBlot.js
@@ -1,7 +1,7 @@
/*
* @Description: 重写图片
* @Author: tangjiang
- * @Github:
+ * @Github:
* @Date: 2019-12-16 15:50:45
* @LastEditors : tangjiang
* @LastEditTime : 2019-12-31 13:59:02
@@ -17,9 +17,14 @@ export default class ImageBlot extends BlockEmbed {
const node = super.create();
node.setAttribute('alt', value.alt);
node.setAttribute('src', value.url);
+ console.log('~~~~~~~~~~~', node, value);
node.addEventListener('click', function () {
- value.onclick(value.url);
- }, false);
+ try {
+ value.onclick(value.url);
+ }catch (e) {
+
+ }
+ }, false);
if (value.width) {
node.setAttribute('width', value.width);
}
@@ -35,6 +40,16 @@ export default class ImageBlot extends BlockEmbed {
node.setAttribute('width', '100%');
}
+ // node.setAttribute('style', { cursor: 'pointer' });
+
+ // if (node.onclick) {
+ // console.log('image 有图片点击事件======》》》》》》');
+ // // node.setAttribute('onclick', node.onCLick);
+ // }
+ // 给图片添加点击事件
+ // node.onclick = () => {
+ // value.onClick && value.onClick(value.url);
+ // }
return node;
}
@@ -54,4 +69,4 @@ export default class ImageBlot extends BlockEmbed {
}
ImageBlot.blotName = 'image';
-ImageBlot.tagName = 'img';
\ No newline at end of file
+ImageBlot.tagName = 'img';
diff --git a/public/react/src/modules/courses/busyWork/CommonWorkList.js b/public/react/src/modules/courses/busyWork/CommonWorkList.js
index e2b70aed5..549dd6ae3 100644
--- a/public/react/src/modules/courses/busyWork/CommonWorkList.js
+++ b/public/react/src/modules/courses/busyWork/CommonWorkList.js
@@ -378,7 +378,8 @@ function buildColumns(that, student_works, studentData) {
{/* /classrooms/"+courseId+"/common_homeworks/"+workId+ '/' + record.id +"/appraise */}
that.props.toWorkDetailPage2(e, courseId, workId, record.id)}
- onClick={() => that.props.toWorkDetailPage(courseId, workId, record.id)}>{isAdmin ? '评阅' : '查看'}
+ // onClick={() => that.props.toWorkDetailPage(courseId, workId, record.id)}
+ >{isAdmin ? '评阅' : '查看'}
diff --git a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
index 3ebd4fab3..d83f51c0a 100644
--- a/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
+++ b/public/react/src/modules/courses/shixunHomework/Listofworksstudentone.js
@@ -502,7 +502,8 @@ class Listofworksstudentone extends Component {
this.Viewstudenttraininginformationtysl2(e, record)}
- onClick={() => this.Viewstudenttraininginformation(record)}>{record.operating}
+ // onClick={() => this.Viewstudenttraininginformation(record)}
+ >{record.operating}
}
@@ -897,7 +898,8 @@ class Listofworksstudentone extends Component {
this.Viewstudenttraininginformationtysl2(e, record)}
- onClick={() => this.Viewstudenttraininginformation(record)}>{record.operating}
+ // onClick={() => this.Viewstudenttraininginformation(record)}
+ >{record.operating}
}
@@ -1295,11 +1297,13 @@ class Listofworksstudentone extends Component {
record.submitstate === "未开启" ?
this.Viewstudenttraininginformationtysl2(e, record)}
- onClick={() => this.Viewstudenttraininginformationt(record)}>{record.has_comment===true?"详情":"评阅 "} :
+ // onClick={() => this.Viewstudenttraininginformationt(record)}
+ >{record.has_comment===true?"详情":"评阅 "} :
this.Viewstudenttraininginformationtysl2(e, record)}
- onClick={() => this.Viewstudenttraininginformationt(record)}>{record.has_comment===true?"详情":"评阅 "}
+ // onClick={() => this.Viewstudenttraininginformationt(record)}
+ >{record.has_comment===true?"详情":"评阅 "}
)
},
@@ -1657,11 +1661,13 @@ class Listofworksstudentone extends Component {
record.submitstate === "未开启" ?
this.Viewstudenttraininginformationtysl2(e, record)}
- onClick={() => this.Viewstudenttraininginformationt(record)}>{record.has_comment===true?"详情":"评阅"} :
+ // onClick={() => this.Viewstudenttraininginformationt(record)}
+ >{record.has_comment===true?"详情":"评阅"} :
this.Viewstudenttraininginformationtysl2(e, record)}
- onClick={() => this.Viewstudenttraininginformationt(record)}>{record.has_comment===true?"详情":"评阅"}
+ // onClick={() => this.Viewstudenttraininginformationt(record)}
+ >{record.has_comment===true?"详情":"评阅"}
)
},
diff --git a/public/react/src/modules/page/layers/ImageLayer.js b/public/react/src/modules/page/layers/ImageLayer.js
index 921a47d8c..b1adc5b6b 100644
--- a/public/react/src/modules/page/layers/ImageLayer.js
+++ b/public/react/src/modules/page/layers/ImageLayer.js
@@ -19,7 +19,7 @@ class ImageLayer extends Component {
{showImage ?
-
+
:
diff --git a/public/react/src/modules/question/Questionitem_banks.js b/public/react/src/modules/question/Questionitem_banks.js
index aade5de2e..503e6f5de 100644
--- a/public/react/src/modules/question/Questionitem_banks.js
+++ b/public/react/src/modules/question/Questionitem_banks.js
@@ -22,6 +22,7 @@ import JudquestionEditor from "./component/JudquestionEditor";
import Bottomsubmit from "../../modules/modals/Bottomsubmit";
import { connect } from 'react-redux';
import actions from "../../redux/actions";
+import QuestionModalPicture from "./component/QuestionModalPicture";
var restricte=false;
class Questionitem_banks extends Component {
constructor(props) {
@@ -38,6 +39,7 @@ class Questionitem_banks extends Component {
knowledgepoints: [],
disciplmy:[],
pages:1,
+ url:''
}
@@ -526,14 +528,33 @@ class Questionitem_banks extends Component {
this.scrollToAnchor("Itembankstopid");
}
+ handleShowUploadImage=(url)=>{
+ debugger
+ this.setState({
+ url:url
+ })
+ }
+ handleClose=()=>{
+ this.setState({
+ url:'',
+ })
+ }
+
+
render() {
- let {page, limit, count, Headertop, visible, placement, modalsType, item_type,restricte} = this.state;
+ let {page, limit, count, Headertop, visible, placement, modalsType, item_type,restricte,url} = this.state;
const params = this.props && this.props.match && this.props.match.params;
// ////console.log(params);
return (
+
+ {url?
+
this.handleClose()}>
+ :
+ ""
+ }
{
restricte===false?
this.getanswerMdRef(ref)}
+ handleShowUploadImage={(url)=>this.handleShowUploadImage(url)}
>
@@ -594,6 +616,7 @@ class Questionitem_banks extends Component {
{...this.state}
{...this.props}
getanswerMdRef={(ref) => this.getChoquesEditor(ref)}
+ handleShowUploadImage={(url)=>this.handleShowUploadImage(url)}
>
diff --git a/public/react/src/modules/question/component/ChoquesEditor.js b/public/react/src/modules/question/component/ChoquesEditor.js
index 512e6e373..82cd7b1b4 100644
--- a/public/react/src/modules/question/component/ChoquesEditor.js
+++ b/public/react/src/modules/question/component/ChoquesEditor.js
@@ -79,6 +79,8 @@ class ChoquesEditor extends Component{
question_titlesysl:this.props.question_titlesysl||'',
question_titleysl:this.props.question_title || '',
item_banksedit:[],
+ bindinginputs:null,
+ url:"",
}
}
addOption = () => {
@@ -174,8 +176,30 @@ class ChoquesEditor extends Component{
onCancel = () => {
this.props.onEditorCancel()
}
+ handleShowUploadImages=(url)=>{
+ this.setState({
+ url:url,
+ })
+ try {
+ this.props.handleShowUploadImage(url)
+ }catch (e) {
+
+ }
+ }
+ handleShowUploadImage = (url,i) => {
+
+ this.setState({
+ url:url,
+ bindinginputs:i
+ })
+
+ try {
+ this.props.handleShowUploadImage(url)
+ }catch (e) {
+ }
+ }
componentDidMount = () => {
try {
@@ -228,10 +252,22 @@ class ChoquesEditor extends Component{
}
var texts;
const _text = quill.getText();
+ // console.log("onOptionContentChange");
+ // console.log(value);
+ // console.log(value.ops.length);
+ // console.log(_text);
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if (!reg.test(_text)) {
// 处理编辑器内容为空
texts="";
+ try {
+ if(value.ops.length>1){
+ //单独图片的话 _text是为空的
+ texts=JSON.stringify(value);
+ }
+ }catch (e) {
+
+ }
} else {
if(_text.length>=500){
var result = _text.substring(0,450);
@@ -288,40 +324,68 @@ class ChoquesEditor extends Component{
if (!reg.test(_text)) {
// 处理编辑器内容为空
this.setState({
- question_titleysl:""
+ question_titleysl:"",
})
+ try {
+ if(value.ops.length>1) {
+ this.setState({
+ question_titleysl:JSON.stringify(value),
+ })
+ }
+ }catch (e) {
+
+ }
} else {
// 提交到后台的内容需要处理一下;
try {
let texts = JSON.stringify(value);
this.setState({
- question_titleysl:texts
+ question_titleysl:texts,
})
}catch (e) {
this.setState({
- question_titleysl:""
+ question_titleysl:"",
})
}
}
}
+ bindinginputs=(i)=>{
+ this.setState({
+ bindinginputs:i
+ })
+
+ }
+
+
onContentChanges=(value,quill)=>{
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
if (!reg.test(_text)) {
// 处理编辑器内容为空
this.setState({
- question_titlesysl:""
+ question_titlesysl:"",
})
+ try {
+ if(value.ops.length>1){
+ //单独图片的话 _text是为空的
+ this.setState({
+ question_titlesysl:JSON.stringify(value),
+ })
+ }
+ }catch (e) {
+
+ }
} else {
// 提交到后台的内容需要处理一下;
try {
let texts = JSON.stringify(value);
this.setState({
- question_titlesysl:texts
+ question_titlesysl:texts,
+
})
}catch (e) {
this.setState({
- question_titlesysl:""
+ question_titlesysl:"",
})
}
@@ -330,7 +394,7 @@ class ChoquesEditor extends Component{
render() {
- let { question_title, question_score, question_type, question_choices, standard_answers,question_titles} = this.state;
+ let { question_title, question_score, question_type, question_choices, standard_answers,question_titles,bindinginputs} = this.state;
let { question_id, index, exerciseIsPublish,
// question_title,
// question_type,
@@ -382,6 +446,20 @@ class ChoquesEditor extends Component{
.signleEditor .quill_editor_for_react_area .ql-container .ql-editor p{
font-family: MicrosoftYaHei;
}
+
+ .content_editorMd_show{
+ display: flex !important;
+ margin-top:0px !important;
+ border-radius:2px !important;
+ max-width: 1056px !important;
+ word-break:break-all !important;
+ border:1px solid rgba(221,221,221,1) !important;
+ }
+ .contestedtext{
+ font-size:14px;
+ font-family:MicrosoftYaHei;
+ color:rgba(172,172,172,1);
+ }
`}
{/* {!question_id ? '新建' : '编辑'} */}
@@ -391,12 +469,14 @@ class ChoquesEditor extends Component{
this.handleShowUploadImages(url)}
+
/>
@@ -407,6 +487,8 @@ class ChoquesEditor extends Component{
{question_choices.map( (item, index) => {
+ // console.log("question_choices");
+ // console.log(item);
const bg = standard_answers[index] ? 'check-option-bg' : ''
return
0?"df optionRow mt15": "df optionRow"} >
{/* 点击设置答案 */}
@@ -423,25 +505,51 @@ class ChoquesEditor extends Component{
{
item===undefined||item===null||item===""?
-
this.onOptionContentChange(value,quill,index)}
- />
+
+ {
+ bindinginputs===null||bindinginputs!==index?
+
this.bindinginputs(index)}>
+ {/*
请您输入选项
*/}
+
:
+
this.onOptionContentChange(value,quill,index)}
+ showUploadImage={(url)=>this.handleShowUploadImage(url,index)}
+ />
+
+ }
+
:
- this.onOptionContentChange(value,quill,index)}
- />
+
+ {
+ bindinginputs===null||bindinginputs!==index?
+
this.bindinginputs(index)}>
+
+ this.handleShowUploadImage(url,index)}
+ />
+
+ :
+
this.onOptionContentChange(value,quill,index)}
+ showUploadImage={(url)=>this.handleShowUploadImage(url,index)}
+ />
+ }
+
+
}
@@ -474,12 +582,14 @@ class ChoquesEditor extends Component{
this.handleShowUploadImages(url)}
+
/>
diff --git a/public/react/src/modules/question/component/JudquestionEditor.js b/public/react/src/modules/question/component/JudquestionEditor.js
index 868700c6b..baea3391f 100644
--- a/public/react/src/modules/question/component/JudquestionEditor.js
+++ b/public/react/src/modules/question/component/JudquestionEditor.js
@@ -58,6 +58,7 @@ class JudquestionEditor extends Component{
zqda:null,
item_banksedit:[],
mychoicess:[],
+ url:''
}
}
addOption = () => {
@@ -310,7 +311,16 @@ class JudquestionEditor extends Component{
this.setState({
question_titleysl:""
})
- // console.log("空");
+ try {
+ if(value.ops.length>1){
+ //单独图片的话 _text是为空的
+ this.setState({
+ question_titleysl:JSON.stringify(value),
+ })
+ }
+ }catch (e) {
+
+ }
} else {
// 提交到后台的内容需要处理一下;
try {
@@ -325,6 +335,16 @@ class JudquestionEditor extends Component{
}
}
}
+ handleShowUploadImages=(url)=>{
+ this.setState({
+ url:url,
+ })
+ try {
+ this.props.handleShowUploadImage(url)
+ }catch (e) {
+
+ }
+ }
onContentChanges=(value,quill)=>{
const _text = quill.getText();
const reg = /^[\s\S]*.*[^\s][\s\S]*$/;
@@ -334,6 +354,16 @@ class JudquestionEditor extends Component{
this.setState({
question_titlesysl:""
})
+ try {
+ if(value.ops.length>1){
+ //单独图片的话 _text是为空的
+ this.setState({
+ question_titlesysl:JSON.stringify(value),
+ })
+ }
+ }catch (e) {
+
+ }
} else {
// 提交到后台的内容需要处理一下;
try {
@@ -412,12 +442,14 @@ class JudquestionEditor extends Component{
this.handleShowUploadImages(url)}
+
/>
@@ -462,12 +494,14 @@ class JudquestionEditor extends Component{
this.handleShowUploadImages(url)}
+
/>
diff --git a/public/react/src/modules/question/component/SingleEditor.js b/public/react/src/modules/question/component/SingleEditor.js
index aaba60dd0..06b057c82 100644
--- a/public/react/src/modules/question/component/SingleEditor.js
+++ b/public/react/src/modules/question/component/SingleEditor.js
@@ -82,6 +82,8 @@ class SingleEditor extends Component{
question_titlesysl:this.props.question_titlesysl||'',
question_titleysl:this.props.question_title || '',
item_banksedit:[],
+ url:"",
+ bindinginputs:null
}
}
addOption = () => {
@@ -249,8 +251,37 @@ class SingleEditor extends Component{
// standard_answers[index] = !standard_answers[index];
this.setState({ standard_answers })
}
+ handleShowUploadImages=(url)=>{
+ this.setState({
+ url:url,
+ })
+ try {
+ this.props.handleShowUploadImage(url)
+ }catch (e) {
+
+ }
+ }
+
+ handleShowUploadImage = (url,i) => {
+
+ this.setState({
+ url:url,
+ bindinginputs:i
+ })
+ try {
+ this.props.handleShowUploadImage(url)
+ }catch (e) {
+
+ }
+ }
+ bindinginputs=(i)=>{
+ this.setState({
+ bindinginputs:i
+ })
+
+ }
+
onOptionContentChange = (value,quill,index) => {
- debugger
if (index >= this.state.question_choices.length) {
// TODO 新建,然后删除CD选项,再输入题干,会调用到这里,且index是3
return;
@@ -261,6 +292,14 @@ class SingleEditor extends Component{
if (!reg.test(_text)) {
// 处理编辑器内容为空
texts="";
+ try {
+ if(value.ops.length>1){
+ //单独图片的话 _text是为空的
+ texts=JSON.stringify(value);
+ }
+ }catch (e) {
+
+ }
} else {
if(_text.length>=500){
var result = _text.substring(0,450);
@@ -318,6 +357,16 @@ class SingleEditor extends Component{
this.setState({
question_titleysl:""
})
+ try {
+ if(value.ops.length>1){
+ //单独图片的话 _text是为空的
+ this.setState({
+ question_titleysl:JSON.stringify(value),
+ })
+ }
+ }catch (e) {
+
+ }
} else {
try {
let texts = JSON.stringify(value);
@@ -341,6 +390,16 @@ class SingleEditor extends Component{
this.setState({
question_titlesysl:""
})
+ try {
+ if(value.ops.length>1){
+ //单独图片的话 _text是为空的
+ this.setState({
+ question_titlesysl:JSON.stringify(value),
+ })
+ }
+ }catch (e) {
+
+ }
} else {
try {
let texts = JSON.stringify(value);
@@ -363,7 +422,7 @@ class SingleEditor extends Component{
}
render() {
- let { question_title, question_score, question_type, question_choices, standard_answers,question_titles,question_titlesysl} = this.state;
+ let { question_title, question_score, question_type, question_choices, standard_answers,question_titles,question_titlesysl,bindinginputs} = this.state;
let { question_id, index, exerciseIsPublish,
// question_title,
// question_type,
@@ -417,6 +476,19 @@ class SingleEditor extends Component{
.signleEditor .quill_editor_for_react_area .ql-container .ql-editor p{
font-family: MicrosoftYaHei;
}
+ .content_editorMd_show{
+ display: flex !important;
+ margin-top:0px !important;
+ border-radius:2px !important;
+ max-width: 1056px !important;
+ word-break:break-all !important;
+ border:1px solid rgba(221,221,221,1) !important;
+ }
+ .contestedtext{
+ font-size:14px;
+ font-family:MicrosoftYaHei;
+ color:rgba(172,172,172,1);
+ }
`}
{/* {!question_id ? '新建' : '编辑'} */}
@@ -426,12 +498,13 @@ class SingleEditor extends Component{
this.handleShowUploadImages(url)}
/>
@@ -456,25 +529,51 @@ class SingleEditor extends Component{
{
item===undefined||item===null||item===""?
-
this.onOptionContentChange(value,quill,index)}
- />
+
+ {
+ bindinginputs===null||bindinginputs!==index?
+
this.bindinginputs(index)}>
+ {/*
请您输入选项
*/}
+
:
+
this.onOptionContentChange(value,quill,index)}
+ showUploadImage={(url)=>this.handleShowUploadImage(url,index)}
+ />
+
+ }
+
:
- this.onOptionContentChange(value,quill,index)}
- />
+
+ {
+ bindinginputs===null||bindinginputs!==index?
+
this.bindinginputs(index)}>
+
+ this.handleShowUploadImage(url,index)}
+ />
+
+ :
+
this.onOptionContentChange(value,quill,index)}
+ showUploadImage={(url)=>this.handleShowUploadImage(url,index)}
+ />
+ }
+
+
}
@@ -509,12 +608,13 @@ class SingleEditor extends Component{
this.handleShowUploadImages(url)}
/>