<div class="layui-upload-drag" id="test10" style="padding: 10px">
   <i class="layui-icon"></i>
  <p>点击上传，或将文件拖拽到此处</p>
  
</div>
     <div class="allimgs">
     	<? 
        $fvalue_temp=$fvalue;
         $fvalue=json_decode($fvalue,true);
        // $sort= array_column($fvalue,'sort');
        //array_multisort($sort,SORT_ASC,$fvalue);
        
        foreach ($fvalue as $key => $value) {?>
     	   <div class="imgaa"><img class="layui-upload-img" src="<?=$value['src']?>"><div class="delete_img alldelete"><i class="layui-icon layui-icon-delete"></i></div><div class="sort"> <input type="text" class="layui-input sortinput" value="<?=$value['sort']?>" ></div></div>
        <? }?>
     </div>
       
              
<script>
    var allimgs=<?=$fvalue_temp?$fvalue_temp:"[]"?>;
    var allnum=<?=count($fvalue)?>;
    layui.use(['form', 'table','laydate','upload','miniAdmin'], function () {
       var form = layui.form,
            layer = layui.layer,
            upload = layui.upload,
            table = layui.table,
            miniAdmin = layui.miniAdmin,
            $ = layui.jquery;
          laydate = layui.laydate;
        /**
         * 初始化表单，要加上，不然刷新部分组件可能会不加载
         */
        form.render();
      
        //执行实例
    var show=0;
    var uploadInst = upload.render({
    elem: '#test10' //绑定元素
    ,url: 'ajax.php?act=upload' //上传接口
    ,accept: 'file' //允许上传的文件类型
    ,exts:"jpg|png"
    ,multiple:true,
    number:50
    
    ,choose:function(obj){
        layer.load(2);
    }
    ,done: function(res){
     layer.closeAll('loading');    
     data=res.data
     allnum=allnum+1;
     var imgdata={};
     imgdata.src=data.src;
     imgdata.sort=allnum;
     allimgs.push(imgdata);
     $("#imgs").val(JSON.stringify(allimgs))
      html='<div class="imgaa"><img class="layui-upload-img" src="'+data.src+'"><div class="delete_img alldelete"><i class="layui-icon layui-icon-delete"></i></div><div class="sort"> <input type="text" class="layui-input" value="'+allnum+'" ></div></div>';  
      $(".allimgs").append(html);

    }
    ,allDone: function(obj){ //当文件全部被提交后，才触发
     
  }
    ,error: function(){
      //请求异常回调
      
    }
  });

   $("body").on("blur",".sortinput", function(e){

       var index=$(this).parent().parent().index();
        if (index=="-1") return
         allimgs[index].sort=$(this).val();
         $("#imgs").val(JSON.stringify(allimgs))
   })
   $("body").on("click",".alldelete", function(e){
        
          var index=$(this).parent().index();
           if (index=="-1") return
            
             allimgs.splice(index,1);
             console.log(index,99,allimgs)
              $("#imgs").val(JSON.stringify(allimgs))
             $(this).parent().remove()
            
              
     })
       

    });
</script>

<STYLE>
.allimgs .layui-upload-img {
    width: 92px;
    height: 92px;
    margin: 0 10px 10px 0;
}
.layui-upload-list{display: none}
.allimgs .delete_img {
    position: absolute;
     background-color: rgba(0,0,0,.5);
    width: 100%;
    bottom: 25px;
     text-align: right;
    height: 25px;
    line-height: 25px;
    color: #fff;
   }
.allimgs .imgaa{width: 92px; position: relative;float: left; margin-right: 10px}
.allimgs{margin: 5px auto; display: flex;; flex-direction: row}
.allimgs .sort{height: 20px; text-align: center;}
.allimgs .sort .layui-input{width: 100%; height: 25px}
</STYLE>