Commit ba3410c0 by yuananting

fix:bug修复

parent 5cafb6c1
...@@ -15,7 +15,6 @@ import NewQuestionTab from "./components/NewQuestionTab"; ...@@ -15,7 +15,6 @@ import NewQuestionTab from "./components/NewQuestionTab";
import { defineJudgeOptionInfo, 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";
const { TabPane } = Tabs; const { TabPane } = Tabs;
class AddNewQuestion extends Component { class AddNewQuestion extends Component {
...@@ -49,6 +48,13 @@ class AddNewQuestion extends Component { ...@@ -49,6 +48,13 @@ class AddNewQuestion 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;
};
queryQuestionDetails = () => { queryQuestionDetails = () => {
let query = { let query = {
id: getParameterByName("id"), id: getParameterByName("id"),
...@@ -58,6 +64,10 @@ class AddNewQuestion extends Component { ...@@ -58,6 +64,10 @@ class AddNewQuestion extends Component {
}; };
QuestionBankService.queryQuestionDetails(query).then((res) => { QuestionBankService.queryQuestionDetails(query).then((res) => {
const { result = [] } = res; const { result = [] } = res;
let stemContent = _.find(
result.questionStemList,
(contentItem) => contentItem.type === "RICH_TEXT"
);
const { questionTypeEnum } = result; const { questionTypeEnum } = result;
switch (questionTypeEnum) { switch (questionTypeEnum) {
case "SINGLE_CHOICE": case "SINGLE_CHOICE":
...@@ -70,6 +80,12 @@ class AddNewQuestion extends Component { ...@@ -70,6 +80,12 @@ class AddNewQuestion extends Component {
this.setState({ judgeContent: result }); this.setState({ judgeContent: result });
break; break;
case "GAP_FILLING": case "GAP_FILLING":
stemContent.content = stemContent.content.split('').map((item) => {
if (item === '_') {
return `<input class="add-fill-line" disabled correctAnswerList="" id=${window.random_string(16)} value="填空"/>`
}
return item;
}).join('');
this.setState({ gapFillingContent: result }); this.setState({ gapFillingContent: result });
break; break;
case "INDEFINITE_CHOICE": case "INDEFINITE_CHOICE":
...@@ -99,7 +115,7 @@ class AddNewQuestion extends Component { ...@@ -99,7 +115,7 @@ class AddNewQuestion extends Component {
case "JUDGE": case "JUDGE":
let judgeContent = defineQuestionInfo("JUDGE"); let judgeContent = defineQuestionInfo("JUDGE");
var judgeOptions = ["正确", "错误"]; var judgeOptions = ["正确", "错误"];
judgeOptions.forEach(item=>{ judgeOptions.forEach(item => {
judgeContent.optionList.push(defineJudgeOptionInfo(item)); judgeContent.optionList.push(defineJudgeOptionInfo(item));
}) })
this.setState({ judgeContent }); this.setState({ judgeContent });
...@@ -155,9 +171,6 @@ class AddNewQuestion extends Component { ...@@ -155,9 +171,6 @@ class AddNewQuestion extends Component {
message.success("保存成功"); message.success("保存成功");
if (next === "add") { if (next === "add") {
this.handleRest(type); this.handleRest(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({
...@@ -231,9 +244,9 @@ class AddNewQuestion extends Component { ...@@ -231,9 +244,9 @@ 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, "GAP_FILLING", next); this.saveCurrentQuestion(gapFillingContent, "GAP_FILLING", next);
// } }
break; break;
case "INDEFINITE_CHOICE": case "INDEFINITE_CHOICE":
if (this.indefiniteRef.checkInput() === 0) { if (this.indefiniteRef.checkInput() === 0) {
...@@ -261,10 +274,11 @@ class AddNewQuestion extends Component { ...@@ -261,10 +274,11 @@ class AddNewQuestion extends Component {
gapFillingContent, gapFillingContent,
indefiniteChoiceContent, indefiniteChoiceContent,
} = this.state; } = this.state;
const categoryId = getParameterByName("categoryId");
return ( return (
<div className="page add-new-question"> <div className="page add-new-question">
<Breadcrumbs <Breadcrumbs
navList={getParameterByName("id") && this.state.currentOperate==="edit" ? "编辑题目" : "新增题目"} navList={getParameterByName("id") && this.state.currentOperate === "edit" ? "编辑题目" : "新增题目"}
goBack={() => this.handleGoBack()} goBack={() => this.handleGoBack()}
/> />
<div className="box"> <div className="box">
...@@ -336,7 +350,6 @@ class AddNewQuestion extends Component { ...@@ -336,7 +350,6 @@ class AddNewQuestion extends Component {
}} }}
questionInfo={gapFillingContent} questionInfo={gapFillingContent}
onSetState={(newContent) => { onSetState={(newContent) => {
console.log("gapFillingContent:" ,newContent)
Object.assign(gapFillingContent, newContent); Object.assign(gapFillingContent, newContent);
}} }}
/> />
...@@ -374,13 +387,13 @@ class AddNewQuestion extends Component { ...@@ -374,13 +387,13 @@ class AddNewQuestion extends Component {
> >
取消 取消
</Button> </Button>
<Button {(categoryId && categoryId!=="null") && <Button
onClick={() => { onClick={() => {
this.confirmSaveQuestion("add"); this.confirmSaveQuestion("add");
}} }}
> >
保存并继续添加 保存并继续添加
</Button> </Button>}
<Button <Button
type="primary" type="primary"
onClick={() => { onClick={() => {
......
...@@ -19,9 +19,6 @@ class QuestionBankIndex extends Component { ...@@ -19,9 +19,6 @@ class QuestionBankIndex extends Component {
super(props); super(props);
this.state = { this.state = {
selectedCategoryId: "", selectedCategoryId: "",
loading: true,
dataSource: [], // 题库列表数据
totalCount: 1, // 题库数据总条数
}; };
} }
...@@ -33,8 +30,8 @@ class QuestionBankIndex extends Component { ...@@ -33,8 +30,8 @@ class QuestionBankIndex extends Component {
} }
}; };
updatedSiderTreeFromList = (updatedCategoryId) => { updatedSiderTreeFromList = (currentTotal) => {
this.setState({updatedCategoryId}); this.setState({currentTotal});
}; };
render() { render() {
...@@ -45,7 +42,7 @@ class QuestionBankIndex extends Component { ...@@ -45,7 +42,7 @@ class QuestionBankIndex extends Component {
<div className="sider"> <div className="sider">
<QuestionBankSider <QuestionBankSider
getSelectedCategoryId={this.getCategoryIdFromSider.bind(this)} getSelectedCategoryId={this.getCategoryIdFromSider.bind(this)}
updatedCategoryId={this.state.updatedCategoryId} currentTotal={this.state.currentTotal}
/> />
</div> </div>
<div className="content"> <div className="content">
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-02-23 18:28:50 * @Date: 2021-02-23 18:28:50
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-03-19 14:15:00 * @LastEditTime: 2021-03-22 09:42:28
* @Description: 助学工具-题库-主页面分类管理 * @Description: 助学工具-题库-主页面分类管理
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -44,6 +44,7 @@ class QuestionCategoryManage extends Component { ...@@ -44,6 +44,7 @@ class QuestionCategoryManage extends Component {
// 查询分类树 // 查询分类树
queryCategoryTree = (categoryName) => { queryCategoryTree = (categoryName) => {
this.setState({categoryName})
let query = { let query = {
source: 0, source: 0,
categoryName, categoryName,
...@@ -202,6 +203,9 @@ class QuestionCategoryManage extends Component { ...@@ -202,6 +203,9 @@ class QuestionCategoryManage extends Component {
}; };
onDrop = (info) => { onDrop = (info) => {
if (this.state.categoryName) {
return
}
// 未分类不可以拖拽 // 未分类不可以拖拽
if ( if (
info.dragNode.categoryName === "未分类" || info.dragNode.categoryName === "未分类" ||
...@@ -215,10 +219,15 @@ class QuestionCategoryManage extends Component { ...@@ -215,10 +219,15 @@ class QuestionCategoryManage extends Component {
info.dropPosition === -1 info.dropPosition === -1
) )
return; return;
let targetParentId = info.dropToGap ? info.node.parentId : info.node.id; let targetParentId = info.dropToGap ? info.node.parentId : info.node.id;
if (this.state.treeMap[targetParentId].categoryLevel === 4) {
return message.info("最多支持5级分类")
}
let relatedNodes = this.getRelatedNodes(targetParentId); let relatedNodes = this.getRelatedNodes(targetParentId);
if (relatedNodes && relatedNodes.length === 30) {
return message.info("最多只能添加30个子分类")
}
const dropKey = info.node.key; const dropKey = info.node.key;
const dragKey = info.dragNode.key; const dragKey = info.dragNode.key;
const dropPos = info.node.pos.split("-"); const dropPos = info.node.pos.split("-");
...@@ -458,7 +467,19 @@ class QuestionCategoryManage extends Component { ...@@ -458,7 +467,19 @@ class QuestionCategoryManage extends Component {
}); });
let map = {}; let map = {};
this.setState({ treeMap: this.getTreeMap(data, map) });
let topItem = []
data.forEach((item) => {
topItem.push(item);
});
this.setState({
treeMap: Object.assign(this.getTreeMap(data, map), {
"0": {
sonCategoryList: topItem
},
})
});
return newTreeData; return newTreeData;
}; };
...@@ -469,6 +490,7 @@ class QuestionCategoryManage extends Component { ...@@ -469,6 +490,7 @@ class QuestionCategoryManage extends Component {
this.getTreeMap(item.sonCategoryList, map); this.getTreeMap(item.sonCategoryList, map);
} }
}); });
return map; return map;
}; };
...@@ -484,17 +506,17 @@ class QuestionCategoryManage extends Component { ...@@ -484,17 +506,17 @@ class QuestionCategoryManage extends Component {
selectedKeys, selectedKeys,
autoExpandParent, autoExpandParent,
} = this.state; } = this.state;
console.log("autoExpandParent:", autoExpandParent);
return ( return (
<div className="page question-category-manage"> <div className="page question-category-manage">
<Breadcrumbs {getParameterByName('from') === "aid" ? <Breadcrumbs
navList="课程分类" navList="课程分类"
goBack={() => goBack={() =>
window.RCHistory.push({ window.RCHistory.push({
pathname: "/question-bank-index", pathname: "/question-bank-index",
}) })
} }
/> /> :
<div className="content-header">课程分类</div>}
<div className="box"> <div className="box">
<div className="search-condition"> <div className="search-condition">
<span className="search-label">搜索名称:</span> <span className="search-label">搜索名称:</span>
......
...@@ -337,16 +337,17 @@ ...@@ -337,16 +337,17 @@
position: relative; position: relative;
display: inline-block; display: inline-block;
width: 208px; width: 208px;
// height: calc(208px * 9 / 16); height: calc(208px * 9 / 16);
position: relative; position: relative;
overflow: hidden; background-color: #000;
// background-color: #000;
padding-top: 12px;
margin: 0px 12px 12px 0; margin: 0px 12px 12px 0;
&_content { &_content {
max-width: 200px; max-width: 100%;
max-height: 200px; max-height: 100%;
border-radius: 4px; position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
} }
&_btn { &_btn {
width: 32px; width: 32px;
...@@ -354,13 +355,13 @@ ...@@ -354,13 +355,13 @@
position: absolute; position: absolute;
top: 50%; top: 50%;
left: 50%; left: 50%;
margin-top: -8px; margin-top: -16px;
margin-left: -16px; margin-left: -16px;
} }
.icon_arrow { .icon_arrow {
position: absolute; position: absolute;
top: 0px; top: -12px;
right: 0px; right: -8px;
color: #bfbfbf; color: #bfbfbf;
cursor: pointer; cursor: pointer;
font-size: 16px; font-size: 16px;
...@@ -380,19 +381,28 @@ ...@@ -380,19 +381,28 @@
width: 50px; width: 50px;
} }
.gap-answer-content { .gap-answer-content {
display: flex; // display: flex;
background: #ffffff; background: #ffffff;
border-radius: 4px; border-radius: 4px;
border: 1px solid #e8e8e8; border: 1px solid #e8e8e8;
padding: 6px 12px; padding: 8px 12px 0;
width: calc(100% - 50px); width: calc(100% - 50px);
word-wrap: break-word;
word-break: break-all;
overflow: hidden;
.ant-tag {
margin-bottom: 8px !important;
}
.gap-tag-input {
margin-right: 5px;
border: 1px solid rgb(165, 165, 165);
}
::-webkit-input-placeholder { /* WebKit browsers */ ::-webkit-input-placeholder { /* WebKit browsers */
color: #FF4F4F; color: #FF4F4F;
} }
::-moz-placeholder { /* Mozilla Firefox 19+ */ ::-moz-placeholder { /* Mozilla Firefox 19+ */
color: #FF4F4F; color: #FF4F4F;
} }
:-ms-input-placeholder { /* Internet Explorer 10+ */ :-ms-input-placeholder { /* Internet Explorer 10+ */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-02-22 10:59:43 * @Date: 2021-02-22 10:59:43
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-03-19 14:18:59 * @LastEditTime: 2021-03-22 09:47:50
* @Description: 助学工具-题库-题库主页面侧边栏 * @Description: 助学工具-题库-题库主页面侧边栏
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -26,7 +26,7 @@ class QuestionBankSider extends Component { ...@@ -26,7 +26,7 @@ class QuestionBankSider extends Component {
NewEditQuestionBankCategory: null, //新增或编辑分类模态框 NewEditQuestionBankCategory: null, //新增或编辑分类模态框
ImportCourseCategory: null, // 引用课程分类模态框 ImportCourseCategory: null, // 引用课程分类模态框
treeData: this.props.treeData || [], treeData: this.props.treeData || [],
autoExpandParent: false autoExpandParent: false,
}; };
} }
...@@ -40,11 +40,9 @@ class QuestionBankSider extends Component { ...@@ -40,11 +40,9 @@ class QuestionBankSider extends Component {
} }
shouldComponentUpdate(nextProps, nextState) { shouldComponentUpdate(nextProps, nextState) {
const { updatedCategoryId } = nextProps; const { currentTotal } = nextProps;
if (this.props.updatedCategoryId !== updatedCategoryId) { if (this.props.currentTotal !== currentTotal) {
this.setState({ selectedKeys: [updatedCategoryId] }, () => this.queryCategoryTree();
this.queryCategoryTree()
);
} }
return true; return true;
} }
...@@ -170,7 +168,12 @@ class QuestionBankSider extends Component { ...@@ -170,7 +168,12 @@ class QuestionBankSider extends Component {
}; };
render() { render() {
const { treeData, expandedKeys, selectedKeys, autoExpandParent } = this.state; const {
treeData,
expandedKeys,
selectedKeys,
autoExpandParent,
} = this.state;
return ( return (
<div className="question-bank-sider"> <div className="question-bank-sider">
<div className="sider-title">题目分类</div> <div className="sider-title">题目分类</div>
...@@ -186,7 +189,7 @@ class QuestionBankSider extends Component { ...@@ -186,7 +189,7 @@ class QuestionBankSider extends Component {
<Button <Button
onClick={() => { onClick={() => {
window.RCHistory.push({ window.RCHistory.push({
pathname: "/question-category-manage", pathname: "/question-category-manage?from=aid",
}); });
}} }}
> >
......
...@@ -139,15 +139,31 @@ class QuestionEditor extends Component { ...@@ -139,15 +139,31 @@ class QuestionEditor extends Component {
let prevList = [] let prevList = []
let counter = 0;
const isEdit = getParameterByName('id'); const isEdit = getParameterByName('id');
if (isEdit) { if (isEdit) {
const stemDom = document.getElementsByClassName("add-fill-line"); const stemDom = document.getElementsByClassName("add-fill-line");
prevList = [...stemDom].map(item => item.id) prevList = [...stemDom].map(item => item.id)
localStorage.setItem('gap_ques_prevList', JSON.stringify(prevList)); localStorage.setItem('gap_ques_prevList', JSON.stringify(prevList));
setTimeout(function () {
const divHeight = document.getElementById(`editor${editorId}_content`)
.firstChild.offsetHeight;
if (divHeight > 30) {
this.setState({ isShowSingleInput: false });
} else {
this.setState({ isShowSingleInput: true });
} }
let counter = 0 }.bind(this))
if (counter === 0) {
this.props.changeBlankCount(stemDom)
}
}
editorRoot.customConfig.onchange = (html) => { editorRoot.customConfig.onchange = (html) => {
counter ++; const conLen = html.replace(/<(?!img|input).*?>/g, "").length;
counter++;
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;
...@@ -186,7 +202,7 @@ class QuestionEditor extends Component { ...@@ -186,7 +202,7 @@ class QuestionEditor extends Component {
this.setState({ blanksList: _blanksList }, () => this.props.changeBlankCount(_blanksList, idx)) this.setState({ blanksList: _blanksList }, () => this.props.changeBlankCount(_blanksList, idx))
} }
this.setState( this.setState(
{ contentLength, visiblePlacehold: contentLength === 0 && !focusFlag }, { contentLength, visiblePlacehold: conLen === 0 && !focusFlag },
() => { () => {
onChange && onChange(html, this.state.contentLength); onChange && onChange(html, this.state.contentLength);
} }
...@@ -194,11 +210,12 @@ class QuestionEditor extends Component { ...@@ -194,11 +210,12 @@ class QuestionEditor extends Component {
}; };
editorRoot.customConfig.onblur = (html) => { editorRoot.customConfig.onblur = (html) => {
const conLen = html.replace(/<(?!img|input).*?>/g, "").length;
editorRoot.change && editorRoot.change(); editorRoot.change && editorRoot.change();
this.setState({ this.setState({
focusFlag: false, focusFlag: false,
visibleMediaBox: false, visibleMediaBox: false,
visiblePlacehold: _.isEmpty(html.replace(/\<\/?[\w]+\>/g, "")), visiblePlacehold: conLen === 0,
zIndex: 9, zIndex: 9,
}); });
}; };
...@@ -262,10 +279,7 @@ class QuestionEditor extends Component { ...@@ -262,10 +279,7 @@ class QuestionEditor extends Component {
var _blanksList = []; var _blanksList = [];
_blanksList = document.getElementsByClassName("add-fill-line"); _blanksList = document.getElementsByClassName("add-fill-line");
this.setState({ blanksList: _blanksList }); this.setState({ blanksList: _blanksList });
this.setState({ this.props.changeBlankCount(_blanksList);
visiblePlacehold: false,
});
// this.props.changeBlankCount(_blanksList);
}; };
render() { render() {
......
...@@ -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 14:21:22 * @LastEditTime: 2021-03-22 09:44:27
* @Description: 助学工具-题库-题目管理主页面列表数据 * @Description: 助学工具-题库-题目管理主页面列表数据
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -105,7 +105,7 @@ class QuestionManageContent extends Component { ...@@ -105,7 +105,7 @@ class QuestionManageContent extends Component {
QuestionBankService.queryQuestionPageList(_query).then((res) => { QuestionBankService.queryQuestionPageList(_query).then((res) => {
const { records = [], total = 0 } = res.result; const { records = [], total = 0 } = res.result;
this.setState({ dataSource: records }); this.setState({ dataSource: records });
this.setState({ total }); this.setState({ total }, () => this.props.updatedSiderTree(total));
}); });
}; };
...@@ -141,7 +141,6 @@ class QuestionManageContent extends Component { ...@@ -141,7 +141,6 @@ class QuestionManageContent extends Component {
if (res.success) { if (res.success) {
message.success("删除成功"); message.success("删除成功");
this.queryQuestionPageList(); this.queryQuestionPageList();
this.props.updatedSiderTree(this.props.selectedCategoryId);
} }
}); });
}; };
...@@ -163,7 +162,7 @@ class QuestionManageContent extends Component { ...@@ -163,7 +162,7 @@ class QuestionManageContent extends Component {
sort = "UPDATED_DESC"; sort = "UPDATED_DESC";
} }
const _query = this.state.query; const _query = this.state.query;
_query.order = sort; _query.order = sort || "UPDATED_DESC";
_query.current = 1; _query.current = 1;
this.setState({ query: _query }, () => this.queryQuestionPageList()); this.setState({ query: _query }, () => this.queryQuestionPageList());
}; };
...@@ -243,7 +242,6 @@ class QuestionManageContent extends Component { ...@@ -243,7 +242,6 @@ class QuestionManageContent extends Component {
key: "accuracy", key: "accuracy",
dataIndex: "accuracy", dataIndex: "accuracy",
sorter: true, sorter: true,
sortDirections: ["ascend", "descend", "ascend"],
showSorterTooltip: false, showSorterTooltip: false,
render: (val) => { render: (val) => {
return val + "%"; return val + "%";
...@@ -254,7 +252,6 @@ class QuestionManageContent extends Component { ...@@ -254,7 +252,6 @@ class QuestionManageContent extends Component {
key: "updateTime", key: "updateTime",
dataIndex: "updateTime", dataIndex: "updateTime",
sorter: true, sorter: true,
sortDirections: ["ascend", "descend", "ascend"],
showSorterTooltip: false, showSorterTooltip: false,
render: (val) => { render: (val) => {
return formatDate("YYYY-MM-DD H:i:s", val); return formatDate("YYYY-MM-DD H:i:s", val);
...@@ -300,6 +297,7 @@ class QuestionManageContent extends Component { ...@@ -300,6 +297,7 @@ class QuestionManageContent extends Component {
// 自定义表格空状态 // 自定义表格空状态
customizeRenderEmpty = () => { customizeRenderEmpty = () => {
const { categoryId } = this.state.query;
return ( return (
<Empty <Empty
image="https://image.xiaomaiketang.com/xm/emptyTable.png" image="https://image.xiaomaiketang.com/xm/emptyTable.png"
...@@ -308,7 +306,7 @@ class QuestionManageContent extends Component { ...@@ -308,7 +306,7 @@ class QuestionManageContent extends Component {
}} }}
description={ description={
<div> <div>
还没有题目,快去 <span>还没有题目</span>{(["CloudManager", "StoreManager"].includes(User.getUserRole()) && !["0", null].includes(categoryId)) && (<span>,快去
<span <span
className="empty-list-tip" className="empty-list-tip"
onClick={() => { onClick={() => {
...@@ -317,7 +315,7 @@ class QuestionManageContent extends Component { ...@@ -317,7 +315,7 @@ class QuestionManageContent extends Component {
> >
新建一个 新建一个
</span> </span>
吧! 吧!</span>)}
</div> </div>
} }
></Empty> ></Empty>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: 吴文洁 * @Author: 吴文洁
* @Date: 2020-03-18 10:01:28 * @Date: 2020-03-18 10:01:28
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-03-02 10:59:09 * @LastEditTime: 2021-03-22 09:46:07
* @Description: 录音组件 * @Description: 录音组件
*/ */
...@@ -35,7 +35,7 @@ class XMRecord extends Component { ...@@ -35,7 +35,7 @@ class XMRecord extends Component {
this.getAudioRecorderDevice(); this.getAudioRecorderDevice();
} }
componentWillUnmount() {} componentWillUnmount() { }
getAudioRecorderDevice = () => { getAudioRecorderDevice = () => {
//仅用来进行录音 //仅用来进行录音
...@@ -124,6 +124,7 @@ class XMRecord extends Component { ...@@ -124,6 +124,7 @@ class XMRecord extends Component {
isFinished: true, isFinished: true,
}); });
window.clearInterval(this.timer); window.clearInterval(this.timer);
this.mMediaRecorder.stop();
}); });
}; };
...@@ -147,6 +148,7 @@ class XMRecord extends Component { ...@@ -147,6 +148,7 @@ class XMRecord extends Component {
}, },
() => { () => {
this.props.onCancel(); this.props.onCancel();
this.mMediaRecorder.stop();
}, },
); );
}; };
......
...@@ -108,6 +108,9 @@ export default function AudioRecorder(stream, config) { ...@@ -108,6 +108,9 @@ export default function AudioRecorder(stream, config) {
//停止 //停止
this.stop = function () { this.stop = function () {
stream.getTracks().forEach(function(track) {
track.stop();
});
recorder.disconnect(); recorder.disconnect();
} }
......
...@@ -244,7 +244,7 @@ class BatchImportQuestionModal extends Component { ...@@ -244,7 +244,7 @@ class BatchImportQuestionModal extends Component {
</Modal> </Modal>
<SelectPrepareFileModal <SelectPrepareFileModal
operateType="select" operateType="select"
accept="xls/xlsx" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
selectTypeList={[ selectTypeList={[
"vnd.openxmlformats-officedocument.spreadsheetml.sheet", "vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"vnd.ms-excel", "vnd.ms-excel",
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: yuananting * @Author: yuananting
* @Date: 2021-02-22 17:51:28 * @Date: 2021-02-22 17:51:28
* @LastEditors: yuananting * @LastEditors: yuananting
* @LastEditTime: 2021-03-18 09:32:59 * @LastEditTime: 2021-03-22 09:43:18
* @Description: 助学工具-题库-题库新建或编辑题库分类模态框 * @Description: 助学工具-题库-题库新建或编辑题库分类模态框
* @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
...@@ -126,6 +126,11 @@ class NewEditQuestionBankCategory extends Component { ...@@ -126,6 +126,11 @@ class NewEditQuestionBankCategory extends Component {
// 查询是否重名 // 查询是否重名
checkExist = (sameLevelNodes, categoryName) => { checkExist = (sameLevelNodes, categoryName) => {
if ((sameLevelNodes.length > 0 && sameLevelNodes[0].parentId === "0")) {
if (categoryName === "未分类") {
return true;
}
}
var result = null; var result = null;
sameLevelNodes.forEach((item) => { sameLevelNodes.forEach((item) => {
if (result != null) { if (result != null) {
......
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