lsc hai 3 días
pai
achega
91ac3a1bd8

+ 9 - 1
src/components/pages/aiAddCourse/addCourse.vue

@@ -7594,6 +7594,7 @@ import MindTask from "./jsmind2";
 import ConvertApi from 'convertapi-js'
 let convertApi = ConvertApi.auth('secret_U1EO5rhgMCnoBnBT')
 import appDialog from '../components/appDialog.vue'
+import { myMixin } from "@/mixins/mixin.js"
 
 var OpenCC = require("opencc-js");
 let converter = OpenCC.Converter({
@@ -7645,7 +7646,8 @@ const getFile = (url) => {
 };
 
 export default {
-  components: {
+  mixins: [ myMixin ],
+  components: {  
     EditorBar,
     Mind,
     Time,
@@ -13311,8 +13313,10 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
           if(type == 3){
             this.steps = 4
           }
+          this.addOp3('1', "", { courseid: this.courseId ,type: "course_aiMode_clickUpload" }, "success")
         })
         .catch((err) => {
+          this.addOp3('1', "", { courseid: this.courseId ,type: "course_aiMode_clickUpload" }, err)
           this.$message.error("网络不佳");
           console.error(err);
         });
@@ -13385,8 +13389,10 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
           });
           this.courseId = this.cid;
           this.addtips();
+          this.addOp3('1', "", { courseid: this.courseId ,type: "course_aiMode_clickUpload" }, "success")
         })
         .catch((err) => {
+          this.addOp3('1', "", { courseid: this.courseId ,type: "course_aiMode_clickUpload" }, err)
           this.$message.error("网络不佳");
           console.error(err);
         });
@@ -13586,8 +13592,10 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
           this.number = this.nbOrder;
           this.courseId = this.cid;
           this.addtips()
+          this.addOp3('1', "", { courseid: this.courseId ,type: "course_aiMode_clickUpload" }, "success")
         })
         .catch((err) => {
+          this.addOp3('1', "", { courseid: this.courseId ,type: "course_aiMode_clickUpload" }, err)
           this.$message.error("网络不佳");
           console.error(err);
         });

+ 6 - 0
src/components/pages/aiEasy/addCourse.vue

@@ -12526,8 +12526,10 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
           if(type == 3){
             this.steps = 4
           }
+          this.addOp3('1', "", { courseid: this.courseId ,type: "course_aiEasyMode_clickUpload" }, "success")
         })
         .catch((err) => {
+          this.addOp3('1', "", { courseid: this.courseId ,type: "course_aiEasyMode_clickUpload" }, err)
           this.$message.error("网络不佳");
           console.error(err);
         });
@@ -12600,8 +12602,10 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
           });
           this.courseId = this.cid;
           this.addtips();
+          this.addOp3('1', "", { courseid: this.courseId ,type: "course_aiEasyMode_clickUpload" }, "success")
         })
         .catch((err) => {
+          this.addOp3('1', "", { courseid: this.courseId ,type: "course_aiEasyMode_clickUpload" }, err)
           this.$message.error("网络不佳");
           console.error(err);
         });
@@ -12801,8 +12805,10 @@ ${_this.unitJson[0].chapterInfo[0].taskJson[index].taskDetail3.replaceAll('#',''
           this.number = this.nbOrder;
           this.courseId = this.cid;
           this.addtips()
+          this.addOp3('1', "", { courseid: this.courseId ,type: "course_aiEasyMode_clickUpload" }, "success")
         })
         .catch((err) => {
+          this.addOp3('1', "", { courseid: this.courseId ,type: "course_aiEasyMode_clickUpload" }, err)
           this.$message.error("网络不佳");
           console.error(err);
         });

+ 25 - 0
src/components/pages/course.vue

@@ -420,9 +420,11 @@ import shareDialog from './dialog/shareDialog.vue'
 import templateDialog from "./aiAddCourse/templateDialog.vue";
 import templateDialogE from "./aiEasy/templateDialog.vue";
 import { v4 as uuidv4 } from "uuid";
