Jelajahi Sumber

修改个人中心页面

aaa 4 tahun lalu
induk
melakukan
a82241d000

+ 3 - 1
src/api/modules/learn.js

@@ -9,6 +9,8 @@ export default {
     // 查询目录详情
     JTXT_GET_CATEGORIES_CATEGROYID_MATERIALS: "categories/{categoryId}/materials",
     // 查询素材详情
-    JTXT_GET_MATERIAL_MATERIALID: "materials/{materialId}"
+    JTXT_GET_MATERIAL_MATERIALID: "materials/{materialId}",
+    // 发表评论
+    JTXT_POST_MATERIALS_COMMENT: "materials/{materialId}/comment"
   }
 };

+ 54 - 1
src/views/home/person/collection.vue

@@ -10,9 +10,19 @@
       <van-cell
         v-for="(item, index) in favorites"
         :key="index"
-        :title="item"
         @click="toMaterialDetail(item)"
       >
+        <div slot="default" class="contentItemDiv">
+          <div>
+            <div class="contentItemTitle">{{ item.name || "学习文章" }}</div>
+            <div class="contentItemDescription">
+              <div>
+                收藏时间:
+                {{ formateDateTimeFun(item.startTime) || item.startTime }}
+              </div>
+            </div>
+          </div>
+        </div>
       </van-cell>
     </van-list>
   </div>
@@ -58,10 +68,53 @@ export default {
         name: "learn-content",
         params: { materialId: item }
       });
+    },
+    formateDateTimeFun(time) {
+      // 获取当前日期
+      let date = new Date(time);
+      // 获取当前月份
+      let nowMonth = date.getMonth() + 1;
+      // 获取当前是几号
+      let strDate = date.getDate();
+      // 添加分隔符“-”
+      let seperator = "-";
+      // 对月份进行处理,1-9月在前面添加一个“0”
+      if (nowMonth >= 1 && nowMonth <= 9) {
+        nowMonth = "0" + nowMonth;
+      }
+      // 对月份进行处理,1-9号在前面添加一个“0”
+      if (strDate >= 0 && strDate <= 9) {
+        strDate = "0" + strDate;
+      }
+      // 最后拼接字符串,得到一个格式为(yyyy-MM-dd)的日期
+      return date.getFullYear() + seperator + nowMonth + seperator + strDate;
     }
   }
 };
 </script>
 
 <style lang="scss" scoped>
+.contentBody {
+  background-color: #fff;
+  .contentItemDiv {
+    .contentBox {
+      display: flex;
+      justify-content: space-between;
+      align-items: center;
+    }
+    .contentItemTitle {
+      font-size: 0.65rem;
+      font-weight: bold;
+    }
+    .contentItemDescription {
+      display: flex;
+      justify-content: space-between;
+      align-items: center;
+    }
+    .exam-point {
+      font-size: 1rem;
+      font-weight: bold;
+    }
+  }
+}
 </style>

+ 73 - 5
src/views/home/person/exam-history.vue

@@ -1,9 +1,31 @@
 <template>
-  <div>
+  <div class="contentBody">
     <van-nav-bar title="成绩" left-arrow @click-left="onClickLeft" />
-    <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
-      <van-cell v-for="(item, index) in examHistoryList" :key="index" :title="item.examId">
-        <div>{{ item.startTime }}</div>
+    <van-list
+      v-model="loading"
+      :finished="finished"
+      finished-text="没有更多了"
+      @load="onLoad"
+    >
+      <van-cell
+        v-for="(item, index) in examHistoryList"
+        :key="index"
+        @click="chooseExam(index)"
+      >
+        <div slot="default" class="contentItemDiv">
+          <div class="contentBox">
+            <div>
+              <div class="contentItemTitle">{{ item.name || "期中考试" }}</div>
+              <div class="contentItemDescription">
+                <div>
+                  考试时间:
+                  {{ formateDateTimeFun(item.startTime) || item.startTime }}
+                </div>
+              </div>
+            </div>
+            <div class="exam-point">{{ item.points }}</div>
+          </div>
+        </div>
       </van-cell>
     </van-list>
   </div>
@@ -51,10 +73,56 @@ export default {
     onClickLeft() {
       this.$router.back();
     },
-    onLoad() {}
+    onLoad() {},
+    chooseExam(index) {
+      console.log("---exam-index---" + index);
+    },
+    formateDateTimeFun(time) {
+      // 获取当前日期
+      let date = new Date(time);
+      // 获取当前月份
+      let nowMonth = date.getMonth() + 1;
+      // 获取当前是几号
+      let strDate = date.getDate();
+      // 添加分隔符“-”
+      let seperator = "-";
+      // 对月份进行处理,1-9月在前面添加一个“0”
+      if (nowMonth >= 1 && nowMonth <= 9) {
+        nowMonth = "0" + nowMonth;
+      }
+      // 对月份进行处理,1-9号在前面添加一个“0”
+      if (strDate >= 0 && strDate <= 9) {
+        strDate = "0" + strDate;
+      }
+      // 最后拼接字符串,得到一个格式为(yyyy-MM-dd)的日期
+      return date.getFullYear() + seperator + nowMonth + seperator + strDate;
+    }
   }
 };
 </script>
 
 <style lang="scss" scoped>
+.contentBody {
+  background-color: #fff;
+  .contentItemDiv {
+    .contentBox {
+      display: flex;
+      justify-content: space-between;
+      align-items: center;
+    }
+    .contentItemTitle {
+      font-size: 0.65rem;
+      font-weight: bold;
+    }
+    .contentItemDescription {
+      display: flex;
+      justify-content: space-between;
+      align-items: center;
+    }
+    .exam-point {
+      font-size: 1rem;
+      font-weight: bold;
+    }
+  }
+}
 </style>