Commit a9d5c0db by sunbingqing

fix: 解决冲突

parents 2e7ee804 acb5ccd5
/* /*
* @Author: 陈剑宇 * @Author: 陈剑宇
* @Date: 2020-10-28 14:27:07 * @Date: 2020-10-28 14:27:07
* @LastEditTime: 2021-03-17 20:27:44 * @LastEditTime: 2021-03-18 10:30:41
* @LastEditors: yuananting * @LastEditors: yuananting
* @Description: * @Description:
* @FilePath: /xiaomai-web-b/app/common/constants/punchClock/punchClock.js * @FilePath: /xiaomai-web-b/app/common/constants/punchClock/punchClock.js
...@@ -114,9 +114,9 @@ export const FILE_ACCEPT = { ...@@ -114,9 +114,9 @@ export const FILE_ACCEPT = {
} }
export const MEDIA_FILE_ACCEPT = { export const MEDIA_FILE_ACCEPT = {
PICTURE: 'JPG,JPEG,PNG,BMP,GIF', PICTURE: 'image/jpg,image/jpeg,image/png,image/bmp,image/gif,JPG,JPEG,PNG,BMP,GIF',
VIDEO: 'MP4', VIDEO: 'audio/mp4,video/mp4,MP4',
VOICE: 'MP3' VOICE: 'audio/x-mpeg,audio/mp3,audio/mpeg,audio/wav,audio/x-m4a,MP3'
} }
export const QUESTION_FILE_ACCEPT = { export const QUESTION_FILE_ACCEPT = {
......
...@@ -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-18 09:32:02 * @LastEditTime: 2021-03-18 14:12:22
* @Description: 助学工具-题库-题目管理-新增题目 * @Description: 助学工具-题库-题目管理-新增题目
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -12,7 +12,7 @@ import Breadcrumbs from "@/components/Breadcrumbs"; ...@@ -12,7 +12,7 @@ import Breadcrumbs from "@/components/Breadcrumbs";
import ShowTips from "@/components/ShowTips"; import ShowTips from "@/components/ShowTips";
import "./AddNewQuestion.less"; import "./AddNewQuestion.less";
import NewQuestionTab from "./components/NewQuestionTab"; import NewQuestionTab from "./components/NewQuestionTab";
import { defineQuestionInfo } from "./components/model"; import { defineJudgeOptionInfo, defineOptionInfo, defineQuestionInfo } from "./components/model";
import QuestionBankService from "@/domains/question-bank-domain/QuestionBankService"; import QuestionBankService from "@/domains/question-bank-domain/QuestionBankService";
import User from "@/common/js/user"; import User from "@/common/js/user";
import UploadOss from "@/core/upload"; import UploadOss from "@/core/upload";
...@@ -21,13 +21,13 @@ const { TabPane } = Tabs; ...@@ -21,13 +21,13 @@ const { TabPane } = Tabs;
class AddNewQuestion extends Component { class AddNewQuestion extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
let activeKey = "" let activeKey = "";
if (getParameterByName("type")) { if (getParameterByName("type")) {
activeKey = getParameterByName("type") activeKey = getParameterByName("type");
} else if (getParameterByName("key")) { } else if (getParameterByName("key")) {
activeKey = getParameterByName("key") activeKey = getParameterByName("key");
} else { } else {
activeKey = "SINGLE_CHOICE" activeKey = "SINGLE_CHOICE";
} }
this.state = { this.state = {
activeKey: activeKey, activeKey: activeKey,
...@@ -37,12 +37,14 @@ class AddNewQuestion extends Component { ...@@ -37,12 +37,14 @@ class AddNewQuestion extends Component {
judgeContent: defineQuestionInfo("JUDGE"), // 判断题 judgeContent: defineQuestionInfo("JUDGE"), // 判断题
gapFillingContent: defineQuestionInfo("GAP_FILLING"), // 填空题 gapFillingContent: defineQuestionInfo("GAP_FILLING"), // 填空题
indefiniteChoiceContent: defineQuestionInfo("INDEFINITE_CHOICE"), // 不定项选择题 indefiniteChoiceContent: defineQuestionInfo("INDEFINITE_CHOICE"), // 不定项选择题
currentOperate: "new",
}; };
} }
componentDidMount() { componentDidMount() {
if (getParameterByName("id")) { if (getParameterByName("id")) {
// 编辑 // 编辑
this.setState({ currentOperate: "edit" });
this.queryQuestionDetails(); this.queryQuestionDetails();
} }
} }
...@@ -77,6 +79,49 @@ class AddNewQuestion extends Component { ...@@ -77,6 +79,49 @@ class AddNewQuestion extends Component {
}); });
}; };
handleRest = (type) => {
this.setState({ currentOperate: "add" });
switch (type) {
case "SINGLE_CHOICE":
let singleChoiceContent = defineQuestionInfo("SINGLE_CHOICE");
for (var i = 0; i < 4; i++) {
singleChoiceContent.optionList.push(defineOptionInfo());
}
this.setState({ singleChoiceContent });
break;
case "MULTI_CHOICE":
let multiChoiceContent = defineQuestionInfo("MULTI_CHOICE");
for (var i = 0; i < 4; i++) {
multiChoiceContent.optionList.push(defineOptionInfo());
}
this.setState({ multiChoiceContent });
break;
case "JUDGE":
let judgeContent = defineQuestionInfo("JUDGE");
var judgeOptions = ["正确", "错误"];
judgeOptions.forEach(item=>{
judgeContent.optionList.push(defineJudgeOptionInfo(item));
})
this.setState({ judgeContent });
break;
case "GAP_FILLING":
this.setState({
gapFillingContent: defineQuestionInfo("GAP_FILLING"),
});
break;
case "INDEFINITE_CHOICE":
let indefiniteChoiceContent = defineQuestionInfo("INDEFINITE_CHOICE");
for (var i = 0; i < 4; i++) {
indefiniteChoiceContent.optionList.push(defineOptionInfo());
}
this.setState({ indefiniteChoiceContent });
}
};
initOption = (content) => {
chooseOptions.push(defineJudgeOptionInfo(content));
};
saveCurrentQuestion = (content, type, next) => { saveCurrentQuestion = (content, type, next) => {
content.questionStemList.map((item, index) => { content.questionStemList.map((item, index) => {
item.sort = index; item.sort = index;
...@@ -95,8 +140,7 @@ class AddNewQuestion extends Component { ...@@ -95,8 +140,7 @@ class AddNewQuestion extends Component {
}); });
let params = {}; let params = {};
let categoryId = getParameterByName("categoryId"); let categoryId = getParameterByName("categoryId");
if (getParameterByName("id") && this.state.currentOperate === "edit") {
if (getParameterByName("id")) {
params = { params = {
...content, ...content,
id: getParameterByName("id"), id: getParameterByName("id"),
...@@ -109,12 +153,13 @@ class AddNewQuestion extends Component { ...@@ -109,12 +153,13 @@ class AddNewQuestion extends Component {
QuestionBankService.editQuestion(params).then((res) => { QuestionBankService.editQuestion(params).then((res) => {
if (res.success) { if (res.success) {
message.success("保存成功"); message.success("保存成功");
if (next === 'add') { if (next === "add") {
window.RCHistory.push({ this.handleRest(type);
pathname: `/create-new-question?categoryId=${params.categoryId}&key=${type}`, // window.RCHistory.push({
}); // pathname: `/create-new-question?categoryId=${params.categoryId}&key=${type}`,
// });
} }
if (next === 'close') { if (next === "close") {
window.RCHistory.push({ window.RCHistory.push({
pathname: `/question-bank-index?categoryId=${params.categoryId}`, pathname: `/question-bank-index?categoryId=${params.categoryId}`,
}); });
...@@ -132,12 +177,10 @@ class AddNewQuestion extends Component { ...@@ -132,12 +177,10 @@ class AddNewQuestion extends Component {
QuestionBankService.addQuestion(params).then((res) => { QuestionBankService.addQuestion(params).then((res) => {
if (res.success) { if (res.success) {
message.success("保存成功"); message.success("保存成功");
if (next === 'add') { if (next === "add") {
window.RCHistory.push({ this.handleRest(type);
pathname: `/create-new-question?categoryId=${params.categoryId}&key=${type}`,
});
} }
if (next === 'close') { if (next === "close") {
window.RCHistory.push({ window.RCHistory.push({
pathname: `/question-bank-index?categoryId=${params.categoryId}`, pathname: `/question-bank-index?categoryId=${params.categoryId}`,
}); });
...@@ -150,16 +193,18 @@ class AddNewQuestion extends Component { ...@@ -150,16 +193,18 @@ class AddNewQuestion extends Component {
// 取消编辑并返回上一级路由 // 取消编辑并返回上一级路由
handleGoBack = () => { handleGoBack = () => {
Modal.confirm({ Modal.confirm({
title: '确定要返回吗?', title: "确定要返回吗?",
content: '返回后,本次编辑的内容将不被保存', content: "返回后,本次编辑的内容将不被保存",
okText: '确认返回', okText: "确认返回",
cancelText: '留在本页', cancelText: "留在本页",
icon: <span className="icon iconfont default-confirm-icon">&#xe6f4;</span>, icon: (
<span className="icon iconfont default-confirm-icon">&#xe6f4;</span>
),
onOk: () => { onOk: () => {
window.RCHistory.goBack(); window.RCHistory.goBack();
} },
}) });
} };
confirmSaveQuestion = (next) => { confirmSaveQuestion = (next) => {
const { const {
...@@ -192,7 +237,11 @@ class AddNewQuestion extends Component { ...@@ -192,7 +237,11 @@ class AddNewQuestion extends Component {
break; break;
case "INDEFINITE_CHOICE": case "INDEFINITE_CHOICE":
if (this.indefiniteRef.checkInput() === 0) { if (this.indefiniteRef.checkInput() === 0) {
this.saveCurrentQuestion(indefiniteChoiceContent, "INDEFINITE_CHOICE", next); this.saveCurrentQuestion(
indefiniteChoiceContent,
"INDEFINITE_CHOICE",
next
);
} }
break; break;
} }
...@@ -215,7 +264,7 @@ class AddNewQuestion extends Component { ...@@ -215,7 +264,7 @@ class AddNewQuestion extends Component {
return ( return (
<div className="page add-new-question"> <div className="page add-new-question">
<Breadcrumbs <Breadcrumbs
navList={getParameterByName("id") ? "编辑题目" : "新增题目"} navList={getParameterByName("id") && this.state.currentOperate==="edit" ? "编辑题目" : "新增题目"}
goBack={() => this.handleGoBack()} goBack={() => this.handleGoBack()}
/> />
<div className="box"> <div className="box">
...@@ -240,7 +289,6 @@ class AddNewQuestion extends Component { ...@@ -240,7 +289,6 @@ class AddNewQuestion extends Component {
}} }}
questionInfo={singleChoiceContent} questionInfo={singleChoiceContent}
onSetState={(newContent) => { onSetState={(newContent) => {
console.log("newContent:", newContent)
Object.assign(singleChoiceContent, newContent); Object.assign(singleChoiceContent, newContent);
}} }}
onLogger={this.handleLogger} onLogger={this.handleLogger}
...@@ -289,7 +337,6 @@ class AddNewQuestion extends Component { ...@@ -289,7 +337,6 @@ class AddNewQuestion extends Component {
questionInfo={gapFillingContent} questionInfo={gapFillingContent}
onSetState={(newContent) => { onSetState={(newContent) => {
Object.assign(gapFillingContent, newContent); Object.assign(gapFillingContent, newContent);
console.log("gapFillingContent:", newContent);
}} }}
/> />
</TabPane> </TabPane>
...@@ -319,10 +366,20 @@ class AddNewQuestion extends Component { ...@@ -319,10 +366,20 @@ class AddNewQuestion extends Component {
</Tabs> </Tabs>
</div> </div>
<div className="footer"> <div className="footer">
<Button onClick={() => { this.handleGoBack() }}>取消</Button> <Button
<Button onClick={() => { onClick={() => {
this.handleGoBack();
}}
>
取消
</Button>
<Button
onClick={() => {
this.confirmSaveQuestion("add"); this.confirmSaveQuestion("add");
}}>保存并继续添加</Button> }}
>
保存并继续添加
</Button>
<Button <Button
type="primary" type="primary"
onClick={() => { onClick={() => {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-02-23 19:41:42 * @Date: 2021-02-23 19:41:42
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-03-18 09:32:37 * @LastEditTime: 2021-03-18 13:58:30
* @Description: 助学工具-题库-题目分类管理样式 * @Description: 助学工具-题库-题目分类管理样式
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -53,10 +53,11 @@ ...@@ -53,10 +53,11 @@
} }
} }
} }
// .ant-tree-treenode-selected:hover::before, .ant-tree-treenode-selected:hover::before,
// .ant-tree-treenode-selected::before { .ant-tree-treenode-selected::before {
// background: rgb(255 251 240); background: #ffb714;
// } opacity: 0.06;
}
} }
} }
.xm-show-tip { .xm-show-tip {
......
import React, { Component } from "react";
import { message, Button } from "antd";
import UploadOss from "@/core/upload";
import "./GapFillingStem.less";
const MEDIA_MAP = [
{
title: "音频",
icon: <React.Fragment>&#xe756;</React.Fragment>,
key: "VOICE",
},
{
title: "录音",
icon: <React.Fragment>&#xe7bb;</React.Fragment>,
key: "RECORD",
},
{
title: "图片",
icon: <React.Fragment>&#xe758;</React.Fragment>,
key: "PICTURE",
},
{
title: "视频",
icon: <React.Fragment>&#xe755;</React.Fragment>,
key: "VIDEO",
},
];
class GapFillingStem extends Component {
constructor(props) {
super(props);
this.state = {
visibleMediaBox: false,
zIndex: 9,
focusFlag: false,
isShowSingleInput: true,
contentLength: 0,
errorInput: false,
blanksList: [],
originBlanksList: [],
};
}
componentDidUpdate() {
const stemInput = document.getElementById("editor-box_content");
stemInput.addEventListener("DOMSubtreeModified", this.watchStemContent);
}
watchStemContent = () => {
var _blanksList = [];
const stemInput = document.getElementById("editor-box_content");
stemInput.childNodes.forEach((item) => {
if (item.nodeName === "SPAN" && item.id) {
_blanksList.push(item);
}
});
this.setState({blanksList:_blanksList})
this.handleStemStyle();
this.props.onChange(stemInput.innerHTML)
this.props.changeBlankCount(_blanksList);
};
/**
* 插入占位符
*
* @memberof QuestionInputItem
*/
insertBlanks = () => {
document.getElementById("editor-box_content").focus();
const _blanksList = this.state.blanksList;
console.log("888888888888:", _blanksList);
var blanks = document.createElement("span");
blanks.className = "fill-line";
blanks.innerHTML = "填空";
blanks.id = window.random_string(16); // 填空id
blanks.contentEditable = false;
_blanksList.push(blanks);
this.setState({ blanksList: _blanksList });
var sel, range;
sel = window.getSelection();
console.log("*****:", sel)
if (sel.getRangeAt && sel.rangeCount) {
range = sel.getRangeAt(0);
range.deleteContents();
var el = document.createElement("div");
el.appendChild(blanks);
var frag = document.createDocumentFragment(),
node,
lastNode;
while ((node = el.firstChild)) {
lastNode = frag.appendChild(node);
}
range.insertNode(frag);
if (lastNode) {
range = range.cloneRange();
range.setStartAfter(lastNode);
range.collapse(true);
sel.removeAllRanges();
sel.addRange(range);
}
}
};
// 输入框样式
handleStemStyle = () => {
const stemInput = document.getElementById("editor-box_content");
const textLength = stemInput.innerText.replace(/\&nbsp\;/gi, " ").length;
const imgLength = stemInput.innerHTML.match(/<img/g)
? stemInput.innerHTML.match(/<img/g).length * 2
: 0;
const contentLength = imgLength + textLength;
this.setState({ contentLength });
const divHeight = document.getElementById("editor-box_content")
.offsetHeight;
if (divHeight > 22 || imgLength > 0) {
this.setState({ isShowSingleInput: false });
} else {
this.setState({ isShowSingleInput: true });
}
};
handleUploadMedia = (key) => {
this.props.onUploadMedia && this.props.onUploadMedia(key);
};
render() {
const {
visibleMediaBox,
zIndex,
focusFlag,
contentLength,
isShowSingleInput,
errorInput,
} = this.state;
const {
mediaBtn = ["VOICE", "RECORD", "PICTURE", "VIDEO"],
limitLength = 1000,
} = this.props;
return (
<div
className="gap-question-edtior_box"
style={{ zIndex }}
onMouseEnter={() => {
if (visibleMediaBox || focusFlag) return;
const setZIndex = 101;
this.setState({
visibleMediaBox: true,
zIndex: setZIndex,
});
}}
onMouseLeave={() => {
if (!visibleMediaBox || focusFlag) return;
this.setState({
visibleMediaBox: false,
zIndex: 9,
});
}}
>
<div
className={
isShowSingleInput ? "editor-box-single " : "editor-box-multiple"
}
style={{
border:
this.props.validateStatus === "error" ? "1px solid red" : "",
}}
>
<div
placeholder="示例:党章规定,凡事有&nbsp;&nbsp;填空1&nbsp;&nbsp;
人以上的&nbsp;&nbsp;填空2&nbsp;&nbsp;
,都应该成立党的基层组织"
contentEditable
suppressContentEditableWarning
className="editor-box_content"
id="editor-box_content"
></div>
<div className="editor-limit">
<span style={{ color: errorInput ? "red" : "" }}>
{contentLength}
</span>
/{limitLength}
</div>
</div>
<div className="editor-fill-info" style={{ top: this.props.validateStatus === "error" ? "56px" : "36px" }}>
在需要填写答案的地方
<Button
type="link"
className="editor-fill-info_icon icon iconfont"
onClick={this.insertBlanks}
>
&#xe7fd; 插入占位符
</Button>
</div>
<div
className={`editor-limit-tip${
contentLength > limitLength ? " mt6" : ""
}`}
style={{ height: contentLength > limitLength ? 20 : 0 }}
>
最多只能输入1000字
</div>
{visibleMediaBox && !_.isEmpty(mediaBtn) && (
<div className="edtior-media_box">
<div className="edtior-media_list">
{_.map(mediaBtn, (mediaItem) => {
const mediaBtnMap = _.find(
MEDIA_MAP,
(mapItem) => mapItem.key === mediaItem
);
return (
mediaBtnMap && (
<div
className="edtior-media_item"
key={mediaItem}
onClick={() => this.handleUploadMedia(mediaItem)}
>
<div className="edtior-media_item__icon icon iconfont">
{mediaBtnMap.icon}
</div>
<div className="edtior-media_item__name">
{mediaBtnMap.title}
</div>
</div>
)
);
})}
</div>
</div>
)}
</div>
);
}
}
export default GapFillingStem;
.gap-question-edtior_box {
position: relative;
.editor-box-single {
border-radius: 4px;
padding: 4px 0 4px 10px;
border: 1px solid #e8e8e8;
display: flex;
justify-content: space-between;
.editor-box_content {
width: calc(100% - 80px);
.fill-line {
padding: 0 10px;
border-bottom: 1px solid;
}
}
.editor-limit {
padding-right: 12px;
line-height: 22px;
font-size: 12px;
color: #cccccc;
}
}
.editor-box-multiple {
border-radius: 4px;
padding: 4px 0 4px 10px;
border: 1px solid #e8e8e8;
.editor-box_content {
display: inline-block;
overflow-y: scroll;
max-height: 110px;
width: 100%;
.fill-line {
padding: 0 10px;
border-bottom: 1px solid;
}
}
.editor-limit {
text-align: right;
padding-right: 12px;
line-height: 22px;
font-size: 12px;
color: #cccccc;
padding-top: 3px;
}
}
.editor-box_content:empty:before {
content: attr(placeholder);
color: #ddd;
}
.editor-box_content:focus {
border: none;
outline: none;
}
.editor-fill-info {
// position: absolute;
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-limit-tip {
height: 20px;
text-align: right;
color: #ec4b35;
transition: height 0.5s ease-in-out;
overflow: hidden;
}
.editor-placehold {
position: absolute;
top: 0;
left: 0;
right: 0;
font-size: 14px;
color: #cccccc;
line-height: 22px;
margin: 6px 12px;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.edtior-media_box {
position: absolute;
top: 100%;
left: 0;
padding-top: 9px;
&::before {
content: "";
border: 6px solid transparent;
border-bottom-color: #ffffff;
position: absolute;
top: -3px;
left: 50%;
margin-left: -3px;
filter: drop-shadow(-2px -2px 4px rgba(0, 0, 0, 0.06));
}
.edtior-media_list {
background: #ffffff;
box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.06);
border-radius: 4px;
display: flex;
align-items: center;
padding: 12px 24px;
}
.edtior-media_item {
margin-right: 24px;
cursor: pointer;
&:hover {
.edtior-media_item__icon {
color: #ffb714;
}
}
&:last-child {
margin-right: 0;
}
.edtior-media_item__icon {
color: #999999;
text-align: center;
font-size: 20px;
}
.edtior-media_item__name {
text-align: center;
font-size: 12px;
color: #999999;
line-height: 17px;
}
}
}
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-02-22 12:02:34 * @Date: 2021-02-22 12:02:34
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-03-18 09:34:06 * @LastEditTime: 2021-03-18 13:59:24
* @Description: 助学工具-题库-题库主页面侧边栏样式 * @Description: 助学工具-题库-题库主页面侧边栏样式
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -54,6 +54,11 @@ ...@@ -54,6 +54,11 @@
color: #666666; color: #666666;
} }
} }
.ant-tree-treenode-selected:hover::before,
.ant-tree-treenode-selected::before {
background: #ffb714;
opacity: 0.06;
}
} }
} }
} }
...@@ -12,7 +12,7 @@ const MEDIA_MAP = [ ...@@ -12,7 +12,7 @@ const MEDIA_MAP = [
{ {
title: "录音", title: "录音",
icon: <React.Fragment>&#xe7bb;</React.Fragment>, icon: <React.Fragment>&#xe7bb;</React.Fragment>,
key: "RECORD", key: "AUDIO",
}, },
{ {
title: "图片", title: "图片",
...@@ -240,7 +240,7 @@ class QuestionEditor extends Component { ...@@ -240,7 +240,7 @@ class QuestionEditor extends Component {
} = this.state; } = this.state;
const { const {
placehold, placehold,
mediaBtn = ["VOICE", "RECORD", "PICTURE", "VIDEO"], mediaBtn = ["VOICE", "AUDIO", "PICTURE", "VIDEO"],
limitLength = 1000, limitLength = 1000,
markKey, markKey,
} = this.props; } = this.props;
......
...@@ -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-18 09:35:03 * @LastEditTime: 2021-03-18 14:21:22
* @Description: 助学工具-题库-题目管理主页面列表数据 * @Description: 助学工具-题库-题目管理主页面列表数据
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -69,7 +69,7 @@ class QuestionManageContent extends Component { ...@@ -69,7 +69,7 @@ class QuestionManageContent extends Component {
query: { query: {
current: 1, current: 1,
size: 10, size: 10,
order: "ACCURACY_DESC", // 排序规则[ ACCURACY_DESC, ACCURACY_ASC, CREATED_DESC, CREATED_ASC, UPDATED_DESC, UPDATED_ASC ] order: "UPDATED_DESC", // 排序规则[ ACCURACY_DESC, ACCURACY_ASC, CREATED_DESC, CREATED_ASC, UPDATED_DESC, UPDATED_ASC ]
categoryId: null, // 当前题库分类Id categoryId: null, // 当前题库分类Id
questionName: null, // 题目名称 questionName: null, // 题目名称
questionType: null, // 题目类型 questionType: null, // 题目类型
...@@ -212,7 +212,6 @@ class QuestionManageContent extends Component { ...@@ -212,7 +212,6 @@ class QuestionManageContent extends Component {
// 表头设置 // 表头设置
parseColumns = () => { parseColumns = () => {
const isPermiss = ["CloudManager", "StoreManager"].includes(User.getUserRole()); const isPermiss = ["CloudManager", "StoreManager"].includes(User.getUserRole());
console.log(isPermiss, User.getUserRole())
const columns = [ const columns = [
{ {
title: "题目", title: "题目",
......
...@@ -50,6 +50,13 @@ class QuestionPreviewModal extends Component { ...@@ -50,6 +50,13 @@ class QuestionPreviewModal extends Component {
}); });
}; };
transferStemDocument = (txt) => {
const template = `<p class='content'>${txt}</p>`;
let doc = new DOMParser().parseFromString(template, "text/html");
let p = doc.querySelector(".content");
return p;
};
render() { render() {
const { const {
showScanFile, showScanFile,
...@@ -80,8 +87,8 @@ class QuestionPreviewModal extends Component { ...@@ -80,8 +87,8 @@ class QuestionPreviewModal extends Component {
const voiceDescList = _.filter(questionAnswerDescList, (descItem) => { const voiceDescList = _.filter(questionAnswerDescList, (descItem) => {
return descItem.type === "VOICE"; return descItem.type === "VOICE";
}); });
const recordDescList = _.filter(questionAnswerDescList, (descItem) => { const audioDescList = _.filter(questionAnswerDescList, (descItem) => {
return descItem.type === "RECORD"; return descItem.type === "AUDIO";
}); });
const videoDeacList = _.filter(questionAnswerDescList, (descItem) => { const videoDeacList = _.filter(questionAnswerDescList, (descItem) => {
return descItem.type === "VIDEO"; return descItem.type === "VIDEO";
...@@ -111,6 +118,18 @@ class QuestionPreviewModal extends Component { ...@@ -111,6 +118,18 @@ class QuestionPreviewModal extends Component {
let { type, content, size } = item; let { type, content, size } = item;
switch (type) { switch (type) {
case "RICH_TEXT": case "RICH_TEXT":
if (questionTypeEnum === "GAP_FILLING") {
content = content.replace(
/_/g,
`<input
class="add-fill-line"
disabled
answerTagList=""
id=${window.random_string(16)}
value="填空"
/>`
);
}
dom = ( dom = (
<div <div
key={index} key={index}
...@@ -262,11 +281,14 @@ class QuestionPreviewModal extends Component { ...@@ -262,11 +281,14 @@ class QuestionPreviewModal extends Component {
{_.map(gapFillingAnswerList, (item, index) => { {_.map(gapFillingAnswerList, (item, index) => {
return ( return (
<div> <div>
<div className="gap-label">填空{index+1}.</div> <div className="gap-label">填空{index + 1}.</div>
<div className="gap-content" key={index}> <div className="gap-content" key={index}>
{_.map(item.correctAnswerList, (childItem, childIndex) => { {_.map(
return <span>{childItem}</span> item.correctAnswerList,
})} (childItem, childIndex) => {
return <span>{childItem}</span>;
}
)}
</div> </div>
</div> </div>
); );
...@@ -305,12 +327,12 @@ class QuestionPreviewModal extends Component { ...@@ -305,12 +327,12 @@ class QuestionPreviewModal extends Component {
})} })}
</div> </div>
)} )}
{recordDescList.length > 0 && ( {audioDescList.length > 0 && (
<div className="desc-audio-box"> <div className="desc-audio-box">
{_.map(recordDescList, (recordItem, recordIndex) => { {_.map(audioDescList, (audioItem, audioIndex) => {
let { content, size } = recordItem; let { content, size } = audioItem;
return ( return (
<div className="audio-box" key={recordIndex}> <div className="audio-box" key={audioIndex}>
<XMAudio <XMAudio
forbidParse forbidParse
url={content} url={content}
...@@ -318,7 +340,7 @@ class QuestionPreviewModal extends Component { ...@@ -318,7 +340,7 @@ class QuestionPreviewModal extends Component {
size = durationSize; size = durationSize;
this.setState({}); this.setState({});
}} }}
index={recordIndex} index={audioIndex}
size={size || 1000} size={size || 1000}
/> />
</div> </div>
......
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