【PT.SCC实名制管理系统】24.10.01 -30天,考勤打卡小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

290 lines
6.3 KiB

9 months ago
  1. <!-- 签到记录 -->
  2. <template>
  3. <view class="record">
  4. <!-- 自定义导航栏 -->
  5. <uni-nav-bar
  6. dark
  7. :fixed="true"
  8. shadow
  9. background-color="var(--main-color)"
  10. status-bar
  11. left-icon="left"
  12. title="签到记录"
  13. @clickLeft="$utils.navigateBack" />
  14. <!-- 签到日历 -->
  15. <view class="sign-calendar main">
  16. <view class="sign-user-info">
  17. <image class="user-img" src="@/static/logo.png" mode="widthFix"></image>
  18. <view class="base">
  19. <view class="name">李知意</view>
  20. <view class="project">高新区项目一队项目1</view>
  21. </view>
  22. </view>
  23. <view>
  24. <view class="calendar-top">
  25. <view class="current-time">
  26. <view class="year">{{ year }}</view>
  27. <view class="time">{{ monthDay }}</view>
  28. </view>
  29. <view class="calendar-desc">
  30. <view class="calendar-desc-item">正常</view>
  31. <view class="calendar-desc-item">缺卡</view>
  32. <view class="calendar-desc-item">未打卡</view>
  33. </view>
  34. </view>
  35. <uni-calendar class="uni-calendar--hook" :selected="selected" showMonth />
  36. <view class="desc">
  37. <view style="width: 100%;justify-content: flex-start;margin-top: 30rpx;" class="calendar-desc">
  38. <view style="margin: 0rpx 45rpx;" class="calendar-desc-item">正常<text>5</text></view>
  39. <view style="margin: 0rpx 45rpx;" class="calendar-desc-item">缺卡<text>3</text></view>
  40. <view style="margin: 0rpx 45rpx;" class="calendar-desc-item">未打卡<text>2</text></view>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <!-- 今日打卡详情 -->
  46. <view class="today-detail main">
  47. <view class="today-detail-title">今日打卡详情</view>
  48. <uv-steps current="8" direction="column" dot>
  49. <uv-steps-item v-for="item in 10" :key="item">
  50. <template #title>
  51. <view class="today-detail-main">
  52. <image src="@/static/image/center/center-bg.png" mode="widthFix"></image>
  53. <view class="sign-detail">
  54. <view class="time">2024-10-09 8:30</view>
  55. <view class="address">长沙市雨花区德思勤城市广场</view>
  56. </view>
  57. </view>
  58. </template>
  59. </uv-steps-item>
  60. </uv-steps>
  61. </view>
  62. </view>
  63. </template>
  64. <script>
  65. /**
  66. * 获取任意时间
  67. */
  68. function getDate(date, AddDayCount = 0) {
  69. if (!date) {
  70. date = new Date()
  71. }
  72. if (typeof date !== 'object') {
  73. date = date.replace(/-/g, '/')
  74. }
  75. const dd = new Date(date)
  76. dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期
  77. const y = dd.getFullYear()
  78. const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期,不足10补0
  79. const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号,不足10补0
  80. return {
  81. fullDate: y + '-' + m + '-' + d,
  82. year: y,
  83. month: m,
  84. date: d,
  85. day: dd.getDay()
  86. }
  87. }
  88. export default {
  89. name: "Record",
  90. data() {
  91. return {
  92. year: '', //年
  93. monthDay: '', //月日
  94. selected: [{ //info为1:正常 2:缺卡 3:未打卡
  95. date: getDate(new Date(), -3).fullDate,
  96. info: 3
  97. },
  98. {
  99. date: getDate(new Date(), -2).fullDate,
  100. info: 2
  101. },
  102. {
  103. date: getDate(new Date(), -1).fullDate,
  104. info: 1
  105. }
  106. ]
  107. }
  108. },
  109. onShow() {
  110. this.getCurrentTime()
  111. },
  112. methods: {
  113. //获取打卡日期
  114. getCurrentTime() {
  115. let currentDate = new Date();
  116. this.year = currentDate.getFullYear();
  117. let currentMonth = currentDate.getMonth() + 1;
  118. let currentDay = currentDate.getDate();
  119. this.monthDay =
  120. `${currentMonth < 10 ? "0" + currentMonth : currentMonth}.${currentDay < 10 ? "0" + currentDay : currentDay}`
  121. },
  122. }
  123. }
  124. </script>
  125. <style lang="scss" scoped>
  126. .record {
  127. min-height: 100vh;
  128. background: #E4E4E4;
  129. padding-bottom: 100rpx;
  130. .main {
  131. width: 95%;
  132. margin: 0rpx auto;
  133. }
  134. // 签到日历
  135. .sign-calendar {
  136. background: white;
  137. border-radius: 15rpx;
  138. overflow: hidden;
  139. margin-top: 30rpx;
  140. box-sizing: border-box;
  141. padding: 25rpx 15rpx;
  142. .sign-user-info {
  143. display: flex;
  144. flex-wrap: wrap;
  145. border-bottom: 2rpx solid #ccc;
  146. padding: 15rpx 0rpx;
  147. .user-img {
  148. width: 150rpx;
  149. height: 150rpx;
  150. }
  151. .base {
  152. display: flex;
  153. flex-direction: column;
  154. justify-content: space-between;
  155. box-sizing: border-box;
  156. padding: 25rpx 0rpx 25rpx 15rpx;
  157. width: calc(100% - 150rpx);
  158. .name {
  159. font-size: 36rpx;
  160. }
  161. .project {
  162. font-size: 30rpx;
  163. color: #959595;
  164. }
  165. }
  166. }
  167. .calendar-top , .desc {
  168. display: flex;
  169. align-items: center;
  170. justify-content: space-between;
  171. padding: 15rpx 0rpx 20rpx 0rpx;
  172. .current-time {
  173. display: flex;
  174. font-size: 32rpx;
  175. font-weight: bold;
  176. width: 35%;
  177. .year {
  178. margin-right: 15rpx;
  179. }
  180. .time {}
  181. }
  182. .calendar-desc {
  183. display: flex;
  184. justify-content: flex-end;
  185. width: 65%;
  186. color: #707070;
  187. .calendar-desc-item {
  188. position: relative;
  189. margin: 0rpx 35rpx;
  190. &::before {
  191. position: absolute;
  192. top: 10rpx;
  193. left: -25rpx;
  194. display: block;
  195. content: "";
  196. width: 20rpx;
  197. height: 20rpx;
  198. border-radius: 50%;
  199. background: #11FF00;
  200. }
  201. &:nth-child(1) {
  202. &::before {
  203. background: #11FF00;
  204. }
  205. }
  206. &:nth-child(2) {
  207. &::before {
  208. background: #F97D00;
  209. }
  210. }
  211. &:nth-child(3) {
  212. &::before {
  213. background: #FF0000;
  214. }
  215. }
  216. }
  217. }
  218. }
  219. // 修改日历样式
  220. &::v-deep .uni-calendar__header {
  221. display: none !important;
  222. }
  223. &::v-deep .uni-calendar-item__weeks-box {
  224. border-radius: 50% !important;
  225. }
  226. &::v-deep .uni-calendar-item--isDay {
  227. background-color: $main-color !important;
  228. }
  229. &::v-deep .uni-calendar-item--checked {
  230. background-color: $main-color !important;
  231. }
  232. }
  233. // 今日打卡详情
  234. .today-detail {
  235. border-radius: 15rpx;
  236. background: white;
  237. margin-top: 35rpx;
  238. box-sizing: border-box;
  239. padding: 25rpx 15rpx;
  240. overflow: hidden;
  241. .today-detail-title {
  242. font-size: 32rpx;
  243. font-weight: bold;
  244. }
  245. .today-detail-main {
  246. display: flex;
  247. box-shadow: 0rpx 0rpx 10rpx rgba(0, 0, 0, .1);
  248. margin: 15rpx 0rpx;
  249. box-sizing: border-box;
  250. padding: 20rpx 15rpx;
  251. image {
  252. width: 30%;
  253. }
  254. }
  255. }
  256. }
  257. </style>