index.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <div class="performance">
  3. <div class="main-container">
  4. <div class="card" v-for="(item, index) in titleList" :class="index === active ? 'actived' : 'isActived'"
  5. :key="index" @click="getDetails(index)">
  6. <div class="card-t">{{ item.sysOrgName }}</div>
  7. <div class="card-b">
  8. <div class="box" v-for="(items, ind) in item.tab" :key="ind" >
  9. <div class="img" > <img :src="items.src" alt="" /> </div>
  10. <div class="text">{{ items.text }}</div>
  11. <div class="num" >{{ items.num }}</div>
  12. </div>
  13. </div>
  14. </div>
  15. </div>
  16. </div>
  17. </template>
  18. <script lang="ts" setup>
  19. import { reactive, ref, onMounted } from 'vue';
  20. import { useRouter } from 'vue-router';
  21. import leftImg from '../../../../assets/images/files/homes/file.svg';
  22. import rightImg from '../../../../assets/images/files/homes/sp.svg';
  23. import { list } from './fileIndex.api';
  24. let router = useRouter(); //路由
  25. let active = ref(); //当前选中项
  26. // let toggleItem = ref(); //当前选中子项
  27. let titleList = reactive<any[]>([]);
  28. //获取首页数据
  29. let getPageList = async () => {
  30. let data = await list();
  31. console.log(data, '首页数据');
  32. if (data.length !== 0) {
  33. let datas = data.map((el) => {
  34. return {
  35. sysOrgName: el.sysOrgName,
  36. tab: [
  37. { src: leftImg, text: '文档总数', num: el.tolalNum },
  38. { src: rightImg, text: '待审批数', num: el.approveNum },
  39. ],
  40. };
  41. });
  42. titleList.push(...datas);
  43. console.log(titleList, '123456');
  44. }
  45. };
  46. //切换选项
  47. let getDetails = (index) => {
  48. console.log('详情跳转');
  49. active.value = index;
  50. router.push('/fileManager/fileDetail');
  51. };
  52. // //切换左右选项
  53. // let getToggle = (ind) => {
  54. // console.log(ind);
  55. // toggleItem.value = ind;
  56. // };
  57. onMounted(() => {
  58. getPageList();
  59. });
  60. </script>
  61. <style lang="less" scoped>
  62. @font-face {
  63. font-family: 'douyuFont';
  64. src: url(../../../../assets/images/files/douyuFont.otf);
  65. }
  66. .performance {
  67. width: 100%;
  68. height: 100%;
  69. padding: 15px;
  70. position: relative;
  71. box-sizing: border-box;
  72. background: url(../../../../assets/images/files/homes/bd.png) no-repeat center;
  73. .main-container {
  74. width: 100%;
  75. height: calc(100% - 30px);
  76. display: flex;
  77. flex-direction: row;
  78. // justify-content: flex-start;
  79. // align-items: flex-start;
  80. justify-content: center;
  81. align-items: center;
  82. flex-wrap: wrap;
  83. .card {
  84. width: 331px;
  85. height: 235px;
  86. background: url(../../../../assets/images/files/homes/default.png) no-repeat center;
  87. background-size: 100% 100%;
  88. margin: 0px 23px 15px 23px;
  89. cursor: pointer;
  90. .card-t {
  91. height: 50px;
  92. display: flex;
  93. justify-content: center;
  94. align-items: center;
  95. font-family: '思源黑体', 'Microsoft Yahei';
  96. font-size: 20px;
  97. color: #fff;
  98. }
  99. .card-b {
  100. height: calc(100% - 65px);
  101. margin-top: 15px;
  102. display: flex;
  103. flex-direction: row;
  104. .box {
  105. display: flex;
  106. flex: 1;
  107. flex-direction: column;
  108. justify-content: flex-start;
  109. align-items: center;
  110. &:first-child .img {
  111. position: relative;
  112. width: 72px;
  113. height: 78px;
  114. background: url(../../../../assets/images/files/homes/file1.png) no-repeat center;
  115. img {
  116. position: absolute;
  117. left: 50%;
  118. top: 50%;
  119. transform: translate(-50%, -75%);
  120. }
  121. }
  122. &:last-child .img {
  123. position: relative;
  124. width: 72px;
  125. height: 78px;
  126. background: url(../../../../assets/images/files/homes/sp.png) no-repeat center;
  127. img {
  128. position: absolute;
  129. left: 50%;
  130. top: 50%;
  131. transform: translate(-50%, -75%);
  132. }
  133. }
  134. .text {
  135. margin: 5px 0px;
  136. font-family: '思源黑体', 'Microsoft Yahei';
  137. color: #fff;
  138. font-size: 14px;
  139. }
  140. &:first-child .num {
  141. width: 120px;
  142. height: 30px;
  143. font-family: 'douyuFont';
  144. color: #fff;
  145. font-size: 20px;
  146. display: flex;
  147. justify-content: center;
  148. align-items: center;
  149. background: url(../../../../assets/images/files/homes/file2.png) no-repeat center;
  150. }
  151. &:last-child .num {
  152. width: 120px;
  153. height: 30px;
  154. font-family: 'douyuFont';
  155. color: #fff;
  156. font-size: 20px;
  157. display: flex;
  158. justify-content: center;
  159. align-items: center;
  160. background: url(../../../../assets/images/files/homes/sp2.png) no-repeat center;
  161. }
  162. }
  163. }
  164. }
  165. .actived {
  166. background: url(../../../../assets/images/files/homes/mouse.png) no-repeat center;
  167. background-size: 100% 100%;
  168. }
  169. .isActived {
  170. background: url(../../../../assets/images/files/homes/default.png) no-repeat center;
  171. background-size: 100% 100%;
  172. }
  173. }
  174. }</style>