Browse Source

根据类型判断submit按钮是否显示

natasha 1 năm trước cách đây
mục cha
commit
885bc17501
2 tập tin đã thay đổi với 33 bổ sung3 xóa
  1. 14 0
      src/views/bookView.vue
  2. 19 3
      src/views/courseView.vue

+ 14 - 0
src/views/bookView.vue

@@ -74,6 +74,7 @@
             :change-id="changeId"
             :change-id="changeId"
             :themeColor="themeColor"
             :themeColor="themeColor"
             :isShowTitle="true"
             :isShowTitle="true"
+            :isAnswerItemShow="isAnswerItemShow"
           />
           />
         </template>
         </template>
         <template v-if="category == 'NNPE'">
         <template v-if="category == 'NNPE'">
@@ -86,6 +87,7 @@
             :change-id="changeId"
             :change-id="changeId"
             :themeColor="themeColor"
             :themeColor="themeColor"
             :isShowTitle="true"
             :isShowTitle="true"
+            :isAnswerItemShow="true"
           />
           />
         </template>
         </template>
         <template v-if="category == 'RLC'">
         <template v-if="category == 'RLC'">
@@ -99,6 +101,7 @@
             :themeColor="themeColor"
             :themeColor="themeColor"
             :isShowTitle="true"
             :isShowTitle="true"
             :bookFontSize="bookFontSize"
             :bookFontSize="bookFontSize"
+            :isAnswerItemShow="isAnswerItemShow"
           />
           />
         </template>
         </template>
       </div>
       </div>
@@ -118,6 +121,7 @@ import { getContent } from "@/api/ajax";
 import Cookies from "js-cookie";
 import Cookies from "js-cookie";
 // import Preview from '@/componentsAnswer/PreviewAnswer.vue'
 // import Preview from '@/componentsAnswer/PreviewAnswer.vue'
 import Preview from "@/components/Preview";
 import Preview from "@/components/Preview";
+import { getToken } from "../utils/auth";
 export default {
 export default {
   name: "CourseView",
   name: "CourseView",
   components: {
   components: {
@@ -143,12 +147,22 @@ export default {
       FatherTreeData: null,
       FatherTreeData: null,
       themeColor: "",
       themeColor: "",
       chapterFree: "false", // 课件免费观看
       chapterFree: "false", // 课件免费观看
+      isAnswerItemShow: false,
     };
     };
   },
   },
   mounted() {
   mounted() {
     // const _this = this
     // const _this = this
     // _this.bookId = this.$route.query.bookId
     // _this.bookId = this.$route.query.bookId
   },
   },
+  created(){
+    const _this = this
+    let userInfor = JSON.parse(getToken());
+    if (userInfor && userInfor.user_type == "TEACHER") {
+      _this.isAnswerItemShow = true;
+    } else {
+      _this.isAnswerItemShow = false;
+    }
+  },
   methods: {
   methods: {
     changeTreeData(val) {
     changeTreeData(val) {
       this.FatherTreeData =
       this.FatherTreeData =

+ 19 - 3
src/views/courseView.vue

@@ -83,10 +83,10 @@
             :themeColor="themeColor"
             :themeColor="themeColor"
             :isShowTitle="true"
             :isShowTitle="true"
             :TaskModel="TaskModel"
             :TaskModel="TaskModel"
-            :isShowSave="false"
+            :isShowSave="true"
             @finishTaskMaterial="finishTaskMaterial"
             @finishTaskMaterial="finishTaskMaterial"
             :bookAnswerContent="bookAnswerContent"
             :bookAnswerContent="bookAnswerContent"
-            :isAnswerItemShow="true"
+            :isAnswerItemShow="isAnswerItemShow"
           />
           />
         </template>
         </template>
         <template v-if="category == 'NNPE'">
         <template v-if="category == 'NNPE'">
@@ -100,6 +100,10 @@
             :themeColor="themeColor"
             :themeColor="themeColor"
             :isShowTitle="true"
             :isShowTitle="true"
             :isAnswerItemShow="true"
             :isAnswerItemShow="true"
+            :TaskModel="TaskModel"
+            :isShowSave="true"
+            @finishTaskMaterial="finishTaskMaterial"
+            :bookAnswerContent="bookAnswerContent"
           />
           />
         </template>
         </template>
         <template v-if="category == 'RLC'">
         <template v-if="category == 'RLC'">
@@ -113,7 +117,11 @@
             :themeColor="themeColor"
             :themeColor="themeColor"
             :isShowTitle="true"
             :isShowTitle="true"
             :bookFontSize="bookFontSize"
             :bookFontSize="bookFontSize"
-            :isAnswerItemShow="true"
+            :isAnswerItemShow="isAnswerItemShow"
+            :TaskModel="TaskModel"
+            :isShowSave="true"
+            @finishTaskMaterial="finishTaskMaterial"
+            :bookAnswerContent="bookAnswerContent"
           />
           />
         </template>
         </template>
       </div>
       </div>
@@ -132,6 +140,7 @@ import { getContent,getLogin } from "@/api/ajax";
 import Cookies from "js-cookie";
 import Cookies from "js-cookie";
 // import Preview from '@/componentsAnswer/PreviewAnswer.vue'
 // import Preview from '@/componentsAnswer/PreviewAnswer.vue'
 import Preview from "@/components/Preview";
 import Preview from "@/components/Preview";
+import { getToken } from "../utils/auth";
 export default {
 export default {
   name: "CourseView",
   name: "CourseView",
   directives: {
   directives: {
@@ -239,6 +248,7 @@ export default {
           id: "002-20220429-18-KIOM0VEXLY",
           id: "002-20220429-18-KIOM0VEXLY",
         },
         },
       ],
       ],
+      isAnswerItemShow: false,
     };
     };
   },
   },
   created() {
   created() {
@@ -285,6 +295,12 @@ export default {
             type: "warning",
             type: "warning",
         });
         });
     }
     }
+    let userInfor = JSON.parse(getToken());
+    if (userInfor && userInfor.user_type == "TEACHER") {
+      _this.isAnswerItemShow = true;
+    } else {
+      _this.isAnswerItemShow = false;
+    }
   },
   },
   mounted() {},
   mounted() {},
   methods: {
   methods: {