帖子
帖子
用户
博客
课程
30
帖子
0
勋章
186
Y币
本帖最后由 雨沛 于 2021-7-17 20:18 编辑
技术支持-F 发表于 2018-8-20 18:02
需要添加模块,编译自定义loader

请问这个,拍照返回的图该怎么写?
以下是我的批量选择上传的代码,可正常使用,就是拍照返回图该怎么写,弄不明白。


<script language="javascript" type="text/javascript">
function selectPic() {
        
var UIAlbumBrowser = api.require('UIAlbumBrowser');
api.clearCache();
UIAlbumBrowser.imagePicker({
    max: 9,
    styles: {
    bg: '#FFFFFF',                  
    cameraImg:'widget://res/cameraImg.png',
    mark: {                             
        icon: '',                       
        position: 'bottom_left',      
        size: 20                        
    },
    nav: {                              
        bg: '#3071b5',                     
        cancelColor: '#fff',            
        cancelSize: 16,  
        nextStepColor: '#fff',
        nextStepSize: 16                 
    },
        thumbnail: { //(可选项)返回的缩略图配置,**建议本图片不要设置过大** 若已有缩略图,则使用已有的缩略图。若要重新生成缩略图,可先调用清除缓存接口api.clearCache()。
                w: 800, //(可选项)数字类型;返回的缩略图的宽;默认:原图的宽度
                h: 800 //(可选项)数字类型;返回的缩略图的宽;默认:原图的高度
        }
    },
    animation:true,   
}, function(ret) {
        
   if (ret.eventType == 'nextStep') {
           
           
      var UIAlbumBrowser = api.require('UIAlbumBrowser');
      UIAlbumBrowser.closePicker();
          //alert(JSON.stringify(ret));
          //alert(ret.list.length);
          if (ret.list && ret.list.length > 0) {
                  
               
                  var resultLenth = ret.list.length;
                   for (var m = 0; m < resultLenth; m++) {
                           
                                api.showProgress();
                                api.ajax({
                                        timeout : 100,
                                        method : 'post',
                                        url : 'http://www.****.com/m/index.php?mod=batch_product&ac=uploadpic',
                                        data : {
                                                files:{file : ret.list[m].thumbPath},
                                        },
                                        dataType : 'json',
                                }, function(res, err) {
                                        api.hideProgress();
                                        if(res.error==0){
                                                $("#piclist").append("<li class='diyUploadHover'><img src='"+res.picture+"' class='img'/><span class='del1'></span><div class='diyControl' img_id='"+res.img_id+"'><span class='diyLeft'><i class='layui-icon layui-icon-left'></i></span><span class='diyCancel'  img_id='"+res.img_id+"'><i class='layui-icon layui-icon-delete'></i></span><span class='diyRight'><i class='layui-icon layui-icon-right'></i></span></div><input type='hidden' name='img_id[]' value='"+res.img_id+"'></li>");
                                        }
                                        else{
                                                layer.msg(res.msg);
                                        }
                                       
                                });
                          
                          
                          
                                
                        }
          }
      //alert(JSON.stringify(ret));
   
   }
});
}
</script>
1
帖子
0
勋章
130
Y币
支持APICloud
1
帖子
0
勋章
130
Y币
支持APICloud
1
帖子
0
勋章
130
Y币
支持APICloud
1
帖子
0
勋章
130
Y币
支持APICloud
1
帖子
0
勋章
130
Y币
支持APICloud
1
帖子
0
勋章
130
Y币
支持APICloud
1
帖子
0
勋章
130
Y币

支持APICloud
1682
帖子
10
勋章
130
Y币
CTO签名版APICloud 3.0新书免费抢
1682
帖子
10
勋章
130
Y币
CTO签名版APICloud 3.0新书免费抢
12345678910下一页
您需要登录后才可以回帖 登录

本版积分规则