提交 26ae58f8 编写于 作者: DCloud_JSON's avatar DCloud_JSON

优化引导打开相册权限,因为ios已经集成不需要另外写

上级 ffa90a8b
......@@ -59,10 +59,8 @@ export default function() {
uni.addInterceptor('chooseImage', {
fail(e) { // 失败回调拦截
console.log(e);
if (
e.errCode === 11 && uni.getSystemInfoSync().platform == "android" ||
e.errCode === 2 && uni.getSystemInfoSync().platform == "ios"
){
if(uni.getSystemInfoSync().platform == "android" && e.errMsg == 'chooseImage:fail No Permission'){
if(e.code === 11){
uni.showModal({
title:"无法访问摄像头",
content: "当前无摄像头访问权限,建议前往设置",
......@@ -73,8 +71,7 @@ export default function() {
}
}
});
}
if(e.errCode === 12 && uni.getSystemInfoSync().platform == "android"){
}else{
uni.showModal({
title:"无法访问相册",
content: "当前无系统相册访问权限,建议前往设置",
......@@ -87,6 +84,7 @@ export default function() {
});
}
}
}
})
// #ifdef APP-PLUS
......@@ -142,3 +140,29 @@ function initAppVersion() {
checkUpdate();
// #endif
}
function openAppPermissionSetting(){
// 跳转到**应用**的权限页面
if (uni.getSystemInfoSync().platform == "ios") {
var UIApplication = plus.ios.import("UIApplication");
var application2 = UIApplication.sharedApplication();
var NSURL2 = plus.ios.import("NSURL");
// var setting2 = NSURL2.URLWithString("prefs:root=LOCATION_SERVICES");
var setting2 = NSURL2.URLWithString("app-settings:");
application2.openURL(setting2);
plus.ios.deleteObject(setting2);
plus.ios.deleteObject(NSURL2);
plus.ios.deleteObject(application2);
} else {
// console.log(plus.device.vendor);
var Intent = plus.android.importClass("android.content.Intent");
var Settings = plus.android.importClass("android.provider.Settings");
var Uri = plus.android.importClass("android.net.Uri");
var mainActivity = plus.android.runtimeMainActivity();
var intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
var uri = Uri.fromParts("package", mainActivity.getPackageName(), null);
intent.setData(uri);
mainActivity.startActivity(intent);
}
}
\ No newline at end of file
<template>
<view>
<!-- #ifndef H5 -->
<uni-nav-bar :border="false"></uni-nav-bar>
<!-- #ifdef APP-PLUS -->
<statusBar></statusBar>
<!-- #endif -->
<!-- 搜索功能 -->
<uni-search-bar @click="searchClick" class="uni-search-box" v-model="keyword" ref="searchBar" radius="100" cancelButton="none" disabled/>
......@@ -58,7 +58,9 @@
<script>
var cdbRef, currentWebview;
import statusBar from "@/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-status-bar";
export default {
components: { statusBar },
data() {
return {
where: "",
......
......@@ -34,7 +34,6 @@
border-radius: 6rpx;
}
.send-btn{
height: 85rpx;
width: 100%;
margin-top:15px;
border-radius: 6rpx;
......
......@@ -130,7 +130,6 @@
}
},
setAvatar() {
console.log('点击编辑信息');
uni.chooseImage({
count: 1,
success: (res) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册