Browse Source

Merge pull request #2091 from visuddhinanda/agile

未绑定显示未红色
visuddhinanda 1 year ago
parent
commit
e130116ead

+ 28 - 12
dashboard/src/components/course/CourseMemberList.tsx

@@ -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>,
         ]}
       />
     </>

+ 34 - 34
dashboard/src/components/course/RolePower.ts

@@ -329,79 +329,79 @@ const managerData: IAction[] = [
   {
     mode: ["manual", "invite"],
     status: "none",
-    before: ["invite"],
-    duration: ["invite"],
-    after: ["invite"],
+    before: [],
+    duration: [],
+    after: [],
   },
   {
     mode: ["manual", "invite"],
     status: "invited",
-    before: ["revoke", "invite"],
-    duration: ["invite"],
-    after: ["invite"],
+    before: ["revoke"],
+    duration: [],
+    after: [],
   },
   {
     mode: ["manual", "invite"],
     status: "revoked",
-    before: ["invite"],
-    duration: ["invite"],
-    after: ["invite"],
+    before: [],
+    duration: [],
+    after: [],
   },
   {
     mode: ["manual", "invite"],
     status: "canceled",
-    signUp: ["invite"],
-    before: ["invite"],
-    duration: ["invite"],
-    after: ["invite"],
+    signUp: [],
+    before: [],
+    duration: [],
+    after: [],
   },
   {
     mode: ["manual", "invite"],
     status: "accepted",
-    before: ["invite"],
-    duration: ["block", "invite"],
-    after: ["invite"],
+    before: [],
+    duration: ["block"],
+    after: [],
   },
   {
     mode: ["manual", "invite"],
     status: "rejected",
-    before: ["invite"],
-    duration: ["invite"],
-    after: ["invite"],
+    before: [],
+    duration: [],
+    after: [],
   },
   {
     mode: ["manual", "invite"],
     status: "blocked",
-    before: ["invite"],
-    duration: ["invite"],
-    after: ["invite"],
+    before: [],
+    duration: [],
+    after: [],
   },
   {
     mode: ["manual", "invite"],
     status: "applied",
-    before: ["accept", "reject", "invite"],
-    duration: ["invite"],
-    after: ["invite"],
+    before: ["accept", "reject"],
+    duration: [],
+    after: [],
   },
   {
     mode: ["manual", "invite"],
     status: "agreed",
-    before: ["invite"],
-    duration: ["block", "invite"],
-    after: ["invite"],
+    before: [],
+    duration: ["block"],
+    after: [],
   },
   {
     mode: ["manual", "invite"],
     status: "disagreed",
-    before: ["invite"],
-    duration: ["invite"],
-    after: ["invite"],
+    before: [],
+    duration: [],
+    after: [],
   },
   {
     mode: ["manual", "invite"],
     status: "left",
-    before: ["invite"],
-    duration: ["invite"],
-    after: ["invite"],
+    before: [],
+    duration: [],
+    after: [],
   },
 ];

+ 1 - 0
dashboard/src/locales/en-US/course/index.ts

@@ -62,6 +62,7 @@ const items = {
   "course.table.count.progressing.title": "待审核",
   "course.timeline.all": "全部参课记录",
   "course.timeline.current": "当前课程",
+  "course.channel.unbound": "Unbound",
 };
 
 export default items;

+ 1 - 0
dashboard/src/locales/zh-Hans/course/index.ts

@@ -60,6 +60,7 @@ const items = {
   "course.table.count.progressing.title": "待审核",
   "course.timeline.all": "全部参课记录",
   "course.timeline.current": "当前课程",
+  "course.channel.unbound": "未绑定",
 };
 
 export default items;