浏览代码

修改学年显示

lex 1 年之前
父节点
当前提交
1415fd6d80

+ 4 - 4
src/views/classList/index.tsx

@@ -86,8 +86,8 @@ export default defineComponent({
         gradeYear: '' as any,
         gradeLevel: ''
       };
-      if (state.popSelectYearList.length > 0) {
-        state.searchForm.gradeYear = state.popSelectYearList[0].id;
+      if (state.popSelectYearList.length > 1) {
+        state.searchForm.gradeYear = state.popSelectYearList[1].id;
       }
       getList();
       setCache({ current: state.searchForm, saveKey: route.path });
@@ -378,8 +378,8 @@ export default defineComponent({
         //   name: '全部学年'
         // });
         state.popSelectYearList = temp || [];
-        if (temp.length > 0 && !state.searchForm.gradeYear) {
-          state.searchForm.gradeYear = temp[0].id;
+        if (temp.length > 1 && !state.searchForm.gradeYear) {
+          state.searchForm.gradeYear = temp[1].id;
         }
       } catch {
         //

+ 13 - 11
src/views/natural-resources/components/my-resources/save-modal/index.tsx

@@ -88,24 +88,26 @@ export default defineComponent({
     const uploadList = ref([] as any);
 
     // 获取文件后缀名
-    // function getFileExtension(filename: string) {
-    //   return filename.slice(((filename.lastIndexOf('.') - 1) >>> 0) + 2);
-    // }
+    function getFileExtension(filename: string) {
+      return filename.slice(((filename.lastIndexOf('.') - 1) >>> 0) + 2);
+    }
 
-    // // 判断是否是允许的文件类型
-    // function isAllowedFileType(filename: string, allowedExtensions: any) {
-    //   const extension = getFileExtension(filename).toLowerCase();
-    //   return allowedExtensions.includes(extension);
-    // }
+    // 判断是否是允许的文件类型
+    function isAllowedFileType(filename: string, allowedExtensions: any) {
+      const extension = getFileExtension(filename).toLowerCase();
+      return allowedExtensions.includes(extension);
+    }
 
     const onBeforeUpload = async (options: any) => {
       const file = options.file;
       // 文件大小
       let isLt2M = true;
 
-      // JPG、PNG、MP3、MP4、PPT
-      // const filename = 'example.jpg';
-      // const allowedExtensions = ['jpg', 'jpeg', 'png', 'mp4', 'ppt'];
+      const allowedExtensions = ['jpg', 'jpeg', 'png', 'mp4', 'ppt', 'pptx'];
+      if (!isAllowedFileType(file.file.name, allowedExtensions)) {
+        message.error('文件格式不支持');
+        return false;
+      }
 
       const type = file.type.includes('image')
         ? NaturalTypeEnum.IMG

+ 4 - 4
src/views/studentList/index.tsx

@@ -109,8 +109,8 @@ export default defineComponent({
         gradeYear: '' as any,
         gradeLevel: ''
       };
-      if (state.popSelectYearList.length > 0) {
-        state.searchForm.gradeYear = state.popSelectYearList[0].id;
+      if (state.popSelectYearList.length > 1) {
+        state.searchForm.gradeYear = state.popSelectYearList[1].id;
       }
       search();
       setCache({ current: state.searchForm, saveKey: route.path });
@@ -154,8 +154,8 @@ export default defineComponent({
         //   name: '全部学年'
         // });
         state.popSelectYearList = temp || [];
-        if (temp.length > 0 && !state.searchForm.gradeYear) {
-          state.searchForm.gradeYear = temp[0].id;
+        if (temp.length > 1 && !state.searchForm.gradeYear) {
+          state.searchForm.gradeYear = temp[1].id;
         }
       } catch {
         //