Commit 83229b62 by yuananting

feat:导入联调,填空待修改

parent 462c5b38
@font-face { @font-face {
font-family: 'iconfont'; /* project id 2223403 */ font-family: 'iconfont'; /* project id 2223403 */
src: url('//at.alicdn.com/t/font_2223403_uxtdisq90ka.eot'); src: url('//at.alicdn.com/t/font_2223403_v302rtv070a.eot');
src: url('//at.alicdn.com/t/font_2223403_uxtdisq90ka.eot?#iefix') format('embedded-opentype'), src: url('//at.alicdn.com/t/font_2223403_v302rtv070a.eot?#iefix') format('embedded-opentype'),
url('//at.alicdn.com/t/font_2223403_uxtdisq90ka.woff2') format('woff2'), url('//at.alicdn.com/t/font_2223403_v302rtv070a.woff2') format('woff2'),
url('//at.alicdn.com/t/font_2223403_uxtdisq90ka.woff') format('woff'), url('//at.alicdn.com/t/font_2223403_v302rtv070a.woff') format('woff'),
url('//at.alicdn.com/t/font_2223403_uxtdisq90ka.ttf') format('truetype'), url('//at.alicdn.com/t/font_2223403_v302rtv070a.ttf') format('truetype'),
url('//at.alicdn.com/t/font_2223403_uxtdisq90ka.svg#iconfont') format('svg'); url('//at.alicdn.com/t/font_2223403_v302rtv070a.svg#iconfont') format('svg');
} }
.iconfont{ .iconfont{
font-family:"iconfont" !important; font-family:"iconfont" !important;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-03-03 15:13:12 * @Date: 2021-03-03 15:13:12
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-03-16 15:11:25 * @LastEditTime: 2021-03-17 11:40:41
* @Description: 助学工具接口 * @Description: 助学工具接口
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -10,49 +10,49 @@ ...@@ -10,49 +10,49 @@
import Service from "@/common/js/service"; import Service from "@/common/js/service";
export function queryCategoryTree(params: object) { export function queryCategoryTree(params: object) {
return Service.Hades("anon/hades/category/queryCategoryTree", params); return Service.Hades("public/hades/queryCategoryTree", params);
} }
export function addCategory(params: object) { export function addCategory(params: object) {
return Service.Hades("anon/hades/category/addCategory", params); return Service.Hades("public/hades/addCategory", params);
} }
export function delCategory(params: object) { export function delCategory(params: object) {
return Service.Hades("anon/hades/category/delCategory", params); return Service.Hades("public/hades/delCategory", params);
} }
export function editCategory(params: object) { export function editCategory(params: object) {
return Service.Hades("anon/hades/category/editCategory", params); return Service.Hades("public/hades/editCategory", params);
} }
export function editCategoryTree(params: object) { export function editCategoryTree(params: object) {
return Service.Hades("anon/hades/category/editCategoryTree", params); return Service.Hades("public/hades/editCategoryTree", params);
} }
export function queryQuestionCategoryTree(params: object) { export function queryQuestionCategoryTree(params: object) {
return Service.Hades("anon/hades/question/queryCategoryTree", params); return Service.Hades("public/hades/queryQuestionCategoryTree", params);
} }
export function queryQuestionPageList(params: object) { export function queryQuestionPageList(params: object) {
return Service.Hades("anon/hades/question/queryQuestionPageList", params); return Service.Hades("public/hades/queryQuestionPageList", params);
} }
export function addQuestion(params: object) { export function addQuestion(params: object) {
return Service.Hades("anon/hades/question/addQuestion", params); return Service.Hades("public/hades/addQuestion", params);
} }
export function deleteQuestion(params: object) { export function deleteQuestion(params: object) {
return Service.Hades("anon/hades/question/deleteQuestion", params); return Service.Hades("public/hades/deleteQuestion", params);
} }
export function queryQuestionDetails(params: object) { export function queryQuestionDetails(params: object) {
return Service.Hades("anon/hades/question/queryQuestionDetails", params); return Service.Hades("public/hades/queryQuestionDetails", params);
} }
export function editQuestion(params: object) { export function editQuestion(params: object) {
return Service.Hades("anon/hades/question/editQuestion", params); return Service.Hades("public/hades/editQuestion", params);
} }
export function batchImport(params: object) { export function batchImport(params: object) {
return Service.Hades("anon/hades/question/batchImport", params); return Service.Hades("public/hades/batchImport", params);
} }
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-02-25 13:46:35 * @Date: 2021-02-25 13:46:35
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-03-16 16:44:23 * @LastEditTime: 2021-03-17 10:45:10
* @Description: 助学工具-题库-题目管理-新增题目 * @Description: 助学工具-题库-题目管理-新增题目
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -151,7 +151,7 @@ class AddNewQuestion extends Component { ...@@ -151,7 +151,7 @@ class AddNewQuestion extends Component {
break; break;
case "GAP_FILLING": case "GAP_FILLING":
if (this.gapRef.checkInput() === 0) { if (this.gapRef.checkInput() === 0) {
// this.saveCurrentQuestion(gapFillingContent); this.saveCurrentQuestion(gapFillingContent);
} }
break; break;
case "INDEFINITE_CHOICE": case "INDEFINITE_CHOICE":
...@@ -251,8 +251,8 @@ class AddNewQuestion extends Component { ...@@ -251,8 +251,8 @@ class AddNewQuestion extends Component {
}} }}
questionInfo={gapFillingContent} questionInfo={gapFillingContent}
onSetState={(newContent) => { onSetState={(newContent) => {
console.log("gapFillingContent:", newContent);
Object.assign(gapFillingContent, newContent); Object.assign(gapFillingContent, newContent);
console.log("gapFillingContent:", gapFillingContent);
}} }}
/> />
</TabPane> </TabPane>
......
import React, { Component } from "react"; import React, { Component } from "react";
import E from "wangeditor"; import E from "wangeditor";
import { message } from "antd"; import { message, Button } from "antd";
import UploadOss from "@/core/upload"; import UploadOss from "@/core/upload";
import "./QuestionEditor.less"; import "./QuestionEditor.less";
const MEDIA_MAP = [ const MEDIA_MAP = [
...@@ -37,7 +37,11 @@ class QuestionEditor extends Component { ...@@ -37,7 +37,11 @@ class QuestionEditor extends Component {
isShowSingleInput: true, isShowSingleInput: true,
contentLength: 0, contentLength: 0,
errorInput: false, errorInput: false,
detailInfo: props.detailInfo || {} isGapFilling: props.isGapFilling,
contentType: props.contentType,
detailInfo: props.detailInfo || {},
gapFillingAnswer: props.gapFillingAnswer || [],
blanksList: props.blanksList || [],
}; };
} }
...@@ -48,9 +52,9 @@ class QuestionEditor extends Component { ...@@ -48,9 +52,9 @@ class QuestionEditor extends Component {
shouldComponentUpdate(nextProps, nextState) { shouldComponentUpdate(nextProps, nextState) {
const { detailInfo } = nextProps; const { detailInfo } = nextProps;
if (this.props.detailInfo !== detailInfo) { if (this.props.detailInfo !== detailInfo) {
this.setState({detailInfo: nextProps.detailInfo}, () => { this.setState({ detailInfo: nextProps.detailInfo }, () => {
this.renderEditor(); this.renderEditor();
}) });
} }
return true; return true;
} }
...@@ -83,7 +87,7 @@ class QuestionEditor extends Component { ...@@ -83,7 +87,7 @@ class QuestionEditor extends Component {
}; };
renderEditor() { renderEditor() {
const { editorId, detailInfo} = this.state; const { editorId, detailInfo } = this.state;
const { onChange, bindChangeContent } = this.props; const { onChange, bindChangeContent } = this.props;
const editorRoot = new E( const editorRoot = new E(
`#editor${editorId}_tabbar`, `#editor${editorId}_tabbar`,
...@@ -114,15 +118,16 @@ class QuestionEditor extends Component { ...@@ -114,15 +118,16 @@ class QuestionEditor extends Component {
str = str.replace(/<\/?[^>]*>/g, ""); str = str.replace(/<\/?[^>]*>/g, "");
str = str.replace(/[ | ]*\n/g, "\n"); str = str.replace(/[ | ]*\n/g, "\n");
str = str.replace(/\&nbsp\;/gi, " "); str = str.replace(/\&nbsp\;/gi, " ");
str = str.replace(/[\r\n]/g,""); str = str.replace(/[\r\n]/g, "");
if (str.length > 1000) { if (str.length > 1000) {
str = str.substring(0, 1000); str = str.substring(0, 1000);
message.error("内容过长,不能超过1000字"); message.error("内容过长,不能超过1000字");
} }
return str return str;
}; };
editorRoot.customConfig.onchange = (html) => { editorRoot.customConfig.onchange = (html) => {
console.log("触发:+——+++++++", this.state.blanksList);
const { focusFlag } = this.state; const { focusFlag } = this.state;
const textLength = editorRoot.txt.text().replace(/\&nbsp\;/gi, " ") const textLength = editorRoot.txt.text().replace(/\&nbsp\;/gi, " ")
.length; .length;
...@@ -137,7 +142,9 @@ class QuestionEditor extends Component { ...@@ -137,7 +142,9 @@ class QuestionEditor extends Component {
} else { } else {
this.setState({ isShowSingleInput: true }); this.setState({ isShowSingleInput: true });
} }
if (this.state.isGapFilling) {
this.props.changeBlankCount(this.state.blanksList);
}
this.setState( this.setState(
{ contentLength, visiblePlacehold: contentLength === 0 && !focusFlag }, { contentLength, visiblePlacehold: contentLength === 0 && !focusFlag },
() => { () => {
...@@ -191,6 +198,18 @@ class QuestionEditor extends Component { ...@@ -191,6 +198,18 @@ class QuestionEditor extends Component {
bindChangeContent && bindChangeContent(this.handleChangeContent); bindChangeContent && bindChangeContent(this.handleChangeContent);
} }
insertBlank = (blanks) => {
var blanks = `<input class="add-fill-line" disabled answerTagList="" id=${window.random_string(
16
)} value="填空"/>`;
this.editorRoot.cmd.do("insertHTML", blanks);
document.getSelection().collapseToEnd();
var _blanksList = [];
_blanksList = document.getElementsByClassName("add-fill-line");
this.setState({ blanksList: _blanksList });
// this.props.changeBlankCount(_blanksList);
};
render() { render() {
const { const {
editorId, editorId,
...@@ -201,6 +220,8 @@ class QuestionEditor extends Component { ...@@ -201,6 +220,8 @@ class QuestionEditor extends Component {
contentLength, contentLength,
isShowSingleInput, isShowSingleInput,
errorInput, errorInput,
isGapFilling,
contentType,
} = this.state; } = this.state;
const { const {
placehold, placehold,
...@@ -229,13 +250,12 @@ class QuestionEditor extends Component { ...@@ -229,13 +250,12 @@ class QuestionEditor extends Component {
}); });
}} }}
> >
<div <div
className="editor-box" className="editor-box"
id={`editor${editorId}_tabbar`} id={`editor${editorId}_tabbar`}
style={{ display: "none" }} style={{ display: "none" }}
></div> ></div>
<div <div
className={ className={
isShowSingleInput ? "editor-box-single " : "editor-box-multiple" isShowSingleInput ? "editor-box-single " : "editor-box-multiple"
} }
...@@ -255,6 +275,18 @@ class QuestionEditor extends Component { ...@@ -255,6 +275,18 @@ class QuestionEditor extends Component {
/{limitLength} /{limitLength}
</div> </div>
</div> </div>
{isGapFilling && contentType === "QUESTION_STEM" && (
<div className="editor-fill-info">
在需要填写答案的地方
<Button
type="link"
className="editor-fill-info_icon icon iconfont"
onClick={this.insertBlank}
>
&#xe7fd; 插入占位符
</Button>
</div>
)}
<div <div
className={`editor-limit-tip${ className={`editor-limit-tip${
contentLength > limitLength ? " mt6" : "" contentLength > limitLength ? " mt6" : ""
......
...@@ -2,7 +2,28 @@ ...@@ -2,7 +2,28 @@
position: relative; position: relative;
z-index: 9; z-index: 9;
background-color: #ffffff; background-color: #ffffff;
.add-fill-line {
padding: 0 10px;
border-bottom: 1px solid !important;
margin: 0 4px;
text-align: center;
border: none;
width: 54px;
}
.editor-fill-info {
height: 20px;
font-size: 14px;
line-height: 20px;
color: #999999;
margin-top: 8px;
.editor-fill-info_icon {
color: #5289fa;
font-size: 14px;
padding-left: 9px;
cursor: pointer;
}
}
.editor-box-single { .editor-box-single {
border-radius: 4px; border-radius: 4px;
padding: 4px 0; padding: 4px 0;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-02-25 11:23:47 * @Date: 2021-02-25 11:23:47
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-03-16 15:34:57 * @LastEditTime: 2021-03-17 12:43:53
* @Description: 助学工具-题库-题目管理主页面列表数据 * @Description: 助学工具-题库-题目管理主页面列表数据
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -218,7 +218,8 @@ class QuestionManageContent extends Component { ...@@ -218,7 +218,8 @@ class QuestionManageContent extends Component {
dataIndex: "questionStem", dataIndex: "questionStem",
render: (val, record) => { render: (val, record) => {
var handleVal = val; var handleVal = val;
handleVal = handleVal.replace(/<(?!img).*?>/g, ""); handleVal = handleVal.replace(/<(?!img|input).*?>/g, "");
handleVal = handleVal.replace(/<\s?input[^>]*>/gi, "_、");
handleVal = handleVal.replace(/<\s?img[^>]*>/gi, "【图片】"); handleVal = handleVal.replace(/<\s?img[^>]*>/gi, "【图片】");
handleVal = handleVal.replace(/\&nbsp\;/gi, " "); handleVal = handleVal.replace(/\&nbsp\;/gi, " ");
return ( return (
...@@ -351,27 +352,17 @@ class QuestionManageContent extends Component { ...@@ -351,27 +352,17 @@ class QuestionManageContent extends Component {
}; };
batchImportQuestion = () => { batchImportQuestion = () => {
const ImportQuestionModal = <BatchImportQuestionModal const { categoryId } = this.state.query;
close={() => { const ImportQuestionModal = (
this.setState({ ImportQuestionModal: null }); <BatchImportQuestionModal
}} close={() => {
onEdit={(record) => { this.setState({ ImportQuestionModal: null });
this.handleEditRecord(record); }}
}} categoryId={categoryId}
showTip={() => { />
Modal.confirm({ );
title: `提醒`,
content: '系统拼命处理中,为避免你等待时间过长,请前往“任务中心”查看导入结果',
onOk: () => {
RCHistory.push(`/download_center/import_record`);
},
okText: '前往任务中心',
cancelText: '关闭',
});
}}
/>;
this.setState({ ImportQuestionModal }); this.setState({ ImportQuestionModal });
} };
render() { render() {
const { dataSource = [], total, query } = this.state; const { dataSource = [], total, query } = this.state;
......
...@@ -29,6 +29,32 @@ ...@@ -29,6 +29,32 @@
font-weight: 400; font-weight: 400;
} }
} }
.file-box {
line-height: 20px;
color: #999999;
line-height: 20px;
margin-top: 10px;
span {
vertical-align: middle;
margin-right: 16px;
}
.link-img {
width: 14px;
vertical-align: middle;
margin-right: 4px;
}
.del-img {
width: 18px;
vertical-align: middle;
visibility: hidden;
}
}
.file-box :hover {
background-color: #FFF8E8;
.del-img {
visibility: visible !important;
}
}
.remark-input { .remark-input {
width: 304px; width: 304px;
margin-bottom: 8px; margin-bottom: 8px;
......
...@@ -214,7 +214,11 @@ ...@@ -214,7 +214,11 @@
.question-preview-modal.ant-modal { .question-preview-modal.ant-modal {
max-height: 60% !important; max-height: 60% !important;
} }
.fill-line { .add-fill-line {
padding: 0 10px; padding: 0 10px;
border-bottom: 1px solid; border-bottom: 1px solid !important;
margin: 0 4px;
text-align: center;
border: none;
width: 54px;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment