diff --git a/pages/index/index.vue b/pages/index/index.vue index 5d0a8bb..7258d6f 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -655,6 +655,7 @@ const handleBannerTap = (item) => { overflow: hidden; box-shadow: 0 2rpx 12rpx rgba(0, 0, 0, 0.04); padding: 19rpx; + margin-bottom: 20rpx; .activity-cover { width: 100%; diff --git a/pages/sub/activity/detail.vue b/pages/sub/activity/detail.vue index e2124c1..2200f98 100644 --- a/pages/sub/activity/detail.vue +++ b/pages/sub/activity/detail.vue @@ -39,7 +39,7 @@ {{ activityInfo.location }} - + @@ -134,6 +134,7 @@ import { ref } from 'vue'; import { onLoad } from '@dcloudio/uni-app'; import ActivityApi from '@/sheep/api/community/activity'; +import DictApi from '@/sheep/api/system/dict'; import sheep from '@/sheep'; // 当前Tab @@ -157,13 +158,43 @@ const activityInfo = ref({ introduction: '', }); +// 字典映射(动态加载) +const serviceCategoryMap = ref({}); +const serviceTargetMap = ref({}); + // 页面加载 onLoad((options) => { + // 并行加载字典 + loadDictMaps(); if (options.id) { loadActivityDetail(options.id); } }); +// 加载字典映射 +async function loadDictMaps() { + const [categoryRes, targetRes] = await Promise.all([ + DictApi.getDictDataListByType('comm_activity_service_category'), + DictApi.getDictDataListByType('comm_activity_service_target'), + ]); + + if (categoryRes.code === 0 && categoryRes.data) { + const map = {}; + categoryRes.data.forEach((item) => { + map[item.value] = item.label; + }); + serviceCategoryMap.value = map; + } + + if (targetRes.code === 0 && targetRes.data) { + const map = {}; + targetRes.data.forEach((item) => { + map[item.value] = item.label; + }); + serviceTargetMap.value = map; + } +} + // 安全解析 JSON 字符串 function safeJsonParse(str, defaultVal = []) { if (!str) return defaultVal; @@ -174,26 +205,6 @@ function safeJsonParse(str, defaultVal = []) { } } -// 服务类别映射 -const serviceCategoryMap = { - 1: '社区服务', - 2: '敬老服务', - 3: '助残服务', - 4: '关爱儿童', - 5: '环保宣传', - 6: '文明礼仪', - 7: '文化教育', -}; - -// 服务对象映射 -const serviceTargetMap = { - 1: '儿童', - 2: '孤寡老人', - 3: '残障人士', - 4: '优抚对象', - 5: '其他', -}; - // 加载活动详情 async function loadActivityDetail(id) { const { code, data } = await ActivityApi.getDetail(id); @@ -203,8 +214,8 @@ async function loadActivityDetail(id) { title: data.title || '', banners: safeJsonParse(data.bannerImages, [data.coverImage]).filter(Boolean), location: data.location || '', - serviceTypes: (data.serviceCategories || []).map((id) => serviceCategoryMap[id] || id), - targetAudience: (data.serviceTargets|| []).map((id) => serviceTargetMap[id] || id), + serviceTypes: (data.serviceCategories || []).map((id) => serviceCategoryMap.value[id] || id), + targetAudience: (data.serviceTargets || []).map((id) => serviceTargetMap.value[id] || id), registerDate: data.registrationStartTime && data.registrationEndTime ? `${sheep.$helper.timeFormat(data.registrationStartTime, 'yyyy/mm/dd')} - ${sheep.$helper.timeFormat(data.registrationEndTime, 'yyyy/mm/dd')}` : '', diff --git a/pages/sub/activity/list.vue b/pages/sub/activity/list.vue index 8a7c1da..df352d9 100644 --- a/pages/sub/activity/list.vue +++ b/pages/sub/activity/list.vue @@ -64,7 +64,7 @@ - + @@ -330,12 +330,10 @@ function handleFloatBtn() { bottom: 80rpx; width: 100rpx; height: 100rpx; - background: linear-gradient(135deg, #FA7E49 0%, #E86935 100%); border-radius: 50%; display: flex; align-items: center; justify-content: center; - box-shadow: 0 8rpx 24rpx rgba(250, 126, 73, 0.4); z-index: 99; &:active { @@ -343,9 +341,10 @@ function handleFloatBtn() { transform: scale(0.95); } - .sicon-edit { - font-size: 44rpx; - color: #FFFFFF; + .float-icon { + width: 130rpx; + height: 130rpx; + border-radius: 50%; } } diff --git a/static/sicon-edit.png b/static/sicon-edit.png new file mode 100644 index 0000000..410387e Binary files /dev/null and b/static/sicon-edit.png differ