no message

This commit is contained in:
aipaw 2021-07-10 23:08:00 +08:00
parent 80369a338d
commit 8f48d61cde
6 changed files with 22 additions and 24 deletions

View File

@ -269,22 +269,8 @@ class FileController extends AbstractController
//
$file = File::allowFind($id);
//
switch ($file->type) {
case "word":
return Response::download(resource_path('assets/statics/empty/empty.docx'));
case "excel":
return Response::download(resource_path('assets/statics/empty/empty.xlsx'));
case "ppt":
return Response::download(resource_path('assets/statics/empty/empty.pptx'));
default:
$content = FileContent::whereFid($file->id)->orderByDesc('id')->first();
return Base::retSuccess('success', [
'content' => FileContent::formatContent($file->type, $content ? $content->content : [])
]);
}
$content = FileContent::whereFid($file->id)->orderByDesc('id')->first();
return FileContent::formatContent($file->type, $content ? $content->content : []);
}
/**
@ -303,10 +289,6 @@ class FileController extends AbstractController
//
$file = File::allowFind($id);
//
if (in_array($file->type, ['word', 'excel', 'ppt'])) {
return Base::retError($file->type . ' 不支持此方式保存');
}
//
$text = '';
if ($file->type == 'document') {
$data = Base::json2array($content);

View File

@ -5,6 +5,7 @@ namespace App\Models;
use App\Module\Base;
use Illuminate\Database\Eloquent\SoftDeletes;
use Response;
/**
* Class FileContent
@ -44,11 +45,17 @@ class FileContent extends AbstractModel
* 获取格式内容
* @param $type
* @param $content
* @return array|array[]|mixed|string[]
* @return array|\Symfony\Component\HttpFoundation\BinaryFileResponse
*/
public static function formatContent($type, $content)
{
$content = Base::json2array($content);
if (in_array($type, ['word', 'excel', 'ppt'])) {
if (empty($content)) {
return Response::download(resource_path('assets/statics/empty/empty.' . str_replace(['word', 'excel', 'ppt'], ['docx', 'xlsx', 'pptx'], $type)));
}
return Response::download(public_path($content['url']));
}
if (empty($content)) {
switch ($type) {
case 'document':
@ -72,6 +79,6 @@ class FileContent extends AbstractModel
break;
}
}
return $content;
return Base::retSuccess('success', [ 'content' => $content ]);
}
}

View File

@ -109,6 +109,7 @@ export default {
const config = {
"document": {
"fileType": this.fileType,
"key": this.fileType + '-' + this.value.id,
"title": this.fileName + '.' + this.fileType,
"url": this.fileUrl,
},

View File

@ -1,6 +1,6 @@
<template>
<div class="file-content">
<div class="edit-header">
<div v-show="!['word', 'excel', 'ppt'].includes(file.type)" class="edit-header">
<div class="header-title">
<EPopover v-if="!equalContent" v-model="unsaveTip" class="file-unsave-tip">
<div class="task-detail-delete-file-popover">

View File

@ -133,7 +133,8 @@
placement="bottom"
:height="editHeight"
:mask-closable="false"
:mask-style="{backgroundColor:'rgba(0,0,0,0.7)'}">
:mask-style="{backgroundColor:'rgba(0,0,0,0.7)'}"
class-name="page-file-drawer">
<FileContent v-if="editShowNum > 0" :parent-show="editShow" :file="editInfo"/>
</Drawer>
</div>

View File

@ -465,3 +465,10 @@
}
}
}
.page-file-drawer {
.ivu-drawer-content {
border-radius: 20px 20px 0 0 !important;
}
}