web前端开发插件(无需重复造*)

时间:2023-03-10 03:17:52
web前端开发插件(无需重复造*)

1、artdialog 对话框组件

  简介:是一个基于JavaScript编写的对话框组件,他拥有精致的界面与友好的接口

  文档链接:http://www.daimajiayuan.com/download/201304/yulan/artDialog4.1.7/

2。图片上传

/*
* 文件上传实例
* _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);
}
}
});
}