Commit 5d4609a0 by yuananting

Merge branch 'feature/yuananting/20210221/question-bank-tools' into dev

parents 8fe8995a 8b5aea7c
...@@ -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 11:15:19 * @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 { defineOptionInfo, 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";
...@@ -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();
} }
} }
...@@ -78,19 +80,29 @@ class AddNewQuestion extends Component { ...@@ -78,19 +80,29 @@ class AddNewQuestion extends Component {
}; };
handleRest = (type) => { handleRest = (type) => {
this.setState({ currentOperate: "add" });
switch (type) { switch (type) {
case "SINGLE_CHOICE": case "SINGLE_CHOICE":
this.setState({ let singleChoiceContent = defineQuestionInfo("SINGLE_CHOICE");
singleChoiceContent: defineQuestionInfo("SINGLE_CHOICE"), for (var i = 0; i < 4; i++) {
}, () => this.state.singleChoiceContent.optionList.push(defineOptionInfo())); singleChoiceContent.optionList.push(defineOptionInfo());
}
this.setState({ singleChoiceContent });
break; break;
case "MULTI_CHOICE": case "MULTI_CHOICE":
this.setState({ let multiChoiceContent = defineQuestionInfo("MULTI_CHOICE");
multiChoiceContent: defineQuestionInfo("MULTI_CHOICE"), for (var i = 0; i < 4; i++) {
}, () => this.state.multiChoiceContent.optionList.push(defineOptionInfo())); multiChoiceContent.optionList.push(defineOptionInfo());
}
this.setState({ multiChoiceContent });
break; break;
case "JUDGE": case "JUDGE":
this.setState({ judgeContent: defineQuestionInfo("JUDGE") }); let judgeContent = defineQuestionInfo("JUDGE");
var judgeOptions = ["正确", "错误"];
judgeOptions.forEach(item=>{
judgeContent.optionList.push(defineJudgeOptionInfo(item));
})
this.setState({ judgeContent });
break; break;
case "GAP_FILLING": case "GAP_FILLING":
this.setState({ this.setState({
...@@ -98,10 +110,11 @@ class AddNewQuestion extends Component { ...@@ -98,10 +110,11 @@ class AddNewQuestion extends Component {
}); });
break; break;
case "INDEFINITE_CHOICE": case "INDEFINITE_CHOICE":
this.setState({ let indefiniteChoiceContent = defineQuestionInfo("INDEFINITE_CHOICE");
indefiniteChoiceContent: defineQuestionInfo("INDEFINITE_CHOICE"), for (var i = 0; i < 4; i++) {
}, () => this.state.indefiniteChoiceContent.optionList.push(defineOptionInfo())); indefiniteChoiceContent.optionList.push(defineOptionInfo());
break; }
this.setState({ indefiniteChoiceContent });
} }
}; };
...@@ -127,8 +140,7 @@ class AddNewQuestion extends Component { ...@@ -127,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"),
...@@ -142,10 +154,10 @@ class AddNewQuestion extends Component { ...@@ -142,10 +154,10 @@ class AddNewQuestion extends Component {
if (res.success) { if (res.success) {
message.success("保存成功"); message.success("保存成功");
if (next === "add") { if (next === "add") {
// this.handleRest(type); this.handleRest(type);
window.RCHistory.push({ // window.RCHistory.push({
pathname: `/create-new-question?categoryId=${params.categoryId}&key=${type}`, // pathname: `/create-new-question?categoryId=${params.categoryId}&key=${type}`,
}); // });
} }
if (next === "close") { if (next === "close") {
window.RCHistory.push({ window.RCHistory.push({
...@@ -166,9 +178,7 @@ class AddNewQuestion extends Component { ...@@ -166,9 +178,7 @@ class AddNewQuestion extends Component {
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({
...@@ -254,7 +264,7 @@ class AddNewQuestion extends Component { ...@@ -254,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">
...@@ -279,7 +289,6 @@ class AddNewQuestion extends Component { ...@@ -279,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}
...@@ -328,7 +337,6 @@ class AddNewQuestion extends Component { ...@@ -328,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>
......
...@@ -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 {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-02-25 14:34:29 * @Date: 2021-02-25 14:34:29
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-03-18 11:03:21 * @LastEditTime: 2021-03-18 15:57:39
* @Description: 助学工具-题库-题目管理-新建题目Tab * @Description: 助学工具-题库-题目管理-新建题目Tab
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -23,7 +23,6 @@ import XMRecord from "./XMRecord"; ...@@ -23,7 +23,6 @@ import XMRecord from "./XMRecord";
import ScanFileModal from "@/modules/resource-disk/modal/ScanFileModal"; import ScanFileModal from "@/modules/resource-disk/modal/ScanFileModal";
import SelectPrepareFileModal from "@/modules/prepare-lesson/modal/SelectPrepareFileModal"; import SelectPrepareFileModal from "@/modules/prepare-lesson/modal/SelectPrepareFileModal";
import _ from "lodash"; import _ from "lodash";
import UploadOss from "@/core/upload";
class NewQuestionTab extends Component { class NewQuestionTab extends Component {
constructor(props) { constructor(props) {
...@@ -84,7 +83,6 @@ class NewQuestionTab extends Component { ...@@ -84,7 +83,6 @@ class NewQuestionTab extends Component {
}; };
static getDerivedStateFromProps(nextProps, prevState) { static getDerivedStateFromProps(nextProps, prevState) {
console.log("nextProps:", nextProps)
// 控制录音组件展示 // 控制录音组件展示
if (nextProps.showBox && !prevState.showBox) { if (nextProps.showBox && !prevState.showBox) {
return { return {
...@@ -100,7 +98,12 @@ class NewQuestionTab extends Component { ...@@ -100,7 +98,12 @@ class NewQuestionTab extends Component {
shouldComponentUpdate(nextProps, nextState) { shouldComponentUpdate(nextProps, nextState) {
const { questionInfo } = nextProps; const { questionInfo } = nextProps;
if (this.props.questionInfo !== questionInfo) { if (this.props.questionInfo !== questionInfo) {
console.log("*********改变了:", questionInfo) if (questionInfo.gapFillingAnswerList !== this.state.gapFillingAnswer) {
console.log(999, questionInfo.gapFillingAnswerList)
this.setState({
gapFillingAnswer: questionInfo.gapFillingAnswerList
})
}
this.setState( this.setState(
{ {
stemContent: JSON.parse( stemContent: JSON.parse(
...@@ -108,12 +111,15 @@ class NewQuestionTab extends Component { ...@@ -108,12 +111,15 @@ class NewQuestionTab extends Component {
), ),
}, },
() => { () => {
const editorHtml = this.transferStemDocument( if(this.props.questionTypeKey==="GAP_FillING") {
questionInfo.questionStemList[0].content const con = questionInfo.questionStemList[0].content;
); const input = con.match(/<input([^<>]*)>/g)
const _blanksList = editorHtml.getElementsByClassName("fill-line"); const _blanksList = input.map(item => {
// this.setState({blanksList:_blanksList}) return this.transferStemDocument(item).firstChild
console.log("转:", editorHtml.getElementsByClassName("fill-line")); })
console.log("-----", _blanksList)
this.setState({blanksList:_blanksList})
}
} }
); // 题干内容 ); // 题干内容
this.setState({ this.setState({
...@@ -199,7 +205,7 @@ class NewQuestionTab extends Component { ...@@ -199,7 +205,7 @@ class NewQuestionTab extends Component {
const { chooseOptions } = this.state; const { chooseOptions } = this.state;
if (this.props.questionTypeKey === "GAP_FILLING") { if (this.props.questionTypeKey === "GAP_FILLING") {
this.state.blanksList.forEach((item, index) => { this.state.blanksList.forEach((item, index) => {
if (item.answerTagList.length === 0) { if (item.correctAnswerList.length === 0) {
this.setState({ [`optionsValidate_${index}`]: "error" }); this.setState({ [`optionsValidate_${index}`]: "error" });
this.setState({ [`optionsText_${index}`]: "请输入答案" }); this.setState({ [`optionsText_${index}`]: "请输入答案" });
validateError++; validateError++;
...@@ -217,7 +223,7 @@ class NewQuestionTab extends Component { ...@@ -217,7 +223,7 @@ class NewQuestionTab extends Component {
if ( if (
optionContent.length === 1 && optionContent.length === 1 &&
optionContent[0].type === "RICH_TEXT" && optionContent[0].type === "RICH_TEXT" &&
optionContent[0].content.length === 0 optionContent[0].textLength === 0
) { ) {
this.setState({ [`optionsValidate_${index}`]: "error" }); this.setState({ [`optionsValidate_${index}`]: "error" });
this.setState({ [`optionsText_${index}`]: "请输入选项" }); this.setState({ [`optionsText_${index}`]: "请输入选项" });
...@@ -328,8 +334,8 @@ class NewQuestionTab extends Component { ...@@ -328,8 +334,8 @@ class NewQuestionTab extends Component {
const voiceMediaArr = _.filter(uploadItemTarget, (mediaItem) => { const voiceMediaArr = _.filter(uploadItemTarget, (mediaItem) => {
return mediaItem.type === "VOICE"; return mediaItem.type === "VOICE";
}); });
const recordMediaArr = _.filter(uploadItemTarget, (mediaItem) => { const audioMediaArr = _.filter(uploadItemTarget, (mediaItem) => {
return mediaItem.type === "RECORD"; return mediaItem.type === "AUDIO";
}); });
const videodMediaArr = _.filter(uploadItemTarget, (mediaItem) => { const videodMediaArr = _.filter(uploadItemTarget, (mediaItem) => {
return mediaItem.type === "VIDEO"; return mediaItem.type === "VIDEO";
...@@ -343,8 +349,8 @@ class NewQuestionTab extends Component { ...@@ -343,8 +349,8 @@ class NewQuestionTab extends Component {
if (voiceMediaArr.length > 0) { if (voiceMediaArr.length > 0) {
existType.push("VOICE"); existType.push("VOICE");
} }
if (recordMediaArr.length > 0) { if (audioMediaArr.length > 0) {
existType.push("RECORD"); existType.push("AUDIO");
} }
if (videodMediaArr.length > 0) { if (videodMediaArr.length > 0) {
existType.push("VIDEO"); existType.push("VIDEO");
...@@ -371,8 +377,8 @@ class NewQuestionTab extends Component { ...@@ -371,8 +377,8 @@ class NewQuestionTab extends Component {
if (voiceMediaArr.length > 0) { if (voiceMediaArr.length > 0) {
existType.push("VOICE"); existType.push("VOICE");
} }
if (recordMediaArr.length > 0) { if (audioMediaArr.length > 0) {
existType.push("RECORD"); existType.push("AUDIO");
} }
if (videodMediaArr.length > 0) { if (videodMediaArr.length > 0) {
existType.push("VIDEO"); existType.push("VIDEO");
...@@ -389,8 +395,8 @@ class NewQuestionTab extends Component { ...@@ -389,8 +395,8 @@ class NewQuestionTab extends Component {
if (voiceMediaArr.length > 0) { if (voiceMediaArr.length > 0) {
existType.push("VOICE"); existType.push("VOICE");
} }
if (recordMediaArr.length > 0) { if (audioMediaArr.length > 0) {
existType.push("RECORD"); existType.push("AUDIO");
} }
if (videodMediaArr.length > 0) { if (videodMediaArr.length > 0) {
existType.push("VIDEO"); existType.push("VIDEO");
...@@ -404,7 +410,7 @@ class NewQuestionTab extends Component { ...@@ -404,7 +410,7 @@ class NewQuestionTab extends Component {
if (key === "VOICE" && voiceMediaArr.length > 2) { if (key === "VOICE" && voiceMediaArr.length > 2) {
return message.warning("只能添加3个音频"); return message.warning("只能添加3个音频");
} }
if (key === "RECORD" && recordMediaArr.length > 2) { if (key === "AUDIO" && audioMediaArr.length > 2) {
return message.warning("只能添加3个录音"); return message.warning("只能添加3个录音");
} }
if (key === "VIDEO" && videodMediaArr.length > 2) { if (key === "VIDEO" && videodMediaArr.length > 2) {
...@@ -427,13 +433,13 @@ class NewQuestionTab extends Component { ...@@ -427,13 +433,13 @@ class NewQuestionTab extends Component {
}, },
() => { () => {
this.uploadInput.current.value = ""; this.uploadInput.current.value = "";
this.setState({ showSelectFileModal: key !== "RECORD" }); this.setState({ showSelectFileModal: key !== "AUDIO" });
// this.uploadInput.current.click(); // this.uploadInput.current.click();
} }
); );
// 录音 // 录音
if (key === "RECORD") { if (key === "AUDIO") {
this.setState({ this.setState({
showRecord: true, showRecord: true,
}); });
...@@ -528,9 +534,9 @@ class NewQuestionTab extends Component { ...@@ -528,9 +534,9 @@ class NewQuestionTab extends Component {
changeBlankCount = (data) => { changeBlankCount = (data) => {
console.log("data:", data); console.log("data:", data);
data.forEach((item) => { data && data.length > 0 && data.forEach((item) => {
if (!item.answerTagList) { if (!item.correctAnswerList) {
item.answerTagList = []; item.correctAnswerList = [];
} }
item.inputVisible = false; item.inputVisible = false;
item.errorHold = false; item.errorHold = false;
...@@ -552,19 +558,26 @@ class NewQuestionTab extends Component { ...@@ -552,19 +558,26 @@ class NewQuestionTab extends Component {
handleInputConfirm = (optionItem, val) => { handleInputConfirm = (optionItem, val) => {
const _blanksList = this.state.blanksList; const _blanksList = this.state.blanksList;
var gapFillingAnswer = []; // const { gapFillingAnswer } = this.state;
_blanksList.forEach((item) => { let _gapFillingAnswer = [];
_blanksList.forEach((item, index) => {
gapFillingAnswer.push({ correctAnswerList: item.answerTagList }); gapFillingAnswer.push({ correctAnswerList: item.answerTagList });
// if (gapFillingAnswer[index] && gapFillingAnswer[index].correctAnswerList) {
// _gapFillingAnswer[index] = gapFillingAnswer[index]
// } else {
// _gapFillingAnswer.push({ correctAnswerList: item.correctAnswerList });
// }
if (item.id === optionItem.id) { if (item.id === optionItem.id) {
if (val) { if (val) {
optionItem.answerTagList.push(val); optionItem.correctAnswerList.push(val);
optionItem.inputVisible = false; optionItem.inputVisible = false;
} else { } else {
optionItem.errorHold = true; optionItem.errorHold = true;
} }
} }
}); });
this.setState({ gapFillingAnswer }, () => this._onSetState()); console.log(8888, _gapFillingAnswer)
this.setState({ gapFillingAnswer: _gapFillingAnswer }, () => this._onSetState());
this.setState({ blanksList: _blanksList }); this.setState({ blanksList: _blanksList });
}; };
...@@ -572,7 +585,7 @@ class NewQuestionTab extends Component { ...@@ -572,7 +585,7 @@ class NewQuestionTab extends Component {
const _blanksList = this.state.blanksList; const _blanksList = this.state.blanksList;
_blanksList.forEach((item) => { _blanksList.forEach((item) => {
if (item.id === optionItem.id) { if (item.id === optionItem.id) {
optionItem = optionItem.answerTagList.filter( optionItem = optionItem.correctAnswerList.filter(
(tag) => tag !== removedTag (tag) => tag !== removedTag
); );
} }
...@@ -584,13 +597,17 @@ class NewQuestionTab extends Component { ...@@ -584,13 +597,17 @@ class NewQuestionTab extends Component {
const _blanksList = this.state.blanksList; const _blanksList = this.state.blanksList;
_blanksList.forEach((item) => { _blanksList.forEach((item) => {
if (item.id === optionItem.id) { if (item.id === optionItem.id) {
item.answerTagList.map(); item.correctAnswerList.map();
} }
}); });
this.setState({ blanksList: _blanksList }); this.setState({ blanksList: _blanksList });
}; };
renderGapFillingAnswer = (optionItem, optionIndex) => { renderGapFillingAnswer = (optionItem, optionIndex) => {
console.log(11111, optionItem)
const { gapFillingAnswer } = this.state;
console.log(222, gapFillingAnswer)
const list = gapFillingAnswer[optionIndex] && gapFillingAnswer[optionIndex].correctAnswerList;
return ( return (
<div className="gap-answer-box" key={optionIndex}> <div className="gap-answer-box" key={optionIndex}>
<span className="gap-answer-label"> <span className="gap-answer-label">
...@@ -598,7 +615,7 @@ class NewQuestionTab extends Component { ...@@ -598,7 +615,7 @@ class NewQuestionTab extends Component {
{optionIndex + 1}. {optionIndex + 1}.
</span> </span>
<div className="gap-answer-content"> <div className="gap-answer-content">
{optionItem.answerTagList.map((tag, index) => { {list && list.map((tag, index) => {
return optionItem.editInput ? ( return optionItem.editInput ? (
<Input <Input
placeholder={optionItem.errorHold ? "请输入" : ""} placeholder={optionItem.errorHold ? "请输入" : ""}
...@@ -607,7 +624,7 @@ class NewQuestionTab extends Component { ...@@ -607,7 +624,7 @@ class NewQuestionTab extends Component {
}} }}
value={tag} value={tag}
size="small" size="small"
suffix={<CloseOutlined style={{ color: "#999999" }} />} suffix={<CloseOutlined onClick={() => this.handleInputConfirm(optionItem)} style={{ color: "#999999" }} />}
onBlur={(e) => onBlur={(e) =>
this.handleInputConfirm(optionItem, e.target.value, index) this.handleInputConfirm(optionItem, e.target.value, index)
} }
...@@ -675,6 +692,7 @@ class NewQuestionTab extends Component { ...@@ -675,6 +692,7 @@ class NewQuestionTab extends Component {
contentType, contentType,
validateStatus validateStatus
) => { ) => {
const { blanksList } = this.state;
const isGapFilling = this.props.questionTypeKey === "GAP_FILLING"; const isGapFilling = this.props.questionTypeKey === "GAP_FILLING";
const editorContent = _.find( const editorContent = _.find(
contentList, contentList,
...@@ -686,8 +704,8 @@ class NewQuestionTab extends Component { ...@@ -686,8 +704,8 @@ class NewQuestionTab extends Component {
const voiceMediaList = _.filter(contentList, (mediaItem) => { const voiceMediaList = _.filter(contentList, (mediaItem) => {
return mediaItem.type === "VOICE"; return mediaItem.type === "VOICE";
}); });
const recordMediaList = _.filter(contentList, (mediaItem) => { const audioMediaList = _.filter(contentList, (mediaItem) => {
return mediaItem.type === "RECORD"; return mediaItem.type === "AUDIO";
}); });
const videoMediaList = _.filter(contentList, (mediaItem) => { const videoMediaList = _.filter(contentList, (mediaItem) => {
return mediaItem.type === "VIDEO"; return mediaItem.type === "VIDEO";
...@@ -704,6 +722,7 @@ class NewQuestionTab extends Component { ...@@ -704,6 +722,7 @@ class NewQuestionTab extends Component {
isGapFilling={isGapFilling} isGapFilling={isGapFilling}
contentType={contentType} contentType={contentType}
mediaBtn={mediaBtn} mediaBtn={mediaBtn}
blanksList={blanksList}
changeBlankCount={this.changeBlankCount.bind(this)} changeBlankCount={this.changeBlankCount.bind(this)}
bindChangeContent={(cb, textElemId) => { bindChangeContent={(cb, textElemId) => {
this.setState({ textElemId }); this.setState({ textElemId });
...@@ -768,26 +787,26 @@ class NewQuestionTab extends Component { ...@@ -768,26 +787,26 @@ class NewQuestionTab extends Component {
})} })}
</div> </div>
)} )}
{recordMediaList.length > 0 && ( {audioMediaList.length > 0 && (
<div className="desc-audio-box"> <div className="desc-audio-box">
{_.map(recordMediaList, (recordItem, recordIndex) => { {_.map(audioMediaList, (audioItem, audioIndex) => {
let { content, status, size } = recordItem; let { content, status, size } = audioItem;
if (["init", "fail"].includes(status)) { if (["init", "fail"].includes(status)) {
return ( return (
<div className="mt12" key={recordIndex}> <div className="mt12" key={audioIndex}>
<UploadingProgress <UploadingProgress
fileDesc={recordItem} fileDesc={audioItem}
canCancelUpload canCancelUpload
onReupload={() => this.handleReupload(recordItem)} onReupload={() => this.handleReupload(audioItem)}
onAbort={() => onAbort={() =>
this.handleAbort(recordItem, recordIndex) this.handleAbort(audioItem, audioIndex)
} }
/> />
</div> </div>
); );
} else { } else {
return ( return (
<div className="audio-box" key={recordIndex}> <div className="audio-box" key={audioIndex}>
<XMAudio <XMAudio
forbidParse forbidParse
url={content} url={content}
...@@ -795,14 +814,14 @@ class NewQuestionTab extends Component { ...@@ -795,14 +814,14 @@ class NewQuestionTab extends Component {
size = durationSize; size = durationSize;
this.setState({}); this.setState({});
}} }}
index={recordIndex} index={audioIndex}
size={size || 1000} size={size || 1000}
/> />
<span <span
className="icon_sider iconfont" className="icon_sider iconfont"
onClick={() => { onClick={() => {
contentList.map((item, index) => { contentList.map((item, index) => {
if (item.contentName === recordItem.contentName) { if (item.contentName === audioItem.contentName) {
contentList.splice(index, 1); contentList.splice(index, 1);
return item; return item;
} }
...@@ -962,7 +981,7 @@ class NewQuestionTab extends Component { ...@@ -962,7 +981,7 @@ class NewQuestionTab extends Component {
</div> </div>
); );
break; break;
case "RECORD": case "AUDIO":
dom = ( dom = (
<div className="audio-box"> <div className="audio-box">
<XMAudio <XMAudio
...@@ -1034,7 +1053,6 @@ class NewQuestionTab extends Component { ...@@ -1034,7 +1053,6 @@ class NewQuestionTab extends Component {
* @memberof QuestionInputItem * @memberof QuestionInputItem
*/ */
handleReupload = (uploadItem) => { handleReupload = (uploadItem) => {
console.log("uploadItem:", uploadItem);
uploadItem.status = "init"; uploadItem.status = "init";
Upload.uploadToOSSEvent( Upload.uploadToOSSEvent(
uploadItem.mediaFile, uploadItem.mediaFile,
...@@ -1089,7 +1107,7 @@ class NewQuestionTab extends Component { ...@@ -1089,7 +1107,7 @@ class NewQuestionTab extends Component {
const { uploadItemTarget, contentType } = this.state; const { uploadItemTarget, contentType } = this.state;
uploadItemTarget.push({ uploadItemTarget.push({
contentType, contentType,
type: "RECORD", type: "AUDIO",
contentName: `${window.random_string(16)}.${originType}`, // 文件名 contentName: `${window.random_string(16)}.${originType}`, // 文件名
fileType: originType, // 文件后缀 fileType: originType, // 文件后缀
content: mp3URL, content: mp3URL,
...@@ -1145,7 +1163,6 @@ class NewQuestionTab extends Component { ...@@ -1145,7 +1163,6 @@ class NewQuestionTab extends Component {
); );
let acceptType = ""; let acceptType = "";
let selectTypeList = []; let selectTypeList = [];
console.log("mediaType", mediaType);
switch (mediaType) { switch (mediaType) {
case "PICTURE": case "PICTURE":
acceptType = MEDIA_FILE_ACCEPT.PICTURE; acceptType = MEDIA_FILE_ACCEPT.PICTURE;
...@@ -1161,8 +1178,6 @@ class NewQuestionTab extends Component { ...@@ -1161,8 +1178,6 @@ class NewQuestionTab extends Component {
break; break;
} }
console.log(acceptType, selectTypeList);
return ( return (
<div className="question-input-item_wrapper"> <div className="question-input-item_wrapper">
{/* 题干 */} {/* 题干 */}
...@@ -1177,7 +1192,7 @@ class NewQuestionTab extends Component { ...@@ -1177,7 +1192,7 @@ class NewQuestionTab extends Component {
{this.renderContent( {this.renderContent(
stemContent, stemContent,
placehold, placehold,
["VOICE", "RECORD", "PICTURE"], ["VOICE", "AUDIO", "PICTURE"],
"QUESTION_STEM", "QUESTION_STEM",
stemValidate stemValidate
)} )}
...@@ -1232,12 +1247,8 @@ class NewQuestionTab extends Component { ...@@ -1232,12 +1247,8 @@ class NewQuestionTab extends Component {
questionOptionContentList, questionOptionContentList,
isCorrectAnswer, isCorrectAnswer,
} = optionItem; } = optionItem;
console.log(
"questionOptionContentList:",
questionOptionContentList
);
optionItem.optionSort = optionIndex; optionItem.optionSort = optionIndex;
const mediaBtn = ["VOICE", "RECORD", "PICTURE"]; const mediaBtn = ["VOICE", "AUDIO", "PICTURE"];
const placeHold = const placeHold =
"必填(1000字以内,可粘贴小图;可以不输入文字,只添加音频或图片)"; "必填(1000字以内,可粘贴小图;可以不输入文字,只添加音频或图片)";
return ( return (
...@@ -1366,7 +1377,7 @@ class NewQuestionTab extends Component { ...@@ -1366,7 +1377,7 @@ class NewQuestionTab extends Component {
{this.renderContent( {this.renderContent(
questionAnswerDesc, questionAnswerDesc,
"1000字以内,可粘贴小图", "1000字以内,可粘贴小图",
["VOICE", "RECORD", "PICTURE", "VIDEO"], ["VOICE", "AUDIO", "PICTURE", "VIDEO"],
"QUESTION_ANSWER_DESC" "QUESTION_ANSWER_DESC"
)} )}
</div> </div>
......
...@@ -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: "图片",
...@@ -56,12 +56,18 @@ class QuestionEditor extends Component { ...@@ -56,12 +56,18 @@ class QuestionEditor extends Component {
} }
shouldComponentUpdate(nextProps, nextState) { shouldComponentUpdate(nextProps, nextState) {
const { detailInfo } = nextProps; const { detailInfo, blanksList } = nextProps;
if (this.state.detailInfo !== detailInfo) { if (this.state.detailInfo !== detailInfo) {
this.setState({ detailInfo: nextProps.detailInfo }, () => { this.setState({ detailInfo: nextProps.detailInfo }, () => {
this.renderEditor(); this.renderEditor();
}); });
} }
if (blanksList !== this.state.blanksList) {
console.log("+++++++", blanksList)
this.setState({
blanksList
})
}
return true; return true;
} }
...@@ -148,6 +154,7 @@ class QuestionEditor extends Component { ...@@ -148,6 +154,7 @@ class QuestionEditor extends Component {
this.setState({ isShowSingleInput: true }); this.setState({ isShowSingleInput: true });
} }
if (this.state.isGapFilling) { if (this.state.isGapFilling) {
console.log(9999, this.state.isGapFilling)
this.props.changeBlankCount(this.state.blanksList); this.props.changeBlankCount(this.state.blanksList);
} }
this.setState( this.setState(
...@@ -204,7 +211,7 @@ class QuestionEditor extends Component { ...@@ -204,7 +211,7 @@ class QuestionEditor extends Component {
} }
insertBlank = (blanks) => { insertBlank = (blanks) => {
var blanks = `<input class="add-fill-line" disabled answerTagList="" id=${window.random_string( var blanks = `<input class="add-fill-line" disabled correctAnswerList="[]" id=${window.random_string(
16 16
)} value="填空"/>`; )} value="填空"/>`;
this.editorRoot.cmd.do("insertHTML", blanks); this.editorRoot.cmd.do("insertHTML", blanks);
...@@ -215,7 +222,7 @@ class QuestionEditor extends Component { ...@@ -215,7 +222,7 @@ class QuestionEditor extends Component {
this.setState({ this.setState({
visiblePlacehold: false, visiblePlacehold: false,
}); });
// this.props.changeBlankCount(_blanksList); this.props.changeBlankCount(_blanksList);
}; };
render() { render() {
...@@ -233,7 +240,7 @@ class QuestionEditor extends Component { ...@@ -233,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 10:24:47 * @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, // 题目类型
......
...@@ -39,7 +39,6 @@ class BatchImportQuestionModal extends Component { ...@@ -39,7 +39,6 @@ class BatchImportQuestionModal extends Component {
// 选择云盘资源 // 选择云盘资源
handleSelectExcel = (file) => { handleSelectExcel = (file) => {
console.log(file);
this.setState({ uploadFile: file }); this.setState({ uploadFile: file });
this.setState({ this.setState({
showSelectFileModal: false, showSelectFileModal: false,
...@@ -133,6 +132,9 @@ class BatchImportQuestionModal extends Component { ...@@ -133,6 +132,9 @@ class BatchImportQuestionModal extends Component {
</div> </div>
<div className="step-section"> <div className="step-section">
<h4 className="step-title">2.选择需要导入的Excel文件</h4> <h4 className="step-title">2.选择需要导入的Excel文件</h4>
<p style={{ marginBottom: 16, color: "gray" }}>
导入限制:一次最多导入1000个题目
</p>
<Button <Button
type="primary" type="primary"
className="add-btn" className="add-btn"
...@@ -220,9 +222,9 @@ class BatchImportQuestionModal extends Component { ...@@ -220,9 +222,9 @@ class BatchImportQuestionModal extends Component {
type="primary" type="primary"
className="down-btn" className="down-btn"
onClick={() => { onClick={() => {
this.setState({ status: "init" }) this.setState({ status: "init" });
this.setState({ uploadFile: null }) this.setState({ uploadFile: null });
this.setState({ showSelectFileModal: true }) this.setState({ showSelectFileModal: true });
}} }}
> >
重新上传文件 重新上传文件
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
.step-title { .step-title {
font-size: 16px; font-size: 16px;
font-weight: 400; font-weight: 400;
margin-bottom: 16px;
color: #333; color: #333;
} }
.tip-box { .tip-box {
......
...@@ -87,8 +87,8 @@ class QuestionPreviewModal extends Component { ...@@ -87,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";
...@@ -327,12 +327,12 @@ class QuestionPreviewModal extends Component { ...@@ -327,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}
...@@ -340,7 +340,7 @@ class QuestionPreviewModal extends Component { ...@@ -340,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