Bladeren bron

课程中心埋点

11wqe1 3 maanden geleden
bovenliggende
commit
429dc1f4f1

+ 2 - 1
src/components/components/choseWorksDetailDialog.vue

@@ -1184,7 +1184,8 @@
 													<span v-if="answer.type===1" v-for="(item2,indP) in answer.label" :key="indP +'indP'">
 														<span :class="`${item2.right?'answerRight':'answerWrong'}`">{{ item2.label }}</span>
 													</span>
-													<span v-if="answer.type===2" class="answer2" :class="`${answer.isRight?'answerRightLine':'answerWrongLine'}`" v-for="item3 in answer.label" :key="answer.index+'-'+item.userid+'-2'">
+													<span v-if="answer.type===2" class="answer2" :class="`${answer.isRight?'answerRightLine':'answerWrongLine'}`" 
+                          v-for="(item3,indUi) in answer.label" :key="indUi + 'indUi2'">
 														<span :class="`${item3.right?'answerRight':'answerWrong'}`">{{ item3.label }}</span>
 													</span>
 												</span>

+ 5 - 0
src/components/courseDetail.vue

@@ -1104,6 +1104,7 @@ import scoreZong from './scoreZong/get.vue'
 
 import MarkdownIt from "markdown-it";
 import { v4 as uuidv4 } from "uuid";
+import { myMixin } from "@/mixins/mixin.js"
 
 
 var OpenCC = require("opencc-js");
@@ -1163,6 +1164,8 @@ const getFile = (url) => {
 };
 
 export default {
+  mixins: [ myMixin ],
+
   components: {
     Heatmap,
     Group,
@@ -1267,6 +1270,8 @@ export default {
 				this.insertMemorandum(`开始为<span class='variable'>${_classData.name}</span>授课`,id)
 			}
 
+      this.addOp3('1', "", { courseid: this.id,classIdL: !id ? '全部' : id ,type: "course_class_open" }, "success")
+
       if (this.courseDetail.state == 1) {
         if (this.classList.length) {
           this.goTo(

+ 11 - 5
src/components/index.vue

@@ -82,7 +82,7 @@
                     '&tType=' +
                     tType +
                     '&screenType=' +
-                    screenType
+                    screenType,item.courseId
                   )
                 ">
                 <div class="wheel">
@@ -132,7 +132,7 @@
                     '&tType=' +
                     tType +
                     '&screenType=' +
-                    screenType
+                    screenType,item.courseId
                   )
                 ">
                   立即学习
@@ -158,7 +158,7 @@
                         '&tType=' +
                         tType +
                         '&screenType=' +
-                        screenType
+                        screenType,item.courseId
                       )
                     ">
                     <div class="wheel">
@@ -208,7 +208,7 @@
                         '&tType=' +
                         tType +
                         '&screenType=' +
-                        screenType
+                        screenType,item.courseId
                       )
                     ">
                       立即学习
@@ -233,7 +233,11 @@
 </template>
 
 <script>
+import { myMixin } from "@/mixins/mixin.js"
+
 export default {
+  mixins: [ myMixin ],
+
   data() {
     return {
       zoneList: [],
@@ -298,7 +302,9 @@ export default {
       }
       this.$forceUpdate();
     },
-    goTo(path) {
+    goTo(path,id) {
+      this.addOp3('1', "", { courseid: id,type: "course_open" }, "success")
+
       this.$router.push(path);
     },
     //获取专区下的课程

+ 1 - 0
src/config/config.js

@@ -9,6 +9,7 @@ const store = new Vuex.Store({
         luyou: 1,
         userInfo: {},
         nCount: 0,
+		apiM: 'https://pbl.cocorobo.cn/api/mongo/',
         api: 'https://pbl.cocorobo.cn/api/pbl/',
         socket: "https://poll.cocorobo.cn",
         // api: 'http://localhost:7003/api/pbl/',

+ 81 - 0
src/mixins/mixin.js

@@ -0,0 +1,81 @@
+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);
+        return 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的信息
+      };
+      console.log('params',params);
+      
+      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);
+        });
+    }
+  }
+};