zhangjie 7 сар өмнө
parent
commit
307122b528

+ 7 - 5
src/views/base/track-export/useDraw.ts

@@ -268,10 +268,12 @@ export default function useDraw(drawConfig: DrawConfig) {
    * 获取文件存储路径,规则:学期/考试/课程/试卷编号/教学班/下载文件类型/学生图片
    */
   function getOutputPath(type: PictureTypeEnum, index?: number) {
+    const transfromStr = (str: string) => str.replace(/[*|:?<>]/g, '');
     let filename =
       trackConfig.studentFileRule === 'CODE_NAME'
         ? `${rawTask.studentCode}-${rawTask.studentName}`
         : rawTask.studentCode;
+    filename = transfromStr(filename);
 
     if (index !== undefined) {
       filename += `-${index}`;
@@ -280,11 +282,11 @@ export default function useDraw(drawConfig: DrawConfig) {
 
     const paths = [
       trackConfig.curOutputDir,
-      task.semesterName,
-      task.examName,
-      `${rawTask.courseName}(${rawTask.courseCode})`,
-      rawTask.paperNumber,
-      taskDetail.className,
+      transfromStr(task.semesterName),
+      transfromStr(task.examName),
+      transfromStr(`${rawTask.courseName}(${rawTask.courseCode})`),
+      transfromStr(rawTask.paperNumber),
+      transfromStr(taskDetail.className),
     ];
     if (trackConfig.pictureType.includes(type)) {
       paths.push(PICTURE_TYPE[type]);