Browse Source

涉访涉诉--附件路径修改

master
buaixuexideshitongxue 4 weeks ago
parent
commit
26ae9060ab
  1. 28
      src/components/file/list.vue

28
src/components/file/list.vue

@ -13,7 +13,7 @@
<div <div
class="img-box" class="img-box"
:style="{ :style="{
backgroundImage: `url(${BASE_PATH}/file/stream/${item.filePath})`, backgroundImage: `url(${getFilepath(item.filePath)})`,
}" }"
@click="filePreview(item, index)" @click="filePreview(item, index)"
></div> ></div>
@ -69,7 +69,7 @@
@wheel="wheel" @wheel="wheel"
> >
<img <img
:src="`${BASE_PATH}/file/stream/${activeFile.filePath}`" :src="getFilepath(activeFile.filePath)"
ref="imgRef" ref="imgRef"
@click.stop @click.stop
:style="{ :style="{
@ -101,7 +101,7 @@
v-else-if="getFileType(activeFile.fileName) === FileType.PDF" v-else-if="getFileType(activeFile.fileName) === FileType.PDF"
> >
<iframe <iframe
:src="`${BASE_PATH}/file/stream/${activeFile.filePath}`" :src="getFilepath(activeFile.filePath)"
style="height: 100vh; width: 900px" style="height: 100vh; width: 900px"
></iframe> ></iframe>
</template> </template>
@ -110,7 +110,7 @@
> >
<audio controls style="width: 50vw"> <audio controls style="width: 50vw">
<source <source
:src="`${BASE_PATH}/file/stream/${activeFile.filePath}`" :src="getFilepath(activeFile.filePath)"
type="audio/mp3" type="audio/mp3"
/> />
</audio> </audio>
@ -120,7 +120,7 @@
> >
<video controls @click.stop style="max-height: 100vh"> <video controls @click.stop style="max-height: 100vh">
<source <source
:src="`${BASE_PATH}/file/stream/${activeFile.filePath}`" :src="getFilepath(activeFile.filePath)"
type="video/mp4" type="video/mp4"
/> />
</video> </video>
@ -129,7 +129,7 @@
v-else-if="getFileType(activeFile.fileName) === FileType.WORD" v-else-if="getFileType(activeFile.fileName) === FileType.WORD"
> >
<vue-office-docx <vue-office-docx
:src="`${BASE_PATH}/file/stream/${activeFile.filePath}`" :src="getFilepath(activeFile.filePath)"
style="height: 100vh; width: 900px" style="height: 100vh; width: 900px"
@error="fileRrror = true" @error="fileRrror = true"
v-if="!fileRrror" v-if="!fileRrror"
@ -270,7 +270,8 @@ function remove(index) {
} }
function download() { function download() {
window.open(`${BASE_PATH}/file/stream/${activeFile.value.filePath}`); // window.open(`${BASE_PATH}/file/stream/${activeFile.value.filePath}`);
window.open(getFilepath(activeFile.value.filePath));
} }
function prev() { function prev() {
@ -347,6 +348,19 @@ function rotateRight() {
rotate.value -= 90; rotate.value -= 90;
} }
} }
const filePath = computed(() => {
// `${BASE_PATH}/file/stream/${activeFile.filePath}`
return getFilepath(activeFile.value.filePath)
})
function getFilepath(path) {
if (path.startsWith('http://')) {
return path;
} else {
return `${BASE_PATH}/file/stream/${path}`;
}
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.file-container { .file-container {

Loading…
Cancel
Save