【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.

284 lines
6.3 KiB

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