feat: 客户端新窗口打开文件
This commit is contained in:
parent
f7fc379e56
commit
343c5eb587
@ -79,6 +79,20 @@ class FileController extends AbstractController
|
||||
return Base::retSuccess('success', $array);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单条数据
|
||||
* @return array
|
||||
*/
|
||||
public function one()
|
||||
{
|
||||
User::auth();
|
||||
//
|
||||
$id = intval(Request::input('id'));
|
||||
//
|
||||
$file = File::allowFind($id);
|
||||
return Base::retSuccess('success', $file);
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索文件列表
|
||||
*
|
||||
|
@ -15,8 +15,6 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import state from "../store/state";
|
||||
|
||||
export default {
|
||||
name: 'DrawerOverlay',
|
||||
props: {
|
||||
|
@ -82,16 +82,16 @@ export default {
|
||||
name: "FileContent",
|
||||
components: {TEditor, MDEditor, LuckySheet, Flow, OnlyOffice},
|
||||
props: {
|
||||
value: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
file: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
parentShow: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
@ -144,7 +144,7 @@ export default {
|
||||
|
||||
case 'file':
|
||||
if (data.action == 'content') {
|
||||
if (this.parentShow && data.id == this.fileId) {
|
||||
if (this.value && data.id == this.fileId) {
|
||||
$A.modalConfirm({
|
||||
title: "更新提示",
|
||||
content: '团队成员(' + info.nickname + ')更新了内容,<br/>更新时间:' + $A.formatDate("Y-m-d H:i:s", info.time) + '。<br/><br/>点击【确定】加载最新内容。',
|
||||
@ -160,7 +160,7 @@ export default {
|
||||
deep: true,
|
||||
},
|
||||
|
||||
parentShow: {
|
||||
value: {
|
||||
handler(val) {
|
||||
if (!val) {
|
||||
this.fileContent[this.fileId] = this.contentDetail;
|
||||
|
@ -199,7 +199,7 @@
|
||||
v-model="editShow"
|
||||
class="page-file-drawer"
|
||||
:mask-closable="false">
|
||||
<FileContent v-if="editNum > 0" :parent-show="editShow" :file="editInfo"/>
|
||||
<FileContent v-if="editNum > 0" v-model="editShow" :file="editInfo"/>
|
||||
</DrawerOverlay>
|
||||
|
||||
</div>
|
||||
@ -289,8 +289,8 @@ export default {
|
||||
shareInfo: {},
|
||||
shareLoad: 0,
|
||||
|
||||
editNum: 0, // 此参数是为了判断首次打开文件再加载文件组件
|
||||
editShow: false,
|
||||
editNum: 0,
|
||||
editInfo: {},
|
||||
|
||||
uploadDir: false,
|
||||
@ -644,11 +644,23 @@ export default {
|
||||
this.searchKey = '';
|
||||
this.pid = item.id;
|
||||
} else {
|
||||
this.editInfo = item;
|
||||
this.editShow = true;
|
||||
if (this.isElectron) {
|
||||
this.openSingle(item);
|
||||
} else {
|
||||
this.editInfo = item;
|
||||
this.editShow = true;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
openSingle(item) {
|
||||
let url = $A.originUrl("index.html/#/single/file/" + item.id + "?title=" + encodeURIComponent(item.name)),
|
||||
name = 'file-' + item.id,
|
||||
width = Math.min(window.screen.availWidth, 1280),
|
||||
height = Math.min(window.screen.availHeight, 800);
|
||||
window.open(url, name, 'height=' + height + ',innerHeight=' + height + ',width=' + width + ',innerWidth=' + width);
|
||||
},
|
||||
|
||||
clickRow(row) {
|
||||
this.dropFile(row, 'open');
|
||||
},
|
||||
|
68
resources/assets/js/pages/single/file.vue
Normal file
68
resources/assets/js/pages/single/file.vue
Normal file
@ -0,0 +1,68 @@
|
||||
<template>
|
||||
<div class="electron-file">
|
||||
<PageTitle :title="editInfo.name"/>
|
||||
<Loading v-if="loadIng > 0"/>
|
||||
<FileContent v-else v-model="editShow" :file="editInfo"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.electron-file {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
import FileContent from "../manage/components/FileContent";
|
||||
|
||||
export default {
|
||||
components: {FileContent},
|
||||
data() {
|
||||
return {
|
||||
loadIng: 0,
|
||||
|
||||
editShow: true,
|
||||
editInfo: {},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
//
|
||||
},
|
||||
watch: {
|
||||
'$route': {
|
||||
handler() {
|
||||
this.getInfo();
|
||||
},
|
||||
immediate: true
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
getInfo() {
|
||||
let id = $A.runNum(this.$route.params.id);
|
||||
if (id <= 0) {
|
||||
return;
|
||||
}
|
||||
this.loadIng++;
|
||||
this.$store.dispatch("call", {
|
||||
url: 'file/one',
|
||||
data: {
|
||||
id,
|
||||
},
|
||||
}).then(({data}) => {
|
||||
this.loadIng--;
|
||||
this.editInfo = data;
|
||||
}).catch(({msg}) => {
|
||||
this.loadIng--;
|
||||
$A.modalError({
|
||||
content: msg,
|
||||
onOk: () => {
|
||||
if (this.isElectron) {
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
5
resources/assets/js/routes.js
vendored
5
resources/assets/js/routes.js
vendored
@ -70,6 +70,11 @@ export default [
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'single-file',
|
||||
path: '/single/file/:id',
|
||||
component: () => import('./pages/single/file.vue'),
|
||||
},
|
||||
{
|
||||
name: 'login',
|
||||
path: '/login',
|
||||
|
Loading…
x
Reference in New Issue
Block a user