Просмотр исходного кода

feat: 添加创建课程学期次数限制及多语言文案

1.  新增多语言配置项ssCreateCourseLimit,适配简体中文、繁体中文、英文环境
2.  在多个课程创建跳转方法中添加学期创建次数校验逻辑,调用checkClass接口获取创建次数
3.  新增checkClass方法,针对特定机构校验用户学期创建课程的次数,超出限制则弹出错误提示
lsc 8 часов назад
Родитель
Сommit
b79a9081cb
4 измененных файлов с 61 добавлено и 9 удалено
  1. 54 6
      src/components/pages/course.vue
  2. 2 1
      src/lang/cn.json
  3. 2 1
      src/lang/en.json
  4. 3 1
      src/lang/hk.json

+ 54 - 6
src/components/pages/course.vue

@@ -440,6 +440,7 @@ import templateDialogE from "./aiEasy/templateDialog.vue";
 import { v4 as uuidv4 } from "uuid";
 import { v4 as uuidv4 } from "uuid";
 import { myMixin } from "@/mixins/mixin.js"
 import { myMixin } from "@/mixins/mixin.js"
 import backPage from "./liyuan/components/backPage.vue";
 import backPage from "./liyuan/components/backPage.vue";
+import { result } from "lodash";
 
 
 export default {
 export default {
   components: { EditorBar, CourseProblem,shareDialog,templateDialog,templateDialogE,backPage },
   components: { EditorBar, CourseProblem,shareDialog,templateDialog,templateDialogE,backPage },
@@ -645,7 +646,7 @@ export default {
       // }
       // }
       // this.$router.push(path);
       // this.$router.push(path);
     },
     },
-    goToCourse4(courseId) {
+    async goToCourse4(courseId) {
       if (courseId) {
       if (courseId) {
         this.$router.push(
         this.$router.push(
           "/newAddCourse?cid=" +
           "/newAddCourse?cid=" +
@@ -661,6 +662,11 @@ export default {
         );
         );
         this.addOp3('1', "", { courseid: courseId ,type: "course_stageMode_edit" }, "success")
         this.addOp3('1', "", { courseid: courseId ,type: "course_stageMode_edit" }, "success")
       } else {
       } else {
+        let classResult = await this.checkClass()
+        if(classResult == 1){
+          this.$message.error(this.lang.ssCreateCourseLimit)
+          return
+        }
         this.$router.push(
         this.$router.push(
           "/newAddCourse?userid=" +
           "/newAddCourse?userid=" +
           this.userid +
           this.userid +
@@ -728,7 +734,7 @@ export default {
       }
       }
       this.addOp3('1', "", {  type: "course_aiMode_createClick" }, "success")
       this.addOp3('1', "", {  type: "course_aiMode_createClick" }, "success")
     },
     },
-    goToCourse5(courseId) {
+    async goToCourse5(courseId) {
       if (courseId) {
       if (courseId) {
         this.$router.push(
         this.$router.push(
           "/aiAddCourse?cid=" +
           "/aiAddCourse?cid=" +
@@ -744,6 +750,11 @@ export default {
         );
         );
         this.addOp3('1', "", { courseid: courseId ,type: "course_aiMode_edit" }, "success")
         this.addOp3('1', "", { courseid: courseId ,type: "course_aiMode_edit" }, "success")
       } else {
       } else {
+        let classResult = await this.checkClass()
+        if(classResult == 1){
+          this.$message.error(this.lang.ssCreateCourseLimit)
+          return
+        }
         this.$router.push(
         this.$router.push(
           "/aiAddCourse?userid=" +
           "/aiAddCourse?userid=" +
           this.userid +
           this.userid +
@@ -802,7 +813,7 @@ export default {
       }
       }
       this.addOp3('1', "", { type: "course_aiEasyMode_createClick" }, "success")
       this.addOp3('1', "", { type: "course_aiEasyMode_createClick" }, "success")
     },
     },
-    goToCourse6(courseId){
+    async goToCourse6(courseId){
       if (courseId) {
       if (courseId) {
         this.$router.push(
         this.$router.push(
           "/addCourseEAi?cid=" +
           "/addCourseEAi?cid=" +
@@ -818,6 +829,11 @@ export default {
         );
         );
         this.addOp3('1', "", { courseid: courseId ,type: "course_aiEasyMode_edit" }, "success")
         this.addOp3('1', "", { courseid: courseId ,type: "course_aiEasyMode_edit" }, "success")
       } else {
       } else {
+        let classResult = await this.checkClass()
+        if(classResult == 1){
+          this.$message.error(this.lang.ssCreateCourseLimit)
+          return
+        }
         this.$router.push(
         this.$router.push(
           "/addCourseEAi?userid=" +
           "/addCourseEAi?userid=" +
           this.userid +
           this.userid +
@@ -857,7 +873,7 @@ export default {
       }
       }
       this.getCourse();
       this.getCourse();
     },
     },
-    goToCourse2(courseId) {
+    async goToCourse2(courseId) {
       if (courseId) {
       if (courseId) {
         this.$router.push(
         this.$router.push(
           "/course/addCourseT?cid=" +
           "/course/addCourseT?cid=" +
@@ -872,6 +888,11 @@ export default {
           this.role
           this.role
         );
         );
       } else {
       } else {
+        let classResult = await this.checkClass()
+        if(classResult == 1){
+          this.$message.error(this.lang.ssCreateCourseLimit)
+          return
+        }
         this.$router.push(
         this.$router.push(
           "/course/addCourseT?userid=" +
           "/course/addCourseT?userid=" +
           this.userid +
           this.userid +
@@ -884,7 +905,7 @@ export default {
         );
         );
       }
       }
     },
     },
-    goToCourse3(courseId) {
+    async goToCourse3(courseId) {
       if (courseId) {
       if (courseId) {
         this.$router.push(
         this.$router.push(
           "/course/addCourseE?cid=" +
           "/course/addCourseE?cid=" +
@@ -900,6 +921,11 @@ export default {
         );
         );
         this.addOp3('1', "", { courseid: courseId ,type: "course_easyMode_edit" }, "success")
         this.addOp3('1', "", { courseid: courseId ,type: "course_easyMode_edit" }, "success")
       } else {
       } else {
+        let classResult = await this.checkClass()
+        if(classResult == 1){
+          this.$message.error(this.lang.ssCreateCourseLimit)
+          return
+        }
         this.$router.push(
         this.$router.push(
           "/course/addCourseE?userid=" +
           "/course/addCourseE?userid=" +
           this.userid +
           this.userid +
@@ -1574,7 +1600,7 @@ export default {
           console.error(err);
           console.error(err);
         });
         });
     },
     },
-    goToPptEasy(courseId){
+    async goToPptEasy(courseId){
       if (courseId) {
       if (courseId) {
           let psOrg = ['311882ee-4e86-11f1-9985-005056924926']
           let psOrg = ['311882ee-4e86-11f1-9985-005056924926']
           let route = '/pptEasy'
           let route = '/pptEasy'
@@ -1596,6 +1622,12 @@ export default {
         );
         );
         this.addOp3('1', "", { courseid: courseId ,type: "course_pptEasyMode_edit" }, "success")
         this.addOp3('1', "", { courseid: courseId ,type: "course_pptEasyMode_edit" }, "success")
       } else {
       } else {
+        let classResult = await this.checkClass()
+        if(classResult == 1){
+          this.$message.error(this.lang.ssCreateCourseLimit)
+          return
+        }
+        
         let psOrg = ['311882ee-4e86-11f1-9985-005056924926']
         let psOrg = ['311882ee-4e86-11f1-9985-005056924926']
         let route = '/pptEasy'
         let route = '/pptEasy'
         if(psOrg.includes(this.org)){
         if(psOrg.includes(this.org)){
@@ -1614,6 +1646,22 @@ export default {
         this.addOp3('1', "", { type: "course_pptEasyMode_createClick" }, "success")
         this.addOp3('1', "", { type: "course_pptEasyMode_createClick" }, "success")
       }
       }
     },
     },
+    async checkClass(){
+      if(this.org == '16ace517-b5c7-4168-a9bb-a9e0035df840'){
+        let params = {
+          userid: this.userid,
+        };
+        try {
+          const res = await this.ajax.get(this.$store.state.api + "checkClass", params)
+          let data = res.data[0][0]
+          return data
+        } catch (err) {
+          console.error(err);
+        }
+      }else {
+        return 2
+      }
+    },
   },
   },
   created() {
   created() {
     if (this.role == "1") {
     if (this.role == "1") {

+ 2 - 1
src/lang/cn.json

@@ -2066,5 +2066,6 @@
   "ssReturnModify": "返回修改",
   "ssReturnModify": "返回修改",
   "ssPleaseWait": "请稍后再试",
   "ssPleaseWait": "请稍后再试",
   "ssFileTooBig":"上传文件大小不能超过20MB, 请重新上传",
   "ssFileTooBig":"上传文件大小不能超过20MB, 请重新上传",
-  "ssAIAssistantTip":"开启后,学生提交作业将弹出 AI 助手,并基于题目引导学生检查与反思。"
+  "ssAIAssistantTip":"开启后,学生提交作业将弹出 AI 助手,并基于题目引导学生检查与反思。",
+  "ssCreateCourseLimit":"创建课程每学期仅创建5次"
 }
 }

+ 2 - 1
src/lang/en.json

@@ -2065,5 +2065,6 @@
   "ssReturnModify": "Return to modify",
   "ssReturnModify": "Return to modify",
   "ssPleaseWait": "Please wait, try again later.",
   "ssPleaseWait": "Please wait, try again later.",
   "ssFileTooBig":"The uploaded file size cannot exceed 20MB, please re-upload.",
   "ssFileTooBig":"The uploaded file size cannot exceed 20MB, please re-upload.",
-  "ssAIAssistantTip":"After enabling, students will be able to use the AI assistant and check with the help of the questions."
+  "ssAIAssistantTip":"After enabling, students will be able to use the AI assistant and check with the help of the questions.",
+  "ssCreateCourseLimit":"Create course limit semester 5 times"
 }
 }

+ 3 - 1
src/lang/hk.json

@@ -2066,5 +2066,7 @@
   "ssReturnModify": "返回修改",
   "ssReturnModify": "返回修改",
   "ssPleaseWait": "請稍後再試",
   "ssPleaseWait": "請稍後再試",
   "ssFileTooBig":"上傳文件大小不能超過20MB, 請重新上傳",
   "ssFileTooBig":"上傳文件大小不能超過20MB, 請重新上傳",
-  "ssAIAssistantTip":"開啟後,學生提交作業將彈出 AI 助手,並根據題目引導學生檢查與反思。"
+  "ssAIAssistantTip":"開啟後,學生提交作業將彈出 AI 助手,並根據題目引導學生檢查與反思。",
+  "ssCreateCourseLimit":"創建課程每学期僅創建5次"
 }
 }
+