12345678910111213 |
- import { ResourceModule } from ".";
- export const helper = ResourceModule.helper({
- createFileName(fileName: string, dir: string) {
- const suffix = fileName.substring(fileName.lastIndexOf("."));
- if (/[\u4e00-\u9fa5]/.test(fileName) || fileName.length > 10) {
- fileName = `${this.controls.uploader.randomName(4)}${suffix}`;
- }
- return `${dir}/${Date.now()}_${this.controls.uploader.randomName(
- 6
- )}_${fileName}`;
- },
- });
|