lsc il y a 4 jours
Parent
commit
961bf8ede0

+ 1 - 1
src/common/axios.config.js

@@ -15,7 +15,7 @@ axios.interceptors.request.use((config) => {
             'Content-Type': 'application/x-www-form-urlencoded'
         }
     }
-    if (config.url === 'https://gpt.cocorobo.cn/chat' || config.url === 'https://gpt4.cocorobo.cn/imageAnalyse' || config.url === 'https://gpt4.cocorobo.cn/create_free_assistants' || config.url === 'https://gpt4.cocorobo.cn/assistants_completion_response') {
+    if (config.url === 'https://gpt.cocorobo.cn/chat' || config.url === 'https://gpt4.cocorobo.cn/imageAnalyse' || config.url === 'https://gpt4.cocorobo.cn/create_free_assistants' || config.url === 'https://gpt4.cocorobo.cn/assistants_completion_response' || config.url.includes('/szdjg/')) {
         config.data = config.data //序列化post 参数
     }else if(config.url.indexOf('https://gpt4.cocorobo.cn/')!=-1 || config.url.indexOf('https://claude3.cocorobo.cn/')!=-1 || config.url.indexOf('https://appapi.cocorobo.cn/')!=-1){
 			config.headers = {

+ 21 - 1
src/components/easy2/studyStudent.vue

@@ -16383,6 +16383,7 @@ export default {
   },
   data() {
     return {
+      startTime: "",
       // 是否允许学生查看内容资料 2不可以 1可以
       IsStulook:false,
       homeWorkLoading:false,
@@ -26308,6 +26309,22 @@ export default {
     clearInterval(this.opertimer);
     this.opertimer = null;
     this.updateSplitScreenData(1);
+    if(this.courseDetail.userid == this.userid && this.tcid2 && this.org == '16ace517-b5c7-4168-a9bb-a9e0035df840'){
+      let endTime = new Date().toLocaleString("zh-CN", { 
+          hour12: false, 
+          timeZone: "Asia/Shanghai" 
+        }).replace(/\//g, "-")
+      let courseTime = Math.floor((new Date(endTime) - new Date(this.startTime)) / (1000 * 60))
+      this.syncClassData({
+        courseId: this.id,
+        title: this.courseDetail.title,
+        courseGrade: this.tcid2,
+        courseTime: courseTime,
+        startTime: this.startTime,
+        endTime: endTime,
+      })
+      console.log('同步数据')
+    }
   },
   computed: {
     renderedFormula2() {
@@ -26519,7 +26536,10 @@ export default {
     
   },
   mounted() {
-
+    this.startTime = new Date().toLocaleString("zh-CN", { 
+      hour12: false, 
+      timeZone: "Asia/Shanghai" 
+    }).replace(/\//g, "-")
     this.updateSplitScreenData(2);
     this.splitScreenData.myUid = uuidv4();
     document.body.addEventListener("click", e => {

+ 21 - 0
src/components/easy3/studyStudent.vue

@@ -12736,6 +12736,7 @@ export default {
   },
   data() {
     return {
+      startTime: "",
       // 是否允许学生查看内容资料 2不可以 1可以
       IsStulook:false,
       homeWorkLoading:false,
@@ -21625,6 +21626,22 @@ export default {
     clearInterval(this.opertimer);
     this.opertimer = null;
 		this.updateSplitScreenData(1);
+    if(this.courseDetail.userid == this.userid && this.tcid2 && this.org == '16ace517-b5c7-4168-a9bb-a9e0035df840'){
+      let endTime = new Date().toLocaleString("zh-CN", { 
+          hour12: false, 
+          timeZone: "Asia/Shanghai" 
+        }).replace(/\//g, "-")
+      let courseTime = Math.floor((new Date(endTime) - new Date(this.startTime)) / (1000 * 60))
+      this.syncClassData({
+        courseId: this.id,
+        title: this.courseDetail.title,
+        courseGrade: this.tcid2,
+        courseTime: courseTime,
+        startTime: this.startTime,
+        endTime: endTime,
+      })
+      console.log('同步数据')
+    }
   },
   computed: {
     renderedFormula2() {
@@ -21831,6 +21848,10 @@ export default {
 
   },
   mounted() {
+    this.startTime = new Date().toLocaleString("zh-CN", { 
+      hour12: false, 
+      timeZone: "Asia/Shanghai" 
+    }).replace(/\//g, "-")
     if (this.tType == 1) {
        // 开局关闭学生查看内容
       this.StulookMode(false)

+ 26 - 0
src/components/pptEasyClass/index.vue

@@ -40,7 +40,10 @@
 </template>
 
 <script>
+import { myMixin } from '../../mixins/mixin';
+
 export default {
+  mixins: [myMixin],
   data() {
     return {
       id: this.$route.query.courseId,
@@ -59,6 +62,7 @@ export default {
       courseDetail: {},
       pageLoading: false,
       inviteCode:"",
+      startTime: "",
     };
   },
   methods: {
@@ -175,7 +179,29 @@ export default {
       }
     }
   },
+  destroyed(){
+    if(this.courseDetail.userid == this.userid && this.tcid2 && this.org == '16ace517-b5c7-4168-a9bb-a9e0035df840'){
+      let endTime = new Date().toLocaleString("zh-CN", { 
+          hour12: false, 
+          timeZone: "Asia/Shanghai" 
+        }).replace(/\//g, "-")
+      let courseTime = Math.floor((new Date(endTime) - new Date(this.startTime)) / (1000 * 60))
+      this.syncClassData({
+        courseId: this.id,
+        title: this.courseDetail.title,
+        courseGrade: this.tcid2,
+        courseTime: courseTime,
+        startTime: this.startTime,
+        endTime: endTime,
+      })
+      console.log('同步数据')
+    }
+  },
   mounted() {
+    this.startTime = new Date().toLocaleString("zh-CN", { 
+      hour12: false, 
+      timeZone: "Asia/Shanghai" 
+    }).replace(/\//g, "-")
     this.getCourseDetail();
   }
 };

+ 21 - 0
src/components/studyStudent.vue

@@ -12664,6 +12664,7 @@ export default {
   },
   data() {
     return {
+      startTime: "",
       // 是否允许学生查看内容资料 2不可以 1可以
       IsStulook:false,
       homeWorkLoading:false,
@@ -21569,6 +21570,22 @@ export default {
     clearInterval(this.opertimer);
     this.opertimer = null;
 		this.updateSplitScreenData(1);
+    if(this.courseDetail.userid == this.userid && this.tcid2 && this.org == '16ace517-b5c7-4168-a9bb-a9e0035df840'){
+      let endTime = new Date().toLocaleString("zh-CN", { 
+          hour12: false, 
+          timeZone: "Asia/Shanghai" 
+        }).replace(/\//g, "-")
+      let courseTime = Math.floor((new Date(endTime) - new Date(this.startTime)) / (1000 * 60))
+      this.syncClassData({
+        courseId: this.id,
+        title: this.courseDetail.title,
+        courseGrade: this.tcid2,
+        courseTime: courseTime,
+        startTime: this.startTime,
+        endTime: endTime,
+      })
+      console.log('同步数据')
+    }
   },
   computed: {
     renderedFormula2() {
@@ -21764,6 +21781,10 @@ export default {
 
   },
   mounted() {
+    this.startTime = new Date().toLocaleString("zh-CN", { 
+      hour12: false, 
+      timeZone: "Asia/Shanghai" 
+    }).replace(/\//g, "-");
     if (this.tType == 1) {
        // 开局关闭学生查看内容
       this.StulookMode(false)

+ 2 - 0
src/config/config.js

@@ -11,8 +11,10 @@ const store = new Vuex.Store({
         nCount: 0,
 		apiM: 'https://pbl.cocorobo.cn/api/mongo/',
         api: 'https://pbl.cocorobo.cn/api/pbl/',
+        apiSz: 'https://pbl.cocorobo.cn/api/szdjg/',
         socket: "https://poll.cocorobo.cn",
         // api: 'http://localhost:7003/api/pbl/',
+        // apiSz: 'http://localhost:7003/api/szdjg/',
     },
 
     mutations: {

+ 43 - 1
src/mixins/mixin.js

@@ -59,7 +59,7 @@ export const myMixin = {
         role: this.userJson.type =='1'?'老师':'学生',
         browser: browser,
         userTime: userTime == "1" ? _time : userTime, // 使用时间 1次的就1 其次传秒
-        loadTime: loadTime, //load的时间没有就“”
+        loadTime: loadTime, //load的时间没有就""
         object: JSON.stringify(object), //执行信息传json
         status: status //成功返回success。失败返回error的信息
       };
@@ -78,6 +78,48 @@ export const myMixin = {
           console.log("保存失败");
           console.log(e);
         });
+    },
+    // 新增:上课/备课数据实时同步接口
+    async syncClassData(classData) {
+      if (!this.$route.query.userid) return
+      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.syncClassData(classData);
+      }
+      let courseGrade = await this.ajax.get(this.$store.state.api + "getClassById", { id: classData.courseGrade });
+      let params = {
+        "serverName": "深教AI6",
+        "dataType": 1,
+        "teacherName": this.userJson.username,
+        "teacherAccount": this.userJson.accountNumber,
+        "teacherPhone": this.userJson.phonenumber,
+        "eduId": this.userJson.sessionid,
+        "schoolName": this.userJson.schoolName,
+        "area": this.schooldest,
+        "courseId": classData.courseId,
+        "courseName": classData.title,
+        "courseGrade": courseGrade.data[0][0].name,
+        "courseTime": classData.courseTime,
+        "startTime": classData.startTime,
+        "endTime": classData.endTime
+      }
+      try {
+        const response = await this.ajax.post(
+          this.$store.state.apiSz + 'sync/class',
+          params
+        );
+        return { success: true, data: response.data };
+      } catch (error) {
+        console.error("同步失败:", error);
+        return { success: false, msg: error };
+      }
     }
   }
 };