| | |
| | | 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) |