谢杰标 2 năm trước cách đây
mục cha
commit
948300a384
2 tập tin đã thay đổi với 164 bổ sung401 xóa
  1. 140 1
      components/popup/camera.vue
  2. 24 400
      pages3/polyv/detail.vue

+ 140 - 1
components/popup/camera.vue

@@ -419,4 +419,143 @@ export default {
 };
 </script>
 
-<style lang="scss" scoped></style>
+<style lang="scss" scoped>
+.btnSet {
+  width: 440rpx;
+  height: 80rpx;
+  background: #007aff;
+  border-radius: 40rpx;
+  color: #ffffff;
+  font-size: 28rpx;
+  line-height: 80rpx;
+}
+.photoBox {
+  width: 100%;
+  // background-color: #ffffff;
+  // border-radius: 24px 24px 0px 0px;
+  .photoTop {
+    width: 100%;
+    height: 74rpx;
+    border-radius: 20px 20px 0px 0px;
+    background-color: #ffffff;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    padding: 0rpx 38rpx;
+    .centersq {
+      color: #333;
+      font-size: 30rpx;
+      font-weight: 500;
+    }
+  }
+  .photoCenter {
+    width: 750rpx;
+    height: 75vh;
+    position: relative;
+    .center_camera {
+      width: 100%;
+      height: 75vh;
+      position: fixed;
+      .head_take {
+        width: 100%;
+        height: 75vh;
+        display: flex;
+        flex-direction: column;
+      }
+      .headTake_up {
+        width: 100%;
+        height: 100rpx;
+      }
+      .headTake_minddle {
+        display: flex;
+        .min_img {
+          width: 500rpx;
+          height: 550rpx;
+        }
+        .min_left,
+        .min_right {
+          flex: 1;
+          height: 550rpx;
+        }
+      }
+      .headTake_down {
+        width: 100%;
+        flex: 1;
+      }
+      .color {
+        background-color: #333;
+        opacity: 0.5;
+      }
+      .photo_v {
+        width: 100%;
+        height: 100%;
+      }
+      .mask {
+        width: 500rpx;
+        height: 550rpx;
+        position: absolute;
+        top: 100rpx;
+        left: 0;
+        right: 0;
+        bottom: 0;
+        margin: 0 auto;
+        box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.4);
+      }
+    }
+    .custom {
+      width: 750rpx;
+      height: 75vh;
+      position: absolute;
+      z-index: 1000;
+      top: 0;
+      left: 0;
+      image {
+        width: 100%;
+        height: 100%;
+      }
+    }
+  }
+
+  .btns {
+    display: flex;
+    .takePhoto_btn {
+      width: 100%;
+      display: flex;
+      align-items: center;
+      justify-content: space-between;
+      background: #a9a7a9;
+      padding: 40rpx 26rpx;
+      .middle_btn {
+        width: 120rpx;
+        height: 120rpx;
+        border-radius: 40rpx;
+        border: 4rpx solid #ffffff;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+      }
+      .square {
+        width: 96rpx;
+        height: 96rpx;
+        background: #ffffff;
+        border-radius: 28rpx;
+      }
+      .rights {
+        font-size: 32rpx;
+        font-weight: 500;
+        color: #ffffff;
+      }
+    }
+    .btnResult {
+      height: 100rpx;
+      flex: 1;
+      background-color: #07c160;
+      text-align: center;
+      line-height: 100rpx;
+      color: #fff;
+      font-size: 32rpx;
+      font-weight: bold;
+    }
+  }
+}
+</style>

+ 24 - 400
pages3/polyv/detail.vue

@@ -193,128 +193,6 @@
         </view>
       </scroll-view>
     </view>
