feat: 增加默认跳转

This commit is contained in:
秋水浮尘
2023-10-15 00:12:03 +08:00
parent a387a61d02
commit 7ba8d52bfe
7 changed files with 97 additions and 81 deletions

View File

@@ -24,7 +24,7 @@ const QuestionBank = () => {
/**
* 获取一级分类数据
* 获取大类分类
*/
const getPrimaryCategoryInfo = () => {
setIsShowSpin(true)
@@ -35,16 +35,34 @@ const QuestionBank = () => {
})
.then((res: Record<string, any>) => {
if (res.data && res.data.length > 0) {
setPromaryCategoryId(res.data[0].primaryCategoryId);
setPromaryCategoryId(res.data[0].id);
setFirstCategoryList(res.data)
setIsShowSpin(false)
} else {
setIsShowSpin(false)
}
})
.catch((err: string) => console.log(err));
.catch((err: string) => {
console.log(err)
}).finally(() => {
setIsShowSpin(false)
})
}
// 获取大类下分类
const getCategoryByPrimary = () => {
req({
method: 'post',
url: apiName.queryCategoryByPrimary,
data: { categoryType: 1, parentId: 1 }
}).then(res => {
console.log(res)
})
}
useEffect(() => {
if (primaryCategoryId) {
getCategoryByPrimary()
}
}, [primaryCategoryId])
/**
* 切换一级分类
* @param {*} e

View File

@@ -50,6 +50,7 @@ export default class KindEditor extends Component {
componentDidMount() {
const elemMenu = this.refs.editorElemMenu;
const elemBody = this.refs.editorElemBody;
if (this.editor) return
this.editor = new Editor(elemMenu, elemBody);
// // 使用 onchange 函数监听内容的变化,并实时更新到 state 中
this.editor.config.onchange = (html) => {

View File

@@ -36,24 +36,24 @@ export const ModuleType = {
export const starList = [
{
categoryId: 1,
categoryName: 'T4',
categoryName: '初级',
active: true,
},
{
categoryId: 2,
categoryName: 'T5',
categoryName: '中级',
},
{
categoryId: 3,
categoryName: 'T6',
categoryName: '高级',
},
{
categoryId: 4,
categoryName: 'T7',
categoryName: '资深',
},
{
categoryId: 5,
categoryName: 'T8',
categoryName: '专家',
},
];
@@ -63,24 +63,24 @@ export const starList = [
export const uploadLayout = [
{
id: 1,
title: '答题',
title: '答题',
active: true,
},
{
id: 2,
title: '单选题',
active: false,
},
{
id: 3,
title: '多选题',
active: false,
},
{
id: 4,
title: '判断题',
active: false,
},
// {
// id: 2,
// title: '单选题',
// active: false,
// },
// {
// id: 3,
// title: '多选题',
// active: false,
// },
// {
// id: 4,
// title: '判断题',
// active: false,
// },
];
/**