Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
glsx
/
gl_tape
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
3
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 552e95c2
authored
Apr 24, 2025
by
胡悦
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改日历每月天数
1 parent
28f5fb55
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
25 deletions
assets/css/sprite.scss
assets/images/sprite.png
components/HomeFrame/components/Attendance/Calendar.vue
assets/css/sprite.scss
View file @
552e95c
This diff is collapsed.
Click to expand it.
assets/images/sprite.png
View file @
552e95c
2.34 MB
|
W:
|
H:
2.34 MB
|
W:
|
H:
2-up
Swipe
Onion skin
components/HomeFrame/components/Attendance/Calendar.vue
View file @
552e95c
...
@@ -14,21 +14,23 @@
...
@@ -14,21 +14,23 @@
</view>
</view>
</view>
</view>
<view
class=
"calendar-dates"
>
<view
class=
"calendar-dates"
>
<view
class=
"calendar-date
"
v-for=
"(date, index) in clockInDateList"
:key=
"index"
>
<view
:class=
"['calendar-date', `lines$
{getMaxLen}`]
" v-for="(date, index) in clockInDateList" :key="index">
<template
v-if=
"date.day"
>
<template
v-if=
"date.day"
>
<view
@
click=
"openDetail(date)"
>
<view
@
click=
"openDetail(date)"
>
<view
v-if=
"date.dayState != 1"
<view
v-if=
"date.dayState != 1"
:class=
"getTagClass(date)"
>
:class=
"['tag', TYPE_LIST.find(item => item.value == date.dayState).class]"
>
{{
DAY_STATE
[
date
.
dayState
]
}}
</view>
{{
DAY_STATE
[
date
.
dayState
]
}}
</view>
<view
class=
"date-num"
v-if=
"date.day != currentInfo.day"
>
{{
date
.
day
||
''
}}
</view>
<view
class=
"date-num"
v-if=
"date.day != currentInfo.day"
>
{{
date
.
day
||
''
}}
</view>
<view
class=
"current-date"
v-else
>
今
</view>
<view
class=
"current-date"
v-else
>
今
</view>
<template
v-if=
"!date.isDefault"
>
<template
v-if=
"!date.isDefault"
>
<view
:class=
"['date-desc first-child', date.clockInState != 0 || date.clockInAbnormalAttire ? 'date-red' : '']"
>
{{
<view
date
.
clockInState
==
3
?
'缺卡'
:
date
.
clockInTime1
}}
<view
v-if=
"date.clockInAbnormalAttire"
:class=
"['date-desc first-child', date.clockInState != 0 || date.clockInAbnormalAttire ? 'date-red' : '']"
>
{{
date
.
clockInState
==
3
?
'缺卡'
:
date
.
clockInTime1
}}
<view
v-if=
"date.clockInAbnormalAttire"
class=
"sprite-icon icon-dress-code"
></view>
class=
"sprite-icon icon-dress-code"
></view>
</view>
</view>
<view
:class=
"['date-desc', date.clockOutState != 0 || date.clockOutAbnormalAttire ? 'date-red' : '']"
>
{{
<view
date
.
clockOutState
==
3
?
'缺卡'
:
date
.
clockOutTime1
}}
<view
v-if=
"date.clockOutAbnormalAttire"
:class=
"['date-desc', date.clockOutState != 0 || date.clockOutAbnormalAttire ? 'date-red' : '']"
>
{{
date
.
clockOutState
==
3
?
'缺卡'
:
date
.
clockOutTime1
}}
<view
v-if=
"date.clockOutAbnormalAttire"
class=
"sprite-icon icon-dress-code"
></view>
class=
"sprite-icon icon-dress-code"
></view>
</view>
</view>
</
template
>
</
template
>
...
@@ -87,25 +89,40 @@ export default {
...
@@ -87,25 +89,40 @@ export default {
},
},
computed
:
{
computed
:
{
dates
()
{
dates
()
{
//
// 获取当前日期
const
firstDayOfMonth
=
new
Date
(
this
.
currentInfo
.
year
,
this
.
currentInfo
.
month
-
1
,
1
)
const
now
=
new
Date
();
const
dates
=
[]
const
year
=
now
.
getFullYear
();
for
(
let
i
=
0
,
len
=
this
.
datesd
.
length
;
i
<
len
;
i
++
)
{
const
month
=
now
.
getMonth
();
dates
.
push
(
this
.
datesd
[
i
])
// 获取当月第一天是星期几,注意 getDay() 返回值 0 代表周日,1 - 6 代表周一到周六
const
firstDayOfMonth
=
new
Date
(
year
,
month
,
1
);
const
firstDayWeekday
=
firstDayOfMonth
.
getDay
();
// 获取当月的总天数
const
lastDayOfMonth
=
new
Date
(
year
,
month
+
1
,
0
);
const
totalDays
=
lastDayOfMonth
.
getDate
();
// 创建一个初始数组,根据当月第一天是星期几插入相应数量的 null
const
daysArray
=
[];
for
(
let
i
=
0
;
i
<
(
firstDayWeekday
===
0
?
6
:
firstDayWeekday
-
1
);
i
++
)
{
daysArray
.
push
(
null
);
}
}
if
(
firstDayOfMonth
.
getDay
()
==
0
)
{
// 填充当月的日期
// 第一行只有一天的情况
for
(
let
day
=
1
;
day
<=
totalDays
;
day
++
)
{
for
(
let
i
=
1
;
i
<=
6
;
i
++
)
{
daysArray
.
push
(
day
);
dates
.
unshift
(
null
)
}
}
else
{
for
(
let
i
=
1
;
i
<
firstDayOfMonth
.
getDay
();
i
++
)
{
dates
.
unshift
(
null
)
}
}
}
console
.
log
(
dates
)
return
daysArray
;
return
dates
},
},
getMaxLen
()
{
const
max_len
=
Math
.
ceil
(
this
.
dates
.
length
/
7
)
return
max_len
},
getTagClass
()
{
return
(
date
)
=>
{
if
(
!
date
||
date
.
dayState
===
null
)
{
return
[
'tag'
];
}
const
item
=
TYPE_LIST
.
find
(
item
=>
item
.
value
==
date
.
dayState
);
return
item
?
[
'tag'
,
item
.
class
]
:
[
'tag'
];
}
}
},
},
mounted
(
options
)
{
mounted
(
options
)
{
console
.
log
(
'Calendar.adsfads'
)
console
.
log
(
'Calendar.adsfads'
)
...
@@ -155,7 +172,7 @@ export default {
...
@@ -155,7 +172,7 @@ export default {
async
getNewCalendar
()
{
async
getNewCalendar
()
{
const
params
=
this
.
getParams
()
const
params
=
this
.
getParams
()
const
res
=
await
uni
.
$api
.
pointApi
.
newCalendar
(
params
)
const
res
=
await
uni
.
$api
.
pointApi
.
newCalendar
(
params
)
if
(
res
)
{
if
(
res
)
{
console
.
log
(
this
.
dates
,
'dates'
)
console
.
log
(
this
.
dates
,
'dates'
)
this
.
dates
.
forEach
(
item
=>
{
this
.
dates
.
forEach
(
item
=>
{
const
clockData
=
res
.
clockInDateList
.
find
(
i
=>
i
.
day
==
item
)
const
clockData
=
res
.
clockInDateList
.
find
(
i
=>
i
.
day
==
item
)
...
@@ -248,7 +265,6 @@ export default {
...
@@ -248,7 +265,6 @@ export default {
.calendar-date
{
.calendar-date
{
position
:
relative
;
position
:
relative
;
width
:
calc
(
100%
/
7
);
width
:
calc
(
100%
/
7
);
min-height
:
calc
((
100vh
-
#{
toRpx
(
550
)}
)
/
5
);
background-color
:
#fff
;
background-color
:
#fff
;
padding
:
toRpx
(
22
)
toRpx
(
32
);
padding
:
toRpx
(
22
)
toRpx
(
32
);
display
:
flex
;
display
:
flex
;
...
@@ -360,6 +376,18 @@ export default {
...
@@ -360,6 +376,18 @@ export default {
margin-bottom
:
toRpx
(
6
);
margin-bottom
:
toRpx
(
6
);
}
}
}
}
&
.lines5
{
min-height
:
calc
((
100vh
-
#{
toRpx
(
550
)}
)
/
5
);
}
&
.lines6
{
min-height
:
calc
((
100vh
-
#{
toRpx
(
550
)}
)
/
6
);
.date-num
{
margin-bottom
:
toRpx
(
0
);
}
}
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment