修改活动报名按钮状态,报修添加小区参数;访客返回数据

This commit is contained in:
zhouyanli
2026-06-24 09:06:10 +08:00
parent d5cacf4087
commit a501524646
9 changed files with 82 additions and 21 deletions

View File

@@ -19,14 +19,14 @@
/* */ /* */
"modules" : { "modules" : {
"Geolocation" : {}, "Geolocation" : {},
"Maps" : {},
"Camera" : {}, "Camera" : {},
"Contacts" : {}, "Contacts" : {},
"Gallery" : {}, "Gallery" : {},
"Push" : {}, "Push" : {},
"Barcode" : {}, "Barcode" : {},
"Payment" : {}, "Payment" : {},
"Bluetooth" : {} "Bluetooth" : {},
"Maps" : {}
}, },
/* */ /* */
"distribute" : { "distribute" : {

View File

@@ -98,7 +98,7 @@
@tap.stop="signupActivity(activity)"> @tap.stop="signupActivity(activity)">
立即报名 立即报名
</button> </button>
<button v-if="activeTab === 'list' && activity.applied === true" class="action-btn signup-btn" <button v-if="activeTab === 'list' && activity.applied === true && activity.statusText !== '已结束'" class="action-btn signup-btn"
@tap.stop="cancelActivity(activity)"> @tap.stop="cancelActivity(activity)">
取消报名 取消报名
</button> </button>

View File

@@ -119,10 +119,11 @@
<view class="record-user"> <view class="record-user">
<view class="user-avatar"> <view class="user-avatar">
<uni-icons type="person" size="20" color="#999"></uni-icons> <uni-icons type="person" size="20" color="#999"></uni-icons>
<!-- <image :src="record.userAvatar" mode="aspectFill"></image> -->
</view> </view>
<view class="user-info"> <view class="user-info">
<view class="user-name">微信用户</view> <view class="user-name">{{record.userNickname || '微信用户'}}</view>
<view class="record-time">{{ record.time }}</view> <view class="record-time">{{ record.createTime }}</view>
<view class="record-content">{{ record.content }}</view> <view class="record-content">{{ record.content }}</view>
<!-- 图片展示 --> <!-- 图片展示 -->
<view v-if="record.images && record.images.length > 0" class="record-images"> <view v-if="record.images && record.images.length > 0" class="record-images">
@@ -149,9 +150,18 @@
<!-- 底部操作栏 --> <!-- 底部操作栏 -->
<view class="bottom-bar"> <view class="bottom-bar">
<!-- 活动已结束且未报名显示不可点击的结束按钮 -->
<button
v-if="isActivityEnded && !hasSigned && activeTab === 'detail'"
class="action-btn ended-btn"
disabled
>
报名已结束
</button>
<!-- 未报名状态显示报名按钮 --> <!-- 未报名状态显示报名按钮 -->
<button <button
v-if="!hasSigned && activeTab === 'detail'" v-if="!isActivityEnded && !hasSigned && activeTab === 'detail'"
class="action-btn signup-btn" class="action-btn signup-btn"
@tap="handleSignup" @tap="handleSignup"
> >
@@ -209,7 +219,7 @@
</template> </template>
<script setup> <script setup>
import { ref, onMounted } from 'vue' import { ref, onMounted, computed } from 'vue'
import {onLoad,onUnload} from '@dcloudio/uni-app' import {onLoad,onUnload} from '@dcloudio/uni-app'
import moment from 'moment' import moment from 'moment'
import {getActivityDetails,confirmResident,cancelActivity,getActivityLive} from '../api/api.js' import {getActivityDetails,confirmResident,cancelActivity,getActivityLive} from '../api/api.js'
@@ -226,6 +236,15 @@ const navTitle = ref('')
const curActivityId = ref('') // 当前活动的id const curActivityId = ref('') // 当前活动的id
const activityConent = ref({}) // 获取详情数据 const activityConent = ref({}) // 获取详情数据
// 判断活动是否已结束
const isActivityEnded = computed(() => {
// 优先使用后端返回的状态字段status: '2' 或 statusText: '已结束'
if (activityConent.value.status === '2' || activityConent.value.statusText === '已结束') return true
// 备选:通过 endTime 时间判断
if (!activityConent.value.applyDeadline) return false
return moment().isAfter(moment(activityConent.value.applyDeadline))
})
// 实况记录数据 // 实况记录数据
const liveRecords = ref([ const liveRecords = ref([
// { // {
@@ -262,13 +281,13 @@ onLoad((option) =>{
// 2. 初始化数据 // 2. 初始化数据
if (curActivityId.value) { if (curActivityId.value) {
getActivityDetailsData(curActivityId.value) // 获取活动详情 getActivityDetailsData(curActivityId.value) // 获取活动详情
getLiveActivityList() // 获取实况列表 // getLiveActivityList() // 获取实况列表
} }
// 3. 监听实况列表刷新事件 // 3. 监听实况列表刷新事件
uni.$on('refreshLiveList', () => { // uni.$on('refreshLiveList', () => {
getLiveActivityList() // getLiveActivityList()
}) // })
}) })
// 获取列表详情 // 获取列表详情
@@ -294,9 +313,13 @@ const getActivityDetailsData = async (id) =>{
} }
} }
// 切换选项卡 // 切换选项卡
const switchTab = (tab) => { const switchTab = (tab) => {
activeTab.value = tab activeTab.value = tab
if (tab === 'status') {
getLiveActivityList()
}
} }
// 返回上一页 // 返回上一页
@@ -434,7 +457,7 @@ const liveClick = () =>{
// --------- // ---------
onUnload(() => { onUnload(() => {
uni.$off('refreshLiveList') // uni.$off('refreshLiveList')
}) })
// 显示提示信息 // 显示提示信息
@@ -759,6 +782,12 @@ const showToastMessage = (message) => {
box-shadow: 0 4rpx 20rpx rgba(0, 122, 255, 0.2); box-shadow: 0 4rpx 20rpx rgba(0, 122, 255, 0.2);
} }
.ended-btn {
background: linear-gradient(135deg, #ccc 0%, #999 100%);
color: #fff;
opacity: 0.7;
}
/* 模态框 */ /* 模态框 */
.modal { .modal {
display: none; display: none;

View File

@@ -77,7 +77,6 @@ const latitude = ref('');
// 接收活动ID // 接收活动ID
onLoad((option) => { onLoad((option) => {
console.log('idiidd',option)
activityId.value = option?.id || ''; activityId.value = option?.id || '';
}); });

View File

@@ -203,6 +203,8 @@ const goBack = () => {
uni.switchTab({ uni.switchTab({
url:"/pages/serviceIndex/serviceIndex" url:"/pages/serviceIndex/serviceIndex"
}) })
}else{
uni.navigateBack()
} }
uni.removeStorageSync('sourcePage') uni.removeStorageSync('sourcePage')

View File

@@ -278,7 +278,7 @@
} }
const goBack = () => { const goBack = () => {
console.log(uni.getStorageSync('sourcePage')) console.log('返回',uni.getStorageSync('sourcePage'))
if (uni.getStorageSync('sourcePage') == 'serviceIndex') { if (uni.getStorageSync('sourcePage') == 'serviceIndex') {
uni.switchTab({ uni.switchTab({
url: '/pages/serviceIndex/serviceIndex' url: '/pages/serviceIndex/serviceIndex'

View File

@@ -107,7 +107,7 @@
<script setup> <script setup>
import { ref, computed } from "vue"; import { ref, computed } from "vue";
import { onLoad } from "@dcloudio/uni-app"; import { onLoad,onShow} from "@dcloudio/uni-app";
import { getVisitorList } from "../api/api.js"; import { getVisitorList } from "../api/api.js";
const activeTab = ref("waiting"); const activeTab = ref("waiting");
@@ -132,9 +132,13 @@ const mapData = (list) => {
}; };
const fetchVisitorList = async () => { const fetchVisitorList = async () => {
const userId = uni.getStorageSync("userId");
try { try {
const res = await getVisitorList({ userId }); const params = {
userId: uni.getStorageSync("userId"),
villageId:uni.getStorageSync('currentVillageId')
}
const res = await getVisitorList(params);
visitorList.value = mapData(res.data || []); visitorList.value = mapData(res.data || []);
} catch (err) { } catch (err) {
uni.showToast({ title: err.msg, icon: "none" }); uni.showToast({ title: err.msg, icon: "none" });
@@ -156,8 +160,11 @@ onLoad(() => {
// 列表区域可用高度 = 窗口高度 - 状态栏 - 导航栏 - tab栏 - 底部按钮区 // 列表区域可用高度 = 窗口高度 - 状态栏 - 导航栏 - tab栏 - 底部按钮区
scrollHeight.value = info.windowHeight - statusBarHeight.value - navPx - tabPx - btnPx; scrollHeight.value = info.windowHeight - statusBarHeight.value - navPx - tabPx - btnPx;
fetchVisitorList();
}); });
onShow(()=>{
fetchVisitorList();
})
const filterdList = computed(() => { const filterdList = computed(() => {
return visitorList.value.filter((item) => item.status === activeTab.value); return visitorList.value.filter((item) => item.status === activeTab.value);

View File

@@ -37,7 +37,11 @@
<scroll-view class="main-scroll" scroll-y> <scroll-view class="main-scroll" scroll-y>
<!-- banner --> <!-- banner -->
<view class="bannarClass"> <view class="bannarClass">
<up-swiper :key="bannerSwiperKey" :list="bannerList" indicator indicatorMode="dot" imgMode="aspectFill" radius="10"></up-swiper> <up-swiper :key="bannerSwiperKey" :list="bannerList" indicator indicatorMode="dot" radius="10">
<template #default="{ item, index }">
<image :src="item" mode="aspectFill" class="banner-img" @tap="bannerClick(index)"></image>
</template>
</up-swiper>
</view> </view>
<!-- 公告 --> <!-- 公告 -->
<view class="noticeClass" @click="getNoticeMore"> <view class="noticeClass" @click="getNoticeMore">
@@ -182,6 +186,7 @@ const currentCommunity = ref('请绑定房屋')
const currentVillageId = ref('') const currentVillageId = ref('')
const statusBarHeight = ref(0) const statusBarHeight = ref(0)
const bannerList = ref([]) const bannerList = ref([])
const bannerRawData = ref([]) // 保留原始数据含link
const bannerSwiperKey = ref(0) const bannerSwiperKey = ref(0)
const noticeText = ref('暂无公告') const noticeText = ref('暂无公告')
const noticeId = ref('') const noticeId = ref('')
@@ -205,7 +210,8 @@ const getbannarData = async () =>{
try{ try{
const res = await getBannarList({villageId:uni.getStorageSync('currentVillageId')}) const res = await getBannarList({villageId:uni.getStorageSync('currentVillageId')})
if(res.code === 200){ if(res.code === 200){
const newList = res.data.map(item => item.url) bannerRawData.value = res.data || []
const newList = (res.data || []).map(item => item.url)
// 只有 banner 数据真正变化时才更新,避免 swiper 反复重建 // 只有 banner 数据真正变化时才更新,避免 swiper 反复重建
if (JSON.stringify(newList) !== JSON.stringify(bannerList.value)) { if (JSON.stringify(newList) !== JSON.stringify(bannerList.value)) {
bannerList.value = newList bannerList.value = newList
@@ -220,6 +226,13 @@ const getbannarData = async () =>{
uni.showToast({title: msg,icon:'error'}) uni.showToast({title: msg,icon:'error'})
} }
} }
// banner点击跳转
const bannerClick = (index) => {
const item = bannerRawData.value[index]
if (item && item.link) {
uni.navigateTo({ url: item.link })
}
}
// 接收选择小区返回的参数 // 接收选择小区返回的参数
const slelctHomeData = (data) =>{ const slelctHomeData = (data) =>{
// console.log('收到B页面返回的数据', data) // console.log('收到B页面返回的数据', data)
@@ -317,6 +330,7 @@ const resetPageData = () => {
currentVillageId.value = '' currentVillageId.value = ''
activityList.value = [] activityList.value = []
bannerList.value = [] bannerList.value = []
bannerRawData.value = []
noticeText.value = '暂无公告' noticeText.value = '暂无公告'
noticeId.value = '' noticeId.value = ''
} }
@@ -555,6 +569,11 @@ const moreClick = () =>{
::v-deep .u-swiper__wrapper__item__wrapper__image{ ::v-deep .u-swiper__wrapper__item__wrapper__image{
height: 300rpx !important; height: 300rpx !important;
} }
::v-deep .banner-img{
height: 300rpx !important;
width: 100%;
border-radius: 10rpx;
}
} }
.noticeClass{ .noticeClass{
padding: 0rpx 36rpx; padding: 0rpx 36rpx;

View File

@@ -8,7 +8,7 @@
<view class="container"> <view class="container">
<!-- 顶部 Banner 轮播 --> <!-- 顶部 Banner 轮播 -->
<view class="banner-box" style="overflow-y: hidden;"> <view class="banner-box" style="overflow-y: hidden;">
<image class="banner-img" src="http://47.104.199.163:9090/images/propertyImgs/serviceImg2.png" /> <image class="banner-img" src="http://47.104.199.163:9090/images/propertyImgs/serviceImg2.png" @tap="bannnerClick"/>
</view> </view>
<!-- 常用功能区 --> <!-- 常用功能区 -->
@@ -140,6 +140,11 @@
complete: () => {} complete: () => {}
}); });
} }
// banner跳转
function bannnerClick(){
uni.navigateTo({ url: '/pageSubPack/online-repair/onlineRepair'})
}
</script> </script>