feat: 上传题目完善

This commit is contained in:
秋水浮尘
2023-10-24 01:33:45 +08:00
parent 26f51df723
commit 773dc83fbb
5 changed files with 97 additions and 69 deletions

View File

@@ -37,6 +37,8 @@ const CategoryList = ({ primaryCategoryId, categoryList, ...props }) => {
const [currentActive, setCurrentActive] = useState(categoryList[0])
const [isPutAway, setIsPutAway] = useState(true)
const [loading, setLoading] = useState(false)
const [currentLabelIndex, setCurrentLabelIndex] = useState([])
const getLabels = (id) => {
return new Promise(resolve => {
@@ -65,8 +67,13 @@ const CategoryList = ({ primaryCategoryId, categoryList, ...props }) => {
let list = res.data
for (let i = 0; i < list.length; i++) {
list[i].children = await getLabels(list[i].id)
if (i === 0) {
list[i].children[0].active = true
}
}
setSecondCategoryList(_.cloneDeep(list))
setCurrentLabelIndex([0, 0])
props.onChangeLabel(_.get(list, [0, 'id']), _.get(list, [0, 'children', 0, 'id']))
})
}
@@ -128,7 +135,6 @@ const CategoryList = ({ primaryCategoryId, categoryList, ...props }) => {
);
};
const [currentLabelIndex, setCurrentLabelIndex] = useState([])
/**
* 选择标签-支持单选(多选)