Browse Source

Merge branch 'master' of https://gitee.com/he2802/saas_applet

chenxiong 3 năm trước cách đây
mục cha
commit
6babc0714f
2 tập tin đã thay đổi với 91 bổ sung14 xóa
  1. 71 12
      pages2/class/detail.vue
  2. 20 2
      pages2/verify/input2.vue

+ 71 - 12
pages2/class/detail.vue

@@ -129,7 +129,7 @@
 			</view>
 		</view>
 		<!-- 播放前拍照start -->
-		<u-popup v-model="photoPopup" mode="bottom" border-radius="32" :mask-close-able="false">
+		<view v-if="photoPopup"  :mask-close-able="false" style="bottom: 0;position: fixed;width: 100%;z-index: 999;">
 			<view class="photoBox">
 				<view class="photoTop">
 					<view class="sqzz" v-if="false"><u-icon name="close" color="#333333" size="30" @click="closePhoto"></u-icon></view>
@@ -137,14 +137,18 @@
 					<view class="sqzz"></view>
 				</view>
 				<view class="photoCenter">
-					<camera device-position="front" flash="off" @error="error" style="width: 100%; height: 100%" v-if="photoPopup"></camera>
+					<view style="width: 100%; height: 979rpx;position: fixed;" v-if="photoPopup">
+						<camera device-position="front" flash="off" @error="error" style="width: 100%; height: 100%;" ></camera>
+					</view>
 					<view class="custom"><image src="@/pages2/static/zhezhao.png" mode=""></image></view>
 				</view>
 				<view class="btnResult" @click="takePhoto">拍照</view>
 			</view>
-		</u-popup>
+		</view>
 		<!-- 播放前拍照end -->
+		
 	</view>
+	
 </template>
 
 <script>
@@ -336,13 +340,63 @@ export default {
 		});
 	},
 	methods: {
+		getCameraSetting () {
+		    const _this = this
+		    wx.getSetting({
+		      success: res => {
+		        if (res.authSetting['scope.camera']) {
+		          // 用户已经授权
+		          
+		        } else {
+		          // 用户还没有授权,向用户发起授权请求
+		          wx.authorize({
+		            scope: 'scope.camera',
+		            success() { // 用户同意授权
+		             
+		            },
+		            fail() { // 用户不同意授权
+		             
+		              wx.showToast({
+		                title: '摄像头授权失败',
+		                icon: 'none',
+		                duration: 3000
+		              })
+					  console.log(232)
+					  wx.openSetting({
+					  success (res) {
+						if(res.authSetting['scope.camera']){
+							console.log(232)
+		  //		          self.setData({ showCamera:true})
+						}
+					  }
+					})
+		            }
+		          })
+		        }
+		      },
+		      fail: res => {
+		        console.log('获取用户授权信息失败')
+		        wx.showToast({
+		          title: '获取用户授权信息失败',
+		          icon: 'none',
+		          duration: 3000
+		        })
+		       
+		      }
+		    })
+		  },
 		openJY(){
-			uni.authorize({
-			     scope: 'scope.camera',
-			     success() {
-			        
-			     }
-			 })
+			this.openPhoto();
+	//		this.getCameraSetting()
+			/* wx.openSetting({
+			      success (res) {
+			        if(res.authSetting['scope.camera']){
+	//		          self.setData({ showCamera:true})
+			        }
+			      }
+			    }) */
+
+
 			this.$u.toast('此功能正在开发中');
 		},
 		async playVideo(item) {
@@ -490,6 +544,7 @@ export default {
 				currentTime = polyvPlayerContext.getCurrentTime();
 			}
 			let self = this;
+			console.log(self.ossAvatarUrl,"准备提交,照片地址")
 			let data = {
 				photo: self.ossAvatarUrl,
 				sectionId: parseInt(sectionId),
@@ -600,7 +655,6 @@ export default {
 			var polyvPlayerContext = this.selectComponent('#playerVideo');
 			if (polyvPlayerContext != null) {
 				let PlayCurrentTime = polyvPlayerContext.getVideoPlayDuration();
-				console.log(PlayCurrentTime,996)
 				this.studyDuration = PlayCurrentTime;
 				if (this.currentTime < PlayCurrentTime) {
 					this.playTime += PlayCurrentTime - this.currentTime;
@@ -642,7 +696,9 @@ export default {
 				this.postStudyRecord() */
 			}
 			if (newstate.detail.newstate == 'ended') {
-				this.ossAvatarUrl = '';
+				setTimeout(function(){
+					this.ossAvatarUrl = '';
+				}, 2000)
 				this.postStudyRecord(1);
 			}
 		},
@@ -807,6 +863,8 @@ export default {
 	font-size: 24rpx;
 }
 .photoBox {
+	background-color: #FFFFFF;
+	border-radius: 32px 32px 0px 0px;
 	.photoTop {
 		height: 74upx;
 		display: flex;
@@ -834,6 +892,7 @@ export default {
 			width: 750upx;
 			height: 979upx;
 			position: absolute;
+			z-index: 1000;
 			top: 0;
 			left: 0;
 			image {
@@ -843,7 +902,7 @@ export default {
 		}
 	}
 	.btnResult {
-		height: 100upx;
+		height: 100rpx;
 		width: 100%;
 		background-color: #07c160;
 		text-align: center;

+ 20 - 2
pages2/verify/input2.vue

@@ -114,13 +114,31 @@ export default {
 							const filePath = result.tempFilePath
 							console.log(this.$method.splitImgHost(res.data.msg));
 							this.$method.showToast('下载成功');
-							uni.openDocument({
+							uni.saveVideoToPhotosAlbum({
+								filePath: filePath,
+								success: function (errMsg) {
+								uni.showToast({
+								  mask: true,
+								  title: '保存成功'
+								  });
+								},
+								fail:(errMsg)=>{
+									uni.showToast({
+										mask: true,
+										title: '保存失败'
+										});
+									},
+									complete:(errMsg)=>{
+													
+									}
+								});     
+							/* uni.openDocument({
 							    filePath: filePath,
 							    fileType:'doc',
 							    showMenu:true,
 							    success: function (res) {
 							    }
-							  })
+							  }) */
 						}
 					}
 				});