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

302 lines
6.7 KiB

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