diff --git a/src/api/upload.ts b/src/api/upload.ts
index 8f31fab6..f0320c88 100644
--- a/src/api/upload.ts
+++ b/src/api/upload.ts
@@ -1,4 +1,5 @@
import request from '@/utils/request';
+import { AxiosRequestConfig } from 'axios';
class UploadAPI {
/** 分类查询接口*/
@@ -58,11 +59,15 @@ class UploadAPI {
});
}
// 附件上传
- static uploadAttachment(data: any) {
+ static uploadAttachment(data: any, progress: any) {
return request({
url: `diyapi/attachmentupload`,
method: 'post',
data,
+ headers: {
+ 'Content-Type': 'multipart/form-data',
+ },
+ onUploadProgress: progress,
});
}
}
diff --git a/src/components/common/upload/index.vue b/src/components/common/upload/index.vue
index b35a7de4..1898da15 100644
--- a/src/components/common/upload/index.vue
+++ b/src/components/common/upload/index.vue
@@ -49,7 +49,7 @@
删除{{ upload_type_name }}
@@ -248,7 +248,8 @@ watch(
() => dialog_visible.value,
(val) => {
if (val) {
- type_data.value = upload_store.category;
+ type_data_list.value = upload_store.category;
+ type_data.value = [all_tree, ...upload_store.category];
get_attachment_list();
}
}
@@ -257,14 +258,14 @@ watch(
// 文件后缀分类
const ext_img_name_list = ref(['.png', '.jpg', '.jpeg', '.bmp', '.webp', '.gif']);
const ext_video_name_list = ref(['.flv', '.swf', '.mkv', '.avi', '.rm', '.rmvb', '.mpeg', '.mpg', '.ogg', '.ogv', '.mov', '.wmv', '.mp4', '.webm']);
-const ext_file_name_list = ref(['.png', 'jpg', 'jpeg', 'bmp', 'webp', 'gif', '.flv', '.swf', '.mkv', '.avi', '.rm', '.rmvb', '.mpeg', '.mpg', '.ogg', '.ogv', '.mov', '.wmv', '.mp4', '.webm', '.mp3', '.csv', '.wav', '.mid', '.cab', '.iso', '.ofd', '.xml', '.rar', '.zip', '.tar', '.gz', '.7z', '.bz2', '.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx', '.pdf', '.txt', '.md', '.vsd']);
+const ext_file_name_list = ref(['.png', '.jpg', '.jpeg', '.bmp', '.webp', '.gif', '.flv', '.swf', '.mkv', '.avi', '.rm', '.rmvb', '.mpeg', '.mpg', '.ogg', '.ogv', '.mov', '.wmv', '.mp4', '.webm', '.mp3', '.csv', '.wav', '.mid', '.cab', '.iso', '.ofd', '.xml', '.rar', '.zip', '.tar', '.gz', '.7z', '.bz2', '.doc', '.docx', '.xls', '.xlsx', '.ppt', '.pptx', '.pdf', '.txt', '.md', '.vsd','.sql']);
const ext_file_name_list_map = ref([
{ type: '.png', icon: 'error-img' },
- { type: 'jpg', icon: 'error-img' },
- { type: 'jpeg', icon: 'error-img' },
- { type: 'bmp', icon: 'error-img' },
- { type: 'webp', icon: 'error-img' },
- { type: 'gif', icon: 'error-img' },
+ { type: '.jpg', icon: 'error-img' },
+ { type: '.jpeg', icon: 'error-img' },
+ { type: '.bmp', icon: 'error-img' },
+ { type: '.webp', icon: 'error-img' },
+ { type: '.gif', icon: 'error-img' },
{ type: '.flv', icon: 'video' },
{ type: '.swf', icon: 'video' },
{ type: '.mkv', icon: 'video' },
@@ -287,6 +288,7 @@ const ext_file_name_list_map = ref([
{ type: '.iso', icon: 'file' },
{ type: '.ofd', icon: 'file' },
{ type: '.xml', icon: 'file' },
+ { type: '.sql', icon: 'file' },
{ type: '.rar', icon: 'zip' },
{ type: '.zip', icon: 'zip' },
{ type: '.tar', icon: 'zip' },
@@ -341,21 +343,22 @@ const filter_node = (value: string, data: any): boolean => {
return data.name.indexOf(value) !== -1;
};
const type_data = ref
([]);
+const all_tree = {
+ id: '',
+ pid: '',
+ name: '全部',
+ path: '',
+ is_enable: 1,
+ sort: '',
+};
+const type_data_list = ref([]);
// 查询分类列表
const get_tree = () => {
UploadAPI.getTree().then((res) => {
- const all_tree = {
- id: '',
- pid: '',
- name: '全部',
- path: '',
- is_enable: 1,
- sort: '',
- };
// 将all_tree和res.data.category_list全部插入到type_data.value,all_tree放在数组最前面
type_data.value = [all_tree, ...res.data.category_list];
-
- upload_store.set_category(type_data.value);
+ type_data_list.value = res.data.category_list;
+ upload_store.set_category(type_data_list.value);
});
};
diff --git a/src/components/common/upload/upload-model copy 2.vue b/src/components/common/upload/upload-model copy 2.vue
new file mode 100644
index 00000000..81a647e7
--- /dev/null
+++ b/src/components/common/upload/upload-model copy 2.vue
@@ -0,0 +1,570 @@
+
+
+
+
+
+
{{ upload_type_name }}上传
+
+
+
+
+
+
+ 本地上传
+ 扫码上传
+ 网络上传
+
+
+
+
+
+
+
+
+
+
+
+
+ 上传{{ upload_type_name }}
+ 上传文件夹
+
+
+
+
清空列表
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ item.file.name }}
+
+
{{ annex_size_to_unit(item.file.size) }}
+
{{ item.status }}
+
移除
+
+
+
+
+
+
+
+
请将需要上传的文件/文件夹拖到此处或粘贴
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ item.name }}
+
+
{{ annex_size_to_unit(item.size) }}
+
删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/common/upload/upload-model copy 3.vue b/src/components/common/upload/upload-model copy 3.vue
new file mode 100644
index 00000000..1a5fe344
--- /dev/null
+++ b/src/components/common/upload/upload-model copy 3.vue
@@ -0,0 +1,583 @@
+
+
+
+
+
+
{{ upload_type_name }}上传
+
+
+
+
+
+
+ 本地上传
+ 扫码上传
+ 网络上传
+
+
+
+
+
+
+
+
+
+
+
+
+ 上传{{ upload_type_name }}
+ 上传文件夹
+
+
+
+
清空列表
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ item.file.name }}
+
+
{{ annex_size_to_unit(item.file.size) }}
+
{{ item.status }}
+
移除
+
+
+
+
+
+
+
+
请将需要上传的文件/文件夹拖到此处或粘贴
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ item.name }}
+
+
{{ annex_size_to_unit(item.size) }}
+
删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/common/upload/upload-model copy.vue b/src/components/common/upload/upload-model copy.vue
new file mode 100644
index 00000000..83e49d74
--- /dev/null
+++ b/src/components/common/upload/upload-model copy.vue
@@ -0,0 +1,588 @@
+
+
+
+
+
+
{{ upload_type_name }}上传
+
+
+
+
+
+
+ 本地上传
+ 扫码上传
+ 网络上传
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 上传{{ upload_type_name }}
+ 上传文件夹
+
+
+
+
清空列表
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ item.file.name }}
+
+
{{ annex_size_to_unit(item.file.size) }}
+
{{ item.status }}
+
移除
+
+
+
+
+
+
+
+
请将需要上传的文件/文件夹拖到此处或粘贴
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ item.name }}
+
+
{{ annex_size_to_unit(item.size) }}
+
删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/common/upload/upload-model.vue b/src/components/common/upload/upload-model.vue
index 720df317..7e1a563e 100644
--- a/src/components/common/upload/upload-model.vue
+++ b/src/components/common/upload/upload-model.vue
@@ -7,7 +7,8 @@