@{
    //多图上传

    //图片路径
    var ImgPath = PageData["ImgPath"] == null ? "" : PageData["ImgPath"] as string;
    //图片的ID名称
    var ImgID = PageData["ImgID"];
    //是否 裁切
    var IsThumbnails = PageData["IsThumbnails"] == null ? true : false;
    //截取后的缩略图的宽
    var ThumbnailsWidth = PageData["ThumbnailsWidth"];
    //截取后的缩略图的高
    var ThumbnailsHeight = PageData["ThumbnailsHeight"];
    //用于替换图片路径
    System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex("http://(\\w)+.xuexiaoruanjian.com");

    //图片数
    var _Count_Imgs = 0;
    if (!string.IsNullOrWhiteSpace(ImgPath))
    {
        var _list = ImgPath.Split(',');
        _Count_Imgs = _list.Count();
    }
}

<script src="http://www.easyui-extlib.com/Scripts/jquery-easyui-extensions/menu/jeasyui.extensions.menu.js"></script>

<script type="text/plain" id="j_ueditorupload_@(ImgID)" style="height:5px;display:none;">
</script>
<script>
    //实例化编辑器
    var o_ueditorupload_@(ImgID) = UE.getEditor('j_ueditorupload_@(ImgID)',
    {
        autoHeightEnabled: false
    });
    var number@(ImgID)=0;

    o_ueditorupload_@(ImgID).ready(function () {
        o_ueditorupload_@(ImgID).hide();//隐藏编辑器
        //监听图片上传
        o_ueditorupload_@(ImgID).addListener('beforeInsertImage', function (t, arg) {
            number@(ImgID)=(number@(ImgID)<0?0:number@(ImgID));
            //批量图片
            for(var i=0;i<arg.length;i++)
            {
                number@(ImgID)=number@(ImgID)+1;
                Add_Imags_@(ImgID)(number@(ImgID), arg[i].src);
                $("#Imags@(ImgID)_Count").html(number@(ImgID));
            }
        });
    });

    //弹出图片上传的对话框
    function upImage_@(ImgID)() {
        var myImage = o_ueditorupload_@(ImgID).getDialog("insertimage");
        myImage.open();
    }

    //************************************************************************************

    //显示图片信息
    function ImageAttributes_@(ImgID)(i) {

        var img = new Image();
        img.src = $("#@(ImgID)_" + i).val();
        img.onload = function () {
            var size = "";
            if (img.fileSize != null && img.fileSize != null) {
                size = img.fileSize + " KB";
            }
            $("#img_html_@(ImgID)"+i).html('<span style=\'color:#f00\'>' + img.width + '</span>×<span style=\'color:#f00\'>' + img.height + "</span>" + size); // + img.fileSize + " KB"
        };
    }

    //预览
    function ImagePreview(url) {
        var path = $('#' + id).val();
        if (path != "") {
            window.open(path, "", "fullscreen=1")
        }
        else {
            alert("请先上传文件！");
        }
    }

    //关闭窗体
    function close() {
        if (grid != null) { grid.datagrid("clearSelections"); }
        if (arraylistWin != null) { arraylistWin.dialog('close'); }
        if (dialogWin != null) { dialogWin.dialog('close'); }
    }

    $(function () {
        @if (!string.IsNullOrWhiteSpace(ImgPath))
            {
                var _list = ImgPath.Split(',');
                for (var i = 0; i < _list.Count(); i++)
                {
                    var _model = _list[i];
    <text>
        number@(ImgID)=@(i+1);
        Add_Imags_@(ImgID)(number@(ImgID), "@(_model)");
        </text>
            }
            <text>
        $("#Imags@(ImgID)_Count").html(number@(ImgID));
        </text>
        }
    });

    function Add_Imags_@(ImgID)(i, url) {
        var img = new Image();
        img.src = url;
        img.onload = function () {
            var size = "";
            if (img.fileSize != null && img.fileSize != null) {
                size = img.fileSize + " KB";
            }
            $("#img_html_@(ImgID)_"+i).html('<span style=\'color:#f00\'>' + img.width + '</span>×<span style=\'color:#f00\'>' + img.height + "</span>" + size); // + img.fileSize + " KB"
        };
        var _item_text = "<li class=\"drag-item\" id=\"@(ImgID)_item_" + i + "\">";
        _item_text = _item_text + "<input id=\"@(ImgID)_" + i + "\" name=\"@(ImgID)\" type=\"hidden\" value=\"" + url + "\">";
        _item_text = _item_text + "<img src=\"" + url + "\" style=\"max-height:150px; max-width:150px;display:block; margin:0 auto;\">";
        _item_text = _item_text + "<div>"+(i)+"</div>";
        _item_text = _item_text + "<div id='img_html_@(ImgID)_" + i + "'>"+(i)+"</div>";
        _item_text = _item_text + "<div>";
        //_item_text = _item_text + "<a onclick=\"number@(ImgID)=number@(ImgID)-1;$(\'#Imags@(ImgID)_Count\').html(number@(ImgID));$(\'#@(ImgID)_item_" + i + "\').remove()\" style=\"display:inline-block;cursor: pointer; padding:2px 5px;background: #f00;z-index:10000;color:#fff;margin-left:2px;\" target=\"_blank\">删除</a>";
        _item_text = _item_text + "</div>";
        _item_text = _item_text + "</li>";
        $("#imgs_list_@(ImgID)").append(_item_text);

        //右键菜单
        $("#@(ImgID)_item_" + i).bind("contextmenu", function (e) {
            e.preventDefault();
            $.easyui.showMenu({
                left: e.pageX, top: e.pageY,
                items: [
                     { text: "预览", handler: function (e, item) { window.open(url); } }
                    ,{ text: "删除", handler: function (e, item) { $("#@(ImgID)_item_" + i).remove(); } }
                ]
            });
        });
    }
</script>
<div>
    <a href="javascript:;" class="easyui-linkbutton" onclick="upImage_@(ImgID)();" data-options="iconCls:'icon-large-picture',size:'large',iconAlign:'top'">图片上传</a>
    （共 <span id="Imags@(ImgID)_Count" style="color:red;"></span> 图） （图片右键菜单操作）
    <ul style="margin:0;padding:0;margin-top:10px; " id="imgs_list_@(ImgID)"></ul>
    <style type="text/css">
        .drag-item {
            list-style-type: none;
            display: inline-block;
            padding: 5px;
            border: 1px dashed #ccc;
            margin: 4px;
            background: #fafafa;
            color: #444;
            text-align: center;
        }

        .indicator {
            position: absolute;
            font-size: 9px;
            width: 10px;
            height: 10px;
            display: none;
            color: red;
        }
    </style>
    <script>
        $(function () {
            var indicator = $('<div class="indicator">↑</div>').appendTo('body');
            $('.drag-item').draggable({
                revert: true,
                deltaX: 0,
                deltaY: 0
            }).droppable({
                onDragOver: function (e, source) {
                    indicator.css({
                        display: 'block',
                        left: $(this).offset().left + $(this).outerWidth() - 5,
                        top: $(this).offset().top + $(this).outerHeight() - 5
                    });
                },
                onDragLeave: function (e, source) {
                    indicator.hide();
                },
                onDrop: function (e, source) {
                    $(source).insertAfter(this);
                    indicator.hide();
                }
            });
        });
    </script>
</div>