开发者社区> 问答> 正文

dd.config设置了biz.util.uploadImage但是使用时,还是会报errorCode7


dd.config设置了'biz.util.uploadImage' 但是使用时,还是会报[Log] {"errorMessage":"Jsapi Should NOT Call, selectorString = uploadImage:to:","errorCode":"7"}


大神请帮忙解答一下!!!


app.js中


dd.ready(()=>{


               dd.config({
                    agentId: this.jsConfig.getAgentId(), // 必填,微应用ID
                    corpId: this.jsConfig.getCorpId(),//必填,企业ID
                    timeStamp:this.jsConfig.getTimeStamp() , // 必填,生成签名的时间戳
                    nonceStr: this.jsConfig.getNonceStr(), // 必填,生成签名的随机串
                    signature: this.jsConfig.getSignature(), // 必填,签名
                    jsApiList: [
                  
                    // test for uploadImage
                    'biz.util.uploadImage',
                    'biz.util.previewImage'
                    ] // 必填,需要使用的jsapi列表
                });


                alert("already!");


                dd.runtime.permission.requestAuthCode({
                    corpId : this.jsConfig.getCorpId(),


                    onSuccess : info => {
                        console.log("get code info:",info)
                        let getUserInfoRequest = new this.backend.root.dingtalk.GetUserInfoRequest();
                        getUserInfoRequest.setCode(info.code);
                        getUserInfoRequest.setCorpId(this.jsConfig.getCorpId());
                        //get current user info
                        executeAPI(this.backend,'.dingtalk.GetUserInfoRequest.cmd',getUserInfoRequest).then(response=>{
                            let getUserInfoResponse = response.get('.dingtalk.GetUserInfoResponse.cmd');
                            let user = getUserInfoResponse.getUser();
                            dd.userdata = user;
                            console.log("userinfo:",user);
                            //update state
                            this.setState({loaded:true});
                        })
                    },


                    onFail : function(err) {
                        alert('fail: ' + JSON.stringify(err));
                    }
                });
            });


            dd.error(function(err) {
                alert('dd error: ' + JSON.stringify(err));
            });


另一个js文件中。



picClick(){
        dd.biz.util.uploadImage({
            multiple: true, //是否多选,默认false
            max: 3, //最多可选个数
            onSuccess : function(result) {
                console.log(JSON.stringify(result));
                //onSuccess将在图片上传成功之后调用
                //[
                //  'http://gtms03.alicdn.com/tps/i3/TB1VF6uGFXXXXalaXXXmh5R_VXX-237-236.png'
                //]
            },
            onFail : function(result) {
                console.log(JSON.stringify(result));
            }
        });
        
    }

展开
收起
大辰儿 2016-09-14 16:05:00 7448 0
1 条回答
写回答
取消 提交回答
  • jsapi的调用需要在dd.ready的回调函数触发后
    2016-09-14 18:58:37
    赞同 展开评论 打赏
问答分类:
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载