Helius
2022-06-16 9b4e9fed83737c688912053d8170586571122ef6
Merge branch 'mall-amz' of http://120.27.238.55:7000/r/xc-mall into mall-amz
1 files modified
42 ■■■■■ changed files
src/main/resources/templates/febs/views/modules/news/newsInfoUpdate.html 42 ●●●●● patch | view | raw | blame | history
src/main/resources/templates/febs/views/modules/news/newsInfoUpdate.html
@@ -47,6 +47,7 @@
            <label class="layui-form-label">视频:</label>
            <div class="layui-input-block">
                <button type="button" class="layui-btn upload" id="upload" style="background-color: #009688; margin-bottom: 2px">上传文件</button>
                <button type="button" class="layui-btn layui-btn-danger" id="uploadDel" style="margin-bottom: 2px">删除</button>
                <input type="text" name="videoUrl" autocomplete="off" value="" id="videoUrl" class="layui-input" readonly>
            </div>
        </div>
@@ -56,9 +57,9 @@
            <div class="layui-input-block">
                <button type="button" class="layui-btn" id="imageUpload" style="background-color: #009688; margin-bottom: 2px">图片上传</button>
                <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                    <div class=" layui-upload-list view-images" id="thumbImage">
                    </div>
                    <div class="layui-upload-list" id="thumbImage"></div>
                </blockquote>
                <div class="layui-word-aux">双击图片删除</div>
                <div class="febs-hide">
                    <input type="text" id="thumb"  name="thumb" autocomplete="off" class="layui-input" readonly>
                </div>
@@ -89,6 +90,7 @@
            layedit = layui.layedit,
            newsInfo = [[${newsInfo}]],
            $view = $('#newsInfo-update'),
            $uploadDel = $view.find('#uploadDel'),
            validate = layui.validate;
        //(下拉框)
@@ -146,12 +148,43 @@
            ,before: function(obj){
                //预读本地文件示例,不支持ie8
                obj.preview(function(index, file, result){
                    $('#thumbImage').html('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img" style="width: 100px">')
                    if ($("#thumb").val()) {
                        $('#thumbImage').html('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img new-image" style="width: 130px">')
                    } else {
                        $('#thumbImage').append('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img new-image" style="width: 130px">')
                    }
                    // $('#thumbImage').html('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img new-image" style="width: 100px">')
                });
            }
            ,done: function(res){
                $("#thumb").val(res.data.src);
                imgUnBind(".new-image");
                imgSingleBind();
            }
        });
        function imgUnBind(className) {
            $(className).each(function() {
                $(this).unbind('dblclick');
            })
        }
        function imgSingleBind() {
            $(".new-image").each(function(index, element) {
                $(this).on("dblclick", function() {
                    var imgThumb = $(".new-image")[index];
                    $(imgThumb).remove();
                    $("#thumb").val("");
                    imgUnBind(".new-image");
                    imgSingleBind();
                });
            })
        }
        $uploadDel.on('click', function () {
            $("#videoUrl").val('');
        });
@@ -183,7 +216,7 @@
        function initUserValue() {
            var thumb = newsInfo.thumb;
            $('#thumbImage').html('<img src="' + thumb + '" alt="" class="layui-upload-img" style="width: 100px">')
            $('#thumbImage').html('<img src="' + thumb + '" alt="" class="layui-upload-img new-image" style="width: 100px">')
            form.val("newsInfo-update-form", {
                "id": newsInfo.id,
                "categoryId": newsInfo.categoryId,
@@ -192,6 +225,7 @@
                "thumb": newsInfo.thumb,
                "content": newsInfo.content,
            });
            imgSingleBind();
            layedit.setContent(index, newsInfo.content, false);
        }