|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356 |
- jQuery.extend({
- createUploadIframe: function (b, d) {
- var a = "jUploadFrame" + b;
- var c = '<iframe id="' + a + '" name="' + a + '" style="position:absolute; top:-9999px; left:-9999px"';
- if (window.ActiveXObject) {
- if (typeof d == "boolean") {
- c += ' src="javascript:false"';
- } else {
- if (typeof d == "string") {
- c += ' src="' + d + '"';
- }
- }
- }
- c += " />";
- jQuery(c).appendTo(document.body);
- return jQuery("#" + a).get(0);
- },
- createUploadForm: function (g, b, a) {
- var e = "jUploadForm" + g;
- var c = "jUploadFile" + g;
- var d = jQuery('<form action="" method="POST" name="' + e + '" id="' + e + '" enctype="multipart/form-data"></form>');
- if (a) {
- for (var f in a) {
- jQuery('<input type="hidden" name="' + f + '" value="' + a[f] + '" />').appendTo(d);
- }
- }
- var j = jQuery("#" + b);
- var h = jQuery(j).clone();
- jQuery(j).attr("id", c);
- jQuery(j).before(h);
- jQuery(j).appendTo(d);
- jQuery(d).css("position", "absolute");
- jQuery(d).css("top", "-1200px");
- jQuery(d).css("left", "-1200px");
- jQuery(d).appendTo("body");
- return d
- },
- ajaxFileUpload: function (i) {
- i = jQuery.extend({},
- jQuery.ajaxSettings, i);
- var f = new Date().getTime();
- var b = jQuery.createUploadForm(f, i.fileElementId, (typeof (i.data) == "undefined" ? false : i.data));
- var g = jQuery.createUploadIframe(f, i.secureuri);
- var d = "jUploadFrame" + f;
- var c = "jUploadForm" + f;
- if (i.global && !jQuery.active++) {
- jQuery.event.trigger("ajaxStart");
- }
- var h = false;
- var k = {};
- if (i.global) {
- jQuery.event.trigger("ajaxSend", [k, i]);
- }
- var j = function (o) {
- var n = document.getElementById(d);
- try {
- if (n.contentWindow) {
- k.responseText = n.contentWindow.document.body ? n.contentWindow.document.body.innerHTML : null;
- k.responseXML = n.contentWindow.document.XMLDocument
- ? n.contentWindow.document.XMLDocument
- : n.contentWindow.document;
- } else {
- if (n.contentDocument) {
- k.responseText = n.contentDocument.document.body ? n.contentDocument.document.body.innerHTML : null;
- k.responseXML = n.contentDocument.document.XMLDocument
- ? n.contentDocument.document.XMLDocument
- : n.contentDocument.document;
- }
- }
- } catch (m) {
- jQuery.handleError(i, k, null, m);
- }
- if (k || o == "timeout") {
- h = true;
- var p;
- try {
- p = o != "timeout" ? "success" : "error";
- if (p != "error") {
- var l = jQuery.uploadHttpData(k, i.dataType);
- if (i.success) {
- i.success(l, p);
- }
- if (i.global) {
- jQuery.event.trigger("ajaxSuccess", [k, i]);
- }
- } else {
- jQuery.handleError(i, k, p);
- }
- } catch (m) {
- p = "error";
- jQuery.handleError(i, k, p, m);
- }
- if (i.global) {
- jQuery.event.trigger("ajaxComplete", [k, i]);
- }
- if (i.global && !--jQuery.active) {
- jQuery.event.trigger("ajaxStop");
- }
- if (i.complete) {
- i.complete(k, p);
- }
- jQuery(n).unbind();
- setTimeout(function () {
- try {
- jQuery(n).remove();
- jQuery(b).remove();
- } catch (q) {
- jQuery.handleError(i, k, null, q);
- }
- },
- 100);
- k = null;
- }
- };
- if (i.timeout > 0) {
- setTimeout(function() {
- if (!h) {
- j("timeout");
- }
- },
- i.timeout);
- }
- try {
- var b = jQuery("#" + c);
- jQuery(b).attr("action", i.url);
- jQuery(b).attr("method", "POST");
- jQuery(b).attr("target", d);
- if (b.encoding) {
- jQuery(b).attr("encoding", "multipart/form-data");
- } else {
- jQuery(b).attr("enctype", "multipart/form-data");
- }
- jQuery(b).submit()
- } catch (a) {
- jQuery.handleError(i, k, null, a);
- }
- jQuery("#" + d).load(j);
- return {
- abort: function () { }
- }
- },
- uploadHttpData: function (r, type) {
- var data = !type;
- data = type == "xml" || data ? r.responseXML : r.responseText;
- if (type == "script") {
- jQuery.globalEval(data);
- }
- if (type == "json") {
- eval("data = " + data);
- }
- if (type == "html") {
- jQuery("<div>").html(data).evalScripts();
- }
- return data;
- }
- });
- var loaddfimg;
- var baseinfo;
- var bootstrap = function (a, b) {
- var c = {
- init: function () {
- c.initData();
- c.bind();
- },
- bind: function () {
- function d(g, h) {
- var e = document.getElementById(g).files[0];
- var i = window.URL.createObjectURL(e);
- document.getElementById(h).src = i;
- }
- a("#uploadFile").on("change",
- function () {
- d("uploadFile", "uploadPreview");
- });
- a("#uploadFile1").on("change",
- function () {
- d("uploadFile1", "uploadPreview1");
- });
- a("#uploadFile2").on("change",
- function () {
- d("uploadFile2", "uploadPreview2");
- });
- a("#uploadFile3").on("change",
- function () {
- d("uploadFile3", "uploadPreview3");
- });
- a("#uploadFile4").on("change",
- function () {
- d("uploadFile4", "uploadPreview4");
- });
- a("#uploadFile5").on("change",
- function () {
- d("uploadFile5", "uploadPreview5");
- });
- a("#lr_save_btn").on("click",
- function () {
- var e = document.getElementById("uploadFile").files[0];
- if (!!e) {
- b.loading(true, "正在保存...");
- a.ajaxFileUpload({
- url: top.$.rootUrl + "/LR_SystemModule/LogoImg/UploadFile?code=default",
- secureuri: false,
- fileElementId: "uploadFile",
- dataType: "json",
- success: function(f) {
- b.loading(false);
- a("#uploadFile").on("change",
- function() {
- d("uploadFile", "uploadPreview");
- });
- if (f.code == 200) {
- b.alert.success("保存成功");
- }
- }
- });
- }
- });
- a("#lr_save_btn1").on("click",
- function () {
- var e = document.getElementById("uploadFile1").files[0];
- if (!!e) {
- b.loading(true, "正在保存...");
- a.ajaxFileUpload({
- url: top.$.rootUrl + "/LR_SystemModule/LogoImg/UploadFile?code=accordion",
- secureuri: false,
- fileElementId: "uploadFile1",
- dataType: "json",
- success: function (f) {
- b.loading(false);
- a("#uploadFile1").on("change",
- function () {
- d("uploadFile1", "uploadPreview1");
- });
- if (f.code == 200) {
- b.alert.success("保存成功");
- }
- }
- })
- }
- });
- a("#lr_save_btn2").on("click",
- function () {
- var e = document.getElementById("uploadFile2").files[0];
- if (!!e) {
- b.loading(true, "正在保存...");
- a.ajaxFileUpload({
- url: top.$.rootUrl + "/LR_SystemModule/LogoImg/UploadFile?code=windows",
- secureuri: false,
- fileElementId: "uploadFile2",
- dataType: "json",
- success: function(f) {
- b.loading(false);
- a("#uploadFile2").on("change",
- function() {
- d("uploadFile2", "uploadPreview2");
- });
- if (f.code == 200) {
- b.alert.success("保存成功");
- }
- }
- });
- }
- });
- a("#lr_save_btn3").on("click",
- function() {
- var e = document.getElementById("uploadFile3").files[0];
- if (!!e) {
- b.loading(true, "正在保存...");
- a.ajaxFileUpload({
- url: top.$.rootUrl + "/LR_SystemModule/LogoImg/UploadFile?code=top",
- secureuri: false,
- fileElementId: "uploadFile3",
- dataType: "json",
- success: function(f) {
- b.loading(false);
- a("#uploadFile3").on("change",
- function() {
- d("uploadFile3", "uploadPreview2");
- });
- if (f.code == 200) {
- b.alert.success("保存成功");
- }
- }
- });
- }
- });
- a("#lr_save_btn4").on("click",
- function() {
- var e = document.getElementById("uploadFile4").files[0];
- if (!!e) {
- b.loading(true, "正在保存...");
- a.ajaxFileUpload({
- url: top.$.rootUrl + "/LR_SystemModule/LogoImg/UploadFile?code=data",
- secureuri: false,
- fileElementId: "uploadFile4",
- dataType: "json",
- success: function(f) {
- b.loading(false);
- a("#uploadFile4").on("change",
- function() {
- d("uploadFile4", "uploadPreview4");
- });
- if (f.code == 200) {
- b.alert.success("保存成功");
- }
- }
- });
- }
- });
- a("#lr_save_btn5").on("click",
- function() {
- var e = document.getElementById("uploadFile5").files[0];
- if (!!e) {
- b.loading(true, "正在保存...");
- a.ajaxFileUpload({
- url: top.$.rootUrl + "/LR_SystemModule/LogoImg/UploadFile?code=headbg",
- secureuri: false,
- fileElementId: "uploadFile5",
- dataType: "json",
- success: function(f) {
- b.loading(false);
- a("#uploadFile5").on("change",
- function() {
- d("uploadFile5", "uploadPreview5");
- });
- if (f.code == 200) {
- b.alert.success("保存成功");
- }
- }
- });
- }
- });
- },
- initData: function () {
- a("#file").prepend('<img id="uploadPreview" src="' +
- top.$.rootUrl +
- '/LR_SystemModule/LogoImg/GetImg?code=default" >');
- a("#file1").prepend('<img id="uploadPreview1" src="' +
- top.$.rootUrl +
- '/LR_SystemModule/LogoImg/GetImg?code=accordion" >');
- a("#file2").prepend('<img id="uploadPreview2" src="' +
- top.$.rootUrl +
- '/LR_SystemModule/LogoImg/GetImg?code=windows" >');
- a("#file3").prepend('<img id="uploadPreview3" src="' +
- top.$.rootUrl +
- '/LR_SystemModule/LogoImg/GetImg?code=top" >');
- a("#file4").prepend('<img id="uploadPreview4" src="' +
- top.$.rootUrl +
- '/LR_SystemModule/LogoImg/GetImg?code=data" >');
- a("#file5").prepend('<img id="uploadPreview5" src="' +
- top.$.rootUrl +
- '/LR_SystemModule/LogoImg/GetImg?code=headbg" >');
- }
- };
- c.init()
- };
|