meixioacomponent 2.0.41 → 2.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,131 @@
1
+ import {computed, ref} from "vue";
2
+ import {MessagePlugin} from "tdesign-vue";
3
+ import componentConfig from "../../config/componentConfig";
4
+ import useUpload from "../../config/use/UseUpload";
5
+
6
+ const useHookByUpload = (key, options = {
7
+ props: {
8
+ max: {}
9
+ },
10
+ uploadEd: () => {
11
+ },
12
+
13
+ }) => {
14
+
15
+
16
+ const dynamicmount = ref();
17
+ const uploadLoading = ref(false);
18
+ const _module = ref([]);
19
+
20
+ let uploadPath = null;
21
+ const callBackIsLaunch = ref(false);
22
+
23
+
24
+ const setUploadPath = (value) => {
25
+ uploadPath = value;
26
+ }
27
+
28
+
29
+ const isMax = computed(() => {
30
+ return _module.value.length >= options.props.max
31
+ })
32
+
33
+
34
+ const inputChange = (list) => {
35
+ callBackIsLaunch.value = false;
36
+ for (let i = 0; i < list.length; i++) {
37
+ if (_module.value) {
38
+ if (isMax.value) {
39
+ MessagePlugin.error("超出文件上传限制");
40
+ break;
41
+ }
42
+ _module.value.push(list[i]);
43
+ }
44
+ list[i].cb = uploadEd;
45
+ list[i].key = key;
46
+ }
47
+
48
+ let isOss = true;
49
+ if (uploadPath instanceof Array) {
50
+ componentConfig.setUploadUrl(uploadPath[0], uploadPath[1]);
51
+ } else {
52
+ componentConfig.setUploadCustomUrl(uploadPath);
53
+ isOss = false;
54
+ }
55
+
56
+ if (!uploadLoading.value) {
57
+ uploadLoading.value = useUpload.toUpload(
58
+ _module.value ? _module.value : list,
59
+ uploadEd,
60
+ isOss
61
+ );
62
+ }
63
+ }
64
+
65
+
66
+ const uploadEd = async (evt) => {
67
+ let filterList = [];
68
+ let callBackParams = null;
69
+ try {
70
+ if (evt instanceof Array) {
71
+ filterList = evt
72
+ .filter((item) => {
73
+ return item.key === key;
74
+ })
75
+ .filter((item) => {
76
+ if (!item.upload || item.upload.state === 1) {
77
+ return item;
78
+ } else {
79
+ Notification.error("存在某些文件取消上传或上传失败!");
80
+ }
81
+ });
82
+
83
+ callBackParams = filterList;
84
+ } else {
85
+ if (_module.value instanceof Array) {
86
+ _module.value = _module.value.filter((item) => {
87
+ return item.url !== "cancel";
88
+ });
89
+ } else {
90
+ _module.value = null;
91
+ }
92
+ callBackParams = evt;
93
+ Notification.error(`${evt}`);
94
+ }
95
+ } catch (error) {
96
+ } finally {
97
+ if (!callBackIsLaunch.value) {
98
+ options.uploadEd && options.uploadEd(callBackParams);
99
+ callBackIsLaunch.value = true;
100
+ if (callBackParams instanceof Array) {
101
+ // 只要考虑oss
102
+ if (componentConfig.ossUploadEdAuthCallback instanceof Function) {
103
+ if (callBackParams.length > 0) {
104
+ await componentConfig.ossUploadEdAuthCallback(callBackParams);
105
+ }
106
+ }
107
+ }
108
+ }
109
+
110
+ uploadLoading.value = false;
111
+ }
112
+ }
113
+
114
+
115
+ return {
116
+ isMax,
117
+ _module,
118
+ dynamicmount,
119
+ uploadLoading,
120
+ uploadPath,
121
+ callBackIsLaunch,
122
+ setUploadPath,
123
+ inputChange,
124
+ uploadEd,
125
+
126
+ }
127
+
128
+ }
129
+
130
+
131
+ export default useHookByUpload;
@@ -68,7 +68,6 @@ import useCropper from "../config/use/useCropper";
68
68
  import useViewVideo from "../config/use/UseViewVideo";
69
69
  import useGuide from "../config/use/UseGuide";
70
70
  import LinkViewClass from "../config/LinkViewClass";
71
-
72
71
  import 'tdesign-vue/es/style/index.css';
73
72
 
74
73
  //组件库type类型
@@ -139,7 +138,6 @@ const install = (Vue) => {
139
138
  meixicomponents.forEach((baseComponent) => {
140
139
  Vue.component(baseComponent.name, baseComponent);
141
140
  });
142
-
143
141
  Vue.use(DynamicMount);
144
142
  Vue.use(VueCropper);
145
143
  Vue.use(registerConfirm);
package/vue.config.js CHANGED
@@ -6,15 +6,19 @@ function resolve(dir) {
6
6
  }
7
7
 
8
8
  module.exports = defineConfig({
9
- transpileDependencies: true, css: {
9
+ transpileDependencies: true,
10
+ css: {
10
11
  extract: false,
11
- }, productionSourceMap: false, configureWebpack: {
12
+ },
13
+ productionSourceMap: false,
14
+ configureWebpack: {
12
15
  resolve: {
13
- extensions: [".js", ".vue", ".json", ".ts", ".tsx"], alias: {
16
+ extensions: [".js", ".vue", ".json", ".ts", ".tsx"],
17
+ alias: {
14
18
  "@": resolve("src"),
15
19
  'zlib': false,
16
20
  "stream": false,
17
- "fs": false
21
+ "fs": false,
18
22
  }, fallback: {
19
23
  path: require.resolve("path-browserify"),
20
24
  },
@@ -28,14 +32,10 @@ module.exports = defineConfig({
28
32
  }
29
33
  }]
30
34
  }
31
- },
32
- chainWebpack(config) {
35
+ }, chainWebpack(config) {
33
36
  config.externals({
34
- 'element-ui': 'ElementUI'
35
37
  })
36
38
  }
37
-
38
-
39
39
  })
40
40
 
41
41