Former-commit-id: 6e9fb3a954c5c1b3a2d4e689f0071bec58da3f3a
master
王兵 4 years ago
parent 02c82190ec
commit da5dcef99d

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -36,6 +36,7 @@ gulp.task("dev", function () {
gulp.task("clean", function () {
del(["dist/*"]);
del(["dist/fonts"]);
})
//baseJs
var baseJsList = [
@ -56,6 +57,7 @@ gulp.task("baseJs", function () {
.pipe(uglify())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest("dist"))
.pipe(gulp.dest("../modules/SpringBoot/resources/static/dist"))
})
//baseCss
gulp.task("baseCss", function () {
@ -73,5 +75,6 @@ var baseFontList = [
];
gulp.task('font', function () {
return gulp.src(baseFontList)
.pipe(gulp.dest('dist/fonts'));
.pipe(gulp.dest('dist/fonts'))
.pipe(gulp.dest("../modules/SpringBoot/resources/static/dist/fonts"))
});

@ -15,7 +15,7 @@ window.location.getParam = function (key) {
* @param url
*/
window.location.open = function (url) {
$("body").append($("<a id='wb-open' href='" + url + "' target='_blank' style='dispaly:none;'></a>"))
$("body").append($("<a id='wb-open' href='" + url + "' target='_blank' style='display:none;'></a>"))
document.getElementById("wb-open").click();
$("#wb-open").remove();
}
@ -75,11 +75,11 @@ Array.prototype.exchange = function (val1, val2) {
* fun(item,next) 处理函数
* finish() 处理完成函数
*/
Array.prototype.forAsync = function (fun, finish) {
Array.prototype.forAsync = function (callBack, finish) {
var this_ = this;
(function loop(index) {
if (index < this_.length) {
fun(this_[index], function () {
callBack(this_[index], function () {
loop(++index)
})
} else if (typeof finish === 'function') {
@ -87,6 +87,71 @@ Array.prototype.forAsync = function (fun, finish) {
}
})(0)
};
/**
* 自定义Map对象
*/
function Map() {
this.keys = new Array();
this.values = new Array();
this.put = function (key, value) {
this.keys.push(key);
this.values.push(value);
}
this.remove = function (key) {
var index = this.keys.indexOf(key);
if (index > -1) {
this.keys.splice(index, 1)
this.values.splice(index, 1)
}
}
this.size = function () {
return this.keys.length;
}
this.isEmpty = function () {
return this.keys.length < 1;
}
this.clear = function () {
this.keys = [];
this.values = [];
}
this.get = function (key) {
var index = this.keys.indexOf(key);
if (index > -1) {
return this.values[index];
} else {
return null;
}
}
this.forEach = function (callBack) {
for (var i = 0; i < this.keys.length; i++) {
callBack(this.keys[i], this.values[i]);
}
}
this.forAsync = function (callBack, finish) {
var this_ = this;
(function loop(index) {
if (index < this_.keys.length) {
callBack(this_.keys[index], this_.values[index], function () {
loop(++index)
})
} else if (typeof finish === 'function') {
finish();
}
})(0)
}
this.containsKey = function (key) {
return this.keys.indexOf(key) !== -1
}
this.containsValue = function (value) {
return this.values.indexOf(value) !== -1
}
this.getKeys = function () {
return this.keys.slice(0, this.keys.length);
}
this.getValues = function () {
return this.values.slice(0, this.values.length);
};
};
window.utils = {
/**
* 隐藏文件选择器
@ -112,7 +177,6 @@ window.utils = {
*/
blobtoDown: function (name, blob) {
var url = window.URL.createObjectURL(blob);
console.log(url)
var link = document.createElement('a');
link.style.display = 'none';
link.href = url;
@ -152,5 +216,26 @@ window.utils = {
*/
base64toBlob: function (base64) {
return new Blob(this.base64toBytes(base64));
},
isEmpty: function(val){
return val === '' || typeof val === 'undefined' || val === null;
},
loadJsCss: function(url){
var node_;
if (url.match(/\\.js$/i)) {
node_ = document.createElement('script');
node_.setAttribute("type", "text/javascript");
node_.setAttribute("src", fileurl);
} else if (url.match(/\\.css$/i)) {
node_ = document.createElement('link');
node_.setAttribute("rel", "stylesheet");
node_.setAttribute("type", "text/css");
node_.setAttribute("href", fileurl);
}
if (node_) {
document.getElementsByTagName("head")[0].appendChild(node_);
} else {
console.error("load " + url + " method error!");
}
}
}
Loading…
Cancel
Save

Powered by TurnKey Linux.