diff --git a/frontend/src/views/desktop/CustomerManage.vue b/frontend/src/views/desktop/CustomerManage.vue index 52e15db..2cf9da7 100644 --- a/frontend/src/views/desktop/CustomerManage.vue +++ b/frontend/src/views/desktop/CustomerManage.vue @@ -7,6 +7,7 @@ import { ElMessage, ElMessageBox } from 'element-plus' import { getManagerColor as mgrColorFn, getMgrTextColor, loadManagerColors } from '@/utils/managerColor' import { compressImage } from '@/utils/image' import api from '@/api/index' +import axios from 'axios' const auth = useAuthStore() const themeStore = useThemeStore() @@ -61,8 +62,8 @@ async function handleIndivPhotoUpload(event: Event) { if (form.photos.length >= 9) break try { const compressed = await compressImage(file, { maxPixels: 1920, quality: 0.8 }) - const presignRes = await api.get('/upload/presigned-url', { params: { filename: compressed.name, content_type: compressed.type || 'image/jpeg' } }) - await api.put(presignRes.data.upload_url, compressed, { headers: { 'Content-Type': compressed.type || 'image/jpeg' } }) + const presignRes = await api.post('/upload/presigned-url', null, { params: { filename: compressed.name, content_type: compressed.type || 'image/jpeg' } }) + await axios.put(presignRes.data.upload_url, compressed, { headers: { 'Content-Type': compressed.type || 'image/jpeg' } }) form.photos.push(presignRes.data.object_key) indivPhotoUrls.value[presignRes.data.object_key] = URL.createObjectURL(compressed) } catch (_) { ElMessage.error('上传失败') }