dataCenter.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <view>
  3. <mescroll-empty :option="option" @emptyclick="$navigateTo('/pages/login/login')" v-if="isEmpty">
  4. </mescroll-empty>
  5. <view class="file-list" v-else>
  6. <view class="file-item" v-for="(item,index) in tableData" :key="index">
  7. <view class="file-image">
  8. <image class="image" src="/static/image/datacenter/folder.png" mode="aspectFill"></image>
  9. </view>
  10. <view class="file-content">
  11. <view class="title">{{item.name}}</view>
  12. <view class="sub">2024-01-01</view>
  13. </view>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. import {
  20. generateFileNodeProject,
  21. getProjectDirList
  22. } from '@/request/api/datacenter.js'
  23. export default {
  24. data() {
  25. return {
  26. option: {
  27. tip: '暂未加入项目'
  28. },
  29. tableData: [],
  30. parentId: '',
  31. isEmpty: true
  32. }
  33. },
  34. onShow() {
  35. this.isEmpty = true;
  36. if (!uni.getStorageSync('token')) {
  37. this.option = {
  38. tip: '暂未登录',
  39. btnText: '点击登录'
  40. }
  41. } else if (!this.$store.getters.project.id) {
  42. this.option = {
  43. tip: '暂未加入项目'
  44. }
  45. } else {
  46. this.isEmpty = false;
  47. }
  48. },
  49. onLoad(body) {
  50. console.log(body.parentId);
  51. if (!body.parentId) return this.initProjectDir();
  52. this.parentId = body.parentId;
  53. this.projectDirList();
  54. },
  55. methods: {
  56. initProjectDir() {
  57. generateFileNodeProject(this.$store.getters.project.id).then(res => {
  58. if (res.code === 200) {
  59. this.tableData = res.data.sort((a, b) => b.directory - a.directory);
  60. console.log(this.tableData);
  61. }
  62. });
  63. },
  64. projectDirList() {
  65. getProjectDirList(this.parentId).then(res => {
  66. if (res.code === 200) {
  67. this.tableData = res.data.sort((a, b) => b.directory - a.directory);
  68. }
  69. });
  70. },
  71. }
  72. }
  73. </script>
  74. <style lang="scss">
  75. .file-list {
  76. padding: 30rpx;
  77. .file-item {
  78. display: flex;
  79. padding: 20rpx;
  80. background: #fff;
  81. display: flex;
  82. align-items: center;
  83. border-radius: 16rpx;
  84. box-shadow: 0px 1px 12px rgba(3, 3, 3, 0.08);
  85. margin-bottom: 30rpx;
  86. .file-image {
  87. width: 100rpx;
  88. height: 80rpx;
  89. display: flex;
  90. align-items: center;
  91. justify-content: center;
  92. margin-right: 30rpx;
  93. }
  94. .title {
  95. font-size: 32rpx;
  96. font-weight: 600;
  97. margin-bottom: 10rpx;
  98. }
  99. .sub {
  100. font-weight: 300;
  101. font-size: 24rpx;
  102. margin-top: 10rpx;
  103. color: $uni-secondary-color;
  104. }
  105. }
  106. }
  107. </style>