Browse Source

feature: permition

able99 4 years ago
parent
commit
8ee4731c7b
2 changed files with 12 additions and 44 deletions
  1. 1 15
      pagesGood/liveDetail.nvue
  2. 11 29
      pagesGood/pickVideo.nvue

+ 1 - 15
pagesGood/liveDetail.nvue

@@ -50,7 +50,6 @@
 <script>
 	import jhlive from "@/jhlive/jhlive";
 	import Jhim from "@/jhim/jhim.js";
-	import permision from "@/utils/permission.js"
 	const NET = require('@/utils/request');
 	const API = require('@/config/api');
 
@@ -123,20 +122,7 @@
 				
 				this.avatar = uni.getStorageSync("liveImgUrl");
 				this.title = uni.getStorageSync("liveName");
-				this.$nextTick(() => {
-					if(this.isAuthor||this.linkMic) {
-						permision.checkAndRequestPermissions(this.isAuthor?['scope.camera','scope.record']:['scope.record']).then(()=>{
-							this.enterRoom();
-						}, ()=>{
-							uni.showToast({
-								title: '获取权限失败',
-								duration: 2000,
-							})
-						})
-					}else {
-						this.enterRoom();
-					}
-				});
+				this.$nextTick(() => this.enterRoom());
 			},
 			enterRoom() {
 				this.jhim = Jhim.getInstance(this.userId, this.sdkAppID, this.secretKey);

+ 11 - 29
pagesGood/pickVideo.nvue

@@ -21,7 +21,8 @@
 </template>
 
 <script>
-	import jhlive from "@/jhlive/jhlive";
+  import jhlive from "@/jhlive/jhlive";
+  import permision from "@/utils/permission.js";
 	const NET = require('@/utils/request')
 	const API = require('@/config/api')
 	
@@ -70,37 +71,18 @@
           this.avatar = res.data.headImg;
           this.liveId = res.data.liveId;
           this.roomId = res.data.roomId;
+          this.userId = this.userData.userId;
           this.goodsList = res.data.liveProducResVO;
           
           this.$nextTick(() => {
-            if(this.isAuthor) {
-              permision.checkAndRequestPermission('scope.camera').then(()=>{
-                permision.checkAndRequestPermission('scope.record').then(()=>{
-                  this.enterRoom();
-                },()=>{
-                  uni.showToast({
-                    title: '获取权限失败',
-                    duration: 2000,
-                  })
-                });
-              },()=>{
-                uni.showToast({
-                  title: '获取权限失败',
-                  duration: 2000,
-                })
-              })
-            }else if(this.linkMic) {
-              permision.checkAndRequestPermission('scope.record').then(()=>{
-                this.enterRoom();
-              },()=>{
-                uni.showToast({
-                  title: '获取权限失败',
-                  duration: 2000,
-                })
-              });
-            }else {
-              this.enterRoom();
-            }
+            permision.checkAndRequestPermissions(['scope.record']).then(()=>{
+							this.enterRoom();
+						}, ()=>{
+							uni.showToast({
+								title: '获取权限失败',
+								duration: 2000,
+							})
+						})
           });
         }).catch(error => {
           uni.showToast({