综合办公系统
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

studyHead.vue 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <!--
  2. * @Author: ysh
  3. * @Date: 2025-03-05 14:19:02
  4. * @LastEditors: wrh
  5. * @LastEditTime: 2026-01-04 11:30:16
  6. -->
  7. <template>
  8. <div class="head-bg">
  9. <div class="user-info">
  10. <div class="user-pic" data-is-fans="0" data-is-follows="">
  11. <div class="user-pic-bg">
  12. <img class="img" :src="$store.getters.avatar">
  13. </div>
  14. </div>
  15. <div class="user-name">
  16. {{ $store.getters.name }}
  17. </div>
  18. <div class="user-dept">
  19. {{ getDeptName($store.getters.deptId) }}
  20. </div>
  21. <div class="user-study">
  22. <div class="user-item">
  23. <div class="u-info-learn" style="cursor:pointer;">
  24. <em>{{ hours }}h</em>
  25. <span>{{new Date().getFullYear()+"学时"}}</span>
  26. </div>
  27. </div>
  28. </div>
  29. </div>
  30. </div>
  31. </template>
  32. <script>
  33. import { listStudy, getStudy, delStudy, addStudy, updateStudy } from "@/api/oa/study/myStudy";
  34. import { listTrainApproval, getTrainApproval, delTrainApproval, addTrainApproval, updateTrainApproval } from "@/api/oa/study/trainApproval";
  35. export default {
  36. data() {
  37. return {
  38. hours: 0,
  39. }
  40. },
  41. created() {
  42. this.getYearHours();
  43. },
  44. methods: {
  45. async getYearHours() {
  46. let lastTime = new Date().getFullYear() + '-01-01';
  47. let studyHours = 0, approvalHours = 0;
  48. let studyRes = await listStudy({ userId: this.$store.getters.userId, lastTime: lastTime })
  49. if (studyRes.total > 0) {
  50. studyHours = studyRes.rows.reduce((sum, item) => sum + Number(item.getHours), 0)
  51. }
  52. let approvalRes = await listTrainApproval({ userId: this.$store.getters.userId, reportTime: lastTime })
  53. if (approvalRes.total > 0) {
  54. approvalHours = approvalRes.rows.reduce((sum, item) => {
  55. if (item.deptTime) {
  56. return sum + Number(item.hours)
  57. } else {
  58. return sum + 0
  59. }
  60. }, 0)
  61. }
  62. console.log(approvalHours);
  63. this.hours = (studyHours + approvalHours).toFixed(1);
  64. }
  65. },
  66. }
  67. </script>
  68. <style lang="scss" scoped>
  69. .head-bg {
  70. background: url('~@/assets/images/temp1.png') no-repeat center top #000;
  71. background-size: cover;
  72. height: 100px;
  73. .user-info {
  74. display: flex;
  75. position: relative;
  76. width: 1200px;
  77. margin: 0 auto;
  78. .user-pic {
  79. float: left;
  80. width: 148px;
  81. height: 148px;
  82. .user-pic-bg {
  83. border: 4px solid #fff;
  84. box-shadow: 0 4px 8px 0 rgba(7, 17, 27, .1);
  85. width: 120px;
  86. height: 120px;
  87. position: relative;
  88. border-radius: 50%;
  89. background: #fff;
  90. top: 24px;
  91. img {
  92. text-align: center;
  93. width: 115px;
  94. height: 115px;
  95. border-radius: 50%;
  96. }
  97. }
  98. }
  99. .user-name {
  100. font-weight: 600;
  101. text-align: left;
  102. font-size: 24px;
  103. color: #fff;
  104. line-height: 28px;
  105. margin-top: 48px;
  106. }
  107. .user-dept {
  108. font-weight: 600;
  109. text-align: left;
  110. font-size: 16px;
  111. color: #ebe7e7;
  112. font-family: 'puhuiti';
  113. line-height: 28px;
  114. margin-top: 52px;
  115. margin-left: 20px;
  116. }
  117. .user-study {
  118. position: absolute;
  119. top: 31px;
  120. right: 185px;
  121. min-width: 200px;
  122. text-align: right;
  123. .user-item {
  124. line-height: 48px;
  125. vertical-align: middle;
  126. height: 48px;
  127. float: left;
  128. em {
  129. display: block;
  130. text-align: center;
  131. font-weight: 700;
  132. font-size: 24px;
  133. color: rgba(255, 255, 255, .8);
  134. line-height: 28px;
  135. }
  136. span {
  137. display: block;
  138. text-align: center;
  139. font-size: 14px;
  140. color: rgba(255, 255, 255, .8);
  141. line-height: 20px;
  142. margin-top: 4px;
  143. }
  144. }
  145. }
  146. }
  147. }
  148. </style>