feat: shared item information
parent
4e48ffc14d
commit
36cacdf598
|
@ -191,10 +191,11 @@ table th {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.share__box, .share__box__header {
|
.share__box {
|
||||||
background: var(--surfacePrimary) !important;
|
background: var(--surfacePrimary) !important;
|
||||||
color: var(--textPrimary);
|
color: var(--textPrimary);
|
||||||
}
|
}
|
||||||
.share__box__header {
|
|
||||||
border-bottom-color: var(--divider);
|
.share__box__element {
|
||||||
|
border-top-color: var(--divider);
|
||||||
}
|
}
|
|
@ -20,37 +20,40 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.share__box__header {
|
.share__box__header {
|
||||||
width: 100%;
|
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
cursor: pointer;
|
text-align: center;
|
||||||
background: #ffffff;
|
|
||||||
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.share__box__body {
|
.share__box__icon i {
|
||||||
padding: 2em 3em;
|
font-size: 10em;
|
||||||
|
color: #40c4ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.share__box__title {
|
.share__box__center {
|
||||||
margin: 0 0 2em;
|
text-align: center;
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.share__box__info {
|
.share__box__info {
|
||||||
text-align: center;
|
|
||||||
flex: 1 1 auto;
|
flex: 1 1 auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.share__box__element {
|
||||||
|
padding: 1em;
|
||||||
|
border-top: 1px solid rgba(0, 0, 0, 0.1);
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
|
||||||
.share__box__items {
|
.share__box__items {
|
||||||
text-align: left;
|
text-align: left;
|
||||||
flex: 10 0 15em;
|
flex: 10 0 25em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.share__box__items #listing.list .item {
|
.share__box__items #listing.list .item {
|
||||||
cursor: auto;
|
cursor: auto;
|
||||||
border-left: 0;
|
border-left: 0;
|
||||||
border-right: 0;
|
border-right: 0;
|
||||||
|
border-bottom: 0;
|
||||||
|
border-top: 1px solid rgba(0, 0, 0, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.share__box__items #listing.list .item .name {
|
.share__box__items #listing.list .item .name {
|
||||||
|
|
|
@ -1,34 +1,37 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="share" v-if="loaded">
|
<div class="share" v-if="loaded">
|
||||||
<div class="share__box share__box__info">
|
<div class="share__box share__box__info">
|
||||||
<a target="_blank" :href="link">
|
<div class="share__box__header">
|
||||||
<div class="share__box__header" v-if="file.isDir">{{ $t('download.downloadFolder') }}</div>
|
{{ file.isDir ? $t('download.downloadFolder') : $t('download.downloadFile') }}
|
||||||
<div class="share__box__header" v-else>{{ $t('download.downloadFile') }}</div>
|
</div>
|
||||||
<div class="share__box__body">
|
<div class="share__box__element share__box__center share__box__icon">
|
||||||
<svg v-if="file.isDir" fill="#40c4ff" height="150" viewBox="0 0 24 24" width="150" xmlns="http://www.w3.org/2000/svg">
|
<i class="material-icons">{{ file.isDir ? 'folder' : 'insert_drive_file'}}</i>
|
||||||
<path d="M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"/>
|
</div>
|
||||||
<path d="M0 0h24v24H0z" fill="none"/>
|
<div class="share__box__element">
|
||||||
</svg>
|
<strong>{{ $t('prompts.displayName') }}</strong> {{ file.name }}
|
||||||
<svg v-else fill="#40c4ff" height="150" viewBox="0 0 24 24" width="150" xmlns="http://www.w3.org/2000/svg">
|
</div>
|
||||||
<path d="M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6H6zm7 7V3.5L18.5 9H13z"/>
|
<div class="share__box__element">
|
||||||
<path d="M0 0h24v24H0z" fill="none"/>
|
<strong>{{ $t('prompts.lastModified') }}:</strong> {{ humanTime }}
|
||||||
</svg>
|
</div>
|
||||||
<h1 class="share__box__title">{{ file.name }}</h1>
|
<div class="share__box__element">
|
||||||
|
<strong>{{ $t('prompts.size') }}:</strong> {{ humanSize }}
|
||||||
|
</div>
|
||||||
|
<div class="share__box__element share__box__center">
|
||||||
|
<a target="_blank" :href="link" class="button button--flat">{{ $t('buttons.download') }}</a>
|
||||||
|
</div>
|
||||||
|
<div class="share__box__element share__box__center">
|
||||||
<qrcode-vue :value="fullLink" size="200" level="M"></qrcode-vue>
|
<qrcode-vue :value="fullLink" size="200" level="M"></qrcode-vue>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
<div v-if="file.isDir" class="share__box share__box__items">
|
<div v-if="file.isDir" class="share__box share__box__items">
|
||||||
<div class="share__box__header" v-if="file.isDir">{{ $t('files.files') }}</div>
|
<div class="share__box__header" v-if="file.isDir">
|
||||||
|
{{ $t('files.files') }}
|
||||||
|
</div>
|
||||||
<div id="listing" class="list">
|
<div id="listing" class="list">
|
||||||
<div class="item" v-for="(item) in file.items.slice(0, this.showLimit)" :key="base64(item.name)">
|
<div class="item" v-for="(item) in file.items.slice(0, this.showLimit)" :key="base64(item.name)">
|
||||||
<div>
|
<div>
|
||||||
<i v-if="item.isDir" class="material-icons">folder</i>
|
<i class="material-icons">{{ item.isDir ? 'folder' : (item.type==='image') ? 'insert_photo' : 'insert_drive_file' }}</i>
|
||||||
<i v-else-if="item.type==='image'" class="material-icons">insert_photo</i>
|
|
||||||
<i v-else class="material-icons">insert_drive_file</i>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<p class="name">{{ item.name }}</p>
|
<p class="name">{{ item.name }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -46,6 +49,8 @@
|
||||||
<script>
|
<script>
|
||||||
import { share as api } from '@/api'
|
import { share as api } from '@/api'
|
||||||
import { baseURL } from '@/utils/constants'
|
import { baseURL } from '@/utils/constants'
|
||||||
|
import filesize from 'filesize'
|
||||||
|
import moment from 'moment'
|
||||||
import QrcodeVue from 'qrcode.vue'
|
import QrcodeVue from 'qrcode.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -75,6 +80,16 @@ export default {
|
||||||
fullLink: function () {
|
fullLink: function () {
|
||||||
return window.location.origin + this.link
|
return window.location.origin + this.link
|
||||||
},
|
},
|
||||||
|
humanSize: function () {
|
||||||
|
if (this.file.isDir) {
|
||||||
|
return this.file.items.length
|
||||||
|
}
|
||||||
|
|
||||||
|
return filesize(this.file.size)
|
||||||
|
},
|
||||||
|
humanTime: function () {
|
||||||
|
return moment(this.file.modified).fromNow()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
base64: function (name) {
|
base64: function (name) {
|
||||||
|
|
Loading…
Reference in New Issue