请选择 进入手机版 | 继续访问电脑版
帖子
帖子
用户
博客
课程
显示全部楼层
6
帖子
0
勋章
20
Y币

[其他] getPicture回调不执行

[复制链接]
发表于 2019-10-7 14:31:06
// 点击选择图片
                $('#addimg').on('click', function() {
                                api.actionSheet({
                                        cancelTitle: '取消',
                                        buttons: ['相机', '相册']
                                }, function(ret, err) {
                                        if (ret.buttonIndex != 3) {
                                                var _sourceType = ""
                                                if (ret.buttonIndex == 1) {
                                                        _sourceType = 'camera';
                                                } else {
                                                        _sourceType = 'library';
                                                }
                                                api.getPicture({
                                                    sourceType: _sourceType,
                                                    encodingType: 'jpg',
                                                    mediaValue: 'pic',
                                                    destinationType: 'url',
                                                    allowEdit: true,
                                                    quality: 50,
                                                    targetWidth: 750,
                                                    targetHeight: 750,
                                                    saveToPhotoAlbum: false
                                                }, function(ret, err){
                                                    console.log('测试');
                                                    if(ret){
                                                         console.log(JSON.stringify(ret));
                                                    }else{
                                                         console.log(JSON.stringify(err));
                                                    }
                                                });
                                        }
                                });
                })



点击能打开相册,相机,但是回调没有执行,测试也打印不出来,大老帮忙看看什么错误
6
帖子
0
勋章
20
Y币
求大神讲解
44
帖子
2
勋章
608
Y币
用alert
6
帖子
0
勋章
20
Y币

alert也不成,回调没有执行,console.log('测试')都没有执行
20
帖子
0
勋章
6613
Y币
小猪佩刀 发表于 2019-10-7 15:44
alert也不成,回调没有执行,console.log('测试')都没有执行

Android 自定义loader 执行getPicture 时跳转到了系统的相机 ,所以console时无效的。
44
帖子
2
勋章
608
Y币
本帖最后由 筦陶 于 2019-10-7 17:27 编辑
小猪佩刀 发表于 2019-10-7 15:44
alert也不成,回调没有执行,console.log('测试')都没有执行

getpic: function(t) {
                                                        var that = this;
                                                        api.getPicture({
                                                                sourceType: that.type,
                                                                encodingType: 'jpg',
                                                                mediaValue: 'pic',
                                                                destinationType: 'url',
                                                                allowEdit: true,
                                                                quality: 100,
                                                                saveToPhotoAlbum: true
                                                        }, function(ret, err) {
                                                                if(ret) {
                                                                        if(ret.data == "") {
                                                                                api.toast({
                                                                                        msg: '请选择'
                                                                                });
                                                                                return false;
                                                                        }
     

                                                                } else {
                                                                        api.toast({
                                                                                msg: '请重试'
                                                                        });
                                                                }
                                                        });
                                                },
你是什么手机?我这边都可以呀
您需要登录后才可以回帖 登录

本版积分规则