Kaynağa Gözat

学生端增加截止时间

Prevalence 7 yıl önce
ebeveyn
işleme
7c673061ae
1 değiştirilmiş dosya ile 20 ekleme ve 1 silme
  1. 20 1
      src/views/student/DlWork/index.vue

+ 20 - 1
src/views/student/DlWork/index.vue

@@ -23,7 +23,16 @@
           class="column is-4-desktop"
         >
           <router-link :to="`${$route.path}/${item.id}`">
-            <card hoverable>{{ item.name }}</card>
+            <card hoverable
+              >{{ item.name }}
+              <div class="hw-time">
+                <small
+                  >{{ timeExchange(item.createAt) }} ~
+                  {{ timeExchange(item.endAt) }}</small
+                >
+              </div>
+              <div><code-state-tag :state="item.status"></code-state-tag></div>
+            </card>
           </router-link>
         </div>
       </div>
@@ -54,6 +63,13 @@ export default {
       dlWorkListLoading: false
     };
   },
+  methods: {
+    timeExchange(timestamp) {
+      return new Date(parseInt(timestamp) * 1000)
+        .toLocaleString()
+        .replace(/:\d{1,2}$/, " ");
+    }
+  },
   async mounted() {
     this.dlWorkListLoading = true;
     const { courseId } = this.$route.params;
@@ -68,4 +84,7 @@ export default {
 .top-nav-section {
   padding: 0 40px;
 }
+.hw-time {
+  color: #656565;
+}
 </style>