浏览代码

作业列表去掉答案

visuddhinanda 1 年之前
父节点
当前提交
3afa19f9ce
共有 1 个文件被更改,包括 17 次插入3 次删除
  1. 17 3
      dashboard/src/components/template/SentEdit/SentWbw.tsx

+ 17 - 3
dashboard/src/components/template/SentEdit/SentWbw.tsx

@@ -37,6 +37,8 @@ const SentWbwWidget = ({
 
 
   const myCourse = useAppSelector(courseUser);
   const myCourse = useAppSelector(courseUser);
 
 
+  const isCourse = myCourse && course;
+
   const load = () => {
   const load = () => {
     let url = `/v2/wbw-sentence?view=sent-can-read`;
     let url = `/v2/wbw-sentence?view=sent-can-read`;
     url += `&book=${book}&para=${para}&wordStart=${wordStart}&wordEnd=${wordEnd}`;
     url += `&book=${book}&para=${para}&wordStart=${wordStart}&wordEnd=${wordEnd}`;
@@ -63,12 +65,24 @@ const SentWbwWidget = ({
       }
       }
     }
     }
 
 
-    console.log("wbw sentence api request", url);
+    console.info("wbw sentence api request", url);
     get<ISentenceWbwListResponse>(url)
     get<ISentenceWbwListResponse>(url)
       .then((json) => {
       .then((json) => {
+        console.info("wbw sentence api response", json);
         if (json.ok) {
         if (json.ok) {
-          console.log("sim load", json.data.count);
-          setSentData(json.data.rows);
+          console.debug("wbw sentence course", course);
+          if (course && myCourse && myCourse.role !== "student") {
+            setSentData(
+              json.data.rows.filter((value) =>
+                value.translation
+                  ? value.translation[0].channel.id !== course.channelId
+                  : true
+              )
+            );
+          } else {
+            setSentData(json.data.rows);
+          }
+
           if (myCourse && course) {
           if (myCourse && course) {
             const answerData = json.data.rows.find((value) =>
             const answerData = json.data.rows.find((value) =>
               value.origin
               value.origin