const getBaseUrl = () => { const app = getApp(); return app && app.globalData && app.globalData.baseUrl ? app.globalData.baseUrl : ''; }; const API = { banners: '/api/eventclient/banners', eventList: '/api/eventclient/list', eventMyList: '/api/eventclient/my-events', eventDetail: (id) => `/api/eventclient/${id}`, eventRegistrationStatus: (registrationId) => `/api/eventclient/status/${registrationId}`, apply: '/api/eventclient/apply', calculateAmount: '/api/eventclient/calculate-amount', calculateRefundAmount: '/api/eventclient/calculate-refund-amount', cancelRegistrationRefund: '/api/eventclient/cancel-registration-refund', couponValidate: '/api/eventclient/coupon/validate', syncPayment: (registrationId) => `/api/eventclient/sync-payment/${registrationId}`, cancelRegistration: (registrationId) => `/api/eventclient/cancel/${registrationId}`, wechatLogin: '/api/oauth/login', loginByCode: '/api/oauth/login', // Refresh token endpoint (请按后端实际接口路径修改) oauthRefreshToken: '/api/oauth/refresh-token', oauthRegister: '/api/oauth/register', oauthResetPassword: '/api/oauth/reset-password', sendVerificationCode: '/api/sms/sendverificationcode', /** 小程序 wx.login 的 code 换 openid(按后端实际路径修改) */ wechatOpenidByJsCode: '/api/wechat/jscode2session', myProfile: '/api/my/profile', updateProfile: '/api/my/avatar/url', myAuth: '/api/my/auth', myRegistrations: '/api/my/registrations', myPoints: '/api/my/points', myOrders: '/api/my/orders', myTeams: '/api/my/teams', myCertificates: '/api/my/certificates', // 成绩查询、检录接口(后端接入时保持页面层无需改动) scoreEvents: '/api/eventclient/scores/events', scoreFilters: '/api/eventclient/scores/filters', scoreQuery: '/api/eventclient/scores/query', checkinContext: '/api/checkin/current', checkinStatus: '/api/checkin/status', checkinStart: '/api/checkin/start', checkinScan: '/api/checkin/scan', checkinOnStage: '/api/checkin/on-stage', checkinProgress: '/api/checkin/progress', refereeProfileOptions: '/api/referee/profile/options', refereeProfile: '/api/referee/profile', refereeProfileSubmit: '/api/referee/profile/submit', refereeRegistrationCode: (code) => `/api/referee/registration-code/${encodeURIComponent(code)}`, refereeApplicationQuota: '/api/referee/applications/quota', refereeApplications: '/api/referee/applications', refereeApply: '/api/referee/applications/apply', fileUpload: '/api/file/upload', uploadMaterial: '/api/eventclient/upload-material', ocrIdCard: '/api/ocr/recognize/idcard', ocrPassport: '/api/ocr/recognize/passport', ocrHousehold: '/api/ocr/recognize/household' }; module.exports = { getBaseUrl, API };