+import { myMixin } from "@/mixins/mixin.js"
 
 export default {
   components: { EditorBar, CourseProblem,shareDialog,templateDialog,templateDialogE },
+  mixins: [ myMixin ],
   data() {
     return {
       itemCount: 1,
@@ -619,6 +621,7 @@ export default {
           "&role=" +
           this.role
         );
+        this.addOp3('1', "", { courseid: courseId ,type: "course_stageMode_edit" }, "success")
       } else {
         this.$router.push(
           "/newAddCourse?userid=" +
@@ -630,6 +633,7 @@ export default {
           "&role=" +
           this.role
         );
+        this.addOp3('1', "", { type: "course_stageMode_createClick" }, "success")
       }
       // this.$router.push(path);
     },
@@ -653,6 +657,7 @@ export default {
           "&templateid=" +
           tid 
         );
+      this.addOp3('1', "", { type: "course_aiStageMode_createClick" }, "success")
     },
     goToCourseTemplate2(tid){
       if(tid){
@@ -683,6 +688,7 @@ export default {
           "&istemplate=1"
         );
       }
+      this.addOp3('1', "", {  type: "course_aiMode_createClick" }, "success")
     },
     goToCourse5(courseId) {
       if (courseId) {
@@ -698,6 +704,7 @@ export default {
           "&role=" +
           this.role
         );
+        this.addOp3('1', "", { courseid: courseId ,type: "course_aiMode_edit" }, "success")
       } else {
         this.$router.push(
           "/aiAddCourse?userid=" +
@@ -755,6 +762,7 @@ export default {
           "&istemplate=1"
         );
       }
+      this.addOp3('1', "", { type: "course_aiEasyMode_createClick" }, "success")
     },
     goToCourse6(courseId){
       if (courseId) {
@@ -770,6 +778,7 @@ export default {
           "&role=" +
           this.role
         );
+        this.addOp3('1', "", { courseid: courseId ,type: "course_aiEasyMode_edit" }, "success")
       } else {
         this.$router.push(
           "/addCourseEAi?userid=" +
@@ -851,6 +860,7 @@ export default {
           "&role=" +
           this.role
         );
+        this.addOp3('1', "", { courseid: courseId ,type: "course_easyMode_edit" }, "success")
       } else {
         this.$router.push(
           "/course/addCourseE?userid=" +
@@ -862,6 +872,7 @@ export default {
           "&role=" +
           this.role
         );
+        this.addOp3('1', "", { type: "course_easyMode_createClick" }, "success")
       }
     },
     tableRowClassName({ row, rowIndex }) {
@@ -881,6 +892,20 @@ export default {
        window.topU.postMessage({ cid: cid, screenType: "2" }, "*");
     },
     get(item) {
+      let _str = ""
+      if(item.state == 1){
+        _str = "course_stageMode_open"
+      }if(item.state == 2){
+        _str = "course_taskMode_open"
+      }if(item.state == 3){
+        _str = "course_easyMode_open"
+      }if(item.state == 5){
+        _str = "course_aiMode_open"
+      }if(item.state == 6){
+        _str = "course_aiEasyMode_open"
+      }
+      this.addOp3('1', "", { courseid: item.courseId, type: _str }, "success")
+      
        window.topU.postMessage({ cid: item.courseId, screenType: "3" }, "*");
     },
     getNT(cid) {

+ 6 - 0
src/components/pages/easy/addCourse.vue

@@ -10532,8 +10532,10 @@ export default {
           this.courseUserid = this.userid;
           this.islogin = true;
           this.steps = 4;
+          this.addOp3('1', "", { courseid: this.courseId ,type: "course_easyMode_clickUpload" }, "success")
         })
         .catch(err => {
+          this.addOp3('1', "", { courseid: this.courseId ,type: "course_easyMode_clickUpload" }, err)
           this.$message.error("网络不佳");
           console.error(err);
         });
@@ -10583,8 +10585,10 @@ export default {
             type: "success"
           });
           this.courseId = this.cid;
+          this.addOp3('1', "", { courseid: this.courseId ,type: "course_easyMode_clickUpload" }, "success")
         })
         .catch(err => {
+          this.addOp3('1', "", { courseid: this.courseId ,type: "course_easyMode_clickUpload" }, err)
           this.$message.error("网络不佳");
           console.error(err);
         });
@@ -10684,8 +10688,10 @@ export default {
           this.number = this.nbOrder;
           this.courseId = this.cid;
           this.steps = 4;
+          this.addOp3('1', "", { courseid: this.courseId ,type: "course_easyMode_clickUpload" }, "success")
         })
         .catch(err => {
+          this.addOp3('1', "", { courseid: this.courseId ,type: "course_easyMode_clickUpload" }, err)
           this.$message.error("网络不佳");
           console.error(err);
         });

+ 6 - 0
src/components/pages/newCourse/addCourse.vue

@@ -10339,8 +10339,10 @@ export default {
           this.cid = res.data.courseId;
           this.courseUserid = this.userid;
           this.islogin = true;
+          this.addOp3('1', "", { courseid: this.courseId ,type: "course_stageMode_clickUpload" }, "success")
         })
         .catch((err) => {
+          this.addOp3('1', "", { courseid: this.courseId ,type: "course_stageMode_clickUpload" }, err)
           this.$message.error("网络不佳");
           console.error(err);
         });
