component-shipinlv 2.0.18 → 2.1.1

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.
Files changed (61) hide show
  1. package/dist/ActiveAccountMode/hour-enabled.d.ts +9 -0
  2. package/dist/ActiveAccountMode/hour-enabled.js +42 -0
  3. package/dist/ActiveAccountMode/hour-enabled.less +24 -0
  4. package/dist/ActiveAccountMode/index.d.ts +7 -0
  5. package/dist/ActiveAccountMode/index.js +12 -0
  6. package/dist/ActiveAccountMode/index.less +0 -0
  7. package/dist/ActiveAccountMode/setting.d.ts +8 -0
  8. package/dist/ActiveAccountMode/setting.js +235 -0
  9. package/dist/ActiveAccountMode/setting.less +39 -0
  10. package/dist/ActiveAccountMode/task/index.d.ts +36 -0
  11. package/dist/ActiveAccountMode/task/index.js +819 -0
  12. package/dist/Auth/index.js +2 -0
  13. package/dist/VideoPublish/account-manage/home.js +1 -0
  14. package/dist/VideoPublish/account-manage/list.js +3 -2
  15. package/dist/VideoPublish/create-task/base/index.js +1 -1
  16. package/dist/VideoPublish/index.js +11 -1
  17. package/dist/VideoPublish/index.less +2 -2
  18. package/dist/VideoPublish/proxy/list.js +2 -1
  19. package/dist/VideoPublish/proxy/select.js +2 -1
  20. package/dist/VideoPublish/publish-task-plan/tool.js +1 -1
  21. package/dist/VideoPublish/task-list/index.js +3 -2
  22. package/dist/VideoPublish/task-list/plan/list.js +3 -2
  23. package/dist/VideoPublish/task-list/plan/query.js +15 -11
  24. package/dist/VideoPublish/video-account/create.js +1 -1
  25. package/dist/VideoPublish/video-account/group.js +1 -1
  26. package/dist/VideoPublish/video-account/index.js +58 -7
  27. package/dist/VideoPublish/video-publish-statistic/operation/list.js +2 -1
  28. package/dist/VideoPublish/video-publish-statistic/publish-plan/list.js +4 -2
  29. package/dist/VideoPublish/video-publish-statistic/publish-plan/query.d.ts +1 -0
  30. package/dist/VideoPublish/video-publish-statistic/publish-plan/query.js +4 -1
  31. package/dist/VideoPublish/video-topic/index.js +2 -2
  32. package/dist/VipCompare/index.js +2 -2
  33. package/dist/config/apiUrls.js +1 -1
  34. package/dist/lib/Tool.js +7 -0
  35. package/dist/lib/allow-mine-type.d.ts +4 -0
  36. package/dist/lib/allow-mine-type.js +19 -0
  37. package/dist/lib/file-type.d.ts +2 -0
  38. package/dist/lib/file-type.js +156 -0
  39. package/dist/lib/fs.d.ts +14 -0
  40. package/dist/lib/fs.js +479 -0
  41. package/dist/lib/getFileExt.d.ts +2 -0
  42. package/dist/lib/getFileExt.js +6 -0
  43. package/dist/lib/save-path.d.ts +17 -0
  44. package/dist/lib/save-path.js +173 -0
  45. package/dist/lib/save-path.less +21 -0
  46. package/dist/service/api/ActiveAccountModeSettingController.d.ts +2 -0
  47. package/dist/service/api/ActiveAccountModeSettingController.js +53 -0
  48. package/dist/service/api/PublishTaskPlanStatisticController.d.ts +1 -0
  49. package/dist/service/api/PublishTaskPlanStatisticController.js +28 -0
  50. package/dist/service/api/VideoPublishController.d.ts +4 -0
  51. package/dist/service/api/VideoPublishController.js +23 -0
  52. package/dist/types/AutoMakeTaskSetting.d.ts +18 -0
  53. package/dist/types/AutoMakeTaskSetting.js +0 -0
  54. package/dist/types/PublishTaskPlanStatistic.d.ts +15 -0
  55. package/dist/types/PublishTaskPlanStatistic.js +0 -0
  56. package/dist/types/VideoPublish.d.ts +1 -0
  57. package/dist/typings/VideoPublishVideoAccount.d.ts +1 -0
  58. package/dist/typings.d.ts +1 -0
  59. package/dist/video-study/index.js +2 -1
  60. package/dist/window.d.ts +5 -0
  61. package/package.json +1 -1
