vue2 k线组件
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

68 lines
2.0 KiB

$('body').on('click', '.layer-close, .layer-close1, .layer-close2', function(){
console.log('asd');
layer.close(layer_index);
})
function get_image_url(img, path, default_str){
if(img == '' || img == null || img == undefined) return default_str || '';
img = $.trim(img);
img_t = img.toLowerCase();
if(img_t.indexOf('http') === 0){
return img;
}
return (path || '') + img;
}
function checkValue(field, value){
if(field == 'mobile'){
var reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/;
if(reg.test(value)) {
return true;
}else{return false;}
}
else if(field == 'number'){
var reg = /^[0-9]+\.?[0-9]*$/;
if(reg.test(value)) {
return true;
}else{return false;}
}
else if(field == 'idcard'){
var reg = /^[0-9]{18}$/;
if(reg.test(value)) {
return true;
}else{return false;}
}
}
function timestampToTime(timestamp, format, date_s) {
if(timestamp == undefined || timestamp == null || timestamp == '' || timestamp == 0) return '';
if(format == undefined || format == null) format = 'all';
var date = new Date(timestamp * 1000); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
Y = date.getFullYear();
M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1);
D = change(date.getDate());
h = change(date.getHours());
m = change(date.getMinutes());
s = change(date.getSeconds());
date_s = date_s || '-';
if(format == 'Y'){
return Y;
}
else if(format == 'full'){
return Y + date_s + M + date_s + D + ' ' + h + ':' + m;
}
else if(format == 'all'){
return Y + date_s + M + date_s + D + ' ' + h + ':' + m + ':' + s;
}
else if(format == 'date'){
return Y + date_s + M + date_s + D;
}
else return M + date_s + D;// + h + m + s;
}
function change(t) {
if (t < 10) {
return "0" + t;
} else {
return t;
}
}