addOrQueryminiFault.html 4.4 KB
<!DOCTYPE html>

<style>
.sale-category-detail-page .goods-image {
    display: flex;
}


.sale-category-detail-page .goods-image .img {
    width: 120px;
    height: 120px;
    margin-right: 10px;
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    position: relative;
}

.sale-category-detail-page .goods-image .img:hover:before {
    content: "删除";
    width: 100%;
    display: block;
    position: absolute;
    top: 0;
    background: #000;
    opacity: 0.5;
    color: #fff;
    text-align: center;
    line-height: 104px;
}
</style>
<div class="sale-category-detail-page"  style="overflow-y: scroll;height: 80%" >
    <h4 id="titleInfo"></h4>
    <form name="categoryEditForm" id="categoryEditForm" method="post" enctype="multipart/form-data">
        <div class="goods-image" style="margin-top: 5px;margin-left: 30px;height: 60%">
            <div style="width:20%;margin-top:5px;" >
                <span style="color:red">*</span><label id="imageLabel"></label>
            </div>
            <div id="imageUpload"></div>
        </div>
        <div style="margin-top: 5px;margin-left: 30px">
            <table border="0" style="width:95%;margin-top:5px;line-height:30px;" >
                <!--<tr style="height: 60px">
                    <td width="20%"><span style="color:red">*</span><label>跳转类型</label></td>
                    <td>

                    </td>
                </tr>-->
                <tr style="height: 60px">
                    <td width="20%"><span style="color:red">*</span><label>瑕疵备注</label></td>
                    <td>
                        <input id="checkText" class="easyui-textbox"  name="checkText" data-options="validType:'length[1,500]'" style="width:600px;" required="true" prompt="请填写具体的瑕疵问题描述"/>
                    </td>
                </tr>
            </table>
        </div>
    </form>
</div>
<script>
    $(function () {
        this.dom = {
            imageUpload: $('#categoryEditForm #imageUpload')
        };
        var data = paramObject.mkData;
        debugger
        $("#imageLabel").html(data.imageLabel==null ? "图片":data.imageLabel);
        //查看页面
        if (data.flag) {
            //上传图片
            this.dom.imageUpload.imageUpload({
                width: 104,
                height: 104,
                realInputName: "imageUrl",
                url: contextPath + '/fileupload/upload',
                queryParams: {
                    bucket: "ufominifault"
                },
                onBeforeSubmit: function () {
                    $.messager.progress({
                        title: "正在执行",
                        msg: "正在执行,请稍后...",
                        interval: 500,
                        text: ""
                    });
                },
                filterFileName: function (data) {
                    if (!data || data.code != 200) {
                        $.messager.progress("close");
                        $.messager.alert("错误", data.message);
                        return "";
                    }
                    return data.data.url;
                },
                onLoadSuccess: function (data) {
                    console.log(data.data );
                    $.messager.progress("close");
                    $(document).find('.file-close').click();
                    $('#categoryEditForm #imageUpload').before('<div class="img" data-url="' + data.data + '" style="background-image:url(' + data.data + ');"> ');
                    return false;
                }
            });

            $(document).on('click', '.goods-image .img', function() {
                $(this).remove();
            });

        }else{//查看页面
            //隐藏按钮
            $('#saveBtn').linkbutton('disable');
            $("#saveBtn").attr("style","display:none;");
            $('#categoryEditForm #imageUpload').attr("style","display:none;");
            $("#checkText").textbox("textbox").attr("readonly","readonly");

           for (var i=0;i<data.imageUrlList.length;i++)
            {
                $('#categoryEditForm #imageUpload').before('<a target="_blank" href="'+data.imageUrlList[i]+'"><img  src="' + data.imageUrlList[i] + '" style="width: 120px;height: 120px;"  /></a> ');
            }
            $("#categoryEditForm #checkText").textbox('setValue',data.checkText);


        }




    });

</script>