소스 검색

18:35 05/07

111
mo 5 년 전
부모
커밋
a6c07f0549
1개의 변경된 파일42개의 추가작업 그리고 9개의 파일을 삭제
  1. 42 9
      src/views/operateManager/serverIndexDetail.vue

+ 42 - 9
src/views/operateManager/serverIndexDetail.vue

@@ -6,11 +6,14 @@
                       :content="studentName">
       </el-page-header>
     </h2>
-    <p class="timeTitle">查询时间 : {{monday}} - {{sunday}}</p>
+
     <el-card class="box-card"
+             v-for="(card,index) in dataList"
+             :key='index'
              style="width:1000px">
+      <p class="timeTitle"> {{card.monday}} - {{card.sunday}}</p>
       <div class="listWrap"
-           v-for="(item,index) in dataList"
+           v-for="(item,index) in card.data"
            :key="index">
         <div class="m-row">
           <div class="textWrap">
@@ -179,12 +182,17 @@ export default {
       }
       findServiceStudentDetail({ studentId: this.studentId, monday: this.monday, sunday: this.sunday, rows: 9999 }).then(res => {
         if (res.code == 200) {
-          this.dataList = res.data.rows.map(res => {
-            res.up = false;
-            res.homeWork = res.attachments.split(',')
-            console.log(res.homeWork)
-            return res;
-          });
+          this.dataList = res.data;
+          for (let i in this.dataList) {
+            this.dataList[i].sunday = this.getNowDateAndSunday(this.dataList[i].monday)
+            this.dataList[i].data = this.dataList[i].data.map(res => {
+              res.up = false;
+              res.homeWork = res.attachments.split(',')
+              console.log(res.homeWork)
+              return res;
+            });
+          }
+          // this.dataList = res.data.rows.
         }
       })
 
@@ -226,7 +234,31 @@ export default {
     openVideo (src) {
       this.activeUrl = src;
       this.workVisible = true;
-    }
+    },
+    getNowDateAndSunday (time) {
+      let timestamp = new Date(time.replace(/-/g, "/")).getTime();
+      let serverDate = new Date(time);
+
+      let num = 7 - serverDate.getDay();
+      if (num == 7) {
+        num = 0;
+      }
+      let sundayTiem = timestamp + num * 24 * 60 * 60 * 1000;
+      let SundayData = new Date(sundayTiem);
+      //年
+      let tomorrowY = SundayData.getFullYear(); //月
+      let tomorrowM =
+        SundayData.getMonth() + 1 < 10
+          ? "0" + (SundayData.getMonth() + 1)
+          : SundayData.getMonth() + 1;
+      //日
+      let tomorrowD =
+        SundayData.getDate() < 10
+          ? "0" + SundayData.getDate()
+          : SundayData.getDate();
+      let str = tomorrowY + "-" + tomorrowM + "-" + tomorrowD;
+      return str;
+    },
 
   },
   watch: {
@@ -249,6 +281,7 @@ export default {
   margin-bottom: 20px;
 }
 .box-card {
+  margin-bottom: 30px;
   .listWrap {
     cursor: pointer;
     margin-bottom: 50px;