lsc 3 maanden geleden
bovenliggende
commit
8cdc802159

+ 8 - 0
src/components/pages/aiAddCourse/addCourse.vue

@@ -7636,6 +7636,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({
@@ -7687,6 +7688,7 @@ const getFile = (url) => {
 };
 
 export default {
+  mixins: [ myMixin ],
   components: {
     EditorBar,
     Mind,
@@ -13353,8 +13355,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);
         });
@@ -13427,8 +13431,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);
         });
@@ -13628,8 +13634,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);
         });

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

@@ -7082,6 +7082,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({
@@ -7133,6 +7134,7 @@ const getFile = (url) => {
 };
 
 export default {
+  mixins: [ myMixin ],
   components: {
     EditorBar,
     Mind,
@@ -12553,8 +12555,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);
         });
@@ -12627,8 +12631,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);
         });
@@ -12828,8 +12834,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);
         });

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

@@ -8171,6 +8171,7 @@ import interVideo from "../interVideo/index.vue";
 import englishRight from "./commpont/englishRight.vue";
 import EnglishVoice from "../EnglishVoice/index.vue";
 import appDialog from "../components/appDialog.vue";
+import { myMixin } from "@/mixins/mixin.js"
 
 var OpenCC = require("opencc-js");
 let converter = OpenCC.Converter({
@@ -8179,6 +8180,7 @@ let converter = OpenCC.Converter({
 });
 
 export default {
+  mixins: [ myMixin ],
   components: {
     EditorBar,
     Mind,
@@ -10555,8 +10557,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);
         });
@@ -10606,8 +10610,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);
         });
@@ -10707,8 +10713,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);
         });

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

@@ -7471,6 +7471,7 @@ import englishRight from "../components/englishRight.vue";
 import evaBox from "../evaBox/index.vue";
 import EnglishVoice from "../EnglishVoice/index.vue";
 import appDialog from '../components/appDialog.vue'
+import { myMixin } from "@/mixins/mixin.js"
 
 var OpenCC = require("opencc-js");
 let converter = OpenCC.Converter({
@@ -7479,6 +7480,7 @@ let converter = OpenCC.Converter({
 })
 
 export default {
+  mixins: [ myMixin ],
   components: {
     EditorBar,
     Mind,
@@ -10385,8 +10387,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);
         });
@@ -10458,8 +10462,10 @@ export default {
             type: "success",
           });
           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);
         });
@@ -10627,8 +10633,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);
         });

+ 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);
+        });
+    }
+  }
+};