Skip to content

Commit

Permalink
修复预览图标不准确问题。
Browse files Browse the repository at this point in the history
  • Loading branch information
deatil committed Dec 23, 2023
1 parent c0f4072 commit 3feabbb
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 33 deletions.
72 changes: 51 additions & 21 deletions resources/assets/field.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* LakeFormMedia-field.js v1.0.17
* LakeFormMedia-field.js v1.0.18
*
* @create 2020-11-28
* @author deatil
Expand Down Expand Up @@ -988,14 +988,20 @@ $(function () {
html += '<i class="fa fa-file-video-o fa-fw lake-form-media-preview-fa"></i>';
} else if (type === 'audio') {
html += '<i class="fa fa-file-audio-o fa-fw lake-form-media-preview-fa"></i>';
} else if (type === 'pdf') {
html += '<i class="fa fa-file-pdf-o fa-fw lake-form-media-preview-fa"></i>';
} else if (type === 'word') {
html += '<i class="fa fa-file-word-o fa-fw lake-form-media-preview-fa"></i>';
} else if (type === 'ppt') {
html += '<i class="fa fa-file-powerpoint-o fa-fw lake-form-media-preview-fa"></i>';
} else if (type === 'xls') {
html += '<i class="fa fa-file-excel-o fa-fw lake-form-media-preview-fa"></i>';
} else if (type === 'text') {
html += '<i class="fa fa-file-text-o fa-fw lake-form-media-preview-fa"></i>';
} else if (type === 'code') {
html += '<i class="fa fa-file-code-o fa-fw lake-form-media-preview-fa"></i>';
} else if (type === 'zip') {
html += '<i class="fa fa-file-zip-o fa-fw lake-form-media-preview-fa"></i>';
} else if (type === 'text') {
html += '<i class="fa fa-file-text-o fa-fw lake-form-media-preview-fa"></i>';
} else {
html += '<i class="fa fa-file fa-fw lake-form-media-preview-fa"></i>';
}
Expand All @@ -1013,14 +1019,20 @@ $(function () {
html += '<i class="fa fa-file-video-o fa-fw lake-form-media-show-icon" title="' + type + '"></i>';
} else if (type === 'audio') {
html += '<i class="fa fa-file-audio-o fa-fw lake-form-media-show-icon" title="' + type + '"></i>';
} else if (type === 'pdf') {
html += '<i class="fa fa-file-pdf-o fa-fw lake-form-media-show-icon" title="' + type + '"></i>';
} else if (type === 'word') {
html += '<i class="fa fa-file-word-o fa-fw lake-form-media-show-icon" title="' + type + '"></i>';
} else if (type === 'ppt') {
html += '<i class="fa fa-file-powerpoint-o fa-fw lake-form-media-show-icon" title="' + type + '"></i>';
} else if (type === 'xls') {
html += '<i class="fa fa-file-excel-o fa-fw lake-form-media-show-icon" title="' + type + '"></i>';
} else if (type === 'text') {
html += '<i class="fa fa-file-text-o fa-fw lake-form-media-show-icon" title="' + type + '"></i>';
} else if (type === 'code') {
html += '<i class="fa fa-file-code-o fa-fw lake-form-media-show-icon" title="' + type + '"></i>';
} else if (type === 'zip') {
html += '<i class="fa fa-file-zip-o fa-fw lake-form-media-show-icon" title="' + type + '"></i>';
} else if (type === 'text') {
html += '<i class="fa fa-file-text-o fa-fw lake-form-media-show-icon" title="' + type + '"></i>';
} else {
html += '<i class="fa fa-file fa-fw lake-form-media-show-icon" title="' + type + '"></i>';
}
Expand All @@ -1038,51 +1050,69 @@ $(function () {
'tif', 'tiff', 'xbm', 'xpm', 'xwd', 'avif'
];

// 匹配视频
var video = [
'mkv', 'avi', 'mp4', 'rmvb', 'rm',
'flv', 'wmv', 'asf', 'mpeg', 'mov'
];

// 匹配音频
var audio = [
'mp3', 'wav', 'flac', '3pg', 'aa', 'aac', 'ape',
'au', 'm4a', 'mpc', 'ogg'
];

// 匹配视频
var video = [
'mkv', 'avi', 'mp4', 'rmvb', 'rm',
'flv', 'wmv', 'asf', 'mpeg', 'mov'
// 匹配 pdf
var pdf = [
'pdf'
];

// 匹配文稿
// 匹配 word
var word = [
'doc', 'dot', 'docx', 'dotx', 'docm', 'dotm', 'xls',
'xlt', 'xla', 'xlsx', 'xltx', 'xlsm', 'xltm', 'xlam',
'xlsb', 'pdf', 'ppt', 'pot', 'pps', 'ppa', 'pptx',
'potx', 'ppsx', 'ppam', 'pptm', 'potm', 'ppsm'
'doc', 'dot', 'docx', 'dotx', 'docm', 'dotm', 'wps'
];

// 匹配 ppt
var ppt = [
'ppt', 'pptx', 'pptm', 'pot', 'pps', 'ppa', 'pptx',
'potx', 'ppsx', 'ppam', 'potm', 'ppsm'
];

// 匹配 ppt
var xls = [
'xls', 'xlt', 'xla', 'xlsx', 'xltx', 'xlsm',
'xltm', 'xlam', 'xlsb'
];

// 匹配文本
var text = [
'txt', 'pac', 'log', 'md'
];

// 匹配代码
var code = [
'html', 'htm', 'js', 'css', 'vue', 'json',
'php', 'java', 'go', 'py', 'ruby', 'rb',
'aspx', 'asp', 'c', 'cpp', 'sql', 'm', 'h',
'python', 'ruby', 'rs', 'zig', 'v'
];

// 匹配压缩包
var zip = [
'zip', 'tar', 'gz', 'rar', 'rpm'
];

// 匹配文本
var text = [
'txt', 'pac', 'log', 'md'
];

var list = {
'image': image,
'audio': audio,
'video': video,
'audio': audio,
'pdf': pdf,
'word': word,
'ppt': ppt,
'xls': xls,
'text': text,
'code': code,
'zip': zip,
'text': text,
}

for (var key in list) {
Expand Down
18 changes: 9 additions & 9 deletions src/MediaManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,16 @@ class MediaManager
* @var array
*/
protected $fileTypes = [
'image' => 'png|jpg|jpeg|ico|gif|bmp|svg|wbmp|avif',
'xls' => 'xls|xlt|xla|xlsx|xltx|xlsm|xltm|xlam|xlsb',
'word' => 'doc|docx|dot|dotx|docm|dotm',
'ppt' => 'ppt|pptx|pptm',
'image' => 'jpeg|jpg|bmp|png|svg|wbmp|pic|cgm|djv|djvu|gif|ico|ief|jp2|jpe|mac|pbm|pct|pgm|pict|pnm|pnt|pntg|ppm|qti|qtif|ras|rgb|tif|tiff|xbm|xpm|xwd|avif',
'video' => 'mkv|avi|mp4|rmvb|rm|flv|wmv|asf|mpeg|mov',
'audio' => 'mp3|wav|flac|3pg|aa|aac|ape|au|m4a|mpc|ogg',
'pdf' => 'pdf',
'code' => 'php|js|java|python|ruby|go|c|cpp|sql|m|h|json|html|aspx',
'zip' => 'zip|tar\.gz|rar|rpm',
'word' => 'doc|docx|dot|dotx|docm|dotm|wps',
'ppt' => 'ppt|pptx|pptm|pot|pps|ppa|pptx|potx|ppsx|ppam|potm|ppsm',
'xls' => 'xls|xlt|xla|xlsx|xltx|xlsm|xltm|xlam|xlsb',
'text' => 'txt|pac|log|md',
'audio' => 'mp3|wav|flac|3pg|aa|aac|ape|au|m4a|mpc|ogg',
'video' => 'mkv|rmvb|flv|mp4|avi|wmv|rm|asf|mpeg',
'code' => 'html|htm|js|css|vue|json|php|java|go|py|ruby|rb|aspx|asp|c|cpp|sql|m|h|python|ruby|rs|zig|v',
'zip' => 'zip|tar|gz|tar\.gz|rar|rpm',
];

/**
Expand Down Expand Up @@ -479,7 +479,7 @@ public function getFilePreview($file)
break;

case 'audio':
$preview = '<span class="file-icon"><i class="fa fa-file-video-o"></i></span>';
$preview = '<span class="file-icon"><i class="fa fa-file-audio-o"></i></span>';
break;

case 'pdf':
Expand Down
6 changes: 3 additions & 3 deletions version.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<?php

return [
'1.0.31' => [
'增加保存全路径。',
],
'1.0.32' => [
'修复弹出选择框标题显示问题。',
],
Expand All @@ -16,4 +13,7 @@
'1.0.36' => [
'添加更多翻译。',
],
'1.0.37' => [
'修复预览图标不准确问题。',
],
];

0 comments on commit 3feabbb

Please sign in to comment.