Commit 7552bd7a7c267962b6f459fdfc19e35e1dbee244
1 parent
513e06e5
填报--- 时间操作
Showing
5 changed files
with
57 additions
and
8 deletions
index/index.html
... | ... | @@ -2,7 +2,7 @@ |
2 | 2 | <html lang="en"> |
3 | 3 | <head> |
4 | 4 | <meta charset="UTF-8"> |
5 | - <title>Title</title> | |
5 | + <title>工时系统</title> | |
6 | 6 | <link rel="stylesheet" id="pageCssLink" type="text/css" href=""/> |
7 | 7 | <link rel="stylesheet" href="../resource/lib/bootstrap/css/bootstrap.min.css"> |
8 | 8 | <link rel="stylesheet" href="../resource/lib/bootstrap-daterangepicker/daterangepicker.css"> | ... | ... |
resource/public/commoncss.css
topages/workfill/workfill.css
topages/workfill/workfill.html
1 | 1 | <div class="time-opr-wrap clearfix"> |
2 | 2 | <div class="float-left time-opr-area"> |
3 | - <div class="time-opr-nowtime">2018/07/13</div> | |
3 | + <div class="time-opr-nowtime" id="time-opr-nowtime"></div> | |
4 | 4 | <div class="time-opr-btnwrap clearfix"> |
5 | - <div class="time-opr-btn time-opr-prevbtn cursorpointer float-left">上一周</div> | |
6 | - <div class="time-opr-btn time-opr-nextbtn cursorpointer float-left">下一周</div> | |
5 | + <div class="time-opr-btn time-opr-prevbtn cursorpointer float-left" id="time-opr-prevbtn">上一周</div> | |
6 | + <div class="time-opr-btn time-opr-nextbtn cursorpointer float-left display-none" id="time-opr-nextbtn">下一周</div> | |
7 | 7 | </div> |
8 | 8 | </div> |
9 | - <div class="float-right time-opr-show text-center"> | |
10 | - 2018/07/04 - 2018/07/11 | |
11 | - </div> | |
9 | + <div class="float-right time-opr-show text-center" id="time-opr-show"> </div> | |
12 | 10 | </div> |
13 | -<div>1</div> | |
14 | 11 | \ No newline at end of file |
12 | +<div>1</div> | |
13 | + | |
14 | +<script src="../topages/workfill/workfill.js"></script> | |
15 | 15 | \ No newline at end of file | ... | ... |
topages/workfill/workfill.js
1 | 1 | /** |
2 | 2 | * Created by mac on 18/7/25. |
3 | 3 | */ |
4 | +var weekOfday = Number(moment().format('E'));//计算今天是这周第几天 | |
5 | +var clicknum = 0;//定义上下周点击次数 | |
6 | +var fun = { | |
7 | + init:function () { | |
8 | + | |
9 | + | |
10 | + //获取本周时间 | |
11 | + $('#time-opr-show').text(moment().subtract('days', weekOfday-1).format('YYYY/MM/DD')+' - '+moment().subtract('days', 0).format('YYYY/MM/DD')); | |
12 | + // 获取今天时间 | |
13 | + var todaytime = moment().subtract('days', 0).format('YYYY/MM/DD'); | |
14 | + $('#time-opr-nowtime').text(todaytime); | |
15 | + }, | |
16 | + timeoprprevbtn:function () { | |
17 | + $('#time-opr-nextbtn').removeClass('display-none'); | |
18 | + clicknum ++; | |
19 | + console.log(clicknum) | |
20 | + var start = weekOfday+7*clicknum-1; | |
21 | + var end = weekOfday+ clicknum*7-7; | |
22 | + $('#time-opr-show').text(moment().subtract('days', start).format('YYYY/MM/DD')+' - '+moment().subtract('days',end).format('YYYY/MM/DD')); | |
23 | + }, | |
24 | + timeoprnextbtn:function () { | |
25 | + | |
26 | + clicknum --; | |
27 | + console.log(clicknum) | |
28 | + if(clicknum == 0){ | |
29 | + $('#time-opr-show').text(moment().subtract('days', weekOfday-1).format('YYYY/MM/DD')+' - '+moment().subtract('days', 0).format('YYYY/MM/DD')); | |
30 | + $('#time-opr-nextbtn').addClass('display-none'); | |
31 | + }else{ | |
32 | + var start = weekOfday+7*clicknum-1; | |
33 | + var end = weekOfday+ clicknum*7-7; | |
34 | + $('#time-opr-show').text(moment().subtract('days', start).format('YYYY/MM/DD')+' - '+moment().subtract('days',end).format('YYYY/MM/DD')); | |
35 | + } | |
36 | + | |
37 | + | |
38 | + }, | |
39 | +}; | |
40 | +fun.init(); | |
41 | +// 上一周点击time-opr-prevbtn | |
42 | +$('#time-opr-prevbtn').on('click',function () { | |
43 | + fun.timeoprprevbtn(); | |
44 | +}); | |
45 | +// 下一周点击time-opr-nextbtn | |
46 | +$('#time-opr-nextbtn').on('click',function () { | |
47 | + fun.timeoprnextbtn(); | |
48 | +}); | |
4 | 49 | \ No newline at end of file | ... | ... |