Quellcode durchsuchen

fix 批量注册学员 下载模板

dusenyao vor 2 Jahren
Ursprung
Commit
255c79910f
2 geänderte Dateien mit 20 neuen und 3 gelöschten Zeilen
  1. 13 0
      src/api/app.js
  2. 7 3
      src/views/student_manager/BatchRegistration.vue

+ 13 - 0
src/api/app.js

@@ -69,3 +69,16 @@ export function GetVerificationCodeImage(data) {
     data
   });
 }
+
+/**
+ * 获取文件静态资源
+ * @param {Object} data
+ */
+export function GetFileResource(data) {
+  return request({
+    method: 'post',
+    url: process.env.VUE_APP_FileServer,
+    params: getRequestParams('file_resource_manager-GetFileResource'),
+    data
+  });
+}

+ 7 - 3
src/views/student_manager/BatchRegistration.vue

@@ -28,7 +28,7 @@
 import { ref, watch } from 'vue';
 import { Message } from 'element-ui';
 import { acceptTypeList, useUpload } from '@/utils/upload';
-import { getUserInfo } from '@/utils/auth';
+import { GetFileResource } from '@/api/app';
 
 const props = defineProps({
   visible: {
@@ -41,8 +41,12 @@ const emits = defineEmits(['update:visible', 'batchRegister']);
 
 let file_id = ref('');
 let file_name = ref('');
-const { session_id, user_code, user_type } = getUserInfo();
-const templateURL = `${process.env.VUE_APP_BASE_API}/GCLSFileServer/WebFileDownload?UserCode=${user_code}&UserType=${user_type}&SessionID=${session_id}&FileID=00201-20220923-15-N7RMJGP1`;
+const templateURL = ref('');
+
+GetFileResource({ resource_key_list: ['batch_register_student_template'] }).then(({ file_list }) => {
+  if (file_list.length <= 0) return;
+  templateURL.value = file_list[0].file_url;
+});
 
 watch(
   () => props.visible,