From 7552bd7a7c267962b6f459fdfc19e35e1dbee244 Mon Sep 17 00:00:00 2001 From: liuqimichale <123456lq> Date: Wed, 25 Jul 2018 16:45:20 +0800 Subject: [PATCH] 填报--- 时间操作 --- index/index.html | 2 +- resource/public/commoncss.css | 3 +++ topages/workfill/workfill.css | 1 + topages/workfill/workfill.html | 14 +++++++------- topages/workfill/workfill.js | 45 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 57 insertions(+), 8 deletions(-) diff --git a/index/index.html b/index/index.html index 56e7671..9e24634 100644 --- a/index/index.html +++ b/index/index.html @@ -2,7 +2,7 @@ - Title + 工时系统 diff --git a/resource/public/commoncss.css b/resource/public/commoncss.css index f43eb53..e1ebdc9 100644 --- a/resource/public/commoncss.css +++ b/resource/public/commoncss.css @@ -17,6 +17,9 @@ ul,li{ .cursorpointer{ cursor: pointer; } +.display-none{ + display: none; +} /********************************************头部公共样式*/ header{ width: 100%; diff --git a/topages/workfill/workfill.css b/topages/workfill/workfill.css index e426d23..eb1909b 100644 --- a/topages/workfill/workfill.css +++ b/topages/workfill/workfill.css @@ -21,6 +21,7 @@ width: 226px; height: 40px; line-height: 40px; + margin-top: 10px; font-size: 14px; color: rgba(0,0,0,.4); background-color: #fff; diff --git a/topages/workfill/workfill.html b/topages/workfill/workfill.html index 05bf899..c75f063 100644 --- a/topages/workfill/workfill.html +++ b/topages/workfill/workfill.html @@ -1,13 +1,13 @@
-
2018/07/13
+
-
上一周
-
下一周
+
上一周
+
-
- 2018/07/04 - 2018/07/11 -
+
-
1
\ No newline at end of file +
1
+ + \ No newline at end of file diff --git a/topages/workfill/workfill.js b/topages/workfill/workfill.js index 567c960..4c88383 100644 --- a/topages/workfill/workfill.js +++ b/topages/workfill/workfill.js @@ -1,3 +1,48 @@ /** * Created by mac on 18/7/25. */ +var weekOfday = Number(moment().format('E'));//计算今天是这周第几天 +var clicknum = 0;//定义上下周点击次数 +var fun = { + init:function () { + + + //获取本周时间 + $('#time-opr-show').text(moment().subtract('days', weekOfday-1).format('YYYY/MM/DD')+' - '+moment().subtract('days', 0).format('YYYY/MM/DD')); + // 获取今天时间 + var todaytime = moment().subtract('days', 0).format('YYYY/MM/DD'); + $('#time-opr-nowtime').text(todaytime); + }, + timeoprprevbtn:function () { + $('#time-opr-nextbtn').removeClass('display-none'); + clicknum ++; + console.log(clicknum) + var start = weekOfday+7*clicknum-1; + var end = weekOfday+ clicknum*7-7; + $('#time-opr-show').text(moment().subtract('days', start).format('YYYY/MM/DD')+' - '+moment().subtract('days',end).format('YYYY/MM/DD')); + }, + timeoprnextbtn:function () { + + clicknum --; + console.log(clicknum) + if(clicknum == 0){ + $('#time-opr-show').text(moment().subtract('days', weekOfday-1).format('YYYY/MM/DD')+' - '+moment().subtract('days', 0).format('YYYY/MM/DD')); + $('#time-opr-nextbtn').addClass('display-none'); + }else{ + var start = weekOfday+7*clicknum-1; + var end = weekOfday+ clicknum*7-7; + $('#time-opr-show').text(moment().subtract('days', start).format('YYYY/MM/DD')+' - '+moment().subtract('days',end).format('YYYY/MM/DD')); + } + + + }, +}; +fun.init(); +// 上一周点击time-opr-prevbtn +$('#time-opr-prevbtn').on('click',function () { + fun.timeoprprevbtn(); +}); +// 下一周点击time-opr-nextbtn +$('#time-opr-nextbtn').on('click',function () { + fun.timeoprnextbtn(); +}); \ No newline at end of file -- libgit2 0.21.4