save code

This commit is contained in:
Ubuntu
2026-02-10 10:09:24 +08:00
parent c93d8b7236
commit cf1cbbd597
10 changed files with 1060 additions and 7 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
// API调用封装
const API_BASE_URL = '/api';
const API_BASE_URL = 'http://localhost:5000/api';
// 获取发型列表
export async function getHairstyles() {
+5
View File
File diff suppressed because one or more lines are too long
+6 -3
View File
@@ -1,7 +1,10 @@
// API基础URL
const API_BASE_URL = 'http://xiangsilian.com:5000/api';
// API调用函数
async function getHairstyles() {
try {
const response = await axios.get('/api/hairstyles');
const response = await axios.get(`${API_BASE_URL}/hairstyles`);
return response.data;
} catch (error) {
console.error('获取发型列表失败:', error);
@@ -15,7 +18,7 @@ async function changeHair(imageFile, hairstyleId) {
formData.append('image', imageFile);
formData.append('hairstyle_id', hairstyleId);
const response = await axios.post('/api/change-hair', formData, {
const response = await axios.post(`${API_BASE_URL}/change-hair`, formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
@@ -34,7 +37,7 @@ async function changeHairColor(imageFile, rgb, ratio) {
formData.append('rgb', rgb);
formData.append('ratio', ratio);
const response = await axios.post('/api/change-hair-color', formData, {
const response = await axios.post(`${API_BASE_URL}/change-hair-color`, formData, {
headers: {
'Content-Type': 'multipart/form-data'
}