diff --git a/pages/media.vue b/pages/media.vue index 608e3ea4..53129b01 100644 --- a/pages/media.vue +++ b/pages/media.vue @@ -358,14 +358,10 @@ export default { async onSubmitCreateFolder (evt) { evt.preventDefault() + const path = this.crumbs.map(e => e.text).join('/') + '/' + this.folderName await this.$axios.post( - 'api/player/media/op/', - { - folder: this.folderName, - path: this.crumbs.map(e => e.text).join('/'), - channel: this.configGui[this.configID].id - } + `api/file/${this.configGui[this.configID].id}/create-folder/`, { source: path } ) this.$root.$emit('bv::hide::modal', 'folder-modal') @@ -451,7 +447,7 @@ export default { this.previewName = src.split('/').slice(-1)[0] const ext = this.previewName.split('.').slice(-1)[0] - if (this.configPlayout.storage.extensions.includes(`.${ext}`)) { + if (this.configPlayout.storage.extensions.includes(`${ext}`)) { this.isImage = false this.previewOptions = { liveui: false, @@ -462,7 +458,7 @@ export default { sources: [ { type: `video/${ext}`, - src: '/' + encodeURIComponent(src.replace(/^\//, '')) + src: '/' + encodeURIComponent(src.replace(/^[/]+/, '')) } ] } diff --git a/store/media.js b/store/media.js index a05b1ea0..f761544b 100644 --- a/store/media.js +++ b/store/media.js @@ -25,20 +25,21 @@ export const actions = { `api/file/${channel}/browse/`, { source: path }) if (response.data) { - const pathStr = 'Home/' + response.data.source - const pathArr = pathStr.split('/') + console.log(response.data) + const pathArr = response.data.source.split('/') + + console.log(pathArr) + console.log('path', path) if (path) { for (const crumb of pathArr) { - if (crumb === 'Home') { - crumbs.push({ text: crumb, path: root }) - } else if (crumb) { + if (crumb) { root += crumb + '/' crumbs.push({ text: crumb, path: root }) } } } else { - crumbs.push({ text: 'Home', path: '' }) + crumbs.push({ text: pathArr[0], path: '' }) } commit('UPDATE_CURRENT_PATH', path)