artistClock.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <el-dialog
  3. width="500px"
  4. :title="activeRow.username || ''"
  5. :visible.sync="lookVisible"
  6. :before-close="onClose"
  7. >
  8. <div class="days-list">
  9. <div
  10. class="days-block"
  11. v-for="(item, index) in trainingList"
  12. :key="index"
  13. >
  14. <div
  15. class="days-item"
  16. :class="[
  17. item.isFinish == 0 ? 'close' : '',
  18. item.isFinish == 1 ? 'check' : '',
  19. ]"
  20. >
  21. <div v-if="item.isFinish > -1" style="font-size: 12px">打卡{{ item.singleDayTrainingDuration }}分钟</div>
  22. <img
  23. v-if="item.isFinish == 0"
  24. class="clock-img"
  25. src="../images/icon_close.png"
  26. alt=""
  27. />
  28. <img
  29. v-if="item.isFinish == 1"
  30. class="clock-img"
  31. src="../images/icon_check.png"
  32. alt=""
  33. />
  34. <img
  35. v-if="item.isFinish == -1"
  36. class="clock-img"
  37. src="../images/icon_check_disabled.png"
  38. alt=""
  39. />
  40. <p class="date">{{ item.trainingDate }}</p>
  41. </div>
  42. </div>
  43. </div>
  44. </el-dialog>
  45. </template>
  46. <script>
  47. import { getUserTrainingTime } from "../api";
  48. import dayjs from "dayjs";
  49. export default {
  50. data() {
  51. return {
  52. lookVisible: false,
  53. activeRow: { username: null },
  54. trainingList: [],
  55. };
  56. },
  57. methods: {
  58. async openDioag(row) {
  59. this.activeRow = row;
  60. try {
  61. const res = await getUserTrainingTime({ userId: row.id, campId: row.campId });
  62. this.trainingList = res.data;
  63. this.trainingList.forEach((item) => {
  64. item.trainingDate = dayjs(item.trainingDate).format("M月D日");
  65. item.singleDayTrainingDuration = Math.floor(item.playTime / 60)
  66. });
  67. } catch (e) {
  68. console.log(e);
  69. }
  70. this.lookVisible = true;
  71. },
  72. onClose() {
  73. this.lookVisible = false;
  74. },
  75. },
  76. };
  77. </script>
  78. <style lang="less" scoped>
  79. .flex-center {
  80. display: flex;
  81. justify-content: flex-start;
  82. align-items: center;
  83. }
  84. // .artistClock {
  85. // background: url("../images/clock_bg.png") no-repeat center top #f8f9fc;
  86. .days-list {
  87. display: flex;
  88. flex-wrap: wrap;
  89. }
  90. .days-block {
  91. width: 20%;
  92. text-align: center;
  93. margin-top: 10px;
  94. }
  95. .days-item {
  96. display: flex;
  97. align-items: center;
  98. flex-direction: column;
  99. justify-content: center;
  100. margin: 0 auto;
  101. padding: 10px 0;
  102. width: 94%;
  103. height: 100px;
  104. background: linear-gradient(180deg, #f0f0f0 0%, #d3d3d3 100%);
  105. box-shadow: 0px 6px 4px 0px rgba(125, 125, 125, 0.14);
  106. border-radius: 0.06rem;
  107. p {
  108. font-size: 13px;
  109. font-weight: 500;
  110. color: #ffffff;
  111. margin-top: 5px;
  112. }
  113. .clock-img {
  114. width: 29px;
  115. height: 29px;
  116. margin-top: 5px;
  117. margin-bottom: 3px;
  118. }
  119. }
  120. .close {
  121. background: linear-gradient(180deg, #ffccbb 0%, #ff9d8b 100%);
  122. box-shadow: 0px 6px 4px 0px rgba(255, 160, 139, 0.29);
  123. }
  124. .check {
  125. background: linear-gradient(180deg, #a1ee99 0%, #b9de66 100%);
  126. box-shadow: 0px 6px 4px 0px rgba(83, 160, 75, 0.14);
  127. }
  128. </style>