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

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) { } else if (this.$isEEUiApp) {
$A.eeuiAppOpenPage({ $A.eeuiAppOpenPage({
pageType: 'web', pageType: 'app',
pageTitle: `${this.msgData.msg.name} (${$A.bytesToSize(this.msgData.msg.size)})`, pageTitle: `${this.msgData.msg.name} (${$A.bytesToSize(this.msgData.msg.size)})`,
statusBarStyle: false, url: 'web.js',
params: {
titleFixed: true,
url: $A.apiUrl(`../token?token=${this.userToken}&from=${encodeURIComponent($A.apiUrl(`..${uri}`))}`) url: $A.apiUrl(`../token?token=${this.userToken}&from=${encodeURIComponent($A.apiUrl(`..${uri}`))}`)
},
}); });
} else { } else {
window.open($A.apiUrl(`..${uri}`)) window.open($A.apiUrl(`..${uri}`))

View File

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

View File

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

View File

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

View File

@ -995,7 +995,7 @@ export default {
} }
} }
// //
if (this.$Electron) { if (this.$Electron || this.$isEEUiApp) {
this.openFileSingle(item); this.openFileSingle(item);
return; return;
} }
@ -1005,9 +1005,11 @@ export default {
}, },
openFileSingle(item) { openFileSingle(item) {
const uri = `/single/file/${item.id}`;
if (this.$Electron) {
this.$Electron.sendMessage('windowRouter', { this.$Electron.sendMessage('windowRouter', {
name: `file-${item.id}`, name: `file-${item.id}`,
path: `/single/file/${item.id}`, path: uri,
userAgent: "/hideenOfficeTitle/", userAgent: "/hideenOfficeTitle/",
force: false, // force: false, //
config: { config: {
@ -1021,6 +1023,19 @@ export default {
nodeIntegrationInSubFrames: item.type === 'drawio' 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); this.browseFile(0);
}, },

View File

@ -3,7 +3,7 @@
<PageTitle :title="pageName"/> <PageTitle :title="pageName"/>
<Loading v-if="loadIng > 0"/> <Loading v-if="loadIng > 0"/>
<template v-else-if="fileInfo"> <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"/> <FileContent v-else v-model="fileShow" :file="fileInfo"/>
</template> </template>
</div> </div>