@@ -0,0 +1,156 @@
1
+ var MineTypes = {
2
+ 'image/bmp': 'bmp',
3
+ 'audio/vnd.dolby.dd-raw': 'ac3',
4
+ 'application/x-apple-diskimage': 'dmg',
5
+ 'application/x-msdownload': 'exe',
6
+ 'application/eps': 'eps',
7
+ 'application/postscript': 'ps',
8
+ 'application/x-compress': 'Z',
9
+ 'image/jpeg': 'jpg',
10
+ 'image/vnd.ms-photo': 'jxr',
11
+ 'application/gzip': 'gz',
12
+ 'application/x-bzip2': 'bz2',
13
+ 'audio/mpeg': 'mp3',
14
+ 'audio/x-musepack': 'mpc',
15
+ 'application/x-shockwave-flash': 'swf',
16
+ 'image/gif': 'gif',
17
+ 'image/flif': 'flif',
18
+ 'image/webp': 'webp',
19
+ 'audio/aiff': 'aif',
20
+ 'image/icns': 'icns',
21
+ 'application/x-xpinstall': 'xpi',
22
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': 'docx',
23
+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation': 'pptx',
24
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': 'xlsx',
25
+ 'model/3mf': '3mf',
26
+ 'application/epub+zip': 'epub',
27
+ 'application/vnd.oasis.opendocument.text': 'odt',
28
+ 'application/vnd.oasis.opendocument.spreadsheet': 'ods',
29
+ 'application/vnd.oasis.opendocument.presentation': 'odp',
30
+ 'application/zip': 'zip',
31
+ 'audio/opus': 'opus',
32
+ 'audio/ogg': 'ogg',
33
+ 'application/ogg': 'ogx',
34
+ 'image/avif': 'avif',
35
+ 'image/heif': 'heic',
36
+ 'image/heif-sequence': 'heic',
37
+ 'image/heic': 'heic',
38
+ 'image/heic-sequence': 'heic',
39
+ 'video/quicktime': 'mov',
40
+ 'video/x-m4v': 'm4v',
41
+ 'audio/mp4': 'm4b',
42
+ 'audio/x-m4a': 'm4a',
43
+ 'image/x-canon-cr3': 'cr3',
44
+ 'video/3gpp2': '3g2',
45
+ 'video/3gpp': '3gp',
46
+ 'video/mp4': 'mp4',
47
+ 'audio/midi': 'mid',
48
+ 'font/woff': 'woff',
49
+ 'font/woff2': 'woff2',
50
+ 'application/vnd.tcpdump.pcap': 'pcap',
51
+ 'audio/x-dsf': 'dsf',
52
+ 'application/x-lzip': 'lz',
53
+ 'audio/x-flac': 'flac',
54
+ 'image/bpg': 'bpg',
55
+ 'audio/wavpack': 'wv',
56
+ 'application/pdf': 'pdf',
57
+ 'application/wasm': 'wasm',
58
+ 'audio/ape': 'ape',
59
+ 'video/webm': 'webm',
60
+ 'video/x-matroska': 'mkv',
61
+ 'video/vnd.avi': 'avi',
62
+ 'audio/vnd.wave': 'wav',
63
+ 'audio/qcelp': 'qcp',
64
+ 'application/x-sqlite3': 'sqlite',
65
+ 'application/x-nintendo-nes-rom': 'nes',
66
+ 'application/x-google-chrome-extension': 'crx',
67
+ 'application/vnd.ms-cab-compressed': 'cab',
68
+ 'application/x-rpm': 'rpm',
69
+ 'application/zstd': 'zst',
70
+ 'font/otf': 'otf',
71
+ 'audio/amr': 'amr',
72
+ 'application/rtf': 'rtf',
73
+ 'video/x-flv': 'flv',
74
+ 'audio/x-it': 'it',
75
+ 'application/x-lzh-compressed': 'lzh',
76
+ 'video/MP1S': 'mpg',
77
+ 'video/MP2P': 'mpg',
78
+ 'application/vnd.ms-htmlhelp': 'chm',
79
+ 'application/x-xz': 'xz',
80
+ 'application/xml': 'xml',
81
+ 'application/x-7z-compressed': '7z',
82
+ 'application/x-rar-compressed': 'rar',
83
+ 'model/stl': 'stl',
84
+ 'application/x-blender': 'blend',
85
+ 'application/x-deb': 'deb',
86
+ 'application/x-unix-archive': 'ar',
87
+ 'image/png': 'png',
88
+ 'image/apng': 'apng',
89
+ 'application/x-apache-arrow': 'arrow',
90
+ 'model/gltf-binary': 'glb',
91
+ 'image/x-olympus-orf': 'orf',
92
+ 'image/x-xcf': 'xcf',
93
+ 'image/x-panasonic-rw2': 'rw2',
94
+ 'audio/x-ms-asf': 'asf',
95
+ 'video/x-ms-asf': 'asf',
96
+ 'application/vnd.ms-asf': 'ktx',
97
+ 'image/ktx': 'mie',
98
+ 'application/x-mie': 'shp',
99
+ 'application/x-esri-shape': 'jp2',
100
+ 'image/jp2': 'jpx',
101
+ 'image/jpx': 'jpm',
102
+ 'image/jpm': 'mj2',
103
+ 'image/mj2': 'jxl',
104
+ 'image/jxl': 'xml',
105
+ 'video/mpeg': 'ttf',
106
+ 'font/ttf': 'ico',
107
+ 'image/x-icon': 'cur',
108
+ 'application/x-cfb': 'vcf',
109
+ 'text/vcard': 'ics',
110
+ 'text/calendar': 'raf',
111
+ 'image/x-fujifilm-raf': 'xm',
112
+ 'audio/x-xm': 'voc',
113
+ 'audio/x-voc': 'asar',
114
+ 'application/x-asar': 'mxf',
115
+ 'application/mxf': 's3m',
116
+ 'audio/x-s3m': 'mts',
117
+ 'video/mp2t': 'mts',
118
+ 'application/x-mobipocket-ebook': 'dcm',
119
+ 'application/dicom': 'lnk',
120
+ 'application/x.ms.shortcut': 'alias',
121
+ 'application/x.apple.alias': 'eot',
122
+ 'application/vnd.ms-fontobject': 'indd',
123
+ 'application/x-indesign': 'tar',
124
+ 'application/x-tar': 'skp',
125
+ 'application/vnd.sketchup.skp': 'pgp',
126
+ 'application/pgp-encrypted': 'aac',
127
+ 'audio/aac': 'mp3',
128
+ 'image/x-sony-arw': 'dng',
129
+ 'image/x-adobe-dng': 'cr2',
130
+ 'image/x-canon-cr2': 'nef',
131
+ 'image/x-nikon-nef': 'tif',
132
+ 'image/tiff': 'tiff'
133
+ };
134
+ var FileType = function FileType() {
135
+ var fileUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
136
+ var mineType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
137
+ // 先从网址获取;
138
+ var url = fileUrl.replace(/#.+/g, '');
139
+ var laseIndex = url.lastIndexOf('.');
140
+ var extName = url.slice(laseIndex + 1).toLocaleLowerCase();
141
+ var matchExtName = '';
142
+ for (var _mineType in MineTypes) {
143
+ var ext = MineTypes[_mineType];
144
+ if (ext === extName) {
145
+ matchExtName = ext;
146
+ break;
147
+ }
148
+ }
149
+
150
+ // 没找到的话 在判断 mineType
151
+ if (!matchExtName) {
152
+ matchExtName = MineTypes[mineType] || extName;
153
+ }
154
+ return matchExtName;
155
+ };
156
+ export default FileType;
@@ -0,0 +1,14 @@
1
+ export declare const fs: () => any;
2
+ export declare function fsDirVideoList(dir: string): string[];
3
+ export declare function getDirSize(dirPath: string): number;
4
+ export declare function isFileExist(filePath: string): Promise<boolean>;
5
+ export declare function isDirExist(dirPath: string): Promise<boolean>;
6
+ export declare function writeFileText(filePath: string, content: any): Promise<true>;
7
+ export declare function getFileText(filePath: string): Promise<string>;
8
+ export declare function fileRename(oldFilePath: string, newFilePath: string): Promise<true>;
9
+ export declare function fileIno(filePath: string): Promise<number>;
10
+ export declare function getFileSize(filePath: string): Promise<number>;
11
+ export declare function delFile(filePath: string): Promise<unknown>;
12
+ export declare function delDirFiles(dirPath: string, oldTime?: number): Promise<unknown>;
13
+ export declare function mkdir(directory: string): Promise<unknown>;
14
+ export declare function isDirExistCreate(directory: string): Promise<boolean>;
package/dist/lib/fs.js ADDED
@@ -0,0 +1,479 @@
1
+ import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
2
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
+ import { VideoMineType } from "./allow-mine-type";
5
+ import getFileExt from "./getFileExt";
6
+ export var fs = function fs() {
7
+ return window.getBridge().fs;
8
+ };
9
+ var path = function path() {
10
+ return window.getBridge().path;
11
+ };
12
+ function fsDirWalk(dir) {
13
+ var _fs, _fs$readdirSync;
14
+ var size = 0;
15
+ (_fs = fs()) === null || _fs === void 0 || (_fs$readdirSync = _fs.readdirSync) === null || _fs$readdirSync === void 0 || _fs$readdirSync.call(_fs, dir).forEach(function (file) {
16
+ var filePath = path().join(dir, file);
17
+ var stat = fs().statSync(filePath);
18
+ if (stat.isDirectory()) {
19
+ size += fsDirWalk(filePath);
20
+ } else {
21
+ size += stat.size;
22
+ }
23
+ });
24
+ return size;
25
+ }
26
+ export function fsDirVideoList(dir) {
27
+ var _fs2, _fs2$readdirSync;
28
+ var list = [];
29
+ console.log('fsDirVideoList:', dir);
30
+ (_fs2 = fs()) === null || _fs2 === void 0 || (_fs2$readdirSync = _fs2.readdirSync) === null || _fs2$readdirSync === void 0 || _fs2$readdirSync.call(_fs2, dir).forEach(function (file) {
31
+ var filePath = path().join(dir, file);
32
+ var extName = getFileExt(file);
33
+ if ((VideoMineType === null || VideoMineType === void 0 ? void 0 : VideoMineType.indexOf(extName)) === -1) {
34
+ console.log('fsDirVideoList not video :', file, extName);
35
+ return;
36
+ }
37
+ list.push(filePath);
38
+ //
39
+ // console.log('fsDirVideoList:', file, extName );
40
+ //
41
+ //
42
+ // const stat = fs().statSync(filePath);
43
+ //
44
+ // console.log('fsDirVideoList stat.isDirectory():', stat.isDirectory() , stat.isFile() );
45
+ //
46
+ // if ( ! stat.isDirectory()) {
47
+ // list.push( filePath );
48
+ // }
49
+ });
50
+
51
+ return list;
52
+ }
53
+ export function getDirSize(dirPath) {
54
+ console.log('getDirSize:', dirPath);
55
+ return fsDirWalk(dirPath);
56
+ }
57
+ export function isFileExist(_x) {
58
+ return _isFileExist.apply(this, arguments);
59
+ }
60
+ function _isFileExist() {
61
+ _isFileExist = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(filePath) {
62
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
63
+ while (1) switch (_context.prev = _context.next) {
64
+ case 0:
65
+ return _context.abrupt("return", new Promise(function (resolve, reject) {
66
+ try {
67
+ fs().stat(filePath, function (err) {
68
+ if (err) {
69
+ console.log('isFileExist fs:', err);
70
+ reject(err);
71
+ return;
72
+ }
73
+ resolve(true);
74
+ });
75
+ } catch (e) {
76
+ reject(e);
77
+ }
78
+ }));
79
+ case 1:
80
+ case "end":
81
+ return _context.stop();
82
+ }
83
+ }, _callee);
84
+ }));
85
+ return _isFileExist.apply(this, arguments);
86
+ }
87
+ export function isDirExist(_x2) {
88
+ return _isDirExist.apply(this, arguments);
89
+ }
90
+ function _isDirExist() {
91
+ _isDirExist = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(dirPath) {
92
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
93
+ while (1) switch (_context2.prev = _context2.next) {
94
+ case 0:
95
+ return _context2.abrupt("return", new Promise(function (resolve, reject) {
96
+ try {
97
+ fs().stat(dirPath, function (err, stats) {
98
+ if (err) {
99
+ console.log('isFileExist fs:', err);
100
+ reject(err);
101
+ return;
102
+ }
103
+ if (stats.isDirectory()) {
104
+ return resolve(true);
105
+ }
106
+ var error = new Error('文件夹不存在,但存在同名文件');
107
+ error.name = 'not-dir-but-file';
108
+ reject(error);
109
+ });
110
+ } catch (e) {
111
+ reject(e);
112
+ }
113
+ }));
114
+ case 1:
115
+ case "end":
116
+ return _context2.stop();
117
+ }
118
+ }, _callee2);
119
+ }));
120
+ return _isDirExist.apply(this, arguments);
121
+ }
122
+ export function writeFileText(_x3, _x4) {
123
+ return _writeFileText.apply(this, arguments);
124
+ }
125
+
126
+ // 获取文本内容
127
+ function _writeFileText() {
128
+ _writeFileText = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(filePath, content) {
129
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
130
+ while (1) switch (_context3.prev = _context3.next) {
131
+ case 0:
132
+ return _context3.abrupt("return", new Promise(function (resolve, reject) {
133
+ var text = typeof content === 'string' ? content : JSON.stringify(content !== null && content !== void 0 ? content : '');
134
+ fs().writeFile(filePath, text, function (err) {
135
+ if (err) {
136
+ console.warn(err);
137
+ reject(err);
138
+ return;
139
+ }
140
+ console.log('内容已成功写入文件');
141
+ resolve(true);
142
+ });
143
+ }));
144
+ case 1:
145
+ case "end":
146
+ return _context3.stop();
147
+ }
148
+ }, _callee3);
149
+ }));
150
+ return _writeFileText.apply(this, arguments);
151
+ }
152
+ export function getFileText(_x5) {
153
+ return _getFileText.apply(this, arguments);
154
+ }
155
+ function _getFileText() {
156
+ _getFileText = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(filePath) {
157
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
158
+ while (1) switch (_context4.prev = _context4.next) {
159
+ case 0:
160
+ return _context4.abrupt("return", new Promise(function (resolve, reject) {
161
+ fs().readFile(filePath, 'utf8', function (err, data) {
162
+ if (err) {
163
+ console.error('getFileText:', err);
164
+ reject(err);
165
+ return;
166
+ }
167
+ console.log(data);
168
+ resolve(data);
169
+ });
170
+ }));
171
+ case 1:
172
+ case "end":
173
+ return _context4.stop();
174
+ }
175
+ }, _callee4);
176
+ }));
177
+ return _getFileText.apply(this, arguments);
178
+ }
179
+ export function fileRename(_x6, _x7) {
180
+ return _fileRename.apply(this, arguments);
181
+ }
182
+ function _fileRename() {
183
+ _fileRename = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(oldFilePath, newFilePath) {
184
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
185
+ while (1) switch (_context5.prev = _context5.next) {
186
+ case 0:
187
+ return _context5.abrupt("return", new Promise(function (resolve, reject) {
188
+ fs().rename(oldFilePath, newFilePath, function (err) {
189
+ if (err) {
190
+ console.log('fileRename err:', err);
191
+ reject(err);
192
+ console.log('re name fail:', err);
193
+ return;
194
+ }
195
+ resolve(true);
196
+ });
197
+ }));
198
+ case 1:
199
+ case "end":
200
+ return _context5.stop();
201
+ }
202
+ }, _callee5);
203
+ }));
204
+ return _fileRename.apply(this, arguments);
205
+ }
206
+ export function fileIno(_x8) {
207
+ return _fileIno.apply(this, arguments);
208
+ }
209
+ function _fileIno() {
210
+ _fileIno = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(filePath) {
211
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
212
+ while (1) switch (_context6.prev = _context6.next) {
213
+ case 0:
214
+ return _context6.abrupt("return", new Promise(function (resolve, reject) {
215
+ fs().stat(filePath, function (err, stats) {
216
+ if (err) {
217
+ console.log('fileIno 2:', err);
218
+ reject(err);
219
+ return;
220
+ }
221
+ resolve(stats.size);
222
+ });
223
+ }));
224
+ case 1:
225
+ case "end":
226
+ return _context6.stop();
227
+ }
228
+ }, _callee6);
229
+ }));
230
+ return _fileIno.apply(this, arguments);
231
+ }
232
+ export function getFileSize(_x9) {
233
+ return _getFileSize.apply(this, arguments);
234
+ }
235
+ function _getFileSize() {
236
+ _getFileSize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(filePath) {
237
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
238
+ while (1) switch (_context7.prev = _context7.next) {
239
+ case 0:
240
+ return _context7.abrupt("return", fileIno(filePath));
241
+ case 1:
242
+ case "end":
243
+ return _context7.stop();
244
+ }
245
+ }, _callee7);
246
+ }));
247
+ return _getFileSize.apply(this, arguments);
248
+ }
249
+ export function delFile(_x10) {
250
+ return _delFile.apply(this, arguments);
251
+ }
252
+ function _delFile() {
253
+ _delFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(filePath) {
254
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
255
+ while (1) switch (_context8.prev = _context8.next) {
256
+ case 0:
257
+ return _context8.abrupt("return", new Promise(function (resolve, reject) {
258
+ fs().unlink(filePath, function (err) {
259
+ if (err) {
260
+ console.error('delFile:', filePath, err);
261
+ reject(err);
262
+ return;
263
+ }
264
+ resolve(true);
265
+ });
266
+ }));
267
+ case 1:
268
+ case "end":
269
+ return _context8.stop();
270
+ }
271
+ }, _callee8);
272
+ }));
273
+ return _delFile.apply(this, arguments);
274
+ }
275
+ export function delDirFiles(_x11) {
276
+ return _delDirFiles.apply(this, arguments);
277
+ }
278
+ function _delDirFiles() {
279
+ _delDirFiles = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(dirPath) {
280
+ var oldTime,
281
+ _args11 = arguments;
282
+ return _regeneratorRuntime().wrap(function _callee10$(_context11) {
283
+ while (1) switch (_context11.prev = _context11.next) {
284
+ case 0:
285
+ oldTime = _args11.length > 1 && _args11[1] !== undefined ? _args11[1] : 6 * 3600 * 1000;
286
+ console.log('delDirFiles:', dirPath, oldTime);
287
+ return _context11.abrupt("return", new Promise( /*#__PURE__*/function () {
288
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(resolve, reject) {
289
+ var _fs3, _fs3$readdirSync;
290
+ var fileList, _iterator, _step, _loop;
291
+ return _regeneratorRuntime().wrap(function _callee9$(_context10) {
292
+ while (1) switch (_context10.prev = _context10.next) {
293
+ case 0:
294
+ fileList = ((_fs3 = fs()) === null || _fs3 === void 0 || (_fs3$readdirSync = _fs3.readdirSync) === null || _fs3$readdirSync === void 0 ? void 0 : _fs3$readdirSync.call(_fs3, dirPath)) || [];
295
+ console.log('delDirFiles 1:', fileList);
296
+ _iterator = _createForOfIteratorHelper(fileList);
297
+ _context10.prev = 3;
298
+ _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
299
+ var filePath, fileFullPath;
300
+ return _regeneratorRuntime().wrap(function _loop$(_context9) {
301
+ while (1) switch (_context9.prev = _context9.next) {
302
+ case 0:
303
+ filePath = _step.value;
304
+ fileFullPath = path().join(dirPath, filePath);
305
+ if (!(oldTime <= 0)) {
306
+ _context9.next = 6;
307
+ break;
308
+ }
309
+ _context9.next = 5;
310
+ return new Promise(function (resolve, reject) {
311
+ fs().rm(fileFullPath, {
312
+ force: true
313
+ }, function (err) {
314
+ resolve(true);
315
+ });
316
+ });
317
+ case 5:
318
+ return _context9.abrupt("return", 1);
319
+ case 6:
320
+ _context9.next = 8;
321
+ return new Promise(function (resolve, reject) {
322
+ fs().stat(fileFullPath, function (err, stats) {
323
+ if (err) {
324
+ console.log('delDirFiles 2:', err);
325
+ reject(err);
326
+ return;
327
+ }
328
+ // console.log('fileList stats:', stats );
329
+ if (stats.birthtimeMs + oldTime < Date.now()) {
330
+ fs().rm(fileFullPath, {
331
+ force: true
332
+ }, function (err) {
333
+ if (err) {
334
+ console.log('delDirFiles 3:', err);
335
+ return reject(err);
336
+ }
337
+ resolve(true);
338
+ });
339
+ } else {
340
+ resolve(true);
341
+ }
342
+ });
343
+ }).catch(function (err) {
344
+ console.log("del err:", err);
345
+ });
346
+ case 8:
347
+ case "end":
348
+ return _context9.stop();
349
+ }
350
+ }, _loop);
351
+ });
352
+ _iterator.s();
353
+ case 6:
354
+ if ((_step = _iterator.n()).done) {
355
+ _context10.next = 12;
356
+ break;
357
+ }
358
+ return _context10.delegateYield(_loop(), "t0", 8);
359
+ case 8:
360
+ if (!_context10.t0) {
361
+ _context10.next = 10;
362
+ break;
363
+ }
364
+ return _context10.abrupt("continue", 10);
365
+ case 10:
366
+ _context10.next = 6;
367
+ break;
368
+ case 12:
369
+ _context10.next = 17;
370
+ break;
371
+ case 14:
372
+ _context10.prev = 14;
373
+ _context10.t1 = _context10["catch"](3);
374
+ _iterator.e(_context10.t1);
375
+ case 17:
376
+ _context10.prev = 17;
377
+ _iterator.f();
378
+ return _context10.finish(17);
379
+ case 20:
380
+ resolve(true);
381
+ case 21:
382
+ case "end":
383
+ return _context10.stop();
384
+ }
385
+ }, _callee9, null, [[3, 14, 17, 20]]);
386
+ }));
387
+ return function (_x14, _x15) {
388
+ return _ref.apply(this, arguments);
389
+ };
390
+ }()));
391
+ case 3:
392
+ case "end":
393
+ return _context11.stop();
394
+ }
395
+ }, _callee10);
396
+ }));
397
+ return _delDirFiles.apply(this, arguments);
398
+ }
399
+ export function mkdir(_x12) {
400
+ return _mkdir.apply(this, arguments);
401
+ }
402
+
403
+ // 检查存在,并创建
404
+ function _mkdir() {
405
+ _mkdir = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(directory) {
406
+ return _regeneratorRuntime().wrap(function _callee11$(_context12) {
407
+ while (1) switch (_context12.prev = _context12.next) {
408
+ case 0:
409
+ return _context12.abrupt("return", new Promise(function (resolve, reject) {
410
+ fs().mkdir(directory, {
411
+ recursive: true
412
+ }, function (err) {
413
+ if (err) {
414
+ console.error(err);
415
+ return reject(err);
416
+ }
417
+ console.log('Directory created successfully');
418
+ resolve(true);
419
+ });
420
+ }));
421
+ case 1:
422
+ case "end":
423
+ return _context12.stop();
424
+ }
425
+ }, _callee11);
426
+ }));
427
+ return _mkdir.apply(this, arguments);
428
+ }
429
+ export function isDirExistCreate(_x13) {
430
+ return _isDirExistCreate.apply(this, arguments);
431
+ }
432
+ function _isDirExistCreate() {
433
+ _isDirExistCreate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(directory) {
434
+ return _regeneratorRuntime().wrap(function _callee13$(_context14) {
435
+ while (1) switch (_context14.prev = _context14.next) {
436
+ case 0:
437
+ return _context14.abrupt("return", new Promise( /*#__PURE__*/function () {
438
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(resolve, reject) {
439
+ var isExist, createDir;
440
+ return _regeneratorRuntime().wrap(function _callee12$(_context13) {
441
+ while (1) switch (_context13.prev = _context13.next) {
442
+ case 0:
443
+ _context13.next = 2;
444
+ return isDirExist(directory).catch(function (err) {});
445
+ case 2:
446
+ isExist = _context13.sent;
447
+ if (!isExist) {
448
+ _context13.next = 5;
449
+ break;
450
+ }
451
+ return _context13.abrupt("return", resolve(true));
452
+ case 5:
453
+ _context13.next = 7;
454
+ return mkdir(directory).catch(function (err) {
455
+ reject(err);
456
+ });
457
+ case 7:
458
+ createDir = _context13.sent;
459
+ if (createDir) {
460
+ resolve(true);
461
+ }
462
+ case 9:
463
+ case "end":
464
+ return _context13.stop();
465
+ }
466
+ }, _callee12);
467
+ }));
468
+ return function (_x16, _x17) {
469
+ return _ref2.apply(this, arguments);
470
+ };
471
+ }()));
472
+ case 1:
473
+ case "end":
474
+ return _context14.stop();
475
+ }
476
+ }, _callee13);
477
+ }));
478
+ return _isDirExistCreate.apply(this, arguments);
479
+ }
@@ -0,0 +1,2 @@
1
+ declare const getFileExt: (fileUrl: string) => string;
2
+ export default getFileExt;
@@ -0,0 +1,6 @@
1
+ var getFileExt = function getFileExt(fileUrl) {
2
+ var _split, _ref;
3
+ var url = ((_split = (fileUrl || '').split(/[#?/]/g)) === null || _split === void 0 ? void 0 : _split[0].match(/\.([a-z0-9]+)$/i)) || [];
4
+ return ((_ref = url[1] || '') === null || _ref === void 0 ? void 0 : _ref.toLocaleLowerCase()) || '';
5
+ };
6
+ export default getFileExt;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import './save-path.less';
3
+ import type { SizeType } from "antd/es/config-provider/SizeContext";
4
+ interface Props {
5
+ isDefaultEmpty?: boolean;
6
+ size?: SizeType;
7
+ label?: React.ReactNode;
8
+ disabled?: boolean;
9
+ path?: string;
10
+ placeholder?: string;
11
+ hiddenOpenDir?: boolean;
12
+ onChange?: (path: string) => void;
13
+ onBeforeSelect?: () => boolean | Promise<boolean>;
14
+ }
15
+ export declare const getSavePath: (productType: string) => void;
16
+ declare const SavePath: React.FC<Props>;
17
+ export default SavePath;