master
wangbing 6 years ago
parent 9cf580f101
commit 4fc55f3eea

@ -620,7 +620,7 @@
// }
//
// {//js文件
// freeMarkerManager.outputTemp(new File(js.getAbsolutePath() + File.separator + "services.js"), option + "/webapp/static/js/services.ftl", ctx);
// freeMarkerManager.outputTemp(new File(js.getAbsolutePath() + File.separator + "base.js"), option + "/webapp/static/js/services.ftl", ctx);
// }
// {//img
// Tool.outputResource(option + "/webapp/static/img/favicon.ico", new File(img.getAbsolutePath() + File.separator + "favicon.ico"));

File diff suppressed because one or more lines are too long

@ -157,77 +157,4 @@
}
}
});
/**
* 获取url参数
* @param key
*/
window.location.getParam = function (key) {
var reg = new RegExp("(^|&)" + key + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) {
return decodeURIComponent(r[2]);
}
return null;
}
/**
* 打开新标签
* @param url
*/
window.location.open = function (url) {
$("body").append($("<a id='wb-open' href='" + url + "' target='_blank' style='dispaly:none;'></a>"))
document.getElementById("wb-open").click();
$("#wb-open").remove();
}
/**
* 日期格式化
*/
Date.prototype.format = function (format) {
var o = {
"M+": this.getMonth() + 1, //month
"d+": this.getDate(), //day
"h+": this.getHours(), //hour
"m+": this.getMinutes(), //minute
"s+": this.getSeconds(), //second
"q+": Math.floor((this.getMonth() + 3) / 3), //quarter
"S": this.getMilliseconds() //millisecond
}
if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
(this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)if (new RegExp("(" + k + ")").test(format))
format = format.replace(RegExp.$1,
RegExp.$1.length == 1 ? o[k] :
("00" + o[k]).substr(("" + o[k]).length));
return format;
};
/**
* 数组移除
*/
Array.prototype.remove = function (val) {
var index = this.indexOf(val);
if (index > -1) {
this.splice(index, 1);
}
};
/**
* 数组替换
*/
Array.prototype.replace = function (val, obj) {
var index = this.indexOf(val);
if (index > -1) {
this.splice(index, 1, obj);
}
};
/**
* 数组位置调整
*/
Array.prototype.exchange = function (val1, val2) {
if (val1 < 0 || val2 < 0 || val2 >= this.length || val1 >= this.length) {
return;
}
var o1 = this[val1];
var o2 = this[val2];
this.splice(val1, 1, o2);
this.splice(val2, 1, o1);
};
</script>

@ -1,4 +1,2 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<script src="/static/js/jquery-3.2.1.js"></script>
<script src="/static/js/services.js"></script>
<script src="/static/js/tools.js"></script>
<script src="/static/js/base.js"></script>

File diff suppressed because one or more lines are too long

@ -46,6 +46,7 @@ var baseJsList = [
"./lib/vue/vue.js",
"./lib/vue-router/vue-router.js",
"./lib/axios/axios.js",
"./js/base.js",
];
//baseCss
var baseCssList = [

@ -0,0 +1,72 @@
/**
* 获取url参数
* @param key
*/
window.location.getParam = function (key) {
var reg = new RegExp("(^|&)" + key + "=([^&]*)(&|$)");
var r = window.location.search.substr(1).match(reg);
if (r != null) {
return decodeURIComponent(r[2]);
}
return null;
}
/**
* 打开新标签
* @param url
*/
window.location.open = function (url) {
$("body").append($("<a id='wb-open' href='" + url + "' target='_blank' style='dispaly:none;'></a>"))
document.getElementById("wb-open").click();
$("#wb-open").remove();
}
/**
* 日期格式化
*/
Date.prototype.format = function (format) {
var o = {
"M+": this.getMonth() + 1, //month
"d+": this.getDate(), //day
"h+": this.getHours(), //hour
"m+": this.getMinutes(), //minute
"s+": this.getSeconds(), //second
"q+": Math.floor((this.getMonth() + 3) / 3), //quarter
"S": this.getMilliseconds() //millisecond
}
if (/(y+)/.test(format)) format = format.replace(RegExp.$1,
(this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)if (new RegExp("(" + k + ")").test(format))
format = format.replace(RegExp.$1,
RegExp.$1.length == 1 ? o[k] :
("00" + o[k]).substr(("" + o[k]).length));
return format;
};
/**
* 数组移除
*/
Array.prototype.remove = function (val) {
var index = this.indexOf(val);
if (index > -1) {
this.splice(index, 1);
}
};
/**
* 数组替换
*/
Array.prototype.replace = function (val, obj) {
var index = this.indexOf(val);
if (index > -1) {
this.splice(index, 1, obj);
}
};
/**
* 数组位置调整
*/
Array.prototype.exchange = function (val1, val2) {
if (val1 < 0 || val2 < 0 || val2 >= this.length || val1 >= this.length) {
return;
}
var o1 = this[val1];
var o2 = this[val2];
this.splice(val1, 1, o2);
this.splice(val2, 1, o1);
};

@ -1,72 +0,0 @@
/**
* Created by on 2018-07-09.
*/
$(function(){
$.services = {};
$.url = "/ajax";
$.extend($.services,{
example:function(data){
return $.ajax({
type: 'POST',
url: $.url+"?method=ajax.example.example",
data: JSON.stringify(data),
contentType:"text/plain",
dataType: "json"
})
},
createUser:function(data){
return $.ajax({
type: 'POST',
url: $.url+"?method=ajax.example.user.create",
data: JSON.stringify(data),
contentType:"text/plain",
dataType: "json"
})
},
deleteUser:function(data){
return $.ajax({
type: 'POST',
url: $.url+"?method=ajax.example.user.delete",
data: JSON.stringify(data),
contentType:"text/plain",
dataType: "json"
})
},
updateUser:function(data){
return $.ajax({
type: 'POST',
url: $.url+"?method=ajax.example.user.update",
data: JSON.stringify(data),
contentType:"text/plain",
dataType: "json"
})
},
findUser:function(data){
return $.ajax({
type: 'POST',
url: $.url+"?method=ajax.example.user.find",
data: JSON.stringify(data),
contentType:"text/plain",
dataType: "json"
})
},
getUser:function(data){
return $.ajax({
type: 'POST',
url: $.url+"?method=ajax.example.user.get",
data: JSON.stringify(data),
contentType:"text/plain",
dataType: "json"
})
},
getAllUser:function(data){
return $.ajax({
type: 'POST',
url: $.url+"?method=ajax.example.user.get.all",
data: JSON.stringify(data),
contentType:"text/plain",
dataType: "json"
})
},
})
})
Loading…
Cancel
Save

Powered by TurnKey Linux.