浏览代码

Merge branch 'chen' into dev

chenxiong 3 年之前
父节点
当前提交
a063019de7

+ 9 - 0
src/apis/course.js

@@ -205,4 +205,13 @@ export default {
 			params: data
 		})
 	},
+  studRrecordListUserRecord(data) {
+		return request({
+			url: '/study/record/listUserRecord',
+			method: 'get',
+			params: data
+		})
+	},
+
+  
 }

+ 33 - 19
src/pages/course-detail/index.vue

@@ -1529,6 +1529,7 @@ export default {
       ossAvatarUrl: "", //照片地址
       nowTime: 0,
       faceUrl: "",
+      loading: null,
     };
   },
   computed: {
@@ -1545,20 +1546,15 @@ export default {
   },
   methods: {
     async takeOk() {
+      this.loading = this.$loading({
+        lock: true,
+        text: "上传中",
+        spinner: "el-icon-loading",
+        background: "rgba(0, 0, 0, 0.1)",
+        target: document.querySelector(".section__body"),
+      });
       let compareFaceData = await this.faceRecognition();
 
-      if (compareFaceData == 0) {
-        this.$message({
-          type: "warning",
-          message: "人脸匹配不通过,请重新拍照上传",
-        });
-
-        setTimeout(() => {
-          this.reTake();
-        }, 2000);
-        return;
-      }
-
       if (compareFaceData >= 80) {
         const waitYS = await this.imageInfos();
         this.postCoursePhotoRecord()
@@ -1567,13 +1563,20 @@ export default {
             this.postStudyRecord(); //提交记录
             //恢复播放
 
+            this.loading.close();
+            this.$message({
+              type: "success",
+              message: "拍照成功",
+            });
             this.takePhotoModal = false;
+            this.isTaking = false;
             var polyvPlayerContext = this.player;
             if (polyvPlayerContext) {
               polyvPlayerContext.j2s_resumeVideo();
             }
           })
           .catch((err) => {
+            this.loading.close();
             console.log(err, "err");
             this.$message({
               type: "warning",
@@ -1581,14 +1584,18 @@ export default {
             });
             this.reTake();
           });
-      }
+      } else {
+        this.$message({
+          type: "warning",
+          message: "人脸匹配不通过,请重新拍照上传",
+        });
 
-      this.$message({
-        type: "success",
-        message: "拍照成功",
-      });
-      this.takePhotoModal = false;
-      this.isTaking = true;
+        setTimeout(() => {
+          this.loading.close();
+          this.reTake();
+        }, 2000);
+        return;
+      }
     },
 
     imageInfos() {
@@ -1655,6 +1662,13 @@ export default {
           .then((res) => {
             console.log(res, "res");
             resolve(res.data);
+          })
+          .catch((err) => {
+            this.loading.close();
+            this.$message({
+              type: "warning",
+              message: err.msg,
+            });
           });
       });
     },

+ 32 - 13
src/pages/person-center/my-course/index.vue

@@ -432,6 +432,7 @@ export default {
       total: 0,
       courseList: [],
       selectItem: {},
+      loading: null,
     };
   },
   mounted() {
@@ -553,31 +554,49 @@ export default {
           })
           .then((res) => {
             //有其他端在操作,不能学习
-            uni.showToast({
-              icon: "none",
-              title: res.msg,
-              mask: true,
-              duration: 3000,
+            this.$message({
+              type: "warning",
+              message: res.msg,
             });
           })
           .catch((err) => {
             //可以学习
+            this.$request
+              .courseCourseList({
+                pageNum: 1,
+                pageSize: 1,
+                goodsId: item.goodsId,
+                gradeId: item.gradeId,
+              })
+              .then((res) => {
+                this.$router.push({
+                  path: `/my-course-detail/${item.goodsId}`,
+                  query: {
+                    gradeId: item.gradeId,
+                    orderGoodsId: item.orderGoodsId,
+                    courseId: res.rows[0].courseId,
+                  },
+                });
+              });
+          });
+      } else {
+        this.$request
+          .courseCourseList({
+            pageNum: 1,
+            pageSize: 1,
+            goodsId: item.goodsId,
+            gradeId: item.gradeId,
+          })
+          .then((res) => {
             this.$router.push({
               path: `/my-course-detail/${item.goodsId}`,
               query: {
                 gradeId: item.gradeId,
                 orderGoodsId: item.orderGoodsId,
+                courseId: res.rows[0].courseId,
               },
             });
           });
-      } else {
-        this.$router.push({
-          path: `/my-course-detail/${item.goodsId}`,
-          query: {
-            gradeId: item.gradeId,
-            orderGoodsId: item.orderGoodsId,
-          },
-        });
       }
     },
 

