|
|
@@ -68,6 +68,7 @@ export default function LogTime() {
|
|
|
const [loaded, setLoaded] = useState(false)
|
|
|
const [autoCheck, setAutoCheck] = useState(false)
|
|
|
const [initCheck, setInitCheck] = useState(router.params.initCheck == '1')
|
|
|
+ const [initSeconds,setInitSeconds] = useState(router.params.initCheck == '1') //初始化时,带入打卡时的秒数
|
|
|
const [count, setCount] = useState(0)
|
|
|
|
|
|
const [ignoreCheck, setIgnoreCheck] = useState(false)
|
|
|
@@ -75,14 +76,7 @@ export default function LogTime() {
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
useEffect(() => {
|
|
|
- // if (isSingle) {
|
|
|
-
|
|
|
- // }
|
|
|
-
|
|
|
loadData()
|
|
|
|
|
|
var now = new Date()
|
|
|
@@ -95,7 +89,6 @@ export default function LogTime() {
|
|
|
t2 += 24 * 3600 * 1000
|
|
|
var left = t2 - t + 500
|
|
|
|
|
|
- //前端待处理,日期更新
|
|
|
setTimeout(() => {
|
|
|
setCount(count => count + 1)
|
|
|
setArray(array => {
|
|
|
@@ -337,7 +330,30 @@ export default function LogTime() {
|
|
|
}
|
|
|
|
|
|
function getTimestamp(obj) {
|
|
|
+ const {event_id} = obj
|
|
|
+ var tempObj:any = null
|
|
|
+
|
|
|
+ if (data.fast){
|
|
|
+ data.fast.timeline.map((item)=>{
|
|
|
+ if (item.event_id == event_id){
|
|
|
+ tempObj = item
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (data.sleep){
|
|
|
+ data.sleep.timeline.map((item)=>{
|
|
|
+ if (item.event_id == event_id){
|
|
|
+ tempObj = item
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
var time = obj.time
|
|
|
+ if (tempObj && tempObj.real && dayjs(tempObj.real.timestamp).format('YYYY-MM-DDTHH:mm')==obj.date + 'T' + time){
|
|
|
+ debugger
|
|
|
+ return tempObj.real.timestamp
|
|
|
+ }
|
|
|
+
|
|
|
// var hour = parseInt(time.split(':')[0])
|
|
|
// var minute = parseInt(time.split(':')[1])
|
|
|
// var date = obj.date
|
|
|
@@ -518,6 +534,7 @@ export default function LogTime() {
|
|
|
}
|
|
|
|
|
|
function commit(list, onlyCheck, save_confirm) {
|
|
|
+ debugger
|
|
|
const sortedData = list.sort((a, b) => {
|
|
|
return b.extra.confirm_time - a.extra.confirm_time; // 降序
|
|
|
});
|
|
|
@@ -552,6 +569,9 @@ export default function LogTime() {
|
|
|
if (posting) return
|
|
|
setPosting(true)
|
|
|
clockTimes(params).then(res => {
|
|
|
+ if (onlyCheck){
|
|
|
+ setRequestId(new Date().getTime())
|
|
|
+ }
|
|
|
|
|
|
if ((res as any).result) {
|
|
|
setErrors([])
|