perf: 优化office组件
This commit is contained in:
parent
d1bca43678
commit
3ccec0d7bd
@ -7,6 +7,7 @@
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
import api from "@/api/file-api"
|
import api from "@/api/file-api"
|
||||||
|
import fileConfig from "@/utils/file-config";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "OnlyOfficeEditor",
|
name: "OnlyOfficeEditor",
|
||||||
@ -104,12 +105,18 @@ export default {
|
|||||||
}
|
}
|
||||||
let fileKey = `${new Date(this.value.updateDate).getTime()}-${this.value.id}`
|
let fileKey = `${new Date(this.value.updateDate).getTime()}-${this.value.id}`
|
||||||
let fileName = $J.strExists(this.fileName, '.') ? this.fileName : (this.fileName + '.' + this.fileType)
|
let fileName = $J.strExists(this.fileName, '.') ? this.fileName : (this.fileName + '.' + this.fileType)
|
||||||
|
|
||||||
|
let url = window.location.origin + fileConfig.previewUrl(this.$store.state.user.name, this.value, this.$store.getters.token)
|
||||||
|
if(this.readOnly){
|
||||||
|
url = window.location.origin + fileConfig.publicPreviewUrl(this.value.id, window.shareId);
|
||||||
|
}
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
"document": {
|
"document": {
|
||||||
"fileType": this.fileType,
|
"fileType": this.fileType,
|
||||||
"key": fileKey,
|
"key": fileKey,
|
||||||
"title": fileName,
|
"title": fileName,
|
||||||
"url": `${window.location.origin}${this.baseUrl}/file/${this.$store.state.user.name}/${encodeURI(this.value.path)}/${encodeURI(this.value.name)}?jmal-token=${this.$store.getters.token}`,
|
"url": url,
|
||||||
},
|
},
|
||||||
"editorConfig": {
|
"editorConfig": {
|
||||||
"mode": "edit",
|
"mode": "edit",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user