-    <!-- 播放前拍照end -->
-    <u-popup
-      v-model="showSet"
-      :mask-close-able="false"
-      mode="center"
-      border-radius="24"
-    >
-      <view
-        style="
-          align-items: center;
-          padding: 0 40rpx;
-          display: flex;
-          flex-direction: column;
-          justify-content: center;
-        "
-      >
-        <view
-          style="
-            font-weight: bold;
-            color: #333333;
-            font-size: 30rpx;
-            margin-top: 30rpx;
-          "
-          >温馨提示</view
-        >
-        <view
-          style="
-            width: 457rpx;
-            color: #666666;
-            font-size: 30rpx;
-            margin-top: 30rpx;
-          "
-          >学习过程中需要拍照验证学员身份, 拍照功能需要使用您的相机。
-          是否授权使用?</view
-        >
-        <view style="margin: 40rpx 0">
-          <button
-            open-type="openSetting"
-            @bindopensetting="openSetting"
-            class="btnSet"
-          >
-            去授权
-          </button>
-        </view>
-      </view>
-    </u-popup>
-    <u-popup
-      v-model="photoPopup"
-      mode="bottom"
-      border-radius="40"
-      :mask-close-able="false"
-    >
-      <!-- 播放前拍照start -->
-      <!-- :mask-close-able="false" -->
-      <!-- style="bottom: 0; position: fixed; width: 100%; z-index: 999" -->
-      <view v-if="photoPopup">
-        <view class="photoBox">
-          <view class="photoTop">
-            <view class="centersq">请正视手机屏幕</view>
-          </view>
-          <view class="photoCenter">
-            <view class="center_camera" v-if="photoPopup && isTaking">
-              <!-- #ifdef MP-WEIXIN -->
-              <camera
-                device-position="front"
-                flash="off"
-                @error="error"
-                style="width: 100%; height: 100%"
-              >
-                <!-- 加人脸框 -->
-                <cover-view class="head_take">
-                  <cover-view class="headTake_up color"></cover-view>
-                  <cover-view class="headTake_minddle">
-                    <cover-view class="min_left color"></cover-view>
-                    <cover-view class="min_img"></cover-view>
-                    <cover-view class="min_right color"></cover-view>
-                  </cover-view>
-                  <cover-view class="headTake_down color"></cover-view>
-                </cover-view>
-              </camera>
-              <!-- #endif -->
-              <!-- #ifdef H5 -->
-              <video
-                :controls="false"
-                id="video"
-                width="400"
-                height="300"
-                class="photo_v"
-              ></video>
-              <view class="mask"></view>
-              <!-- #endif -->
-            </view>
-            <view class="custom" v-if="!isTaking">
-              <!-- #ifdef MP-WEIXIN -->
-              <image :src="avatarUrl" mode=""></image>
-              <!-- #endif -->
-              <!-- #ifdef H5 -->
-              <image :src="faceUrl" mode=""></image>
-              <!-- #endif -->
-            </view>
-          </view>
-          <view class="btns">
-            <!-- <view class="btnResult" v-if="isTaking" @click="takePhoto"
-              >拍照</view
-            > -->
-            <view v-if="isTaking" class="takePhoto_btn">
-              <view style="width: 100rpx; height: 2rpx"></view>
-              <view class="middle_btn" @click="takePhoto">
-                <view class="square"></view>
-              </view>
-              <view class="rights" @click="takePhTips()">
-                <text>拍照提示</text>
-                <u-icon name="arrow-right" color="#FFFFFF" size="30"></u-icon>
-              </view>
-            </view>
-            <view class="btnResult" v-if="!isTaking" @click="reTake">重拍</view>
-            <view class="btnResult" v-if="!isTaking" @click="submit">确认</view>
-          </view>
-        </view>
-      </view>
-    </u-popup>
-
     <u-popup
       v-model="noticeShow"
       class="notice_modal"
@@ -477,12 +355,6 @@
         </view>
       </view>
     </u-popup>
-
-    <!-- 拍照提示 -->
-    <popup-photo
-      :popupPhotoShow.sync="popupPhotoShow"
-      @takePhoto="toTakePhoto()"
-    ></popup-photo>
     <!-- 摄像头 -->
     <Popup-camera :goodsId="goodsId" ref="camera"></Popup-camera>
   </view>
@@ -496,7 +368,6 @@ import courseSection from "@/components/course/courseSection.vue";
 import handoutsBox from "@/components/course/handoutsBox.vue";
 import courseTree from "@/components/course/courseTree.vue";
 import PopupCamera from "../../components/popup/camera.vue";
