fullstack.web/swa/token/tools.js
2023-08-09 13:57:49 +08:00

46 lines
976 B
JavaScript

// 覆盖默认行为
function success(msg){
layx.notice({
title: '成功',
type: 'success',
message: msg
});
}
// 覆盖默认行为
function warning(msg){
layx.notice({
title: '警告',
type: 'warning',
message: msg
});
}
// 覆盖默认行为
function alert(msg){
layx.notice({
title: '错误',
type: 'error',
message: msg
});
}
function check(v, re, msg) {
if (!re.test(v)) {
alert("参数校验失败:" + msg)
throw "参数校验失败"
}
}
function getyyyyMMdd(){
var d = new Date();
var curr_date = d.getDate();
var curr_month = d.getMonth() + 1;
var curr_year = d.getFullYear();
String(curr_month).length < 2 ? (curr_month = "0" + curr_month): curr_month;
String(curr_date).length < 2 ? (curr_date = "0" + curr_date): curr_date;
var yyyyMMdd = curr_year + "" + curr_month +""+ curr_date;
return yyyyMMdd;
}