@@ -10412,9 +10414,11 @@ export default {
             type: "success",
           });
           this.courseId = this.cid;
+          this.addOp3('1', "", { courseid: this.courseId ,type: "course_stageMode_clickUpload" }, "success")
         })
         .catch((err) => {
           this.$message.error("网络不佳");
+          this.addOp3('1', "", { courseid: this.courseId ,type: "course_stageMode_clickUpload" }, err)
           console.error(err);
         });
     },
@@ -10581,8 +10585,10 @@ export default {
           }
           this.number = this.nbOrder;
           this.courseId = this.cid;
+          this.addOp3('1', "", { courseid: this.courseId ,type: "course_stageMode_clickUpload" }, "success")
         })
         .catch((err) => {
+          this.addOp3('1', "", { courseid: this.courseId ,type: "course_stageMode_clickUpload" }, err)
           this.$message.error("网络不佳");
           console.error(err);
         });

+ 1 - 0
src/config/config.js

@@ -10,6 +10,7 @@ const store = new Vuex.Store({
         userInfo: {},
         nCount: 0,
         report:"",
+		apiM: 'https://pbl.cocorobo.cn/api/mongo/',
         api: 'https://pbl.cocorobo.cn/api/pbl/',
         // fileApi: 'http://localhost:7004/file/',
         // fileApi: 'http://10.3.16.166:7004/file/',

+ 79 - 0
src/mixins/mixin.js

@@ -0,0 +1,79 @@
+export const myMixin = {
+  data() {
+    return {
+        userJson: {}
+    };
+  },
+  methods: {
+    detectBrowser() {
+      const ua = navigator.userAgent;
+
+      // 按优先级顺序检测
+      if (ua.includes("Edg/") || ua.includes("Edge/")) {
+        return "Microsoft Edge";
+      } else if (ua.includes("Firefox")) {
+        return "Mozilla Firefox";
+      } else if (ua.includes("Trident") || ua.includes("MSIE")) {
+        return "Internet Explorer";
+      } else if (ua.includes("360EE")) {
+        return "360 Browser (极速模式)";
+      } else if (ua.includes("360SE")) {
+        return "360 Browser (安全模式)";
+      } else if (ua.includes("SLBrowser")) {
+        return "QQ Browser";
+      } else if (ua.includes("UCBrowser")) {
+        return "UC Browser";
+      } else if (ua.includes("Opera") || ua.includes("OPR/")) {
+        return "Opera";
+      } else if (ua.includes("Chrome") && !ua.includes("Edg/")) {
+        return "Google Chrome";
+      } else if (ua.includes("Safari/") && !ua.includes("Chrome")) {
+        return "Safari";
+      } else {
+        return "Other Browser";
+      }
+    },
+    async addOp3(userTime, loadTime, object, status) {
+      try {
+        if(!this.userJson || !this.userJson.accountNumber){
+            let res = await this.ajax.get(this.$store.state.api + "selectUser", {
+            userid: this.$route.query.userid
+            });
+            this.userJson = res.data[0][0]
+        }
+      } catch (e) {
+        console.log(e);
+        this.addOp3(userTime, loadTime, object, status);
+      }
+      let _time = new Date()
+        .toLocaleString("zh-CN", { hour12: false, timeZone: "Asia/Shanghai" })
+        .replace(/\//g, "-");
+      let browser = this.detectBrowser();
+      let params = {
+        userid: this.$route.query.userid,
+        username: this.userJson.username,
+        accountNumber: this.userJson.accountNumber,
+        org: this.userJson.orgName,
+        school: this.userJson.schoolName,
+        browser: browser,
+        userTime: userTime == "1" ? _time : userTime, // 使用时间 1次的就1 其次传秒
+        loadTime: loadTime, //load的时间没有就“”
+        object: JSON.stringify(object), //执行信息传json
+        status: status //成功返回success。失败返回error的信息
+      };
+      this.ajax
+        .post(this.$store.state.apiM + "updateUserData2", [params])
+        .then(res => {
+          if (res.data.status == 1) {
+            console.log("保存成功");
+          } else {
+            console.log("保存失败");
+          }
+        })
+        .catch(e => {
+          console.log("保存失败");
+          console.log(e);
+        });
+    }
+  }
+};