Browse Source

未绑定显示未红色

visuddhinanda 1 year ago
parent
commit
f0fcecb753
1 changed files with 18 additions and 4 deletions
  1. 18 4
      dashboard/src/components/course/CourseMemberList.tsx

+ 18 - 4
dashboard/src/components/course/CourseMemberList.tsx

@@ -1,5 +1,5 @@
 import { useIntl } from "react-intl";
 import { useIntl } from "react-intl";
-import { Dropdown, Tag, Tooltip, message } from "antd";
+import { Dropdown, Tag, Tooltip, Typography, message } from "antd";
 import { ActionType, ProList } from "@ant-design/pro-components";
 import { ActionType, ProList } from "@ant-design/pro-components";
 import { ExportOutlined } from "@ant-design/icons";
 import { ExportOutlined } from "@ant-design/icons";
 
 
@@ -12,6 +12,7 @@ import {
   ICourseResponse,
   ICourseResponse,
   TCourseMemberAction,
   TCourseMemberAction,
   TCourseMemberStatus,
   TCourseMemberStatus,
+  TCourseRole,
   actionMap,
   actionMap,
 } from "../api/Course";
 } from "../api/Course";
 import { ItemType } from "antd/lib/menu/hooks/useItems";
 import { ItemType } from "antd/lib/menu/hooks/useItems";
@@ -34,7 +35,7 @@ export interface ICourseMember {
   name?: string;
   name?: string;
   tag?: IRoleTag[];
   tag?: IRoleTag[];
   image: string;
   image: string;
-  role?: string;
+  role?: TCourseRole;
   channel?: IChannel;
   channel?: IChannel;
   startExp?: number;
   startExp?: number;
   endExp?: number;
   endExp?: number;
@@ -53,6 +54,7 @@ const CourseMemberListWidget = ({ courseId, onSelect }: IWidget) => {
   const [canManage, setCanManage] = useState(false);
   const [canManage, setCanManage] = useState(false);
   const [course, setCourse] = useState<ICourseDataResponse>();
   const [course, setCourse] = useState<ICourseDataResponse>();
   const ref = useRef<ActionType>();
   const ref = useRef<ActionType>();
+  const { Text } = Typography;
 
 
   useEffect(() => {
   useEffect(() => {
     if (courseId) {
     if (courseId) {
@@ -103,8 +105,20 @@ const CourseMemberListWidget = ({ courseId, onSelect }: IWidget) => {
             render(dom, entity, index, action, schema) {
             render(dom, entity, index, action, schema) {
               return (
               return (
                 <div>
                 <div>
-                  {"channel:"}
-                  {entity.channel?.name ?? "未绑定"}
+                  {entity.role === "student" ? (
+                    <>
+                      {"channel:"}
+                      {entity.channel?.name ?? (
+                        <Text type="danger">
+                          {intl.formatMessage({
+                            id: `course.channel.unbound`,
+                          })}
+                        </Text>
+                      )}
+                    </>
+                  ) : (
+                    <></>
+                  )}
                 </div>
                 </div>
               );
               );
             },
             },