+ 109 - 13
src/pages/person-center/play-record/index.vue

@@ -2,21 +2,38 @@
   <div class="play-record">
     <div class="play-record__header clearfix">
       播放记录
-      <a class="clear-btn">清空记录</a>
+      <!-- <a class="clear-btn">清空记录</a> -->
     </div>
     <div class="play-record__body">
-      <div class="date-item" v-for="(item, index) in 2" :key="index">
-        <div class="date-item__header">2022-12-23</div>
+      <div class="date-item" v-for="(v, k) in recordList" :key="k">
+        <div class="date-item__header">{{ k }}</div>
         <div class="date-item__body">
           <div class="list">
-            <div class="course-item" v-for="(item, index) in 2" :key="index">
-              <div class="course-item__header">这是节名称</div>
+            <div
+              class="course-item"
+              v-for="(sectionItem, sectionIndex) in v.list"
+              :key="'section' + sectionIndex"
+            >
+              <div class="course-item__header">{{ sectionItem.goodsName }}</div>
               <div class="course-item__body">
-                <div class="img"></div>
+                <div
+                  class="img"
+                  @click="
+                    go('/my-course-detail/' + sectionItem.goodsId, {
+                      gradeId: sectionItem.gradeId,
+                      orderGoodsId: sectionItem.orderGoodsId,
+                    })
+                  "
+                >
+                  <img
+                    :src="$tools.splitImgHost(sectionItem.coverUrl, true)"
+                    alt=""
+                  />
+                </div>
                 <div class="text">
                   <div class="title">
-                    二级建造师建设工程施工管理
-                    <div class="note">60学时</div>
+                    {{ sectionItem.sectionName }}
+                    <!-- <div class="note">60学时</div> -->
                   </div>
                   <div class="progress">
                     学习进度
@@ -24,21 +41,41 @@
                       class="progress-line"
                       :text-inside="true"
                       :stroke-width="16"
-                      :percentage="70"
+                      :percentage="
+                        toFixed(
+                          (sectionItem.videoCurrentTime /
+                            sectionItem.durationTime) *
+                            100
+                        )
+                      "
                     ></el-progress>
                   </div>
                 </div>
-                <div class="btns-wrap">
+                <!-- <div class="btns-wrap">
                   <div class="btns">
                     <div class="btn btn--warm">删除记录</div>
                   </div>
-                </div>
+                </div> -->
               </div>
             </div>
           </div>
         </div>
       </div>
     </div>
+
+    <div class="play-record__footer">
+      <div class="pagination">
+        <el-pagination
+          @current-change="currentChange"
+          background
+          layout="prev, pager, next"
+          :total="total"
+          :pager-count="5"
+          :page-size="params.pageSize"
+        >
+        </el-pagination>
+      </div>
+    </div>
   </div>
 </template>
 
@@ -48,15 +85,62 @@ export default {
   data() {
     return {
       activeName: "1",
+      recordList: {},
+      total: 0,
+      params: {
+        pageNum: 1,
+        pageSize: 10,
+      },
     };
   },
-  mounted() {},
+  mounted() {
+    this.studRrecordListUserRecord();
+  },
   methods: {
+    toFixed(num) {
+      if (num) {
+        let str = String(num).indexOf(".");
+
+        if (str != -1) {
+          return +num.toFixed(2);
+        } else {
+          return num;
+        }
+      } else {
+        return 0;
+      }
+    },
     pay() {
       this.$router.push({
         path: "payment-success",
       });
     },
+    currentChange(e) {
+      this.params.pageNum = e;
+      this.studRrecordListUserRecord();
+    },
+    studRrecordListUserRecord() {
+      this.$request.studRrecordListUserRecord(this.params).then((res) => {
+        let dateObj = {};
+
+        res.rows.forEach((row) => {
+          if (!dateObj[row.date]) {
+            dateObj[row.date] = { title: row.goodsName, list: [] };
+            dateObj[row.date].list.push(row);
+          } else {
+            dateObj[row.date].list.push(row);
+          }
+        });
+        this.recordList = dateObj;
+        this.total = res.total;
+      });
+    },
+    go(path, query) {
+      this.$router.push({
+        path,
+        query,
+      });
+    },
   },
 };
 </script>
@@ -120,10 +204,15 @@ export default {
 
             &__body {
               .img {
+                cursor: pointer;
                 float: left;
                 width: 160px;
                 height: 90px;
-                background: #3f8dfd;
+
+                img {
+                  max-width: 100%;
+                  max-height: 100%;
+                }
               }
 
               .text {
@@ -199,5 +288,12 @@ export default {
       }
     }
   }
+
+  &__footer {
+    .pagination {
+      padding: 30px 0;
+      text-align: center;
+    }
+  }
 }
 </style>