Browse Source

时间格式

XMTT 7 years ago
parent
commit
3c9471bcb7

+ 17 - 1
js/common.js

@ -427,4 +427,20 @@ if(typeof jQuery === 'undefined') {
427 427
		$.util=ret;
428 428
		return ret;
429 429
	});
430
})(jQuery, window, document);
430
})(jQuery, window, document);
431

432
Date.prototype.format = function (fmt) {
433
    var o = {
434
        "M+": this.getMonth() + 1, //月份
435
        "d+": this.getDate(), //日
436
        "h+": this.getHours(), //小时
437
        "m+": this.getMinutes(), //分
438
        "s+": this.getSeconds(), //秒
439
        "q+": Math.floor((this.getMonth() + 3) / 3), //季度
440
        "S": this.getMilliseconds() //毫秒
441
    };
442
    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
443
    for (var k in o)
444
        if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
445
    return fmt;
446
};

+ 14 - 31
js/model/sys/article/count.js

@ -57,22 +57,6 @@ spa_define(function () {
57 57
                    spa.closeModal();
58 58
                });
59 59
60
                Date.prototype.format = function (fmt) {
61
                    var o = {
62
                        "M+": this.getMonth() + 1, //月份
63
                        "d+": this.getDate(), //日
64
                        "h+": this.getHours(), //小时
65
                        "m+": this.getMinutes(), //分
66
                        "s+": this.getSeconds(), //秒
67
                        "q+": Math.floor((this.getMonth() + 3) / 3), //季度
68
                        "S": this.getMilliseconds() //毫秒
69
                    };
70
                    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
71
                    for (var k in o)
72
                        if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
73
                    return fmt;
74
                };
75
76 60
                var dayList = function () {
77 61
                    var dayList = [];
78 62
                    var now = new Date();
@ -120,7 +104,7 @@ spa_define(function () {
120 104
                                    day.num = day.pc + day.app + day.h5;
121 105
                                })
122 106
                            });
123
                            var colors = ['#003366', "#660099", '#c23531', "#91C7AE"];
107
                            var colors = ["#660099", '#c23531', "#91C7AE",'#003366'];
124 108
                            var option = {
125 109
126 110
                                color: colors,
@ -132,7 +116,7 @@ spa_define(function () {
132 116
                                    trigger: 'axis'
133 117
                                },
134 118
                                legend: {
135
                                    data: ['合计', 'PC端', '移动端APP', '移动端H5']
119
                                    data: ['PC端', '移动端APP', '移动端H5','合计']
136 120
                                },
137 121
                                xAxis: {
138 122
                                    data: allData.map(function (item) {
@ -171,19 +155,6 @@ spa_define(function () {
171 155
                                    right: 10
172 156
                                },
173 157
                                series: [
174
                                        {
175
                                        name: '合计',
176
                                        type: 'line',
177
                                        label: {
178
                                            normal: {
179
                                                show: true,
180
                                                position: 'top'
181
                                            }
182
                                        },
183
                                        data: allData.map(function (item) {
184
                                            return item.num;
185
                                        })
186
                                    },
187 158
                                    {
188 159
                                        name: 'PC端',
189 160
                                        type: 'line',
@ -202,6 +173,18 @@ spa_define(function () {
202 173
                                        data: allData.map(function (item) {
203 174
                                            return item.h5;
204 175
                                        })
176
                                    }, {
177
                                        name: '合计',
178
                                        type: 'line',
179
                                        label: {
180
                                            normal: {
181
                                                show: true,
182
                                                position: 'top'
183
                                            }
184
                                        },
185
                                        data: allData.map(function (item) {
186
                                            return item.num;
187
                                        })
205 188
                                    }
206 189
                                ]
207 190
                            };

+ 0 - 16
js/model/sys/article/viewcount.js

@ -14,22 +14,6 @@ spa_define(function () {
14 14
                    allData = [],
15 15
                    $data = {tn: "article"};
16 16
17
                Date.prototype.format = function (fmt) {
18
                    var o = {
19
                        "M+": this.getMonth() + 1, //月份
20
                        "d+": this.getDate(), //日
21
                        "h+": this.getHours(), //小时
22
                        "m+": this.getMinutes(), //分
23
                        "s+": this.getSeconds(), //秒
24
                        "q+": Math.floor((this.getMonth() + 3) / 3), //季度
25
                        "S": this.getMilliseconds() //毫秒
26
                    };
27
                    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
28
                    for (var k in o)
29
                        if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
30
                    return fmt;
31
                };
32
33 17
                var now = new Date(),
34 18
                    nbt = new Date();
35 19
                nbt.setDate(now.getDate() - 7);

+ 2 - 1
js/model/sys/consult/msgidx.js

@ -10,7 +10,8 @@ spa_define(function () {
10 10
                var pdg = pdgf.build(root);
11 11
                pdg.code.shell("showDay", function (env) {
12 12
                    if (env.cd && env.cd[this.k]) {
13
                        var day = env.cd[this.k].toString();
13
                        var date = new Date(env.cd[this.k]);
14
                        var day = date.format("yyyyMMdd");
14 15
                        return day.substring(0, 4) + "-" + day.substring(4, 6) + "-" + day.substring(6, 8);
15 16
                    }
16 17
                    return "";

+ 0 - 16
js/model/sys/searchword/index.js

@ -14,22 +14,6 @@ spa_define(function () {
14 14
                    allData = [],
15 15
                    $data = {tn: "kw"};
16 16
17
                Date.prototype.format = function (fmt) {
18
                    var o = {
19
                        "M+": this.getMonth() + 1, //月份
20
                        "d+": this.getDate(), //日
21
                        "h+": this.getHours(), //小时
22
                        "m+": this.getMinutes(), //分
23
                        "s+": this.getSeconds(), //秒
24
                        "q+": Math.floor((this.getMonth() + 3) / 3), //季度
25
                        "S": this.getMilliseconds() //毫秒
26
                    };
27
                    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
28
                    for (var k in o)
29
                        if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
30
                    return fmt;
31
                };
32
33 17
                var now = new Date(),
34 18
                    nbt = new Date();
35 19
                nbt.setDate(now.getDate() - 7);