diff --git a/pages.json b/pages.json
index 8c1db5f..54a669b 100644
--- a/pages.json
+++ b/pages.json
@@ -659,6 +659,17 @@
"group": "物业管理"
}
},
+ {
+ "path": "activity/my-registration",
+ "style": {
+ "navigationBarTitleText": "我的报名"
+ },
+ "meta": {
+ "sync": true,
+ "title": "我的报名",
+ "group": "物业管理"
+ }
+ },
{
"path": "staff/index",
"style": {
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 237b373..5d0a8bb 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -77,23 +77,28 @@
-
-
-
+
+
+
- 福清市音西街道融侨馨苑1号楼下
+ {{ item.location }}
报名日期:
- 2025/06/30-2025/07/01
+ {{ item.registerDate }}
活动日期:
- 2025/07/05 12:00-2025/07/05 18:00
+ {{ item.dateRange }}
@@ -106,6 +111,7 @@ import { ref, onMounted, computed } from 'vue';
import { onLoad, onShow } from '@dcloudio/uni-app';
import MemberHouseApi from '@/sheep/api/community/memberHouse';
import NoticeApi from '@/sheep/api/community/notice';
+import ActivityApi from '@/sheep/api/community/activity';
import sheep from '@/sheep';
// 状态栏高度
@@ -122,7 +128,7 @@ const selectedCommunityName = ref('');
// 当前小区名称
const communityName = computed(() => {
- return selectedCommunityName.value || userInfo.value.currentCommunityName || '请选择小区';
+ return userInfo.value.currentCommunityName || selectedCommunityName.value || '请选择小区';
});
// 是否已完成房屋认证(根据 currentHouseId 判断)
@@ -143,11 +149,16 @@ const houseAddress = computed(() => {
// 通知数据
const noticeTitle = ref('');
+// 活动列表数据(首页只展示2条)
+const activityList = ref([]);
+
// 查询最新通知
const fetchNotice = async () => {
const { code, data } = await NoticeApi.getPage({ pageNo: 1, pageSize: 1 });
if (code === 0 && data && data.list && data.list.length > 0) {
noticeTitle.value = data.list[0].title;
+ }else{
+ noticeTitle.value = '';
}
};
@@ -165,6 +176,8 @@ const fetchBannerList = async () => {
icon: item.picUrl,
url: item.url,
}));
+ } else {
+ bannerList.value = [];
}
};
@@ -208,6 +221,28 @@ const fetchFunctionList = async () => {
}
};
+// 查询活动列表(首页只取2条)
+const fetchActivityList = async () => {
+ const { code, data } = await ActivityApi.getPage({
+ pageNo: 1,
+ pageSize: 2,
+ });
+ if (code === 0 && data) {
+ activityList.value = (data.list || []).map((item) => ({
+ id: item.id,
+ title: item.title || '',
+ cover: item.coverImage || '/static/img/guest.png',
+ location: item.location || '',
+ registerDate: item.registrationStartTime && item.registrationEndTime
+ ? `${sheep.$helper.timeFormat(item.registrationStartTime, 'yyyy/mm/dd')} - ${sheep.$helper.timeFormat(item.registrationEndTime, 'yyyy/mm/dd')}`
+ : '',
+ dateRange: item.activityStartTime && item.activityEndTime
+ ? `${sheep.$helper.timeFormat(item.activityStartTime, 'yyyy/mm/dd hh:MM')} - ${sheep.$helper.timeFormat(item.activityEndTime, 'yyyy/mm/dd hh:MM')}`
+ : '',
+ }));
+ }
+};
+
onLoad(() => {
// 获取状态栏高度
const systemInfo = uni.getSystemInfoSync();
@@ -220,6 +255,8 @@ onLoad(() => {
fetchBannerList();
// 加载功能入口
fetchFunctionList();
+ // 加载活动列表(只取2条)
+ fetchActivityList();
});
onShow(() => {
@@ -227,6 +264,11 @@ onShow(() => {
if (userStore.isLogin) {
userStore.getInfo();
}
+ // 重新加载所有数据(切换房屋后 tenant-id 已变更)
+ fetchNotice();
+ fetchBannerList();
+ fetchFunctionList();
+ fetchActivityList();
});
// 获取小区房屋树
@@ -269,8 +311,22 @@ const showCommunityPicker = () => {
communityId: selectedCommunity.communityId,
});
if (switchRes.code === 0) {
- // 切换成功后刷新用户信息
- await userStore.getInfo();
+ const resData = switchRes.data || {};
+ // 刷新 token / 用户信息
+ if (resData.needRelogin) {
+ await userStore.setToken(resData.accessToken, resData.refreshToken);
+ } else {
+ await userStore.getInfo();
+ }
+ // 刷新请求头 tenant-id
+ if (resData.communityId) {
+ uni.setStorageSync('tenant-id', String(resData.communityId));
+ }
+ // 重新加载首页数据
+ fetchNotice();
+ fetchBannerList();
+ fetchFunctionList();
+ fetchActivityList();
uni.showToast({ title: '切换成功', icon: 'success' });
}
}
@@ -326,8 +382,8 @@ const goActivityList = () => {
};
// 活动详情
-const goActivityDetail = () => {
- uni.navigateTo({ url: '/pages/sub/activity/detail?id=1' });
+const goActivityDetail = (item) => {
+ uni.navigateTo({ url: `/pages/sub/activity/detail?id=${item.id}` });
};
// Banner点击跳转
diff --git a/pages/index/switch-house.vue b/pages/index/switch-house.vue
index 2492047..59bdd00 100644
--- a/pages/index/switch-house.vue
+++ b/pages/index/switch-house.vue
@@ -136,6 +136,11 @@ const selectHouse = async (item) => {
await sheep.$store('user').getInfo();
}
+ // 刷新请求头中的 tenant-id
+ if (resData.communityId) {
+ uni.setStorageSync('tenant-id', String(resData.communityId));
+ }
+
uni.showToast({ title: '已切换至 ' + item.name, icon: 'none' });
// 回到首页重新加载数据
diff --git a/pages/index/user.vue b/pages/index/user.vue
index 4709b6e..1972393 100644
--- a/pages/index/user.vue
+++ b/pages/index/user.vue
@@ -117,7 +117,7 @@ const updateUserInfo = () => {
avatar: user.avatar || '/static/img/login_img.png',
nickname: user.nickname || '未登录',
mobile: user.mobile || '',
- communityAddress: user.communityAddress || '未设置地址'
+ communityAddress: user.currentCommunityName || '未设置地址'
};
};
diff --git a/pages/sub/activity/detail.vue b/pages/sub/activity/detail.vue
index 7e05b0c..e2124c1 100644
--- a/pages/sub/activity/detail.vue
+++ b/pages/sub/activity/detail.vue
@@ -37,9 +37,9 @@
-
+
{{ activityInfo.location }}
-
+
@@ -80,14 +80,14 @@
-
+
人数上限:
{{ activityInfo.maxPeople }}人
-
+
{{ activityInfo.contactName }}
{{ activityInfo.contactPhone }}
@@ -105,14 +105,26 @@
-
+
-
- 已有{{ activityInfo.registeredCount }}人报名
-
-
- 返回
-
+
+
+
+ 立即报名
+
+
+ 返回
+
+
+
+
+
+ 已有{{ activityInfo.registeredCount }}人报名
+
+
+ 取消报名
+
+
@@ -121,6 +133,8 @@
@@ -174,7 +178,8 @@ function handleFloatBtn() {
.activity-list-page {
display: flex;
flex-direction: column;
- min-height: 100vh;
+ height: calc(100vh - 176rpx);
+ overflow: hidden;
position: relative;
}
@@ -205,9 +210,10 @@ function handleFloatBtn() {
}
}
-/* 活动列表滚动区域 - 高度由JS动态绑定 */
+/* 活动列表滚动区域:flex:1 占满剩余空间,height:0 是小程序 scroll-view 配合 flex 的关键 */
.activity-scroll {
- flex: 1; /* 占据剩余空间 */
+ flex: 1;
+ height: 0;
}
/* 列表内容包裹层 */
@@ -254,6 +260,15 @@ function handleFloatBtn() {
display: flex;
align-items: center;
margin-top: 8rpx;
+
+ &.nowrap {
+ flex-wrap: nowrap;
+ white-space: nowrap;
+ }
+
+ &.wrap {
+ flex-wrap: wrap;
+ }
}
.item-location {
@@ -279,23 +294,28 @@ function handleFloatBtn() {
}
.item-value {
- font-size: 24rpx;
+ font-size: 22rpx;
color: #333333;
}
.item-date {
- font-size: 24rpx;
+ font-size: 20rpx;
color: #666666;
}
}
}
+.load-more{
+ text-align: center;
+ padding-top: 30rpx;
+}
+
/* 空状态 */
.empty-state {
display: flex;
align-items: center;
justify-content: center;
- padding: 200rpx 0;
+ flex: 1;
.empty-text {
font-size: 28rpx;
diff --git a/pages/sub/activity/my-registration.vue b/pages/sub/activity/my-registration.vue
new file mode 100644
index 0000000..af46a73
--- /dev/null
+++ b/pages/sub/activity/my-registration.vue
@@ -0,0 +1,314 @@
+
+
+
+
+
+
+ 暂无报名记录
+
+
+
+
+
+
+
+
+
+
+
+ {{ item.title }}
+
+ {{ item.location }}
+ {{ item.statusText }}
+
+
+ 报名日期:
+ {{ item.registerDate }}
+
+
+ {{ item.dateRange }}
+
+
+
+
+
+
+ {{ finished ? '没有更多了' : loading ? '加载中...' : '上拉加载更多' }}
+
+
+
+
+
+
+ 返回
+
+
+
+
+
+
+
+
diff --git a/sheep/api/community/activity.js b/sheep/api/community/activity.js
new file mode 100644
index 0000000..5cb0375
--- /dev/null
+++ b/sheep/api/community/activity.js
@@ -0,0 +1,66 @@
+import request from '@/sheep/request';
+
+const ActivityApi = {
+ // 获取活动列表
+ getPage: (data) => {
+ return request({
+ url: '/community/activity/page',
+ method: 'GET',
+ params: data,
+ custom: {
+ showLoading: true,
+ auth: true,
+ },
+ });
+ },
+ // 获取活动详情
+ getDetail: (id) => {
+ return request({
+ url: '/community/activity/get',
+ method: 'GET',
+ params: { id },
+ custom: {
+ showLoading: true,
+ auth: true,
+ },
+ });
+ },
+ // 活动报名
+ register: (data) => {
+ return request({
+ url: '/community/activity/registration',
+ method: 'POST',
+ data,
+ custom: {
+ showLoading: true,
+ auth: true,
+ },
+ });
+ },
+ // 取消报名
+ cancelRegister: (id) => {
+ return request({
+ url: '/community/activity/registration/cancel',
+ method: 'POST',
+ params: { id },
+ custom: {
+ showLoading: true,
+ auth: true,
+ },
+ });
+ },
+ // 我的报名列表
+ getMyRegistrationPage: (data) => {
+ return request({
+ url: '/community/activity/registration/page',
+ method: 'GET',
+ params: data,
+ custom: {
+ showLoading: true,
+ auth: true,
+ },
+ });
+ },
+};
+
+export default ActivityApi;
diff --git a/static/img/Group_1.png b/static/img/Group_1.png
deleted file mode 100644
index 7f676a1..0000000
Binary files a/static/img/Group_1.png and /dev/null differ
diff --git a/static/img/Group_2.png b/static/img/Group_2.png
deleted file mode 100644
index a7e8916..0000000
Binary files a/static/img/Group_2.png and /dev/null differ
diff --git a/static/img/Group_3.png b/static/img/Group_3.png
deleted file mode 100644
index 394fdce..0000000
Binary files a/static/img/Group_3.png and /dev/null differ
diff --git a/static/img/Group_4.png b/static/img/Group_4.png
deleted file mode 100644
index 472fe67..0000000
Binary files a/static/img/Group_4.png and /dev/null differ
diff --git a/static/img/Group_5.png b/static/img/Group_5.png
deleted file mode 100644
index 2831cc4..0000000
Binary files a/static/img/Group_5.png and /dev/null differ
diff --git a/static/img/Group_6.png b/static/img/Group_6.png
deleted file mode 100644
index 98bcfe0..0000000
Binary files a/static/img/Group_6.png and /dev/null differ
diff --git a/static/img/Group_7.png b/static/img/Group_7.png
deleted file mode 100644
index ce0babd..0000000
Binary files a/static/img/Group_7.png and /dev/null differ
diff --git a/static/img/Group_8.png b/static/img/Group_8.png
deleted file mode 100644
index 7c6e867..0000000
Binary files a/static/img/Group_8.png and /dev/null differ
diff --git a/static/img/dh.png b/static/img/dh.png
new file mode 100644
index 0000000..5e3ed86
Binary files /dev/null and b/static/img/dh.png differ
diff --git a/static/img/dw.png b/static/img/dw.png
new file mode 100644
index 0000000..94b8ff0
Binary files /dev/null and b/static/img/dw.png differ
diff --git a/static/img/people.png b/static/img/people.png
new file mode 100644
index 0000000..6bd4105
Binary files /dev/null and b/static/img/people.png differ
diff --git a/static/img/phone.png b/static/img/phone.png
new file mode 100644
index 0000000..1921bb1
Binary files /dev/null and b/static/img/phone.png differ