移动客户端文件使用新窗口打开

This commit is contained in:
kuaifan 2022-06-11 23:48:43 +08:00
parent 0150b41e17
commit 76e66ab433
6 changed files with 56 additions and 28 deletions

View File

@ -426,10 +426,13 @@ export default {
});
} else if (this.$isEEUiApp) {
$A.eeuiAppOpenPage({
pageType: 'web',
pageType: 'app',
pageTitle: `${this.msgData.msg.name} (${$A.bytesToSize(this.msgData.msg.size)})`,
statusBarStyle: false,
url: $A.apiUrl(`../token?token=${this.userToken}&from=${encodeURIComponent($A.apiUrl(`..${uri}`))}`)
url: 'web.js',
params: {
titleFixed: true,
url: $A.apiUrl(`../token?token=${this.userToken}&from=${encodeURIComponent($A.apiUrl(`..${uri}`))}`)
},
});
} else {
window.open($A.apiUrl(`..${uri}`))

View File

@ -200,10 +200,13 @@ export default {
});
} else if (this.$isEEUiApp) {
$A.eeuiAppOpenPage({
pageType: 'web',
pageType: 'app',
pageTitle: $A.getFileName(this.file) + ` [${row.created_at}]`,
statusBarStyle: false,
url: $A.apiUrl(`../token?token=${this.userToken}&from=${encodeURIComponent($A.apiUrl(`..${uri}`))}`)
url: 'web.js',
params: {
titleFixed: true,
url: $A.apiUrl(`../token?token=${this.userToken}&from=${encodeURIComponent($A.apiUrl(`..${uri}`))}`)
},
});
} else {
window.open($A.apiUrl(`..${uri}`))

View File

@ -2,7 +2,7 @@
<div class="file-preview">
<IFrame v-if="isPreview" class="preview-iframe" :src="previewUrl" @on-message="onMessage"/>
<template v-else>
<div v-show="!['word', 'excel', 'ppt'].includes(file.type)" class="edit-header">
<div v-show="headerShow && !['word', 'excel', 'ppt'].includes(file.type)" class="edit-header">
<div class="header-title">
<div class="title-name">{{$A.getFileName(file)}}</div>
<Tag color="default">{{$L('只读')}}</Tag>
@ -68,6 +68,10 @@ export default {
return {};
}
},
headerShow: {
type: Boolean,
default: true
},
},
data() {

View File

@ -1303,10 +1303,13 @@ export default {
});
} else if (this.$isEEUiApp) {
$A.eeuiAppOpenPage({
pageType: 'web',
pageType: 'app',
pageTitle: `${file.name} (${$A.bytesToSize(file.size)})`,
statusBarStyle: false,
url: $A.apiUrl(`../token?token=${this.userToken}&from=${encodeURIComponent($A.apiUrl(`..${uri}`))}`)
url: 'web.js',
params: {
titleFixed: true,
url: $A.apiUrl(`../token?token=${this.userToken}&from=${encodeURIComponent($A.apiUrl(`..${uri}`))}`)
},
});
} else {
window.open($A.apiUrl(`..${uri}`))

View File

@ -995,7 +995,7 @@ export default {
}
}
//
if (this.$Electron) {
if (this.$Electron || this.$isEEUiApp) {
this.openFileSingle(item);
return;
}
@ -1005,22 +1005,37 @@ export default {
},
openFileSingle(item) {
this.$Electron.sendMessage('windowRouter', {
name: `file-${item.id}`,
path: `/single/file/${item.id}`,
userAgent: "/hideenOfficeTitle/",
force: false, //
config: {
title: $A.getFileName(item),
titleFixed: true,
parent: null,
width: Math.min(window.screen.availWidth, 1440),
height: Math.min(window.screen.availHeight, 900),
},
webPreferences: {
nodeIntegrationInSubFrames: item.type === 'drawio'
},
});
const uri = `/single/file/${item.id}`;
if (this.$Electron) {
this.$Electron.sendMessage('windowRouter', {
name: `file-${item.id}`,
path: uri,
userAgent: "/hideenOfficeTitle/",
force: false, //
config: {
title: $A.getFileName(item),
titleFixed: true,
parent: null,
width: Math.min(window.screen.availWidth, 1440),
height: Math.min(window.screen.availHeight, 900),
},
webPreferences: {
nodeIntegrationInSubFrames: item.type === 'drawio'
},
});
} else if (this.$isEEUiApp) {
$A.eeuiAppOpenPage({
pageType: 'app',
pageTitle: $A.getFileName(item),
url: 'web.js',
params: {
titleFixed: true,
url: $A.apiUrl(`../token?token=${this.userToken}&from=${encodeURIComponent($A.apiUrl(`..${uri}`))}`)
},
});
} else {
window.open($A.apiUrl(`..${uri}`))
}
this.browseFile(0);
},

View File

@ -3,7 +3,7 @@
<PageTitle :title="pageName"/>
<Loading v-if="loadIng > 0"/>
<template v-else-if="fileInfo">
<FilePreview v-if="isPreview" :code="code" :file="fileInfo" :historyId="historyId"/>
<FilePreview v-if="isPreview" :code="code" :file="fileInfo" :historyId="historyId" :headerShow="!$isEEUiApp"/>
<FileContent v-else v-model="fileShow" :file="fileInfo"/>
</template>
</div>