From 39f6fca28e3f78abe48f08e474ec011abb990b36 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期三, 09 九月 2026 10:39:21 +0800
Subject: [PATCH] update

---
 frontend/src/api/users.js |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/frontend/src/api/users.js b/frontend/src/api/users.js
index 57a4b6a..0b4ab90 100644
--- a/frontend/src/api/users.js
+++ b/frontend/src/api/users.js
@@ -15,6 +15,29 @@
 export const getGuideUsers = (params) => http.get('/guide-users', { params })
 export const getGuideUserDetail = (id) => http.get(`/guide-users/${id}`)
 export const updateGuideUserDetail = (id, data) => http.put(`/guide-users/${id}`, data)
+export const uploadGuideUserAvatar = (id, file) => {
+  const data = new FormData()
+  data.append('file', file)
+  return http.post(`/guide-users/${id}/avatar`, data)
+}
+export const uploadGuideUserDocument = (id, documentType, file) => {
+  const data = new FormData()
+  data.append('file', file)
+  return http.post(`/guide-users/${id}/documents/${documentType}`, data)
+}
+export const getGuideUserDocumentBlob = async (documentUrl) => {
+  const apiUrl = new URL(http.defaults.baseURL)
+  const fileUrl = new URL(documentUrl, apiUrl.origin)
+  if (fileUrl.origin !== apiUrl.origin || !fileUrl.pathname.startsWith('/uploads/guide-applications/')) {
+    return null
+  }
+  const token = localStorage.getItem('admin_token')
+  const response = await fetch(fileUrl, {
+    headers: token ? { Authorization: `Bearer ${token}` } : {},
+  })
+  if (!response.ok) throw new Error('证件图片加载失败')
+  return response.blob()
+}
 export const addGuideScenicConfig = (id, scenicSpotId) => http.post(`/guide-users/${id}/scenic-configs`, { scenicSpotId })
 export const deleteGuideScenicConfig = (id, configId) => http.delete(`/guide-users/${id}/scenic-configs/${configId}`)
 export const createGuideUser = (data) => http.post('/guide-users', data)

--
Gitblit v1.7.1