Bläddra i källkod

评估管理学期

11wqe1 4 dagar sedan
förälder
incheckning
dd1a07bb5b

+ 30 - 2
src/components/pages/components/exportDataDialog.vue

@@ -41,9 +41,9 @@
             />
             />
           </div>
           </div>
           <div class="termC">
           <div class="termC">
-            <div><span>2023-2024</span>{{lang.ssSchoolYear}}</div>
+            <div><span>{{schoolYear}}</span>{{lang.ssSchoolYear}}</div>
             <div style="width: 20px;"></div>
             <div style="width: 20px;"></div>
-            <div>{{lang.ssSemester.replace(/\*/g, 2)}}</div>
+            <div>{{lang.ssSemester.replace(/\*/g, semester)}}</div>
           </div>
           </div>
 
 
           <div class="fromCss">
           <div class="fromCss">
@@ -1416,6 +1416,34 @@ export default {
         let md = new MarkdownIt();
         let md = new MarkdownIt();
         return c ? md.render(c) : "";
         return c ? md.render(c) : "";
       };
       };
+    },
+    // 计算中国学年
+    schoolYear() {
+      const now = new Date();
+      const year = now.getFullYear();
+      const month = now.getMonth() + 1; // getMonth() 返回 0-11
+      
+      // 中国学年:9月1日到次年8月31日
+      // 如果当前月份是9-12月,学年是 当前年-次年
+      // 如果当前月份是1-8月,学年是 去年-当前年
+      if (month >= 9) {
+        return `${year}-${year + 1}`;
+      } else {
+        return `${year - 1}-${year}`;
+      }
+    },
+    // 计算学期:1学期或2学期
+    semester() {
+      const now = new Date();
+      const month = now.getMonth() + 1; // getMonth() 返回 0-11
+      
+      // 第一学期:9月-次年1月
+      // 第二学期:2月-8月
+      if (month >= 9 || month <= 1) {
+        return 1;
+      } else {
+        return 2;
+      }
     }
     }
   },
   },
 
 

+ 30 - 2
src/components/pages/components/exportWorksDialog.vue

@@ -28,9 +28,9 @@
             {{ lang.ssWorkSet }}
             {{ lang.ssWorkSet }}
           </div>
           </div>
           <div class="termC">
           <div class="termC">
-            <div><span>2023-2024</span>{{ lang.ssSchoolYear }}</div>
+            <div><span>{{schoolYear}}</span>{{ lang.ssSchoolYear }}</div>
             <div style="width: 20px;"></div>
             <div style="width: 20px;"></div>
-            <div>{{ lang.ssSemester.replace(/\*/g, 2) }}</div>
+            <div>{{ lang.ssSemester.replace(/\*/g, semester) }}</div>
           </div>
           </div>
           <div class="fromCss">
           <div class="fromCss">
             <div>
             <div>
@@ -989,6 +989,34 @@ export default {
 
 
         return this.convertToTimestamp(TimeList[0]);
         return this.convertToTimestamp(TimeList[0]);
       };
       };
+    },
+    // 计算中国学年
+    schoolYear() {
+      const now = new Date();
+      const year = now.getFullYear();
+      const month = now.getMonth() + 1; // getMonth() 返回 0-11
+      
+      // 中国学年:9月1日到次年8月31日
+      // 如果当前月份是9-12月,学年是 当前年-次年
+      // 如果当前月份是1-8月,学年是 去年-当前年
+      if (month >= 9) {
+        return `${year}-${year + 1}`;
+      } else {
+        return `${year - 1}-${year}`;
+      }
+    },
+    // 计算学期:1学期或2学期
+    semester() {
+      const now = new Date();
+      const month = now.getMonth() + 1; // getMonth() 返回 0-11
+      
+      // 第一学期:9月-次年1月
+      // 第二学期:2月-8月
+      if (month >= 9 || month <= 1) {
+        return 1;
+      } else {
+        return 2;
+      }
     }
     }
   },
   },