实现部分页面前后端相通

This commit is contained in:
2026-07-16 17:29:27 +08:00
parent 7e45ecd144
commit a9ccdab421
16 changed files with 778 additions and 184 deletions
+12
View File
@@ -0,0 +1,12 @@
const http = require('../utils/request')
/**
* 微信小程序登录
* @param {string} code - wx.login() 返回的 code
* @param {string} [phoneCode] - 可选,手机号 code
*/
function miniappLogin(code, phoneCode) {
return http.post('/member/auth/miniapp/login', { code, phoneCode })
}
module.exports = { miniappLogin }
+34
View File
@@ -0,0 +1,34 @@
const http = require('../utils/request')
/** 预约课程 */
function bookCourse(params) {
return http.post('/groupCourse/book', params)
}
/** 取消预约 */
function cancelBooking(bookingId) {
return http.post('/groupCourse/booking/' + bookingId + '/cancel')
}
/** 获取会员的预约列表 */
function getMemberBookings(memberId) {
return http.get('/groupCourse/bookings/member/' + memberId)
}
/** 获取课程的预约列表 */
function getCourseBookings(courseId) {
return http.get('/groupCourse/bookings/course/' + courseId)
}
/** 获取预约详情 */
function getBookingDetail(bookingId) {
return http.get('/groupCourse/bookings/' + bookingId)
}
module.exports = {
bookCourse,
cancelBooking,
getMemberBookings,
getCourseBookings,
getBookingDetail
}
+40
View File
@@ -0,0 +1,40 @@
const http = require('../utils/request')
/** 分页查询团课 */
function getCoursesByPage(params) {
return http.post('/groupCourse/page', params)
}
/** 获取课程详情 */
function getCourseDetail(id) {
return http.get('/groupCourse/' + id + '/detail')
}
/** 获取团课类型列表 */
function getCourseTypes() {
return http.get('/groupCourse/types')
}
/** 获取课程标签 */
function getCourseLabels() {
return http.get('/groupCourse/labels')
}
/** 获取活跃推荐课程 */
function getActiveRecommendations() {
return http.get('/groupCourse/recommend/active')
}
/** 搜索团课 */
function searchCourses(params) {
return http.post('/groupCourse/search', params)
}
module.exports = {
getCoursesByPage,
getCourseDetail,
getCourseTypes,
getCourseLabels,
getActiveRecommendations,
searchCourses
}
+34
View File
@@ -0,0 +1,34 @@
const http = require('../utils/request')
/** 获取当前会员信息 */
function getMemberInfo() {
return http.get('/member/info')
}
/** 更新会员信息 */
function updateMemberInfo(data) {
return http.put('/member/info', data)
}
/** 获取活跃会员卡 */
function getActiveCards() {
return http.get('/member-cards/active')
}
/** 获取会员签到统计 */
function getCheckInStatistics() {
return http.get('/checkIn/statistics')
}
/** 获取会员签到记录 */
function getCheckInRecords(params) {
return http.get('/checkIn/records', { params })
}
module.exports = {
getMemberInfo,
updateMemberInfo,
getActiveCards,
getCheckInStatistics,
getCheckInRecords
}