合作页面的内容
This commit is contained in:
@@ -1114,3 +1114,75 @@ export const deletePartner = async (id: number): Promise<void> => {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
// 咨询相关类型
|
||||
export interface Inquiry {
|
||||
id?: number
|
||||
name: string
|
||||
company: string
|
||||
contactMethod: string
|
||||
contactValue: string
|
||||
budget: string
|
||||
description: string
|
||||
status?: number // 0-Unread, 1-Read, 2-Contacted
|
||||
createdAt?: string
|
||||
}
|
||||
|
||||
export interface EmailSuffix {
|
||||
id: number
|
||||
suffix: string
|
||||
isActive: boolean
|
||||
sortOrder: number
|
||||
createdAt: string
|
||||
updatedAt: string
|
||||
}
|
||||
|
||||
// 咨询相关API
|
||||
export const submitInquiry = async (data: Inquiry): Promise<void> => {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE}/inquiries`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(data)
|
||||
})
|
||||
if (!response.ok) {
|
||||
const errorData = await response.json()
|
||||
throw new Error(errorData.error || '提交咨询失败')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Submit inquiry error:', error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
export const fetchEmailSuffixes = async (): Promise<EmailSuffix[]> => {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE}/email-suffixes`)
|
||||
if (!response.ok) {
|
||||
const errorData = await response.json()
|
||||
throw new Error(errorData.error || '获取邮箱后缀失败')
|
||||
}
|
||||
return await response.json()
|
||||
} catch (error) {
|
||||
console.error('Fetch email suffixes error:', error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
export const fetchInquiries = async (): Promise<Inquiry[]> => {
|
||||
try {
|
||||
const response = await fetch(`${API_BASE}/admin/inquiries`, {
|
||||
headers: getAuthHeaders()
|
||||
})
|
||||
if (!response.ok) {
|
||||
const errorData = await response.json()
|
||||
throw new Error(errorData.error || '获取咨询列表失败')
|
||||
}
|
||||
return await response.json()
|
||||
} catch (error) {
|
||||
console.error('Fetch inquiries error:', error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user