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-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