关于uinapp 华为审核相册 权限 拍摄/从相册选择,申请相机、存储权限;需要说明用途,复制可用

关于uinapp 华为审核相册 权限 拍摄/从相册选择,申请相机、存储权限; 需要说明用途复制可用

	export default {
		data() {
			return {
			qx_album:'', // 是否授权
			qx_sys:''
	
			}
		},
		onLoad() {
			 this.determine() //加载完成调用函数
		},
	
		methods: {	
			determine:function(){ // 判断手机类型与是否有授权
				var that = this;
				that.qx_album= uni.getStorageSync('QXSM_SAN'); // 定义一个变量值
				uni.getSystemInfo({
				    success: function (res) {
					  that.qx_sys = res.platform.toUpperCase();				
				   }			
				})						
			},
	empower:function(item){// 点击上传按钮
				var that = this;
				var _id=item.licenses_id;			
				if(that.qx_sys =='IOS'){
					
					that.xxx(_id)//如果是ios 直接调用上传方法
					
				} else if(that.qx_sys =='ANDROID'){	 // 如果是安卓,
					if(that.qx_sys =='agree'){ // 判断是否为agree 如果是 就直接调用上传方法
					   that.xxx(_id)
					   
					}else if(that.qx_sys ==''){  // 如果等于空就直接弹出提示
						uni.showModal({
							title: "相册权限说明",
							content:'便于您使用该功能上传您的照片/图片/视频,请您确认授权,否则无法使用该功能',
							confirmText:'同意',
							cancelText:'不同意',
							success: function(res) { 
								if (res.confirm) {
									//初始化相机
									that.requestPre(_id)
							
								} else if (res.cancel) {
									 uni.navigateBack();
								}
							}
							
						})
						
						
					}else if(that.sc_album=='denie'){ //如果弹窗拒绝再次发起
								  
								   uni.showModal({
									title: "相册权限说明",
								   	content:'便于您使用该功能上传您的照片/图片/视频,请您确认授权,否则无法使用该功能',
								   	confirmText:'去授权',
								   	cancelText:'算了',
								   	success: function(res) {
								   		if (res.confirm) {
									uni.setStorageSync('CLIENT_SCAN_Permissions','');
											//去到授权页面
								   			uni.openAppAuthorizeSetting();
								   			
								   		} else if (res.cancel) {
								   			 uni.navigateBack();
								   		}
								   	}
								   	
								   })
								  								  
							  }				 
					 else{
						that.xxx(_id)	
					}		
				}
			},

requestPre:function(_id){
				
			var that = this;
			//判断相机是否权限
		plus.android.requestPermissions(['android.permission.WRITE_EXTERNAL_STORAGE'], (e) => {	//权限被永久拒绝
				if (e.deniedAlways.length > 0) { 
					  uni.setStorageSync('QXSM_SAN','denie');					 
					  uni.navigateBack();	 
														  
				}
				//权限被临时拒绝
				if (e.deniedPresent.length > 0) {
				   uni.setStorageSync('QXSM_SAN','denie');
				   uni.navigateBack();
				}		
				if(e.granted.length > 0) { //权限被允许(包括权限仅在运行中使用和本次运行允许)
					 uni.setStorageSync('QXSM_SAN','agree');	 
					 that.XXX(_id);			
				}	
			});
			
		},
				
	
		}
	}
  • 11
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

功能点分享

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值