Generating commit message...
This commit is contained in:
87
mini-program/api/config.js
Normal file
87
mini-program/api/config.js
Normal file
@@ -0,0 +1,87 @@
|
||||
// API基础配置
|
||||
const config = {
|
||||
// 开发环境
|
||||
development: {
|
||||
baseURL: 'http://localhost:3000/api',
|
||||
timeout: 10000
|
||||
},
|
||||
// 生产环境
|
||||
production: {
|
||||
baseURL: 'https://api.jiebanke.com/api',
|
||||
timeout: 15000
|
||||
}
|
||||
}
|
||||
|
||||
// 获取当前环境配置
|
||||
const getConfig = () => {
|
||||
const env = process.env.NODE_ENV || 'development'
|
||||
return config[env]
|
||||
}
|
||||
|
||||
// API端点
|
||||
const endpoints = {
|
||||
// 用户相关
|
||||
USER: {
|
||||
LOGIN: '/auth/login',
|
||||
REGISTER: '/auth/register',
|
||||
PROFILE: '/user/profile',
|
||||
UPDATE_PROFILE: '/user/profile',
|
||||
UPLOAD_AVATAR: '/user/avatar'
|
||||
},
|
||||
|
||||
// 旅行计划
|
||||
TRAVEL: {
|
||||
LIST: '/travel/list',
|
||||
DETAIL: '/travel/detail',
|
||||
CREATE: '/travel/create',
|
||||
JOIN: '/travel/join',
|
||||
MY_PLANS: '/travel/my-plans',
|
||||
SEARCH: '/travel/search'
|
||||
},
|
||||
|
||||
// 动物认养
|
||||
ANIMAL: {
|
||||
LIST: '/animal/list',
|
||||
DETAIL: '/animal/detail',
|
||||
ADOPT: '/animal/adopt',
|
||||
MY_ANIMALS: '/animal/my-animals',
|
||||
CATEGORIES: '/animal/categories'
|
||||
},
|
||||
|
||||
// 送花服务
|
||||
FLOWER: {
|
||||
LIST: '/flower/list',
|
||||
DETAIL: '/flower/detail',
|
||||
ORDER: '/flower/order',
|
||||
MY_ORDERS: '/flower/my-orders',
|
||||
CATEGORIES: '/flower/categories'
|
||||
},
|
||||
|
||||
// 订单管理
|
||||
ORDER: {
|
||||
LIST: '/order/list',
|
||||
DETAIL: '/order/detail',
|
||||
CANCEL: '/order/cancel',
|
||||
PAY: '/order/pay',
|
||||
CONFIRM: '/order/confirm'
|
||||
},
|
||||
|
||||
// 支付相关
|
||||
PAYMENT: {
|
||||
CREATE: '/payment/create',
|
||||
QUERY: '/payment/query',
|
||||
REFUND: '/payment/refund'
|
||||
},
|
||||
|
||||
// 系统相关
|
||||
SYSTEM: {
|
||||
CONFIG: '/system/config',
|
||||
NOTICE: '/system/notice',
|
||||
FEEDBACK: '/system/feedback'
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
...getConfig(),
|
||||
endpoints
|
||||
}
|
||||
Reference in New Issue
Block a user