filter.wxs
1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
var filters = {
toFix:function(val,count){
return val.toFixed(count)
},
replace_time:function(val){
if(!val) return "不限";
return val.replace("00:00:00","");
},
replace_time2: function (val) {
if(val==null || val==undefined || val=='') return "";
var a = val.split(" ");
return a[0];
},
format_time:function(ts,isFull) {
if(ts==null || ts==undefined || ts=='') return "";
var d = getDate(ts*1000)
var fm=[d.getFullYear(), d.getMonth()+1, d.getDate()].join('-');
if(isFull==1)
fm=fm + ' '+ [d.getHours(), d.getMinutes(), d.getSeconds()].join(':')
return fm;
},
pInt:function(t) {
var d = parseInt(t); return d;
},
show_gui_ge:function(spec,color){
if((spec=="" || spec==null || spec=="null")){
if((color=="" || color==null || color=="null")){ return "规格1";
}else{return color; }
}else{
if((color=="" || color==null || color=="null")){ return spec;
}else{ return spec+"/"+color; }
}
},
}
module.exports = {
toFix: filters.toFix,
replace_time:filters.replace_time,
replace_time2: filters.replace_time2,
format_time:filters.format_time,
pInt:filters.pInt,
show_gui_ge:filters.show_gui_ge,
}