11wqe1 6 дней назад
Родитель
Сommit
7f941eb255
1 измененных файлов с 9 добавлено и 9 удалено
  1. 9 9
      src/mixins/mixin.js

+ 9 - 9
src/mixins/mixin.js

@@ -33,18 +33,18 @@ export const myMixin = {
         return "Other Browser";
         return "Other Browser";
       }
       }
     },
     },
-    async addOp3(userTime, loadTime, object, status) {
+    async addOp3(userTime, loadTime, object, status,api = 'selectUser') {
       if (!this.$route.query.userid) return
       if (!this.$route.query.userid) return
       try {
       try {
         if(!this.userJson || !this.userJson.accountNumber){
         if(!this.userJson || !this.userJson.accountNumber){
-            let res = await this.ajax.get(this.$store.state.api + "selectUser", {
+            let res = await this.ajax.get(this.$store.state.api + api, {
             userid: this.$route.query.userid
             userid: this.$route.query.userid
             });
             });
             this.userJson = res.data[0][0]
             this.userJson = res.data[0][0]
         }
         }
       } catch (e) {
       } catch (e) {
         console.log(e);
         console.log(e);
-        return this.addOp3(userTime, loadTime, object, status);
+        return this.addOp3(userTime, loadTime, object, status,'selectUser2');
       }
       }
       let _time = new Date()
       let _time = new Date()
         .toLocaleString("zh-CN", { hour12: false, timeZone: "Asia/Shanghai" })
         .toLocaleString("zh-CN", { hour12: false, timeZone: "Asia/Shanghai" })
@@ -80,18 +80,18 @@ export const myMixin = {
         });
         });
     },
     },
     // 新增:上课/备课数据实时同步接口
     // 新增:上课/备课数据实时同步接口
-    async syncClassData(classData) {
+    async syncClassData(classData,api = 'selectUser') {
       if (!this.$route.query.userid) return
       if (!this.$route.query.userid) return
       try {
       try {
         if(!this.userJson || !this.userJson.accountNumber){
         if(!this.userJson || !this.userJson.accountNumber){
-            let res = await this.ajax.get(this.$store.state.api + "selectUser", {
+            let res = await this.ajax.get(this.$store.state.api + api, {
             userid: this.$route.query.userid
             userid: this.$route.query.userid
             });
             });
             this.userJson = res.data[0][0]
             this.userJson = res.data[0][0]
         }
         }
       } catch (e) {
       } catch (e) {
         console.log(e);
         console.log(e);
-        return this.syncClassData(classData);
+        return this.syncClassData(classData,'selectUser2');
       }
       }
       let courseGrade = classData.courseGrade ? await this.ajax.get(this.$store.state.api + "getClassById", { id: classData.courseGrade }) : '';
       let courseGrade = classData.courseGrade ? await this.ajax.get(this.$store.state.api + "getClassById", { id: classData.courseGrade }) : '';
       let coursePackageName = await this.ajax.get(this.$store.state.api + "getCopyCourseName", { id: classData.courseId });
       let coursePackageName = await this.ajax.get(this.$store.state.api + "getCopyCourseName", { id: classData.courseId });
@@ -124,18 +124,18 @@ export const myMixin = {
       }
       }
     },
     },
     // 新增:上课/备课数据实时同步接口
     // 新增:上课/备课数据实时同步接口
-    async syncClassData2(classData) {
+    async syncClassData2(classData,api = 'selectUser') {
       if (!this.$route.query.userid) return
       if (!this.$route.query.userid) return
       try {
       try {
         if(!this.userJson || !this.userJson.accountNumber){
         if(!this.userJson || !this.userJson.accountNumber){
-            let res = await this.ajax.get(this.$store.state.api + "selectUser", {
+            let res = await this.ajax.get(this.$store.state.api + api, {
             userid: this.$route.query.userid
             userid: this.$route.query.userid
             });
             });
             this.userJson = res.data[0][0]
             this.userJson = res.data[0][0]
         }
         }
       } catch (e) {
       } catch (e) {
         console.log(e);
         console.log(e);
-        return this.syncClassData(classData);
+        return this.syncClassData(classData,'selectUser2');
       }
       }
       let courseGrade = classData.courseGrade ? await this.ajax.get(this.$store.state.api + "getClassById", { id: classData.courseGrade }) : '';
       let courseGrade = classData.courseGrade ? await this.ajax.get(this.$store.state.api + "getClassById", { id: classData.courseGrade }) : '';
       let coursePackageName = await this.ajax.get(this.$store.state.api + "getCopyCourseName", { id: classData.courseId });
       let coursePackageName = await this.ajax.get(this.$store.state.api + "getCopyCourseName", { id: classData.courseId });