web前端開發插件(無需重複造輪子)

一、artdialog 對話框組件

  簡介:是一個基於JavaScript編寫的對話框組件,他擁有精緻的界面與友好的接口
html

  文檔連接:http://www.daimajiayuan.com/download/201304/yulan/artDialog4.1.7/
node

 2。圖片上傳json

/*
 * 文件上傳實例
 * _this 當前文件上傳input節點
 * imgnode  當前父節點
 * localfilename 當前節點 id
 * 火狐、谷歌、ie標準文檔模式下可兼容
 */
function uploadfile_change(that) {
    var _this = $(that);
    var _thisId = $(that).attr("id");
    var result = uploadfileMore1(_this.siblings("div"), $(this).parent(), url_uploadscheduleIMG, _thisId);
}
function uploadfileMore1(_this, imgnode,url, localfilename) {
    var hint = $("#" + localfilename).attr("node");//標識
    var filebase64 = "null";
    var jsondata = {};
    var dealdata = {'servicecode': '9003'};
    jsondata.service = dealdata;
    dealdata.watermark = true;
    apiFileupload(url,localfilename, filebase64, jsondata, function (data, status) {
        var json_data = JSON.parse(data);
        if (json_data.status == 0) {
            var data_obj = json_data.data;
            var split = data_obj.url.split(",");
            var div_obj = $(imgnode).parent("div.img_hunk");
            var now_length = div_obj.siblings("div.img_hunk").length;
            var img_str = "";
            if(hint == 2){
                 _this.empty();
                 _this.append('<img class="purls" src="' + split[0] + '" path="' + split[0] + '" style="width:150px;height:100px;">');
            }else{
                for (var i = 0; i < split.length; i++) {
                    if (now_length == 0) {
                        if (i <= 7) {
                            img_str += ' <div class="img_hunk img_hunk_other" uuid="">'
                            img_str += '<p><img src="' + split[i] + '" path="' + split[i] + '"></p>';
                            img_str += ' <p>';
                            img_str += '<span class="del_upload_img">刪除</span>';
                            img_str += ' </p>';
                            img_str += '</div>';
                            if (i == 7) {
                                div_obj.hide();
                            }
                        }
                    } else {
                        if (i <= (7 - now_length)) {
                            img_str += ' <div class="img_hunk img_hunk_other" uuid="">'
                            img_str += '<p><img src="' + split[i] + '" path="' + split[i] + '"></p>';
                            img_str += ' <p>';
                            img_str += '<span class="del_upload_img">刪除</span>';
                            img_str += ' </p>';
                            img_str += '</div>';
                            if (i == (7 - now_length)) {
                                div_obj.hide();
                            }
                        }
                    }
                }
            }
            if (div_obj.siblings("div.img_hunk").html() != undefined) {
                div_obj.siblings("div.img_hunk:last").after(img_str);
            } else {
                div_obj.after(img_str);
            }
        }
    });
}
相關文章
相關標籤/搜索