Bläddra i källkod

fix 相机授权

he2802 3 år sedan
förälder
incheckning
358cb1ae88
2 ändrade filer med 13 tillägg och 15 borttagningar
  1. 12 15
      pages2/class/detail.vue
  2. 1 0
      pages2/plan/create.vue

+ 12 - 15
pages2/class/detail.vue

@@ -130,7 +130,7 @@
 		</view>
 		<!-- 播放前拍照end -->
 		<u-popup v-model="showSet" :mask-close-able="false" mode="center">
-			<view style="width: 250rpx;height: 250rpx;display: flex;align-items:center">
+			<view style="height: 250rpx;display: flex;align-items:center;padding: 0 30rpx;">
 				<button open-type="openSetting" @bindopensetting="openSetting" class="btnSet">相机授权</button>
 			</view>
 		</u-popup>
@@ -240,6 +240,8 @@ export default {
 	},
 	onShow() {
 		var self = this;
+		//相机授权
+		this.getCameraSetting()
 		this.$api.getbaseprofiletplists({ goodsId: self.goodsId }).then(res => {
 			if (res.data.code === 200 && res.data.rows.length) {
 				if (res.data.rows[0].keyValue) {
@@ -335,7 +337,6 @@ export default {
 	},
 	mounted() {
 		uni.$on('changeSection', oldSectionId => {
-			this.ossAvatarUrl = '';
 			this.postStudyRecord(0, oldSectionId);
 		});
 		uni.$on('getSection', item => {
@@ -358,38 +359,33 @@ export default {
 		      success: res => {
 		        if (res.authSetting['scope.camera']) {
 		          // 用户已经授权
-		          
+		           self.showSet = false
 		        } else {
 		          // 用户还没有授权,向用户发起授权请求
 		          wx.authorize({
 		            scope: 'scope.camera',
 		            success() { // 用户同意授权
-		             
+		              self.showSet = false
 		            },
 		            fail() { // 用户不同意授权
 		             self.showSet = true
-		              wx.showToast({
+		             /* wx.showToast({
 		                title: '摄像头授权失败',
 		                icon: 'none',
 		                duration: 3000
-		              })
+		              }) */
 		            }
 		          })
 		        }
 		      },
 		      fail: res => {
-		        console.log('获取用户授权信息失败')
-		        wx.showToast({
-		          title: '获取用户授权信息失败',
-		          icon: 'none',
-		          duration: 3000
-		        })
+		       
 		       
 		      }
 		    })
 		  },
 		openJY(){
-	//		this.getCameraSetting()
+			
 	//		this.openPhoto();
 	//		this.getCameraSetting()
 			/* wx.openSetting({
@@ -842,12 +838,13 @@ export default {
 
 <style lang="scss" scope>
 	.btnSet{
-		width: 100px;
 		height: 50px;
+		width: 400rpx;
 		background: #007AFF;
-		border-radius: 40rpx;
+		border-radius: 25rpx;
 		color: #FFFFFF;
 		font-size: 28rpx;
+		line-height: 50px;
 	}
 .btnReply {
 	width: 80rpx;

+ 1 - 0
pages2/plan/create.vue

@@ -274,6 +274,7 @@ export default {
 							showCancel: false,
 							success: function(resst) {
 								if (resst.confirm) {
+									uni.setStorageSync('updateHome',1)
 									uni.navigateBack();
 								}
 							}