diff --git a/gym-manage-uniapp/common/img/icon/jianshen2.png b/gym-manage-uniapp/common/img/icon/jianshen2.png
new file mode 100644
index 0000000..c032879
Binary files /dev/null and b/gym-manage-uniapp/common/img/icon/jianshen2.png differ
diff --git a/gym-manage-uniapp/pages.json b/gym-manage-uniapp/pages.json
index 8ef8f0a..64b5e85 100644
--- a/gym-manage-uniapp/pages.json
+++ b/gym-manage-uniapp/pages.json
@@ -11,14 +11,16 @@
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "首页",
- "navigationStyle": "custom"
+ "navigationStyle": "custom",
+ "enablePullDownRefresh": true
}
},
{
"path": "pages/search/search",
"style": {
"navigationBarTitleText": "团课搜索",
- "navigationStyle": "custom"
+ "navigationStyle": "custom",
+ "enablePullDownRefresh": true
}
},
{
@@ -32,7 +34,16 @@
"path": "pages/profile/profile",
"style": {
"navigationBarTitleText": "个人中心",
- "navigationStyle": "custom"
+ "navigationStyle": "custom",
+ "enablePullDownRefresh": true
+ }
+ },
+ {
+ "path": "pages/my-courses/my-courses",
+ "style": {
+ "navigationBarTitleText": "我的课程",
+ "navigationStyle": "custom",
+ "enablePullDownRefresh": true
}
}
],
@@ -60,6 +71,12 @@
"iconPath": "static/icon/jianshen.png",
"selectedIconPath": "static/icon/jianshen.png"
},
+ {
+ "pagePath": "pages/my-courses/my-courses",
+ "text": "我的课程",
+ "iconPath": "static/icon/jianshen2.png",
+ "selectedIconPath": "static/icon/jianshen2.png"
+ },
{
"pagePath": "pages/profile/profile",
"text": "我的",
diff --git a/gym-manage-uniapp/pages/course-detail/course-detail.vue b/gym-manage-uniapp/pages/course-detail/course-detail.vue
index ad3b7d3..2dbe5a5 100644
--- a/gym-manage-uniapp/pages/course-detail/course-detail.vue
+++ b/gym-manage-uniapp/pages/course-detail/course-detail.vue
@@ -294,7 +294,8 @@
async handleBooking() {
if (!this.course.canBook || this.submitting) return
const memberInfo = store.getMemberInfo()
- if (!memberInfo || !memberInfo.memberId) {
+ const memberId = memberInfo ? (memberInfo.memberId || memberInfo.id) : null
+ if (!memberId) {
uni.showToast({ title: '请先登录', icon: 'none' })
return
}
@@ -302,10 +303,12 @@
try {
await bookingApi.bookCourse({
courseId: this.course.id,
- memberId: memberInfo.memberId || memberInfo.id
+ memberId: memberId
})
+ uni.hideLoading()
uni.showToast({ title: '预约成功', icon: 'success' })
- setTimeout(() => { uni.navigateBack() }, 1000)
+ // 跳转到「我的课程」页面
+ setTimeout(() => { uni.switchTab({ url: '/pages/my-courses/my-courses' }) }, 1000)
} catch (e) {
console.error('预约失败:', e)
const msg = (e.data && e.data.message) || '预约失败,请重试'
diff --git a/gym-manage-uniapp/pages/index/index.vue b/gym-manage-uniapp/pages/index/index.vue
index 6a854c3..da8868f 100644
--- a/gym-manage-uniapp/pages/index/index.vue
+++ b/gym-manage-uniapp/pages/index/index.vue
@@ -117,6 +117,9 @@
}
this.loadData()
},
+ onPullDownRefresh() {
+ this.loadData().finally(() => { uni.stopPullDownRefresh() })
+ },
methods: {
goToCourseDetail(id) { uni.navigateTo({ url: '/pages/course-detail/course-detail?id=' + id }) },
goToSearch() { uni.switchTab({ url: '/pages/search/search' }) },
diff --git a/gym-manage-uniapp/pages/my-courses/my-courses.vue b/gym-manage-uniapp/pages/my-courses/my-courses.vue
new file mode 100644
index 0000000..927847e
--- /dev/null
+++ b/gym-manage-uniapp/pages/my-courses/my-courses.vue
@@ -0,0 +1,306 @@
+
+
+
+
+
+
+
+ 加载中...
+
+
+
+
+
+
+ 日期
+ {{ item.fullDate }}
+
+
+ 时间
+ {{ item.shortTime }} - {{ item.endShortTime }}
+
+
+ 地点
+ {{ item.location }}
+
+
+ 预约时间
+ {{ item.bookingTime }}
+
+
+
+
+
+
+
+
+
+ ⊙
+ 暂无预约课程
+ 前往预约团课 ›
+
+
+
+
+
+
+
+
+
+
+
diff --git a/gym-manage-uniapp/pages/profile/profile.vue b/gym-manage-uniapp/pages/profile/profile.vue
index 71eafba..3e6b0c9 100644
--- a/gym-manage-uniapp/pages/profile/profile.vue
+++ b/gym-manage-uniapp/pages/profile/profile.vue
@@ -164,6 +164,9 @@
if (!store.isLoggedIn) return
this.loadData()
},
+ onPullDownRefresh() {
+ this.loadData().finally(() => { uni.stopPullDownRefresh() })
+ },
methods: {
async loadData() {
this.loading = true
diff --git a/gym-manage-uniapp/pages/search/search.vue b/gym-manage-uniapp/pages/search/search.vue
index 0322b8d..ef1302a 100644
--- a/gym-manage-uniapp/pages/search/search.vue
+++ b/gym-manage-uniapp/pages/search/search.vue
@@ -125,6 +125,8 @@
diff --git a/gym-manage-uniapp/static/icon/jianshen2.png b/gym-manage-uniapp/static/icon/jianshen2.png
new file mode 100644
index 0000000..c032879
Binary files /dev/null and b/gym-manage-uniapp/static/icon/jianshen2.png differ