diff --git a/src/components/AllTypeFile/update.vue b/src/components/AllTypeFile/update.vue
index 20c4916..ac21a14 100644
--- a/src/components/AllTypeFile/update.vue
+++ b/src/components/AllTypeFile/update.vue
@@ -22,7 +22,7 @@
{{ getFileName(scope.row.fileName) }}
-
+
@@ -35,10 +35,10 @@
- 下载
- 通过
- 不通过
- 删除
+ 下载
+ 通过
+ 不通过
+ 删除
@@ -190,6 +190,41 @@ export default {
return name;
}
},
+ previewFile(file) {
+ debugger
+ const fileType = this.getFileType(file.name);
+ switch (fileType) {
+ case 'image':
+ this.$router.push(`${this.baseUrl}/${file.url}`);
+ break;
+ case 'pdf':
+ this.$router.push(`/preview/pdf/${file.url}`);
+ break;
+ case 'excel':
+ this.$router.push(`/preview/excel/${file.url}`);
+ break;
+ case 'word':
+ this.$router.push(`/preview/word/${file.url}`);
+ break;
+ default:
+ // 默认处理
+ break;
+ }
+ },
+ getFileType(fileName) {
+ const extension = fileName.split('.').pop().toLowerCase();
+ if (['jpg', 'jpeg', 'png', 'gif'].includes(extension)) {
+ return 'image';
+ } else if (['pdf'].includes(extension)) {
+ return 'pdf';
+ } else if (['xlsx', 'xls'].includes(extension)) {
+ return 'excel';
+ } else if (['doc', 'docx'].includes(extension)) {
+ return 'word';
+ } else {
+ return 'unknown';
+ }
+ },
// 对象转成指定字符串分隔
listToString(list, separator) {
let strs = "";