|
@@ -7,8 +7,8 @@ import { useI18n } from '@/hooks/web/useI18n'
|
|
|
import type { FileVO } from '@/api/infra/file/types'
|
|
|
import { allSchemas } from './fileList.data'
|
|
|
import * as FileApi from '@/api/infra/file'
|
|
|
-import { useCache } from '@/hooks/web/useCache'
|
|
|
-const { wsCache } = useCache()
|
|
|
+import { getAccessToken, getTenantId } from '@/utils/auth'
|
|
|
+
|
|
|
const { t } = useI18n() // 国际化
|
|
|
|
|
|
// ========== 列表相关 ==========
|
|
@@ -29,7 +29,7 @@ const uploadHeaders = ref()
|
|
|
const beforeUpload = (file: UploadRawFile) => {
|
|
|
const isImg = file.type === 'image/jpeg' || 'image/gif' || 'image/png'
|
|
|
const isLt5M = file.size / 1024 / 1024 < 5
|
|
|
- if (!isImg) ElMessage.error('上传文件只能是 xls / xlsx 格式!')
|
|
|
+ if (!isImg) ElMessage.error('上传文件只能是 jpeg / gif / png 格式!')
|
|
|
if (!isLt5M) ElMessage.error('上传文件大小不能超过 5MB!')
|
|
|
return isImg && isLt5M
|
|
|
}
|
|
@@ -40,8 +40,8 @@ const beforeUpload = (file: UploadRawFile) => {
|
|
|
// 文件上传
|
|
|
const submitFileForm = () => {
|
|
|
uploadHeaders.value = {
|
|
|
- Authorization: 'Bearer ' + wsCache.get('ACCESS_TOKEN'),
|
|
|
- 'tenant-id': wsCache.get('tenantId')
|
|
|
+ Authorization: 'Bearer ' + getAccessToken(),
|
|
|
+ 'tenant-id': getTenantId()
|
|
|
}
|
|
|
uploadDisabled.value = true
|
|
|
uploadRef.value!.submit()
|