123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <template>
- <view>
- <mescroll-empty :option="option" @emptyclick="$navigateTo('/pages/login/login')" v-if="isEmpty">
- </mescroll-empty>
- <view class="file-list" v-else>
- <view class="file-item" v-for="(item,index) in tableData" :key="index" @click="clickFolder(item)">
- <view class="file-image">
- <image class="image" src="/static/image/datacenter/folder.png" mode="aspectFill"></image>
- </view>
- <view class="file-content">
- <view class="title">{{item.name}}</view>
- <view class="sub">{{item.createDate || '-'}}</view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {
- generateFileNodeProject,
- getProjectDirList
- } from '@/request/api/datacenter.js'
- import {
- projectPermission
- } from '@/uitls/datacenter'
- export default {
- data() {
- return {
- option: {
- tip: '暂未加入项目'
- },
- tableData: [],
- parentId: '',
- isEmpty: true
- }
- },
- onShow() {
- this.isEmpty = true;
- if (!uni.getStorageSync('token')) {
- this.option = {
- tip: '暂未登录',
- btnText: '点击登录'
- }
- } else if (!this.$store.getters.project.id) {
- this.option = {
- tip: '暂未加入项目'
- }
- } else {
- this.initProjectDir();
- this.isEmpty = false;
- }
- },
- methods: {
- initProjectDir() {
- generateFileNodeProject(this.$store.getters.project.id).then(res => {
- if (res.code === 200) {
- this.tableData = res.data.sort((a, b) => b.directory - a.directory);
- }
- });
- },
- clickFolder(item) {
- if (!item.directory) return;
- projectPermission({
- id: item.id,
- oldPermission: item.permissions,
- type: 'access',
- name: item.name,
- folderList: [item.name]
- }, () => {
- this.$navigateTo('/pages/file/file?parentId=' + item.id + '&title=' + item.name)
- });
- }
- }
- }
- </script>
- <style lang="scss">
- .file-list {
- padding: 30rpx;
- .file-item {
- display: flex;
- padding: 20rpx;
- background: #fff;
- display: flex;
- align-items: center;
- border-radius: 16rpx;
- box-shadow: 0px 1px 12px rgba(3, 3, 3, 0.08);
- margin-bottom: 30rpx;
- .file-image {
- width: 100rpx;
- height: 80rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- margin-right: 30rpx;
- }
- .title {
- font-size: 32rpx;
- font-weight: 600;
- margin-bottom: 10rpx;
- }
- .sub {
- font-weight: 300;
- font-size: 24rpx;
- margin-top: 10rpx;
- color: $uni-secondary-color;
- }
- }
- }
- </style>
|