import { Button, Card, Space, Switch } from "antd";
import { Link, useParams } from "react-router";
import { useAppSelector } from "../../hooks";
import { courseUser } from "../../reducers/course-user";
import SelectChannel from "../course/SelectChannel";
import { currentUser as _currentUser } from "../../reducers/current-user";
import { courseInfo } from "../../reducers/current-course";
interface IWidgetExerciseCtl {
id?: string;
title?: string;
channel?: string;
children?: React.ReactNode;
}
const ExerciseCtl = ({ id, title, channel, children }: IWidgetExerciseCtl) => {
const { type } = useParams(); //url 参数
const cardTitle = title ? title : "练习";
const user = useAppSelector(courseUser);
const currUser = useAppSelector(_currentUser);
const currCourse = useAppSelector(courseInfo);
let exeButton = <>>;
switch (user?.role) {
case "student":
switch (type) {
case "textbook":
if (typeof user.channelId === "string") {
exeButton = (
);
} else {
exeButton = ;
}
break;
default:
exeButton = (
问题筛选
{
console.log(`switch to ${checked}`);
}}
/>
对答案
{
console.log(`switch to ${checked}`);
}}
/>
);
break;
}
break;
case "assistant":
if (type === "textbook") {
exeButton = (
);
}
break;
default:
break;
}
return (
{children}
);
};
interface IWidget {
props: string;
children?: React.ReactNode;
}
const Widget = ({ props, children }: IWidget) => {
const prop: IWidgetExerciseCtl = JSON.parse(atob(props));
return {children};
};
export default Widget;