FileOverview.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <div class="card-b">
  3. <div class="box" v-for="item in FILE_OVERVIEW_CONFIG" :key="item.id" @click="$emit('click', item)">
  4. <div class="img"> <img :src="item.src" alt="" /> </div>
  5. <div class="text">{{ item.text }}</div>
  6. <div class="num">{{ fileData[item.prop] }}</div>
  7. </div>
  8. </div>
  9. </template>
  10. <script lang="ts" setup>
  11. import { watch, shallowRef } from 'vue';
  12. import { BillboardType, DEFAULT_TEST_DATA, FILE_OVERVIEW_CONFIG } from '../billboard.data';
  13. import _ from 'lodash-es';
  14. const props = withDefaults(
  15. defineProps<{
  16. data?: BillboardType;
  17. }>(),
  18. {
  19. data: () => DEFAULT_TEST_DATA,
  20. }
  21. );
  22. defineEmits(['click']);
  23. const fileData = shallowRef<BillboardType['fileServerInfo']>({
  24. totalNum: 0,
  25. approvalNum: 0,
  26. });
  27. function fetchData() {
  28. const info = props.data.fileServerInfo;
  29. if (!info) return;
  30. fileData.value = info;
  31. }
  32. watch(
  33. () => props.data,
  34. () => {
  35. console.log('debug');
  36. fetchData();
  37. },
  38. { immediate: true }
  39. );
  40. </script>
  41. <style lang="less" scoped>
  42. @font-face {
  43. font-family: 'douyuFont';
  44. src: url(/@/assets/images/files/douyuFont.otf);
  45. }
  46. .card-b {
  47. height: 100%;
  48. display: flex;
  49. flex-direction: row;
  50. align-items: center;
  51. .box {
  52. display: flex;
  53. flex: 1;
  54. flex-direction: column;
  55. justify-content: flex-start;
  56. align-items: center;
  57. &:first-child .img {
  58. position: relative;
  59. width: 72px;
  60. height: 78px;
  61. background: url(/@/assets/images/files/homes/file1.png) no-repeat center;
  62. img {
  63. position: absolute;
  64. left: 50%;
  65. top: 50%;
  66. transform: translate(-50%, -75%);
  67. }
  68. }
  69. &:last-child .img {
  70. position: relative;
  71. width: 72px;
  72. height: 78px;
  73. background: url(/@/assets/images/files/homes/sp.png) no-repeat center;
  74. img {
  75. position: absolute;
  76. left: 50%;
  77. top: 50%;
  78. transform: translate(-50%, -75%);
  79. }
  80. }
  81. .text {
  82. margin: 5px 0px;
  83. font-family: '思源黑体', 'Microsoft Yahei';
  84. color: #fff;
  85. font-size: 14px;
  86. }
  87. &:first-child .num {
  88. width: 120px;
  89. height: 30px;
  90. font-family: 'douyuFont';
  91. color: #fff;
  92. font-size: 20px;
  93. display: flex;
  94. justify-content: center;
  95. align-items: center;
  96. background: url(/@/assets/images/files/homes/file2.png) no-repeat center;
  97. }
  98. &:last-child .num {
  99. width: 120px;
  100. height: 30px;
  101. font-family: 'douyuFont';
  102. color: #fff;
  103. font-size: 20px;
  104. display: flex;
  105. justify-content: center;
  106. align-items: center;
  107. background: url(/@/assets/images/files/homes/sp2.png) no-repeat center;
  108. }
  109. }
  110. }
  111. </style>
  112. onMounted, import { getSummary } from '../billboard.api';onMounted, import { getSummary } from '../billboard.api';