fixes login

This commit is contained in:
Weidi Deng 2020-12-23 16:10:52 +08:00
parent 5087c6c579
commit b483e8d0bc
3 changed files with 13 additions and 20 deletions

View File

@ -37,7 +37,7 @@
<delete-button v-show="showDeleteButton"></delete-button> <delete-button v-show="showDeleteButton"></delete-button>
</div> </div>
<shell-button v-if="isExecEnabled && user.perm.execute" /> <shell-button v-if="isExecEnabled && !isSharing && user.perm.execute" />
<switch-button v-show="isListing"></switch-button> <switch-button v-show="isListing"></switch-button>
<download-button v-show="showDownloadButton"></download-button> <download-button v-show="showDownloadButton"></download-button>
<upload-button v-show="showUpload"></upload-button> <upload-button v-show="showUpload"></upload-button>

View File

@ -13,7 +13,7 @@
:aria-label="name" :aria-label="name"
:aria-selected="isSelected"> :aria-selected="isSelected">
<div> <div>
<img v-if="type==='image' && isThumbsEnabled" v-lazy="thumbnailUrl"> <img v-if="type==='image' && isThumbsEnabled && !isSharing" v-lazy="thumbnailUrl">
<i v-else class="material-icons">{{ icon }}</i> <i v-else class="material-icons">{{ icon }}</i>
</div> </div>
@ -47,8 +47,12 @@ export default {
}, },
props: ['name', 'isDir', 'url', 'type', 'size', 'modified', 'index'], props: ['name', 'isDir', 'url', 'type', 'size', 'modified', 'index'],
computed: { computed: {
...mapState(['user', 'selected', 'req', 'user', 'jwt']), ...mapState(['user', 'selected', 'req', 'jwt']),
...mapGetters(['selectedCount', 'isSharing']), ...mapGetters(['selectedCount', 'isSharing']),
singleClick () {
if (this.isSharing) return false
return this.user.singleClick
},
isSelected () { isSelected () {
return (this.selected.indexOf(this.index) !== -1) return (this.selected.indexOf(this.index) !== -1)
}, },
@ -60,7 +64,7 @@ export default {
return 'insert_drive_file' return 'insert_drive_file'
}, },
isDraggable () { isDraggable () {
return this.user.perm.rename return !this.isSharing && this.user.perm.rename
}, },
canDrop () { canDrop () {
if (!this.isDir || this.isSharing) return false if (!this.isDir || this.isSharing) return false
@ -171,11 +175,11 @@ export default {
action(overwrite, rename) action(overwrite, rename)
}, },
itemClick: function(event) { itemClick: function(event) {
if (this.user.singleClick && !this.$store.state.multiple) this.open() if (this.singleClick && !this.$store.state.multiple) this.open()
else this.click(event) else this.click(event)
}, },
click: function (event) { click: function (event) {
if (!this.user.singleClick && this.selectedCount !== 0) event.preventDefault() if (!this.singleClick && this.selectedCount !== 0) event.preventDefault()
if (this.$store.state.selected.indexOf(this.index) !== -1) { if (this.$store.state.selected.indexOf(this.index) !== -1) {
this.removeSelected(this.index) this.removeSelected(this.index)
return return
@ -202,11 +206,11 @@ export default {
return return
} }
if (!this.user.singleClick && !event.ctrlKey && !this.$store.state.multiple) this.resetSelected() if (!this.singleClick && !event.ctrlKey && !this.$store.state.multiple) this.resetSelected()
this.addSelected(this.index) this.addSelected(this.index)
}, },
dblclick: function () { dblclick: function () {
if (!this.user.singleClick) this.open() if (!this.singleClick) this.open()
}, },
touchstart () { touchstart () {
setTimeout(() => { setTimeout(() => {

View File

@ -7,18 +7,7 @@ import upload from './modules/upload'
Vue.use(Vuex) Vue.use(Vuex)
const state = { const state = {
user: { user: null,
perm: {
admin: false,
create: false,
delete: false,
download: false,
execute: false,
modify: false,
rename: false,
share: false
}
},
req: {}, req: {},
oldReq: {}, oldReq: {},
clipboard: { clipboard: {