mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 19:35:50 +00:00
perf: 对webp文件的支持
This commit is contained in:
parent
433a46bba9
commit
8ffac1376a
@ -607,7 +607,7 @@ class FileController extends AbstractController
|
|||||||
if ($file->type == 'document') {
|
if ($file->type == 'document') {
|
||||||
$data = Base::json2array($content);
|
$data = Base::json2array($content);
|
||||||
$isRep = false;
|
$isRep = false;
|
||||||
preg_match_all("/<img\s+src=\"data:image\/(png|jpg|jpeg);base64,(.*?)\"/s", $data['content'], $matchs);
|
preg_match_all("/<img\s+src=\"data:image\/(png|jpg|jpeg|webp);base64,(.*?)\"/s", $data['content'], $matchs);
|
||||||
foreach ($matchs[2] as $key => $text) {
|
foreach ($matchs[2] as $key => $text) {
|
||||||
$tmpPath = "uploads/file/document/" . date("Ym") . "/" . $id . "/attached/";
|
$tmpPath = "uploads/file/document/" . date("Ym") . "/" . $id . "/attached/";
|
||||||
Base::makeDir(public_path($tmpPath));
|
Base::makeDir(public_path($tmpPath));
|
||||||
@ -811,7 +811,7 @@ class FileController extends AbstractController
|
|||||||
'xls', 'xlsx' => "excel",
|
'xls', 'xlsx' => "excel",
|
||||||
'ppt', 'pptx' => "ppt",
|
'ppt', 'pptx' => "ppt",
|
||||||
'wps' => "wps",
|
'wps' => "wps",
|
||||||
'jpg', 'jpeg', 'png', 'gif', 'bmp', 'ico', 'raw', 'svg' => "picture",
|
'jpg', 'jpeg', 'webp', 'png', 'gif', 'bmp', 'ico', 'raw', 'svg' => "picture",
|
||||||
'rar', 'zip', 'jar', '7-zip', 'tar', 'gzip', '7z', 'gz', 'apk', 'dmg' => "archive",
|
'rar', 'zip', 'jar', '7-zip', 'tar', 'gzip', '7z', 'gz', 'apk', 'dmg' => "archive",
|
||||||
'tif', 'tiff' => "tif",
|
'tif', 'tiff' => "tif",
|
||||||
'dwg', 'dxf' => "cad",
|
'dwg', 'dxf' => "cad",
|
||||||
|
|||||||
@ -783,7 +783,7 @@ class SystemController extends AbstractController
|
|||||||
];
|
];
|
||||||
//
|
//
|
||||||
$extension = pathinfo($dirPath . $filename, PATHINFO_EXTENSION);
|
$extension = pathinfo($dirPath . $filename, PATHINFO_EXTENSION);
|
||||||
if (in_array($extension, array('gif', 'jpg', 'jpeg', 'png', 'bmp'))) {
|
if (in_array($extension, array('gif', 'jpg', 'jpeg', 'webp', 'png', 'bmp'))) {
|
||||||
if (file_exists($dirPath . $filename . '_thumb.jpg')) {
|
if (file_exists($dirPath . $filename . '_thumb.jpg')) {
|
||||||
$array['thumb'] .= '_thumb.jpg';
|
$array['thumb'] .= '_thumb.jpg';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,6 @@ namespace App\Ldap;
|
|||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use App\Module\Base;
|
use App\Module\Base;
|
||||||
use App\Module\ImgCompress;
|
|
||||||
use LdapRecord\Configuration\ConfigurationException;
|
use LdapRecord\Configuration\ConfigurationException;
|
||||||
use LdapRecord\Container;
|
use LdapRecord\Container;
|
||||||
use LdapRecord\LdapRecordException;
|
use LdapRecord\LdapRecordException;
|
||||||
|
|||||||
@ -81,14 +81,14 @@ class File extends AbstractModel
|
|||||||
* 图片文件
|
* 图片文件
|
||||||
*/
|
*/
|
||||||
const imageExt = [
|
const imageExt = [
|
||||||
'jpg', 'jpeg', 'png', 'gif', 'bmp'
|
'jpg', 'jpeg', 'webp', 'png', 'gif', 'bmp'
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 本地媒体文件
|
* 本地媒体文件
|
||||||
*/
|
*/
|
||||||
const localExt = [
|
const localExt = [
|
||||||
'jpg', 'jpeg', 'png', 'gif', 'bmp', 'ico', 'raw',
|
'jpg', 'jpeg', 'webp', 'png', 'gif', 'bmp', 'ico', 'raw',
|
||||||
'tif', 'tiff',
|
'tif', 'tiff',
|
||||||
'mp3', 'wav', 'mp4', 'flv',
|
'mp3', 'wav', 'mp4', 'flv',
|
||||||
'avi', 'mov', 'wmv', 'mkv', '3gp', 'rm',
|
'avi', 'mov', 'wmv', 'mkv', '3gp', 'rm',
|
||||||
|
|||||||
@ -61,7 +61,7 @@ class ProjectTaskContent extends AbstractModel
|
|||||||
{
|
{
|
||||||
$path = 'uploads/task/content/' . date("Ym") . '/' . $task_id . '/';
|
$path = 'uploads/task/content/' . date("Ym") . '/' . $task_id . '/';
|
||||||
//
|
//
|
||||||
preg_match_all("/<img\s+src=\"data:image\/(png|jpg|jpeg);base64,(.*?)\"/s", $content, $matchs);
|
preg_match_all("/<img\s+src=\"data:image\/(png|jpg|jpeg|webp);base64,(.*?)\"/s", $content, $matchs);
|
||||||
foreach ($matchs[2] as $key => $text) {
|
foreach ($matchs[2] as $key => $text) {
|
||||||
$tmpPath = $path . 'attached/';
|
$tmpPath = $path . 'attached/';
|
||||||
Base::makeDir(public_path($tmpPath));
|
Base::makeDir(public_path($tmpPath));
|
||||||
|
|||||||
@ -94,7 +94,7 @@ class ProjectTaskFile extends AbstractModel
|
|||||||
if (!isset($this->appendattrs['width'])) {
|
if (!isset($this->appendattrs['width'])) {
|
||||||
$width = -1;
|
$width = -1;
|
||||||
$height = -1;
|
$height = -1;
|
||||||
if (in_array($this->ext, ['jpg', 'jpeg', 'gif', 'png'])) {
|
if (in_array($this->ext, ['jpg', 'jpeg', 'webp', 'gif', 'png'])) {
|
||||||
$path = public_path($this->getRawOriginal('path'));
|
$path = public_path($this->getRawOriginal('path'));
|
||||||
[$width, $height] = Cache::remember("File::size-" . md5($path), now()->addDays(7), function () use ($path) {
|
[$width, $height] = Cache::remember("File::size-" . md5($path), now()->addDays(7), function () use ($path) {
|
||||||
$width = -1;
|
$width = -1;
|
||||||
|
|||||||
@ -2,9 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use App\Module\ImgCompress;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use App\Models\User;
|
|
||||||
use App\Module\Base;
|
use App\Module\Base;
|
||||||
use App\Tasks\PushTask;
|
use App\Tasks\PushTask;
|
||||||
use App\Exceptions\ApiException;
|
use App\Exceptions\ApiException;
|
||||||
@ -127,7 +125,7 @@ class WebSocketDialogMsg extends AbstractModel
|
|||||||
}
|
}
|
||||||
$value = Base::json2array($value);
|
$value = Base::json2array($value);
|
||||||
if ($this->type === 'file') {
|
if ($this->type === 'file') {
|
||||||
$value['type'] = in_array($value['ext'], ['jpg', 'jpeg', 'png', 'gif']) ? 'img' : 'file';
|
$value['type'] = in_array($value['ext'], ['jpg', 'jpeg', 'webp', 'png', 'gif']) ? 'img' : 'file';
|
||||||
$value['path'] = Base::fillUrl($value['path']);
|
$value['path'] = Base::fillUrl($value['path']);
|
||||||
$value['thumb'] = Base::fillUrl($value['thumb'] ?: Base::extIcon($value['ext']));
|
$value['thumb'] = Base::fillUrl($value['thumb'] ?: Base::extIcon($value['ext']));
|
||||||
} else if ($this->type === 'record') {
|
} else if ($this->type === 'record') {
|
||||||
@ -582,7 +580,7 @@ class WebSocketDialogMsg extends AbstractModel
|
|||||||
// 基础处理
|
// 基础处理
|
||||||
$text = preg_replace("/<(\/[a-zA-Z]+)\s*>/s", "<$1>", $text);
|
$text = preg_replace("/<(\/[a-zA-Z]+)\s*>/s", "<$1>", $text);
|
||||||
// 图片 [:IMAGE:className:width:height:src:alt:]
|
// 图片 [:IMAGE:className:width:height:src:alt:]
|
||||||
preg_match_all("/<img\s+src=\"data:image\/(png|jpg|jpeg|gif);base64,(.*?)\"(.*?)>(<\/img>)*/s", $text, $matchs);
|
preg_match_all("/<img\s+src=\"data:image\/(png|jpg|jpeg|webp|gif);base64,(.*?)\"(.*?)>(<\/img>)*/s", $text, $matchs);
|
||||||
foreach ($matchs[2] as $key => $base64) {
|
foreach ($matchs[2] as $key => $base64) {
|
||||||
$imagePath = "uploads/chat/" . date("Ym") . "/" . $dialog_id . "/";
|
$imagePath = "uploads/chat/" . date("Ym") . "/" . $dialog_id . "/";
|
||||||
Base::makeDir(public_path($imagePath));
|
Base::makeDir(public_path($imagePath));
|
||||||
@ -618,7 +616,7 @@ class WebSocketDialogMsg extends AbstractModel
|
|||||||
$imageSize = getimagesize(public_path($imagePath));
|
$imageSize = getimagesize(public_path($imagePath));
|
||||||
// 添加后缀
|
// 添加后缀
|
||||||
if ($imageSize && !str_contains($imagePath, '.')) {
|
if ($imageSize && !str_contains($imagePath, '.')) {
|
||||||
preg_match("/^image\/(png|jpg|jpeg|gif)$/", $imageSize['mime'], $matchMine);
|
preg_match("/^image\/(png|jpg|jpeg|webp|gif)$/", $imageSize['mime'], $matchMine);
|
||||||
if ($matchMine) {
|
if ($matchMine) {
|
||||||
$imageNewPath = $imagePath . "." . $matchMine[1];
|
$imageNewPath = $imagePath . "." . $matchMine[1];
|
||||||
if (rename(public_path($imagePath), public_path($imageNewPath))) {
|
if (rename(public_path($imagePath), public_path($imageNewPath))) {
|
||||||
@ -642,7 +640,7 @@ class WebSocketDialogMsg extends AbstractModel
|
|||||||
}
|
}
|
||||||
// 其他网络图片
|
// 其他网络图片
|
||||||
$imageSaveLocal = Base::settingFind("system", "image_save_local");
|
$imageSaveLocal = Base::settingFind("system", "image_save_local");
|
||||||
preg_match_all("/<img[^>]*?src=([\"'])(.*?\.(png|jpg|jpeg|gif))\\1[^>]*?>/is", $text, $matchs);
|
preg_match_all("/<img[^>]*?src=([\"'])(.*?\.(png|jpg|jpeg|webp|gif))\\1[^>]*?>/is", $text, $matchs);
|
||||||
foreach ($matchs[2] as $key => $str) {
|
foreach ($matchs[2] as $key => $str) {
|
||||||
if ($imageSaveLocal === 'close') {
|
if ($imageSaveLocal === 'close') {
|
||||||
$imageSize = getimagesize($str);
|
$imageSize = getimagesize($str);
|
||||||
@ -801,7 +799,7 @@ class WebSocketDialogMsg extends AbstractModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif ($type === 'file') {
|
} elseif ($type === 'file') {
|
||||||
if (in_array($msg['ext'], ['jpg', 'jpeg', 'png', 'gif'])) {
|
if (in_array($msg['ext'], ['jpg', 'jpeg', 'webp', 'png', 'gif'])) {
|
||||||
$mtype = 'image';
|
$mtype = 'image';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2085,7 +2085,7 @@ class Base
|
|||||||
$imgBase64 = $param['image64'];
|
$imgBase64 = $param['image64'];
|
||||||
if (preg_match('/^(data:\s*image\/(\w+);base64,)/', $imgBase64, $res)) {
|
if (preg_match('/^(data:\s*image\/(\w+);base64,)/', $imgBase64, $res)) {
|
||||||
$extension = $res[2];
|
$extension = $res[2];
|
||||||
if (!in_array($extension, ['png', 'jpg', 'jpeg', 'gif'])) {
|
if (!in_array($extension, ['png', 'jpg', 'jpeg', 'webp', 'gif'])) {
|
||||||
return Base::retError('图片格式错误');
|
return Base::retError('图片格式错误');
|
||||||
}
|
}
|
||||||
$scaleName = "";
|
$scaleName = "";
|
||||||
@ -2197,11 +2197,8 @@ class Base
|
|||||||
case 'png':
|
case 'png':
|
||||||
$type = ['png'];
|
$type = ['png'];
|
||||||
break;
|
break;
|
||||||
case 'png+jpg':
|
|
||||||
$type = ['jpg', 'jpeg', 'png'];
|
|
||||||
break;
|
|
||||||
case 'image':
|
case 'image':
|
||||||
$type = ['jpg', 'jpeg', 'gif', 'png'];
|
$type = ['jpg', 'jpeg', 'webp', 'gif', 'png'];
|
||||||
break;
|
break;
|
||||||
case 'video':
|
case 'video':
|
||||||
$type = ['rm', 'rmvb', 'wmv', 'avi', 'mpg', 'mpeg', 'mp4'];
|
$type = ['rm', 'rmvb', 'wmv', 'avi', 'mpg', 'mpeg', 'mp4'];
|
||||||
@ -2219,7 +2216,7 @@ class Base
|
|||||||
$type = ['zip'];
|
$type = ['zip'];
|
||||||
break;
|
break;
|
||||||
case 'file':
|
case 'file':
|
||||||
$type = ['jpg', 'jpeg', 'png', 'gif', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'esp', 'pdf', 'rar', 'zip', 'gz', 'ai', 'avi', 'bmp', 'cdr', 'eps', 'mov', 'mp3', 'mp4', 'pr', 'psd', 'svg', 'tif'];
|
$type = ['jpg', 'jpeg', 'webp', 'png', 'gif', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'esp', 'pdf', 'rar', 'zip', 'gz', 'ai', 'avi', 'bmp', 'cdr', 'eps', 'mov', 'mp3', 'mp4', 'pr', 'psd', 'svg', 'tif'];
|
||||||
break;
|
break;
|
||||||
case 'firmware':
|
case 'firmware':
|
||||||
$type = ['img', 'tar', 'bin'];
|
$type = ['img', 'tar', 'bin'];
|
||||||
@ -2306,7 +2303,7 @@ class Base
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
if (in_array($extension, ['jpg', 'jpeg', 'gif', 'png'])) {
|
if (in_array($extension, ['jpg', 'jpeg', 'webp', 'gif', 'png'])) {
|
||||||
//图片尺寸
|
//图片尺寸
|
||||||
$paramet = getimagesize($array['file']);
|
$paramet = getimagesize($array['file']);
|
||||||
$array['width'] = $paramet[0];
|
$array['width'] = $paramet[0];
|
||||||
@ -2417,7 +2414,7 @@ class Base
|
|||||||
$dst_img = $src_img;
|
$dst_img = $src_img;
|
||||||
}
|
}
|
||||||
$st = pathinfo($src_img, PATHINFO_EXTENSION);
|
$st = pathinfo($src_img, PATHINFO_EXTENSION);
|
||||||
if (!in_array(strtolower($st), array('jpg', 'jpeg', 'png', 'gif', 'bmp'))) {
|
if (!in_array(strtolower($st), array('jpg', 'jpeg', 'webp', 'png', 'gif', 'bmp'))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$ot = pathinfo($dst_img, PATHINFO_EXTENSION);
|
$ot = pathinfo($dst_img, PATHINFO_EXTENSION);
|
||||||
|
|||||||
@ -34,7 +34,9 @@ class ImgCompress
|
|||||||
*/
|
*/
|
||||||
public function compressImg($saveName = '')
|
public function compressImg($saveName = '')
|
||||||
{
|
{
|
||||||
$this->_openImage();
|
if (!$this->_openImage()) { //打开图片
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!empty($saveName)) $this->_saveImage($saveName); //保存
|
if (!empty($saveName)) $this->_saveImage($saveName); //保存
|
||||||
else $this->_showImage();
|
else $this->_showImage();
|
||||||
}
|
}
|
||||||
@ -52,8 +54,12 @@ class ImgCompress
|
|||||||
'attr' => $attr
|
'attr' => $attr
|
||||||
);
|
);
|
||||||
$fun = "imagecreatefrom" . $this->imageinfo['type'];
|
$fun = "imagecreatefrom" . $this->imageinfo['type'];
|
||||||
|
if (!function_exists($fun)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$this->image = $fun($this->src);
|
$this->image = $fun($this->src);
|
||||||
$this->_thumpImage();
|
$this->_thumpImage();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -90,7 +96,7 @@ class ImgCompress
|
|||||||
if (str_contains($dstImgName, '.')) {
|
if (str_contains($dstImgName, '.')) {
|
||||||
$dstName = $dstImgName;
|
$dstName = $dstImgName;
|
||||||
} else {
|
} else {
|
||||||
$allowImgs = ['.jpg', '.jpeg', '.png', '.bmp', '.wbmp', '.gif']; //如果目标图片名有后缀就用目标图片扩展名 后缀,如果没有,则用源图的扩展名
|
$allowImgs = ['.jpg', '.jpeg', '.webp', '.png', '.bmp', '.wbmp', '.gif']; //如果目标图片名有后缀就用目标图片扩展名 后缀,如果没有,则用源图的扩展名
|
||||||
$dstExt = strrchr($dstImgName, ".");
|
$dstExt = strrchr($dstImgName, ".");
|
||||||
$sourseExt = strrchr($this->src, ".");
|
$sourseExt = strrchr($this->src, ".");
|
||||||
if (!empty($dstExt)) $dstExt = strtolower($dstExt);
|
if (!empty($dstExt)) $dstExt = strtolower($dstExt);
|
||||||
@ -105,6 +111,9 @@ class ImgCompress
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$funcs = "image" . $this->imageinfo['type'];
|
$funcs = "image" . $this->imageinfo['type'];
|
||||||
|
if (!function_exists($funcs)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$funcs($this->image, $dstName);
|
$funcs($this->image, $dstName);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -114,7 +123,9 @@ class ImgCompress
|
|||||||
*/
|
*/
|
||||||
public function __destruct()
|
public function __destruct()
|
||||||
{
|
{
|
||||||
imagedestroy($this->image);
|
if ($this->image) {
|
||||||
|
imagedestroy($this->image);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -132,7 +143,7 @@ class ImgCompress
|
|||||||
if (!file_exists($src)) {
|
if (!file_exists($src)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$allowImgs = ['.jpg', '.jpeg', '.png', '.bmp', '.wbmp'];
|
$allowImgs = ['.jpg', '.jpeg', '.webp', '.png', '.bmp', '.wbmp'];
|
||||||
if (!in_array(strrchr($src, "."), $allowImgs)) {
|
if (!in_array(strrchr($src, "."), $allowImgs)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -179,7 +179,7 @@ export default {
|
|||||||
"tar|zip|7z|rar|gz|arj|z"
|
"tar|zip|7z|rar|gz|arj|z"
|
||||||
],
|
],
|
||||||
"images": [
|
"images": [
|
||||||
"icon|jpg|jpeg|png|bmp|gif|tif|emf"
|
"icon|jpg|jpeg|webp|png|bmp|gif|tif|emf"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|||||||
@ -30,7 +30,7 @@
|
|||||||
:data="uploadParams"
|
:data="uploadParams"
|
||||||
:show-upload-list="false"
|
:show-upload-list="false"
|
||||||
:max-size="maxSize"
|
:max-size="maxSize"
|
||||||
:format="['jpg', 'jpeg', 'gif', 'png']"
|
:format="['jpg', 'jpeg', 'webp', 'gif', 'png']"
|
||||||
:default-file-list="defaultList"
|
:default-file-list="defaultList"
|
||||||
:on-progress="handleProgress"
|
:on-progress="handleProgress"
|
||||||
:on-success="handleSuccess"
|
:on-success="handleSuccess"
|
||||||
@ -259,7 +259,7 @@
|
|||||||
//上传类型错误
|
//上传类型错误
|
||||||
$A.noticeWarning({
|
$A.noticeWarning({
|
||||||
title: this.$L('文件格式不正确'),
|
title: this.$L('文件格式不正确'),
|
||||||
desc: this.$L('文件 ' + file.name + ' 格式不正确,请上传 jpg、jpeg、gif、png 格式的图片。')
|
desc: this.$L('文件 ' + file.name + ' 格式不正确,请上传 jpg、jpeg、webp、gif、png 格式的图片。')
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleMaxSize (file) {
|
handleMaxSize (file) {
|
||||||
|
|||||||
@ -157,7 +157,7 @@
|
|||||||
htmlValue: '',
|
htmlValue: '',
|
||||||
|
|
||||||
uploadIng: 0,
|
uploadIng: 0,
|
||||||
uploadFormat: ['jpg', 'jpeg', 'png', 'gif', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'esp', 'pdf', 'rar', 'zip', 'gz', 'ai', 'avi', 'bmp', 'cdr', 'eps', 'mov', 'mp3', 'mp4', 'pr', 'psd', 'svg', 'tif'],
|
uploadFormat: ['jpg', 'jpeg', 'webp', 'png', 'gif', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'esp', 'pdf', 'rar', 'zip', 'gz', 'ai', 'avi', 'bmp', 'cdr', 'eps', 'mov', 'mp3', 'mp4', 'pr', 'psd', 'svg', 'tif'],
|
||||||
actionUrl: $A.apiUrl('system/fileupload'),
|
actionUrl: $A.apiUrl('system/fileupload'),
|
||||||
maxSize: 1024000
|
maxSize: 1024000
|
||||||
};
|
};
|
||||||
|
|||||||
@ -146,7 +146,7 @@
|
|||||||
transfer: false,
|
transfer: false,
|
||||||
|
|
||||||
uploadIng: 0,
|
uploadIng: 0,
|
||||||
uploadFormat: ['jpg', 'jpeg', 'png', 'gif', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'esp', 'pdf', 'rar', 'zip', 'gz', 'ai', 'avi', 'bmp', 'cdr', 'eps', 'mov', 'mp3', 'mp4', 'pr', 'psd', 'svg', 'tif'],
|
uploadFormat: ['jpg', 'jpeg', 'webp', 'png', 'gif', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'esp', 'pdf', 'rar', 'zip', 'gz', 'ai', 'avi', 'bmp', 'cdr', 'eps', 'mov', 'mp3', 'mp4', 'pr', 'psd', 'svg', 'tif'],
|
||||||
actionUrl: $A.apiUrl('system/fileupload'),
|
actionUrl: $A.apiUrl('system/fileupload'),
|
||||||
maxSize: 10240
|
maxSize: 10240
|
||||||
};
|
};
|
||||||
|
|||||||
@ -2383,7 +2383,7 @@ export default {
|
|||||||
data = this.operateItem
|
data = this.operateItem
|
||||||
}
|
}
|
||||||
const {msg} = data;
|
const {msg} = data;
|
||||||
if (['jpg', 'jpeg', 'gif', 'png'].includes(msg.ext)) {
|
if (['jpg', 'jpeg', 'webp', 'gif', 'png'].includes(msg.ext)) {
|
||||||
this.onViewPicture(msg.path);
|
this.onViewPicture(msg.path);
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -2424,7 +2424,7 @@ export default {
|
|||||||
onViewPicture(currentUrl) {
|
onViewPicture(currentUrl) {
|
||||||
const data = this.allMsgs.filter(item => {
|
const data = this.allMsgs.filter(item => {
|
||||||
if (item.type === 'file') {
|
if (item.type === 'file') {
|
||||||
return ['jpg', 'jpeg', 'gif', 'png'].includes(item.msg.ext);
|
return ['jpg', 'jpeg', 'webp', 'gif', 'png'].includes(item.msg.ext);
|
||||||
} else if (item.type === 'text') {
|
} else if (item.type === 'text') {
|
||||||
return item.msg.text.match(/<img\s+class="browse"[^>]*?>/);
|
return item.msg.text.match(/<img\s+class="browse"[^>]*?>/);
|
||||||
}
|
}
|
||||||
@ -2529,12 +2529,12 @@ export default {
|
|||||||
this.$store.dispatch("call", {
|
this.$store.dispatch("call", {
|
||||||
url: 'dialog/msg/emoji',
|
url: 'dialog/msg/emoji',
|
||||||
data,
|
data,
|
||||||
}).then(({data}) => {
|
}).then(({data: resData}) => {
|
||||||
const index = this.dialogMsgs.findIndex(item => item.id == data.id)
|
const index = this.dialogMsgs.findIndex(item => item.id == resData.id)
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
this.$store.dispatch("saveDialogMsg", data);
|
this.$store.dispatch("saveDialogMsg", resData);
|
||||||
} else if (this.todoViewData.id === data.id) {
|
} else if (this.todoViewData.id === resData.id) {
|
||||||
this.todoViewData = Object.assign(this.todoViewData, data)
|
this.todoViewData = Object.assign(this.todoViewData, resData)
|
||||||
}
|
}
|
||||||
}).catch(({msg}) => {
|
}).catch(({msg}) => {
|
||||||
$A.messageError(msg);
|
$A.messageError(msg);
|
||||||
@ -2758,6 +2758,8 @@ export default {
|
|||||||
let format = "png";
|
let format = "png";
|
||||||
if ($A.rightExists(url, "jpg") || $A.rightExists(url, "jpeg")) {
|
if ($A.rightExists(url, "jpg") || $A.rightExists(url, "jpeg")) {
|
||||||
format = "jpeg"
|
format = "jpeg"
|
||||||
|
} else if ($A.rightExists(url, "webp")) {
|
||||||
|
format = "webp"
|
||||||
} else if ($A.rightExists(url, "git")) {
|
} else if ($A.rightExists(url, "git")) {
|
||||||
format = "git"
|
format = "git"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1450,8 +1450,8 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
viewFile(file) {
|
viewFile(file) {
|
||||||
if (['jpg', 'jpeg', 'gif', 'png'].includes(file.ext)) {
|
if (['jpg', 'jpeg', 'webp', 'gif', 'png'].includes(file.ext)) {
|
||||||
const list = this.fileList.filter(item => ['jpg', 'jpeg', 'gif', 'png'].includes(item.ext))
|
const list = this.fileList.filter(item => ['jpg', 'jpeg', 'webp', 'gif', 'png'].includes(item.ext))
|
||||||
const index = list.findIndex(item => item.id === file.id);
|
const index = list.findIndex(item => item.id === file.id);
|
||||||
if (index > -1) {
|
if (index > -1) {
|
||||||
this.$store.dispatch("previewImage", {
|
this.$store.dispatch("previewImage", {
|
||||||
|
|||||||
@ -25,7 +25,7 @@ export default {
|
|||||||
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
uploadFormat: ['jpg', 'jpeg', 'png', 'gif', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'esp', 'pdf', 'rar', 'zip', 'gz', 'ai', 'avi', 'bmp', 'cdr', 'eps', 'mov', 'mp3', 'mp4', 'pr', 'psd', 'svg', 'tif'],
|
uploadFormat: ['jpg', 'jpeg', 'webp', 'png', 'gif', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'esp', 'pdf', 'rar', 'zip', 'gz', 'ai', 'avi', 'bmp', 'cdr', 'eps', 'mov', 'mp3', 'mp4', 'pr', 'psd', 'svg', 'tif'],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user