Przeglądaj źródła

fix: 修正课程时长计算逻辑并注释无用调用

1. 将原有的向下取整时长改为向上取整并取最小1分钟,避免时长为0的异常情况
2. 注释无用的setoTime调用,统一使用服务器时间初始化startTime
lsc 5 dni temu
rodzic
commit
e96019e798

+ 2 - 2
src/components/easy2/studyStudent.vue

@@ -25774,7 +25774,7 @@ export default {
       let userArray = ['6fbc6471-1d48-11ed-8c78-005056b86db5','333d0dfc-1cd9-11ef-bee5-005056b86db5','6fbce5ef-1d48-11ed-8c78-005056b86db5','66feffcc-ad35-11ed-b13d-005056b86db5']
       if (this.courseDetail.userid == this.userid && (this.org == '16ace517-b5c7-4168-a9bb-a9e0035df840' || userArray.includes(this.userid))) {
         let endTime = await this.getServerTime()
-        let courseTime = Math.floor((new Date(endTime) - new Date(this.startTime)) / (1000 * 60))
+        let courseTime = Math.max(1, Math.ceil((new Date(endTime) - new Date(this.startTime)) / (1000 * 60)))
         this.syncClassData({
           courseId: this.id,
           title: this.courseDetail.title,
@@ -26073,7 +26073,7 @@ export default {
     
   },
   async mounted() {
-    this.setoTime("1");
+    // this.setoTime("1");
     this.startTime = await this.getServerTime()
     this.timeoutPan = setTimeout(() => {
       this.startIdleDetection(this.resetIdleOp);

+ 2 - 2
src/components/easy3/studyStudent.vue

@@ -21096,7 +21096,7 @@ export default {
       let userArray = ['6fbc6471-1d48-11ed-8c78-005056b86db5','333d0dfc-1cd9-11ef-bee5-005056b86db5','6fbce5ef-1d48-11ed-8c78-005056b86db5','66feffcc-ad35-11ed-b13d-005056b86db5']
       if (this.courseDetail.userid == this.userid && (this.org == '16ace517-b5c7-4168-a9bb-a9e0035df840' || userArray.includes(this.userid))) {
         let endTime = await this.getServerTime()
-        let courseTime = Math.floor((new Date(endTime) - new Date(this.startTime)) / (1000 * 60))
+        let courseTime = Math.max(1, Math.ceil((new Date(endTime) - new Date(this.startTime)) / (1000 * 60)))
         this.syncClassData({
           courseId: this.id,
           title: this.courseDetail.title,
@@ -21387,7 +21387,7 @@ export default {
 
   },
   async mounted() {
-    this.setoTime("1");
+    // this.setoTime("1");
     this.startTime = await this.getServerTime()
     this.timeoutPan = setTimeout(() => {
       this.startIdleDetection(this.resetIdleOp);

+ 1 - 1
src/components/pptEasyClass/index.vue

@@ -919,7 +919,7 @@ export default {
       let userArray = ['6fbc6471-1d48-11ed-8c78-005056b86db5','333d0dfc-1cd9-11ef-bee5-005056b86db5','6fbce5ef-1d48-11ed-8c78-005056b86db5','66feffcc-ad35-11ed-b13d-005056b86db5']
       if (this.courseDetail.userid == this.userid && (this.org == '16ace517-b5c7-4168-a9bb-a9e0035df840' || userArray.includes(this.userid))) {
         let endTime = await this.getServerTime()
-        let courseTime = Math.floor((new Date(endTime) - new Date(this.startTime)) / (1000 * 60))
+        let courseTime = Math.max(1, Math.ceil((new Date(endTime) - new Date(this.startTime)) / (1000 * 60)))
         this.syncClassData({
           courseId: this.id,
           title: this.courseDetail.title,

+ 2 - 2
src/components/pptEasyClass/indexPS.vue

@@ -923,7 +923,7 @@ export default {
       let userArray = ['6fbc6471-1d48-11ed-8c78-005056b86db5','333d0dfc-1cd9-11ef-bee5-005056b86db5','6fbce5ef-1d48-11ed-8c78-005056b86db5','66feffcc-ad35-11ed-b13d-005056b86db5']
       if (this.courseDetail.userid == this.userid && (this.org == '16ace517-b5c7-4168-a9bb-a9e0035df840' || userArray.includes(this.userid))) {
         let endTime = await this.getServerTime()
-        let courseTime = Math.floor((new Date(endTime) - new Date(this.startTime)) / (1000 * 60))
+        let courseTime = Math.max(1, Math.ceil((new Date(endTime) - new Date(this.startTime)) / (1000 * 60)))
         this.syncClassData({
           courseId: this.id,
           title: this.courseDetail.title,
@@ -1010,7 +1010,7 @@ export default {
     this.stopIdleDetection(this.resetIdleOp);
   },
   async mounted() {
-    this.setoTime("1");
+    // this.setoTime("1");
     this.startTime = await this.getServerTime()
     console.log('this.startTime', this.startTime)
     this.timeoutPan = setTimeout(() => {

+ 2 - 2
src/components/pptEasyClass/index_old.vue

@@ -214,7 +214,7 @@ export default {
         hour12: false,
         timeZone: "Asia/Shanghai"
       }).replace(/\//g, "-")
-      let courseTime = Math.floor((new Date(endTime) - new Date(this.startTime)) / (1000 * 60))
+      let courseTime = Math.max(1, Math.ceil((new Date(endTime) - new Date(this.startTime)) / (1000 * 60)))
       this.syncClassData({
         courseId: this.id,
         title: this.courseDetail.title,
@@ -228,7 +228,7 @@ export default {
     }
   },
   mounted() {
-    this.setoTime("1");
+    // this.setoTime("1");
     this.startTime = new Date().toLocaleString("zh-CN", {
       hour12: false,
       timeZone: "Asia/Shanghai"

+ 2 - 2
src/components/studyStudent.vue

@@ -21047,7 +21047,7 @@ export default {
       let userArray = ['6fbc6471-1d48-11ed-8c78-005056b86db5','333d0dfc-1cd9-11ef-bee5-005056b86db5','6fbce5ef-1d48-11ed-8c78-005056b86db5','66feffcc-ad35-11ed-b13d-005056b86db5']
       if (this.courseDetail.userid == this.userid && (this.org == '16ace517-b5c7-4168-a9bb-a9e0035df840' || userArray.includes(this.userid))) {
         let endTime = await this.getServerTime()
-        let courseTime = Math.floor((new Date(endTime) - new Date(this.startTime)) / (1000 * 60))
+        let courseTime = Math.max(1, Math.ceil((new Date(endTime) - new Date(this.startTime)) / (1000 * 60)))
         this.syncClassData({
           courseId: this.id,
           title: this.courseDetail.title,
@@ -21333,7 +21333,7 @@ export default {
     },
   },
   async mounted() {
-    this.setoTime("1");
+    // this.setoTime("1");
     this.startTime = await this.getServerTime()
     this.timeoutPan = setTimeout(() => {
       this.startIdleDetection(this.resetIdleOp);