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

288 lines
6.4 KiB

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