perf: 该文件版本已经改变了。该页面将被重新加载
This commit is contained in:
parent
bc3932c8b8
commit
96580e2284
@ -9,6 +9,7 @@ use App\Models\WebSocketDialog;
|
|||||||
use App\Models\WebSocketDialogMsg;
|
use App\Models\WebSocketDialogMsg;
|
||||||
use App\Models\WebSocketDialogMsgRead;
|
use App\Models\WebSocketDialogMsgRead;
|
||||||
use App\Module\Base;
|
use App\Module\Base;
|
||||||
|
use Carbon\Carbon;
|
||||||
use Request;
|
use Request;
|
||||||
use Response;
|
use Response;
|
||||||
|
|
||||||
@ -349,6 +350,9 @@ class DialogController extends AbstractController
|
|||||||
* @apiName msg__detail
|
* @apiName msg__detail
|
||||||
*
|
*
|
||||||
* @apiParam {Number} msg_id 消息ID
|
* @apiParam {Number} msg_id 消息ID
|
||||||
|
* @apiParam {String} only_update_at 仅获取update_at字段
|
||||||
|
* - no (默认)
|
||||||
|
* - yes
|
||||||
*
|
*
|
||||||
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
||||||
* @apiSuccess {String} msg 返回信息(错误描述)
|
* @apiSuccess {String} msg 返回信息(错误描述)
|
||||||
@ -359,11 +363,20 @@ class DialogController extends AbstractController
|
|||||||
User::auth();
|
User::auth();
|
||||||
//
|
//
|
||||||
$msg_id = intval(Request::input('msg_id'));
|
$msg_id = intval(Request::input('msg_id'));
|
||||||
|
$only_update_at = Request::input('only_update_at', 'no');
|
||||||
//
|
//
|
||||||
$dialogMsg = WebSocketDialogMsg::whereId($msg_id)->first();
|
$dialogMsg = WebSocketDialogMsg::whereId($msg_id)->first();
|
||||||
if (empty($dialogMsg)) {
|
if (empty($dialogMsg)) {
|
||||||
return Base::retError("文件不存在");
|
return Base::retError("文件不存在");
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
if ($only_update_at == 'yes') {
|
||||||
|
return Base::retSuccess('success', [
|
||||||
|
'id' => $dialogMsg->id,
|
||||||
|
'update_at' => Carbon::parse($dialogMsg->updated_at)->toDateTimeString()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
//
|
||||||
$data = $dialogMsg->toArray();
|
$data = $dialogMsg->toArray();
|
||||||
//
|
//
|
||||||
if ($data['type'] == 'file') {
|
if ($data['type'] == 'file') {
|
||||||
|
@ -9,12 +9,11 @@ use App\Models\FileContent;
|
|||||||
use App\Models\FileLink;
|
use App\Models\FileLink;
|
||||||
use App\Models\FileUser;
|
use App\Models\FileUser;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Models\WebSocketDialogMsg;
|
|
||||||
use App\Module\Base;
|
use App\Module\Base;
|
||||||
use App\Module\Ihttp;
|
use App\Module\Ihttp;
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Request;
|
use Request;
|
||||||
use Response;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @apiDefine file
|
* @apiDefine file
|
||||||
@ -383,6 +382,9 @@ class FileController extends AbstractController
|
|||||||
* @apiParam {Number|String} id
|
* @apiParam {Number|String} id
|
||||||
* - Number: 文件ID(需要登录)
|
* - Number: 文件ID(需要登录)
|
||||||
* - String: 链接码(不需要登录,用于预览)
|
* - String: 链接码(不需要登录,用于预览)
|
||||||
|
* @apiParam {String} only_update_at 仅获取update_at字段
|
||||||
|
* - no (默认)
|
||||||
|
* - yes
|
||||||
* @apiParam {String} down 直接下载
|
* @apiParam {String} down 直接下载
|
||||||
* - no: 浏览(默认)
|
* - no: 浏览(默认)
|
||||||
* - yes: 下载(office文件直接下载)
|
* - yes: 下载(office文件直接下载)
|
||||||
@ -395,6 +397,7 @@ class FileController extends AbstractController
|
|||||||
{
|
{
|
||||||
$id = Request::input('id');
|
$id = Request::input('id');
|
||||||
$down = Request::input('down', 'no');
|
$down = Request::input('down', 'no');
|
||||||
|
$only_update_at = Request::input('only_update_at', 'no');
|
||||||
//
|
//
|
||||||
if (Base::isNumber($id)) {
|
if (Base::isNumber($id)) {
|
||||||
User::auth();
|
User::auth();
|
||||||
@ -409,6 +412,13 @@ class FileController extends AbstractController
|
|||||||
return Base::retError('参数错误');
|
return Base::retError('参数错误');
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
if ($only_update_at == 'yes') {
|
||||||
|
return Base::retSuccess('success', [
|
||||||
|
'id' => $file->id,
|
||||||
|
'update_at' => Carbon::parse($file->updated_at)->toDateTimeString()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
//
|
||||||
$content = FileContent::whereFid($file->id)->orderByDesc('id')->first();
|
$content = FileContent::whereFid($file->id)->orderByDesc('id')->first();
|
||||||
return FileContent::formatContent($file, $content?->content, $down == 'yes');
|
return FileContent::formatContent($file, $content?->content, $down == 'yes');
|
||||||
}
|
}
|
||||||
|
@ -1100,6 +1100,9 @@ class ProjectController extends AbstractController
|
|||||||
* @apiName task__filedetail
|
* @apiName task__filedetail
|
||||||
*
|
*
|
||||||
* @apiParam {Number} file_id 文件ID
|
* @apiParam {Number} file_id 文件ID
|
||||||
|
* @apiParam {String} only_update_at 仅获取update_at字段
|
||||||
|
* - no (默认)
|
||||||
|
* - yes
|
||||||
*
|
*
|
||||||
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
||||||
* @apiSuccess {String} msg 返回信息(错误描述)
|
* @apiSuccess {String} msg 返回信息(错误描述)
|
||||||
@ -1110,11 +1113,20 @@ class ProjectController extends AbstractController
|
|||||||
User::auth();
|
User::auth();
|
||||||
//
|
//
|
||||||
$file_id = intval(Request::input('file_id'));
|
$file_id = intval(Request::input('file_id'));
|
||||||
|
$only_update_at = Request::input('only_update_at', 'no');
|
||||||
//
|
//
|
||||||
$file = ProjectTaskFile::find($file_id);
|
$file = ProjectTaskFile::find($file_id);
|
||||||
if (empty($file)) {
|
if (empty($file)) {
|
||||||
return Base::retError("文件不存在");
|
return Base::retError("文件不存在");
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
if ($only_update_at == 'yes') {
|
||||||
|
return Base::retSuccess('success', [
|
||||||
|
'id' => $file->id,
|
||||||
|
'update_at' => Carbon::parse($file->updated_at)->toDateTimeString()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
//
|
||||||
$data = $file->toArray();
|
$data = $file->toArray();
|
||||||
$data['path'] = $file->getRawOriginal('path');
|
$data['path'] = $file->getRawOriginal('path');
|
||||||
//
|
//
|
||||||
|
@ -60,6 +60,7 @@ export default {
|
|||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
|
documentKey: Function
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
@ -91,10 +92,6 @@ export default {
|
|||||||
fileName() {
|
fileName() {
|
||||||
return this.value.name;
|
return this.value.name;
|
||||||
},
|
},
|
||||||
|
|
||||||
fileUpdatedAt() {
|
|
||||||
return this.value.updated_at ? $A.Date(this.value.updated_at, true) : '';
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
@ -108,8 +105,17 @@ export default {
|
|||||||
this.loadIng--;
|
this.loadIng--;
|
||||||
if (e !== null) {
|
if (e !== null) {
|
||||||
$A.modalAlert("组件加载失败!");
|
$A.modalAlert("组件加载失败!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!this.documentKey) {
|
||||||
|
this.handleClose();
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const documentKey = this.documentKey();
|
||||||
|
if (documentKey && documentKey.then) {
|
||||||
|
documentKey.then(this.loadFile);
|
||||||
} else {
|
} else {
|
||||||
this.loadFile()
|
this.loadFile();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -130,7 +136,7 @@ export default {
|
|||||||
return type;
|
return type;
|
||||||
},
|
},
|
||||||
|
|
||||||
loadFile() {
|
loadFile(keyAppend = '') {
|
||||||
if (this.docEditor !== null) {
|
if (this.docEditor !== null) {
|
||||||
this.docEditor.destroyEditor();
|
this.docEditor.destroyEditor();
|
||||||
this.docEditor = null;
|
this.docEditor = null;
|
||||||
@ -152,7 +158,7 @@ export default {
|
|||||||
const config = {
|
const config = {
|
||||||
"document": {
|
"document": {
|
||||||
"fileType": this.fileType,
|
"fileType": this.fileType,
|
||||||
"key": `${this.fileType}-${fileKey}-${this.fileUpdatedAt}`,
|
"key": `${this.fileType}-${fileKey}-${keyAppend}`,
|
||||||
"title": fileName,
|
"title": fileName,
|
||||||
"url": `http://nginx/api/file/content/?id=${fileKey}&token=${this.userToken}`,
|
"url": `http://nginx/api/file/content/?id=${fileKey}&token=${this.userToken}`,
|
||||||
},
|
},
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<Flow v-else-if="file.type=='flow'" ref="myFlow" v-model="contentDetail" @saveData="handleClick('saveBefore')"/>
|
<Flow v-else-if="file.type=='flow'" ref="myFlow" v-model="contentDetail" @saveData="handleClick('saveBefore')"/>
|
||||||
<Minder v-else-if="file.type=='mind'" ref="myMind" v-model="contentDetail" @saveData="handleClick('saveBefore')"/>
|
<Minder v-else-if="file.type=='mind'" ref="myMind" v-model="contentDetail" @saveData="handleClick('saveBefore')"/>
|
||||||
<OnlyOffice v-else-if="['word', 'excel', 'ppt'].includes(file.type)" v-model="contentDetail"/>
|
<OnlyOffice v-else-if="['word', 'excel', 'ppt'].includes(file.type)" v-model="contentDetail" :documentKey="documentKey"/>
|
||||||
<AceEditor v-else-if="['code', 'txt'].includes(file.type)" v-model="contentDetail.content" :ext="file.ext" @saveData="handleClick('saveBefore')"/>
|
<AceEditor v-else-if="['code', 'txt'].includes(file.type)" v-model="contentDetail.content" :ext="file.ext" @saveData="handleClick('saveBefore')"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -330,6 +330,22 @@ export default {
|
|||||||
this.unsaveTip = false;
|
this.unsaveTip = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
documentKey() {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
this.$store.dispatch("call", {
|
||||||
|
url: 'file/content',
|
||||||
|
data: {
|
||||||
|
id: this.fileId,
|
||||||
|
only_update_at: 'yes'
|
||||||
|
},
|
||||||
|
}).then(({data}) => {
|
||||||
|
resolve($A.Date(data.update_at, true))
|
||||||
|
}).catch(() => {
|
||||||
|
resolve(0)
|
||||||
|
});
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
formatName(file) {
|
formatName(file) {
|
||||||
let {name, ext} = file;
|
let {name, ext} = file;
|
||||||
if (ext != '') {
|
if (ext != '') {
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
</template>
|
</template>
|
||||||
<Flow v-else-if="file.type=='flow'" ref="myFlow" v-model="contentDetail" readOnly/>
|
<Flow v-else-if="file.type=='flow'" ref="myFlow" v-model="contentDetail" readOnly/>
|
||||||
<Minder v-else-if="file.type=='mind'" ref="myMind" v-model="contentDetail" readOnly/>
|
<Minder v-else-if="file.type=='mind'" ref="myMind" v-model="contentDetail" readOnly/>
|
||||||
<OnlyOffice v-else-if="['word', 'excel', 'ppt'].includes(file.type)" v-model="contentDetail" :code="code" readOnly/>
|
<OnlyOffice v-else-if="['word', 'excel', 'ppt'].includes(file.type)" v-model="contentDetail" :code="code" :documentKey="documentKey" readOnly/>
|
||||||
<AceEditor v-else-if="['code', 'txt'].includes(file.type)" v-model="contentDetail.content" :ext="file.ext" readOnly/>
|
<AceEditor v-else-if="['code', 'txt'].includes(file.type)" v-model="contentDetail.content" :ext="file.ext" readOnly/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -144,6 +144,22 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
documentKey() {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
this.$store.dispatch("call", {
|
||||||
|
url: 'file/content',
|
||||||
|
data: {
|
||||||
|
id: this.code || this.file.id,
|
||||||
|
only_update_at: 'yes'
|
||||||
|
},
|
||||||
|
}).then(({data}) => {
|
||||||
|
resolve($A.Date(data.update_at, true))
|
||||||
|
}).catch(() => {
|
||||||
|
resolve(0)
|
||||||
|
});
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
exportMenu(act) {
|
exportMenu(act) {
|
||||||
switch (this.file.type) {
|
switch (this.file.type) {
|
||||||
case 'mind':
|
case 'mind':
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<Loading v-if="loadIng > 0"/>
|
<Loading v-if="loadIng > 0"/>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<AceEditor v-if="isCode" v-model="codeContent" :ext="codeExt" class="view-editor" readOnly/>
|
<AceEditor v-if="isCode" v-model="codeContent" :ext="codeExt" class="view-editor" readOnly/>
|
||||||
<OnlyOffice v-else-if="isOffice" v-model="officeContent" :code="officeCode" readOnly/>
|
<OnlyOffice v-else-if="isOffice" v-model="officeContent" :code="officeCode" :documentKey="documentKey" readOnly/>
|
||||||
<iframe v-else-if="isPreview" class="preview-iframe" :src="previewUrl"/>
|
<iframe v-else-if="isPreview" class="preview-iframe" :src="previewUrl"/>
|
||||||
<div v-else class="no-support">{{$L('不支持单独查看此消息')}}</div>
|
<div v-else class="no-support">{{$L('不支持单独查看此消息')}}</div>
|
||||||
</template>
|
</template>
|
||||||
@ -68,6 +68,10 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
msgId() {
|
||||||
|
return $A.runNum(this.$route.params.id);
|
||||||
|
},
|
||||||
|
|
||||||
title() {
|
title() {
|
||||||
const {msg} = this.msgDetail;
|
const {msg} = this.msgDetail;
|
||||||
if (msg && msg.name) {
|
if (msg && msg.name) {
|
||||||
@ -99,7 +103,6 @@ export default {
|
|||||||
return {
|
return {
|
||||||
id: this.isOffice ? this.msgDetail.id : 0,
|
id: this.isOffice ? this.msgDetail.id : 0,
|
||||||
type: this.msgDetail.msg.ext,
|
type: this.msgDetail.msg.ext,
|
||||||
updated_at: this.msgDetail.created_at,
|
|
||||||
name: this.title,
|
name: this.title,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -122,15 +125,14 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getInfo() {
|
getInfo() {
|
||||||
let msg_id = $A.runNum(this.$route.params.id);
|
if (this.msgId <= 0) {
|
||||||
if (msg_id <= 0) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.loadIng++;
|
this.loadIng++;
|
||||||
this.$store.dispatch("call", {
|
this.$store.dispatch("call", {
|
||||||
url: 'dialog/msg/detail',
|
url: 'dialog/msg/detail',
|
||||||
data: {
|
data: {
|
||||||
msg_id,
|
msg_id: this.msgId,
|
||||||
},
|
},
|
||||||
}).then(({data}) => {
|
}).then(({data}) => {
|
||||||
this.loadIng--;
|
this.loadIng--;
|
||||||
@ -146,6 +148,21 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
documentKey() {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
this.$store.dispatch("call", {
|
||||||
|
url: 'dialog/msg/detail',
|
||||||
|
data: {
|
||||||
|
msg_id: this.msgId,
|
||||||
|
only_update_at: 'yes'
|
||||||
|
},
|
||||||
|
}).then(({data}) => {
|
||||||
|
resolve($A.Date(data.update_at, true))
|
||||||
|
}).catch(() => {
|
||||||
|
resolve(0)
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<Loading v-if="loadIng > 0"/>
|
<Loading v-if="loadIng > 0"/>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<AceEditor v-if="isCode" v-model="codeContent" :ext="codeExt" class="view-editor" readOnly/>
|
<AceEditor v-if="isCode" v-model="codeContent" :ext="codeExt" class="view-editor" readOnly/>
|
||||||
<OnlyOffice v-else-if="isOffice" v-model="officeContent" :code="officeCode" readOnly/>
|
<OnlyOffice v-else-if="isOffice" v-model="officeContent" :code="officeCode" :documentKey="documentKey" readOnly/>
|
||||||
<iframe v-else-if="isPreview" class="preview-iframe" :src="previewUrl"/>
|
<iframe v-else-if="isPreview" class="preview-iframe" :src="previewUrl"/>
|
||||||
<div v-else class="no-support">{{$L('不支持单独查看此消息')}}</div>
|
<div v-else class="no-support">{{$L('不支持单独查看此消息')}}</div>
|
||||||
</template>
|
</template>
|
||||||
@ -68,6 +68,10 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
fileId() {
|
||||||
|
return $A.runNum(this.$route.params.id);
|
||||||
|
},
|
||||||
|
|
||||||
title() {
|
title() {
|
||||||
const {name} = this.fileDetail;
|
const {name} = this.fileDetail;
|
||||||
if (name) {
|
if (name) {
|
||||||
@ -99,8 +103,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
id: this.isOffice ? this.fileDetail.id : 0,
|
id: this.isOffice ? this.fileDetail.id : 0,
|
||||||
type: this.fileDetail.ext,
|
type: this.fileDetail.ext,
|
||||||
updated_at: this.fileDetail.created_at,
|
name: this.title,
|
||||||
name: this.title
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
officeCode() {
|
officeCode() {
|
||||||
@ -122,15 +125,14 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getInfo() {
|
getInfo() {
|
||||||
let file_id = $A.runNum(this.$route.params.id);
|
if (this.fileId <= 0) {
|
||||||
if (file_id <= 0) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.loadIng++;
|
this.loadIng++;
|
||||||
this.$store.dispatch("call", {
|
this.$store.dispatch("call", {
|
||||||
url: 'project/task/filedetail',
|
url: 'project/task/filedetail',
|
||||||
data: {
|
data: {
|
||||||
file_id,
|
file_id: this.fileId,
|
||||||
},
|
},
|
||||||
}).then(({data}) => {
|
}).then(({data}) => {
|
||||||
this.loadIng--;
|
this.loadIng--;
|
||||||
@ -146,6 +148,21 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
documentKey() {
|
||||||
|
return new Promise(resolve => {
|
||||||
|
this.$store.dispatch("call", {
|
||||||
|
url: 'project/task/filedetail',
|
||||||
|
data: {
|
||||||
|
file_id: this.fileId,
|
||||||
|
only_update_at: 'yes'
|
||||||
|
},
|
||||||
|
}).then(({data}) => {
|
||||||
|
resolve($A.Date(data.update_at, true))
|
||||||
|
}).catch(() => {
|
||||||
|
resolve(0)
|
||||||
|
});
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user