General.Web/wwwroot/lib/imageupload/1.0/js/imgup.js

(开头部分) 9KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。


(function ($) {
    "use strict";

    var deleteParent;
    var deleteDisplay = 'none';
    var defaults = {
        fileType: ["jpg", "png", "bmp", "jpeg"],   // 上传文件的类型
        fileSize: 1024 * 1024 * 10                 // 上传文件的大小 10M
    };

    $.fn.imageUpload = function (option, param) {
        if (typeof option == 'string') {
            return $.fn.imageUpload.methods[option](this, param);
        }
        var _option = $.extend({}, $.fn.imageUpload.defaults, option || {});
        var target = $(this);
        var id = target.attr("id");
        var inputFileId = id + "_file";
        var html = '';
        html += '<section class="img-section">';
        html += '    <div class="z_photo upimg-div clear">';
        html += '       <section class="z_file fl">';
        if (_option.canAdd == 1) {
            html += '           <img src="' + _option.context + 'lib/imageupload/1.0/img/add.png" class="add-img">';
            deleteDisplay = 'block';
        }
        html += '           <input type="file" name="' + inputFileId + '" id="' + inputFileId + '" class="file-image" callback="' + _option.uploadImage + '" context="' + _option.context + '" limit="' + _option.limit + '"  value="" accept="image/jpg,image/jpeg,image/png,image/bmp" />';
        html += '       </section>';
        html += '   </div>';
        html += '</section>';
        html += '<aside class="mask works-mask">';
        html += '   <div class="mask-content">';
        html += '       <div class="del-p">您确定要删除图片吗?</div>';
        html += '       <div class="check-p"><span class="del-com wsdel-ok">确定</span><span class="wsdel-no">取消</span></div>';
        html += '   </div>';
        html += '</aside>';
        target.append(html);

        target.find(".wsdel-ok").click(function () {
            $(".works-mask").hide();
            var numUp = deleteParent.siblings().length;
            if (numUp < 6) {
                deleteParent.parent().find(".z_file").show();
            }
            deleteParent.remove();
        });

        target.find(".wsdel-no").click(function () {
            $(".works-mask").hide();
        });

        $("#" + inputFileId).change(function () {
            prepareUploadImage(inputFileId);
        });
    };

    $.fn.imageUpload.defaults = {
        uploadImage: '',    // 上传图片回调
        limit: 10,          // 上传限制
后面还有 161 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。