Commit f968813b by 陈岩

fix: 修复相册权限问题

1 parent a368866a
......@@ -2,8 +2,8 @@
"name" : "CVA YAP",
"appid" : "__UNI__C2F3380",
"description" : "",
"versionName" : "1.0.18",
"versionCode" : 28,
"versionName" : "1.0.19",
"versionCode" : 29,
"transformPx" : false,
/* h5代理方式 */
"h5" : {
......@@ -45,7 +45,8 @@
/* 模块配置 */
"modules" : {
"File" : {},
"Push" : {}
"Push" : {},
"Camera" : {}
},
/* 应用发布信息 */
"distribute" : {
......@@ -103,7 +104,8 @@
/* 模块配置 */
"modules" : {
"File" : {},
"Push" : {}
"Push" : {},
"Camera" : {}
},
/* 应用发布信息 */
"distribute" : {
......
......@@ -110,22 +110,19 @@ async function chooseImageAction() {
return new Promise((resolve, reject) => {
const imgI18nMap = {
'zh_CN':{
takePhoto:'拍照',
gallery:'从图库中选择'
takePhoto:'拍照'
},
'en_US':{
takePhoto:'Take photo',
gallery:'Choose from gallery'
takePhoto:'Take photo'
},
'ja_JP':{
takePhoto:'カメラで撮る',
gallery:'ギャラリーから選択'
takePhoto:'カメラで撮る'
}
}
const lang = uni.getStorageSync('lang') || 'en_US'
uni.showActionSheet({
itemList: [imgI18nMap[lang].takePhoto, imgI18nMap[lang].gallery],
success: (res) => resolve(res.tapIndex === 0 ? 'camera' : 'album'),
itemList: [imgI18nMap[lang].takePhoto],
success: (res) => resolve('camera'),
fail: (err) => reject(err)
});
});
......@@ -138,13 +135,18 @@ async function chooseImageAction() {
*/
export async function chooseImage(options = {}) {
const source = options.source;
const count = options.count ?? 1;
const sizeType = options.sizeType || ['original', 'compressed'];
const sourceType = options.sourceType || ['album', 'camera'];
// const count = options.count ?? 1;
// const sizeType = options.sizeType || ['original', 'compressed'];
// const sourceType = options.sourceType || ['album', 'camera'];
const count = 1;
const sizeType = ['compressed']
const sourceType = ['camera'];
try {
const finalSource = source ?? (await chooseImageAction());
const paths = finalSource === 'camera' ? await takePhoto() : await pickFromGallery();
// finalSource === 'camera' ? : await pickFromGallery();
const paths = await takePhoto()
if (!paths || paths.length === 0) {
return {
......
import {
chooseImagePath as chooseImage
} from './plusUpload.js'
import {
chooseSystemMedia
} from "@/uni_modules/uni-chooseSystemImage"
function pickExclude(obj, keys) {
// 某些情况下,type可能会为
......@@ -89,20 +86,20 @@ export function chooseFile({
case 'image':
const isAndroid = isAndroidApp()
if (isAndroid) {
chooseSystemMedia({
count: 2,
mediaType: ['image'],
pageOrientation: "portrait",
success: (e) => {
console.log(e.filePaths)
},
fail: (e) => {
console.log(e)
},
})
// chooseImage().then(res => {
// resolve(formatImage(res))
// chooseSystemMedia({
// count: 2,
// mediaType: ['image'],
// pageOrientation: "portrait",
// success: (e) => {
// console.log(e.filePaths)
// },
// fail: (e) => {
// console.log(e)
// },
// })
chooseImage().then(res => {
resolve(formatImage(res))
})
} else {
uni.chooseImage({
count: multiple ? Math.min(maxCount, 9) : 1,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!