-import PopupPhoto from "@/components/popup/index.vue";
 import myCompressImage from "@/common/compressPhoto.js";
 import myPlayer from "@/components/myPlayer/polyvPlayer.vue";
 import noteBox from "@/components/course/noteBox.vue";
@@ -508,7 +379,6 @@ export default {
     courseModule,
     courseChapter,
     courseSection,
-    PopupPhoto,
     handoutsBox,
     myPlayer,
     noteBox,
@@ -586,7 +456,6 @@ export default {
       CountTo1: 0,
       handoutTipLength: 0,
       menuAllList: [],
-      popupPhotoShow: false,
       curPlayIndex: 0, // 正在播放的节的下标
       faceUrl: "",
       erJianErZao: false,
@@ -673,11 +542,6 @@ export default {
     },
   },
   async onLoad(option) {
-    console.log(
-      "🚀 ~ file: detail.vue:747 ~ onLoad ~ option:",
-      option,
-      this.$refs.player
-    );
     if (option.isOther) {
       this.showMark = true;
       return;
@@ -690,8 +554,13 @@ export default {
     if (this.$method.isGoLogin()) {
       return;
     }
-    this.option.isQ !== "" && (await this.qCheckIsCanLearn());
+
+    this.option.isQ !== "" && (await this.qCheckIsCanLearn(orderGoodsId));
     !this.userInfo && this.$api.refreshUserInfo();
+    this.courseId = Number(id) || "";
+    this.goodsId = Number(goodsId);
+    this.orderGoodsId = Number(orderGoodsId) || "";
+    this.gradeId = Number(gradeId);
     // 公众号模板消息的数据埋点
     informId && this.clickOfficial(informId);
     this.init();
@@ -714,7 +583,6 @@ export default {
     ...mapMutations(["updateChapterOpen", "updateLiveLast"]),
     init() {
       // #ifdef MP-WEIXIN
-      this.getCameraSetting();
       this.isAllowSeek = "no";
       // #endif
       // #ifdef H5
@@ -725,8 +593,8 @@ export default {
       this.lockTimer = setInterval(lockAction, 10000);
     },
     // 七大员是否能进入学习
-    async qCheckIsCanLearn() {
-      let res = await this.$api.qCheckIsCanLearn(this.orderGoodsId);
+    async qCheckIsCanLearn(orderGoodsId) {
+      let res = await this.$api.qCheckIsCanLearn(orderGoodsId);
       if (res.data.code !== 200) {
         uni.showModal({
           showCancel: false,
@@ -739,7 +607,7 @@ export default {
         return Promise.reject();
       }
       let res1 = await this.$api.syncSevenPublicClass({
-        orderGoodsId: this.orderGoodsId,
+        orderGoodsId,
       });
       if (res1.data.code !== 200) {
         uni.showModal({
@@ -962,6 +830,7 @@ export default {
         this.photoIndex = 0;
         //清除直播
         this.$store.commit("setPlayChannelId", { playChannelId: 0 });
+        // 防止原先初始化错误
         if (!this.refPlv) {
           this.refPlv = this.$refs.player;
         }
@@ -1786,61 +1655,34 @@ export default {
         plv.destroy();
       }
     },
-    openSetting(res) {
-      console.log(res, 98);
-    },
-    getCameraSetting() {
-      const self = this;
-      // 不支持h5
-      wx.getSetting({
-        success: (res) => {
-          if (res.authSetting["scope.camera"]) {
-            // 用户已经授权
-            self.showSet = false;
-            this.prendreAutoCarme = false;
-          } else {
-            this.prendreAutoCarme = true;
-            // 用户还没有授权,向用户发起授权请求
-            wx.authorize({
-              scope: "scope.camera",
-              success: () => {
-                // 用户同意授权
-                self.showSet = false;
-                this.prendreAutoCarme = false;
-              },
-              fail: () => {
-                // 用户不同意授权
-                self.showSet = true;
-              },
-            });
-          }
-        },
-        fail: (res) => {},
-      });
-    },
     studyNotice() {
       this.noticeShow = true;
     },
     //正常播放视频
     async playVideo(item) {
       this.sectionItem = item;
+      let { learning, videoCurrentTime, sectionId, recordingUrl } = item;
       console.log(this.sectionItem, "this.sectionItem");
       if (this.timer) {
         clearInterval(this.timer);
       }
-      this.recordObj = item.videoCurrentTime
-        ? { videoCurrentTime: item.videoCurrentTime }
+      this.recordObj = videoCurrentTime
+        ? { videoCurrentTime }
         : await this.getRecordLast(item);
+      // 查找拍照历史
+      if (this.photoNum > 0 && learning != 1) {
+        await this.getPhotoLastRecord();
+      }
       this.$store.commit("setPlayVID", {
-        playVID: item.recordingUrl,
+        playVID: recordingUrl,
       });
       this.$store.commit("setPlaySectionId", {
-        playSectionId: item.sectionId,
+        playSectionId: sectionId,
       });
       this.startStatus = true;
       if (this.refPlv) {
         this.refPlv.changeVid({
-          vid: item.recordingUrl,
+          vid: recordingUrl,
           videoCurrentTime: this.recordObj.videoCurrentTime,
         });
       }
@@ -2126,15 +1968,6 @@ export default {
             this.refPlv.playPause();
             this.refPlv.exitFullScreen();
             this.photoIndex = i;
-            if (
-              uni.getStorageSync(`tabkePhotoShow${this.goodsId}`) ==
-              this.goodsId
-            ) {
-              return this.openPhoto();
-            } else {
-              this.popupPhotoShow = true;
-              uni.setStorageSync(`tabkePhotoShow${this.goodsId}`, this.goodsId); // 本地缓存用来判断是否已经弹出过弹窗
-            }
           }
         }
       }
@@ -2185,6 +2018,9 @@ export default {
         this.postStudyRecord(0);
       }, 15000);
     },
+    openCamera(){
+      this.$refs["camera"].openCamera();
+    },
     pause() {
       this.erJianErZaoPauseTip();
       clearInterval(this.timer);
@@ -2426,90 +2262,6 @@ export default {
           });
         });
     },
-    // 确定拍照
-    async submit() {
-      if (this.uploadLock) {
-        return;
-      }
-      this.uploadLock = true;
-      let compareFaceData = await this.faceRecognition();
-      this.compareFaceData = compareFaceData;
-      if (compareFaceData >= 80) {
-        await this.imageInfos();
-        this.postCoursePhotoRecord()
-          .then(async (res) => {
-            this.photoHistoryList.push(this.photoIndex);
-            // console.log('拍照确定提交', this.photoHistoryList);
-            this.postStudyRecord(); //提交记录
-            if (this.erJianErZao && this.isReach) {
-              console.log("1校验");
-              await this.postStudyRecord(1);
-              this.photoPopup = false;
-              this.uploadLock = false;
-              this.enableAutoRotation = true;
-              this.nextSection();
-              return;
-            }
-            //恢复播放
-            // #ifdef MP-WEIXIN
-            uni.setKeepScreenOn({
-              keepScreenOn: false,
-            });
-            // #endif
-            this.photoPopup = false;
-            this.uploadLock = false;
-            this.enableAutoRotation = true;
-            this.refPlv.resumeVideo();
-          })
-          .catch((err) => {
-            console.log("拍照记录接口的err", err);
-            uni.showToast({
-              title: "上传接口报错,请重新拍照上传" + err,
-              icon: "none",
-            });
-            this.uploadLock = false;
-            this.openPhoto();
-          });
-      } else {
-        uni.showToast({
-          title: "人脸匹配不通过,请重新拍照上传",
-          icon: "none",
-          duration: 2000,
-        });
-
-        setTimeout(() => {
-          this.uploadLock = false;
-          this.openPhoto();
-        }, 2000);
-      }
-    },
-    reTake() {
-      this.isTaking = true;
-      // #ifdef H5
-      this.faceUrl = "";
-      this.getUserMedia(
-        {
-          video: {
-            width: 400,
-            height: 300,
-            facingMode: "user",
-          },
-        },
-        this.photographSuccess,
-        this.photographError
-      );
-      // #endif
-    },
-    toTakePhoto() {
-      this.popupPhotoShow = false;
-      this.openPhoto();
-    },
-    takePhTips() {
-      this.popupPhotoShow = true;
-      this.isTaking = false;
-      this.photoPopup = false;
-      this.enableAutoRotation = false;
-    },
     //确认拍照
     takePhoto() {
       // #ifdef MP-WEIXIN
@@ -2587,6 +2339,7 @@ export default {
     },
     async getGoodsDetail() {
       let { data } = await this.$api.goodsDetail(this.goodsId);
+      console.log("🚀 ~ file: detail.vue:2342 ~ getGoodsDetail ~ data:", data)
       this.goodsData = data.data;
       this.erJianErZao = this.goodsData.erJianErZao;
       this.erJianErZao && (await this.userConfirmInfoDetail());
@@ -2839,135 +2592,6 @@ export default {
   padding: 10rpx;
   border-radius: 16rpx;
 }
-.photoBox {
-  width: 100%;
-  // background-color: #ffffff;
-  // border-radius: 24px 24px 0px 0px;
-  .photoTop {
-    width: 100%;
-    height: 74rpx;
-    border-radius: 20px 20px 0px 0px;
-    background-color: #ffffff;
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    padding: 0rpx 38rpx;
-    .centersq {
-      color: #333;
-      font-size: 30rpx;
-      font-weight: 500;
-    }
-  }
-  .photoCenter {
-    width: 750rpx;
-    height: 75vh;
-    position: relative;
-    .center_camera {
-      width: 100%;
-      height: 75vh;
-      position: fixed;
-      .head_take {
-        width: 100%;
-        height: 75vh;
-        display: flex;
-        flex-direction: column;
-      }
-      .headTake_up {
-        width: 100%;
-        height: 100rpx;
-      }
-      .headTake_minddle {
-        display: flex;
-        .min_img {
-          width: 500rpx;
-          height: 550rpx;
-        }
-        .min_left,
-        .min_right {
-          flex: 1;
-          height: 550rpx;
-        }
-      }
-      .headTake_down {
-        width: 100%;
-        flex: 1;
-      }
-      .color {
-        background-color: #333;
-        opacity: 0.5;
-      }
-      .photo_v {
-        width: 100%;
-        height: 100%;
-      }
-      .mask {
-        width: 500rpx;
-        height: 550rpx;
-        position: absolute;
-        top: 100rpx;
-        left: 0;
-        right: 0;
-        bottom: 0;
-        margin: 0 auto;
-        box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.4);
-      }
-    }
-    .custom {
-      width: 750rpx;
-      height: 75vh;
-      position: absolute;
-      z-index: 1000;
-      top: 0;
-      left: 0;
-      image {
-        width: 100%;
-        height: 100%;
-      }
-    }
-  }
-
-  .btns {
-    display: flex;
-    .takePhoto_btn {
-      width: 100%;
-      display: flex;
-      align-items: center;
-      justify-content: space-between;
-      background: #a9a7a9;
-      padding: 40rpx 26rpx;
-      .middle_btn {
-        width: 120rpx;
-        height: 120rpx;
-        border-radius: 40rpx;
-        border: 4rpx solid #ffffff;
-        display: flex;
-        align-items: center;
-        justify-content: center;
-      }
-      .square {
-        width: 96rpx;
-        height: 96rpx;
-        background: #ffffff;
-        border-radius: 28rpx;
-      }
-      .rights {
-        font-size: 32rpx;
-        font-weight: 500;
-        color: #ffffff;
-      }
-    }
-    .btnResult {
-      height: 100rpx;
-      flex: 1;
-      background-color: #07c160;
-      text-align: center;
-      line-height: 100rpx;
-      color: #fff;
-      font-size: 32rpx;
-      font-weight: bold;
-    }
-  }
-}
 
 .tBox {
   display: flex;