|
|
@@ -1,5 +1,5 @@
|
|
|
import { useIntl } from "react-intl";
|
|
|
-import { Button, Dropdown, Tag, message } from "antd";
|
|
|
+import { Dropdown, Tag, Tooltip, Typography, message } from "antd";
|
|
|
import { ActionType, ProList } from "@ant-design/pro-components";
|
|
|
import { ExportOutlined } from "@ant-design/icons";
|
|
|
|
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
ICourseResponse,
|
|
|
TCourseMemberAction,
|
|
|
TCourseMemberStatus,
|
|
|
+ TCourseRole,
|
|
|
actionMap,
|
|
|
} from "../api/Course";
|
|
|
import { ItemType } from "antd/lib/menu/hooks/useItems";
|
|
|
@@ -34,7 +35,7 @@ export interface ICourseMember {
|
|
|
name?: string;
|
|
|
tag?: IRoleTag[];
|
|
|
image: string;
|
|
|
- role?: string;
|
|
|
+ role?: TCourseRole;
|
|
|
channel?: IChannel;
|
|
|
startExp?: number;
|
|
|
endExp?: number;
|
|
|
@@ -53,6 +54,7 @@ const CourseMemberListWidget = ({ courseId, onSelect }: IWidget) => {
|
|
|
const [canManage, setCanManage] = useState(false);
|
|
|
const [course, setCourse] = useState<ICourseDataResponse>();
|
|
|
const ref = useRef<ActionType>();
|
|
|
+ const { Text } = Typography;
|
|
|
|
|
|
useEffect(() => {
|
|
|
if (courseId) {
|
|
|
@@ -103,8 +105,20 @@ const CourseMemberListWidget = ({ courseId, onSelect }: IWidget) => {
|
|
|
render(dom, entity, index, action, schema) {
|
|
|
return (
|
|
|
<div>
|
|
|
- {"channel:"}
|
|
|
- {entity.channel?.name ?? "未绑定"}
|
|
|
+ {entity.role === "student" ? (
|
|
|
+ <>
|
|
|
+ {"channel:"}
|
|
|
+ {entity.channel?.name ?? (
|
|
|
+ <Text type="danger">
|
|
|
+ {intl.formatMessage({
|
|
|
+ id: `course.channel.unbound`,
|
|
|
+ })}
|
|
|
+ </Text>
|
|
|
+ )}
|
|
|
+ </>
|
|
|
+ ) : (
|
|
|
+ <></>
|
|
|
+ )}
|
|
|
</div>
|
|
|
);
|
|
|
},
|
|
|
@@ -298,20 +312,22 @@ const CourseMemberListWidget = ({ courseId, onSelect }: IWidget) => {
|
|
|
search: true,
|
|
|
}}
|
|
|
toolBarRender={() => [
|
|
|
- <a
|
|
|
- href={`${API_HOST}/api/v2/course-member-export?course_id=${courseId}`}
|
|
|
- target="_blank"
|
|
|
- key="export"
|
|
|
- rel="noreferrer"
|
|
|
- >
|
|
|
- <ExportOutlined />
|
|
|
- </a>,
|
|
|
<CourseInvite
|
|
|
courseId={courseId}
|
|
|
onCreated={() => {
|
|
|
ref.current?.reload();
|
|
|
}}
|
|
|
/>,
|
|
|
+ <Tooltip title="导出成员列表">
|
|
|
+ <a
|
|
|
+ href={`${API_HOST}/api/v2/course-member-export?course_id=${courseId}`}
|
|
|
+ target="_blank"
|
|
|
+ key="export"
|
|
|
+ rel="noreferrer"
|
|
|
+ >
|
|
|
+ <ExportOutlined />
|
|
|
+ </a>
|
|
|
+ </Tooltip>,
|
|
|
]}
|
|
|
/>
|
|
|
</>
|