对接活动实况接口;注掉登录接口代码
This commit is contained in:
@@ -54,7 +54,16 @@
|
|||||||
"setting" : {
|
"setting" : {
|
||||||
"urlCheck" : false
|
"urlCheck" : false
|
||||||
},
|
},
|
||||||
"usingComponents" : true
|
"usingComponents" : true,
|
||||||
|
"requiredPrivateInfos": [
|
||||||
|
"getLocation", // 定位接口(必填)
|
||||||
|
"chooseLocation" // 如果用到选择位置也加
|
||||||
|
],
|
||||||
|
"permission": {
|
||||||
|
"scope.userLocation": {
|
||||||
|
"desc": "你的位置信息将用于活动地点定位、签到验证等功能"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"mp-alipay" : {
|
"mp-alipay" : {
|
||||||
"usingComponents" : true
|
"usingComponents" : true
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ const loadMoreData = () => {
|
|||||||
*/
|
*/
|
||||||
const formatDate = (date) => {
|
const formatDate = (date) => {
|
||||||
if (!date) return ''
|
if (!date) return ''
|
||||||
return moment(date).format('YYYY-MM-DD HH:mm:ss')
|
return moment(date).format('YYYY-MM-DD HH:mm')
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -37,20 +37,20 @@
|
|||||||
<view class="info-section">
|
<view class="info-section">
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<view class="info-label">报名截止时间</view>
|
<view class="info-label">报名截止时间</view>
|
||||||
<view class="info-value">{{activityConent.applyDeadline}}</view>
|
<view class="info-value">{{formatTime(activityConent.applyDeadline)}}</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<view class="info-label">活动时间</view>
|
<view class="info-label">活动时间</view>
|
||||||
<view class="info-value">
|
<view class="info-value">
|
||||||
<text>{{activityConent.startTime}} 至 {{activityConent.endTime}}</text>
|
<text>{{formatTime(activityConent.startTime)}} 至 {{formatTime(activityConent.endTime)}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="info-item">
|
<view class="info-item">
|
||||||
<view class="info-label">签到时间</view>
|
<view class="info-label">签到时间</view>
|
||||||
<view class="info-value">
|
<view class="info-value">
|
||||||
<text>{{activityConent.signinStartTime}} 至 {{activityConent.signinEndTime}}</text>
|
<text>{{formatTime(activityConent.signinStartTime)}} 至 {{formatTime(activityConent.signinEndTime)}}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
<view class="section" style="margin-bottom: 40rpx;">
|
<view class="section" style="margin-bottom: 40rpx;">
|
||||||
<view class="section-title">活动详情</view>
|
<view class="section-title">活动详情</view>
|
||||||
<view class="section-content">
|
<view class="section-content">
|
||||||
<view>{{activityConent.content}}</view>
|
<view>{{activityConent.content || "暂无"}}</view>
|
||||||
<view></view>
|
<view></view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@@ -168,7 +168,7 @@
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
<!-- 活动实况页显示添加实况按钮 -->
|
<!-- 活动实况页显示添加实况按钮 -->
|
||||||
<button class="action-btn add-status-btn" v-if="activeTab === 'status'" @click="liveClick">添加实况</button>
|
<button class="action-btn add-status-btn" v-if="hasSigned &&activeTab === 'status'" @click="liveClick">添加实况</button>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 报名确认模态框 -->
|
<!-- 报名确认模态框 -->
|
||||||
@@ -244,14 +244,32 @@ const liveRecords = ref([
|
|||||||
// }
|
// }
|
||||||
])
|
])
|
||||||
|
|
||||||
// 接受参数
|
|
||||||
|
// ========方法=====
|
||||||
|
// 时间格式化函数
|
||||||
|
const formatTime = (timeStr) => {
|
||||||
|
if (!timeStr) return ''
|
||||||
|
// 格式化:YYYY-MM-DD HH:mm:ss → 简化为 YYYY-MM-DD HH:mm
|
||||||
|
return moment(timeStr).format('YYYY-MM-DD HH:mm')
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---接收参数---
|
||||||
onLoad((option) =>{
|
onLoad((option) =>{
|
||||||
navTitle.value = option?.title
|
navTitle.value = option?.title
|
||||||
curActivityId.value = option?.id
|
curActivityId.value = option?.id
|
||||||
// 处理applied参数(可能是字符串类型,需要转布尔)
|
// 处理applied参数(可能是字符串类型,需要转布尔)
|
||||||
hasSigned.value = option?.applied === 'true' || option?.applied === true
|
hasSigned.value = option?.applied === 'true' || option?.applied === true
|
||||||
// console.log('hasSigned.value',hasSigned.value)
|
// console.log('hasSigned.value',hasSigned.value)
|
||||||
getActivityDetailsData(curActivityId.value)
|
// 2. 初始化数据
|
||||||
|
if (curActivityId.value) {
|
||||||
|
getActivityDetailsData(curActivityId.value) // 获取活动详情
|
||||||
|
getLiveActivityList() // 获取实况列表
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 监听实况列表刷新事件
|
||||||
|
uni.$on('refreshLiveList', () => {
|
||||||
|
getLiveActivityList()
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// 获取列表详情
|
// 获取列表详情
|
||||||
@@ -356,7 +374,7 @@ const cancelActivityData = async () =>{
|
|||||||
try{
|
try{
|
||||||
const res = await cancelActivity(curActivityId.value)
|
const res = await cancelActivity(curActivityId.value)
|
||||||
if(res.code === 200){
|
if(res.code === 200){
|
||||||
hasSigned.value = true // 报名成功后更新状态
|
hasSigned.value = false // 报名成功后更新状态
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '取消报名成功',
|
title: '取消报名成功',
|
||||||
icon:"success"
|
icon:"success"
|
||||||
@@ -364,7 +382,7 @@ const cancelActivityData = async () =>{
|
|||||||
setTimeout(() =>{
|
setTimeout(() =>{
|
||||||
uni.$emit('refreshActivityList', {
|
uni.$emit('refreshActivityList', {
|
||||||
activityId: curActivityId.value,
|
activityId: curActivityId.value,
|
||||||
isSigned: true
|
isSigned: false
|
||||||
})
|
})
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
},1500)
|
},1500)
|
||||||
@@ -414,12 +432,6 @@ const liveClick = () =>{
|
|||||||
// 监听实况列表刷新
|
// 监听实况列表刷新
|
||||||
|
|
||||||
// ---------
|
// ---------
|
||||||
onLoad(() =>{
|
|
||||||
uni.$on('refreshLiveList', () => {
|
|
||||||
getLiveActivityList();
|
|
||||||
});
|
|
||||||
getLiveActivityList()
|
|
||||||
})
|
|
||||||
onUnload(() => {
|
onUnload(() => {
|
||||||
uni.$off('refreshLiveList')
|
uni.$off('refreshLiveList')
|
||||||
})
|
})
|
||||||
@@ -446,6 +458,12 @@ const showToastMessage = (message) => {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
background: linear-gradient(to bottom left, #E2F0FF 0%, #ffffff 50%)
|
background: linear-gradient(to bottom left, #E2F0FF 0%, #ffffff 50%)
|
||||||
}
|
}
|
||||||
|
/* 状态栏 */
|
||||||
|
.status_bar {
|
||||||
|
height: 46px;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
/* 顶部导航栏 */
|
/* 顶部导航栏 */
|
||||||
.nav-bar {
|
.nav-bar {
|
||||||
height: 90rpx;
|
height: 90rpx;
|
||||||
@@ -489,10 +507,6 @@ const showToastMessage = (message) => {
|
|||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
margin-bottom: 120rpx;
|
margin-bottom: 120rpx;
|
||||||
}
|
}
|
||||||
.status_bar {
|
|
||||||
height: 46px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 选项卡 */
|
/* 选项卡 */
|
||||||
.tabs {
|
.tabs {
|
||||||
|
|||||||
@@ -103,25 +103,109 @@ const deleteImg = (index) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 重新定位
|
// 重新定位
|
||||||
|
// 定位并获取具体地点名称
|
||||||
const reLocate = () => {
|
const reLocate = () => {
|
||||||
uni.showLoading({ title: '定位中...' });
|
uni.showLoading({ title: '定位中...' });
|
||||||
|
|
||||||
|
// 第一步:获取经纬度
|
||||||
uni.getLocation({
|
uni.getLocation({
|
||||||
type: 'gcj02',
|
type: 'gcj02', // 微信地图专用坐标系,必须用这个
|
||||||
success: (res) => {
|
success: (locRes) => {
|
||||||
uni.hideLoading();
|
// 第二步:通过经纬度逆解析为具体地址
|
||||||
longitude.value = res.longitude;
|
uni.request({
|
||||||
latitude.value = res.latitude;
|
url: 'https://apis.map.qq.com/ws/geocoder/v1/', // 腾讯地图逆地理编码接口(免费)
|
||||||
location.value = `${res.longitude},${res.latitude}`;
|
data: {
|
||||||
uni.showToast({ title: '定位成功', icon: 'success' });
|
location: `${locRes.latitude},${locRes.longitude}`, // 纬度,经度
|
||||||
|
key: 'XCNBZ-TJ46B-BCJUZ-JBMIM-LZWRJ-SBBWW', // 替换成你自己的Key(下面教你怎么获取)
|
||||||
|
get_poi: 0 // 0=只返回基础地址,1=返回周边POI
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
success: (geoRes) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
if (geoRes.data.status === 0) {
|
||||||
|
// 解析成功,获取具体地址
|
||||||
|
const address = geoRes.data.result.address; // 完整地址(如:北京市海淀区中关村南大街5号)
|
||||||
|
const formattedAddress = geoRes.data.result.formatted_addresses.recommend; // 推荐地址(更简洁)
|
||||||
|
const province = geoRes.data.result.address_component.province; // 省
|
||||||
|
const city = geoRes.data.result.address_component.city; // 市
|
||||||
|
const district = geoRes.data.result.address_component.district; // 区
|
||||||
|
const street = geoRes.data.result.address_component.street; // 街道
|
||||||
|
|
||||||
|
// 保存数据(按需选择)
|
||||||
|
longitude.value = locRes.longitude;
|
||||||
|
latitude.value = locRes.latitude;
|
||||||
|
location.value = address; // 把location改为存储具体地址,而非经纬度
|
||||||
|
// 也可以自定义格式:location.value = `${city}${district}${street}`;
|
||||||
|
|
||||||
|
// 提示定位成功并显示地址
|
||||||
|
uni.showToast({ title: `定位成功:${formattedAddress}`, icon: 'success', duration: 2000 });
|
||||||
|
console.log('完整地址:', address);
|
||||||
|
console.log('省市区:', province, city, district);
|
||||||
|
} else {
|
||||||
|
// 解析地址失败,降级显示经纬度
|
||||||
|
location.value = `${locRes.longitude},${locRes.latitude}`;
|
||||||
|
uni.showToast({ title: '定位成功,但无法解析地址', icon: 'none' });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (geoErr) => {
|
||||||
|
uni.hideLoading();
|
||||||
|
// 接口请求失败,降级显示经纬度
|
||||||
|
location.value = `${locRes.longitude},${locRes.latitude}`;
|
||||||
|
uni.showToast({ title: '定位成功,地址解析失败', icon: 'none' });
|
||||||
|
console.error('地址解析失败:', geoErr);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
fail: (locErr) => {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
uni.showToast({ title: '定位失败,请检查权限', icon: 'none' });
|
uni.showToast({ title: '定位失败,请检查权限', icon: 'none' });
|
||||||
console.error('定位失败:', err);
|
console.error('定位失败:', locErr);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// const reLocate = () => {
|
||||||
|
// // 调用微信原生选择位置接口(自带地址解析,无调用上限)
|
||||||
|
// uni.chooseLocation({
|
||||||
|
// success: (res) => {
|
||||||
|
// // res.address = 具体地址(如:XX市XX区XX街道XX小区)
|
||||||
|
// // res.name = 地点名称(如:XX小区)
|
||||||
|
// longitude.value = res.longitude;
|
||||||
|
// latitude.value = res.latitude;
|
||||||
|
// location.value = res.address; // 显示具体地址
|
||||||
|
// uni.showToast({ title: `定位成功:${res.name}`, icon: 'success' });
|
||||||
|
// },
|
||||||
|
// fail: (err) => {
|
||||||
|
// // 处理权限拒绝/定位失败
|
||||||
|
// if (err.errMsg.includes('auth deny')) {
|
||||||
|
// uni.showModal({
|
||||||
|
// title: '需要定位权限',
|
||||||
|
// content: '请允许获取位置信息以显示具体地点',
|
||||||
|
// confirmText: '去设置',
|
||||||
|
// success: (modalRes) => {
|
||||||
|
// if (modalRes.confirm) {
|
||||||
|
// uni.openSetting({
|
||||||
|
// success: (settingRes) => {
|
||||||
|
// // 用户开启权限后重新定位
|
||||||
|
// if (settingRes.authSetting['scope.userLocation']) {
|
||||||
|
// reLocate();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// } else {
|
||||||
|
// uni.hideLoading();
|
||||||
|
// uni.showToast({ title: '定位失败,请重试', icon: 'none' });
|
||||||
|
// console.error('定位失败:', err);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// };
|
||||||
|
|
||||||
// 上传所有图片
|
// 上传所有图片
|
||||||
const uploadAllImages = async () => {
|
const uploadAllImages = async () => {
|
||||||
if (imgList.value.length === 0) return [];
|
if (imgList.value.length === 0) return [];
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ const phoneNumber = ref('');
|
|||||||
const verifyCode = ref('');
|
const verifyCode = ref('');
|
||||||
const placeholderStyle = ref('font-size:24rpx')
|
const placeholderStyle = ref('font-size:24rpx')
|
||||||
// 是否同意协议
|
// 是否同意协议
|
||||||
const agreeAgreement = ref(true); // 默认勾选
|
const agreeAgreement = ref(false); // 默认勾选
|
||||||
// 倒计时(秒)
|
// 倒计时(秒)
|
||||||
const countDown = ref(0);
|
const countDown = ref(0);
|
||||||
// 定时器
|
// 定时器
|
||||||
@@ -173,42 +173,50 @@ const handleLogin = () => {
|
|||||||
smsCode:'123456',
|
smsCode:'123456',
|
||||||
scene:'login',
|
scene:'login',
|
||||||
}
|
}
|
||||||
getLoginBySms(params).then(res =>{
|
// getLoginBySms(params).then(res =>{
|
||||||
if(res.code === 200){
|
// if(res.code === 200){
|
||||||
if(res.data){
|
// if(res.data){
|
||||||
uni.setStorageSync('token', res.data.token);
|
// uni.setStorageSync('token', res.data.token);
|
||||||
// 存用户ID
|
// // 存用户ID
|
||||||
if(res.data.userId) {
|
// if(res.data.userId) {
|
||||||
uni.setStorageSync('userId', res.data.userId);
|
// uni.setStorageSync('userId', res.data.userId);
|
||||||
}
|
// }
|
||||||
// 存当前绑定的小区ID,0 表示未绑定
|
// // 存当前绑定的小区ID,0 表示未绑定
|
||||||
const currentVillageId = res.data.currentVillageId || 0;
|
// const currentVillageId = res.data.currentVillageId || 0;
|
||||||
uni.setStorageSync('currentVillageId', currentVillageId);
|
// uni.setStorageSync('currentVillageId', currentVillageId);
|
||||||
uni.hideLoading();
|
// uni.hideLoading();
|
||||||
uni.showToast({ title: '登录成功', icon: 'success' });
|
// uni.showToast({ title: '登录成功', icon: 'success' });
|
||||||
setTimeout(() =>{
|
// setTimeout(() =>{
|
||||||
uni.switchTab({ url: '/pages/index/index' });
|
// uni.switchTab({ url: '/pages/index/index' });
|
||||||
},1500)
|
// },1500)
|
||||||
}else{
|
// }else{
|
||||||
uni.showToast({ title: '登录失败', icon: 'error' });
|
// uni.showToast({ title: '登录失败', icon: 'error' });
|
||||||
}
|
// }
|
||||||
|
|
||||||
}else{
|
// }else{
|
||||||
uni.showToast({ title:'登录失败', icon: 'error' });
|
// uni.showToast({ title:'登录失败', icon: 'error' });
|
||||||
}
|
// }
|
||||||
|
|
||||||
}).catch(err => {
|
// }).catch(err => {
|
||||||
uni.showToast({
|
// uni.showToast({
|
||||||
title: '网络异常,请重试',
|
// title: '网络异常,请重试',
|
||||||
icon: 'error'
|
// icon: 'error'
|
||||||
});
|
// });
|
||||||
})
|
// })
|
||||||
|
|
||||||
|
|
||||||
// 模拟登录请求
|
// 模拟登录请求
|
||||||
// uni.showLoading({
|
uni.showLoading({
|
||||||
// title: '登录中...'
|
title: '登录中...'
|
||||||
// });
|
});
|
||||||
|
uni.showToast({
|
||||||
|
title:"登录成功",
|
||||||
|
icon:'success'
|
||||||
|
})
|
||||||
|
setTimeout(() =>{
|
||||||
|
uni.switchTab({ url: '/pages/index/index' });
|
||||||
|
},1500)
|
||||||
|
uni.hideLoading()
|
||||||
};
|
};
|
||||||
|
|
||||||
// ========== 生命周期 ==========
|
// ========== 生命周期 ==========
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ import {getLoginPassword} from '../api/api.js'
|
|||||||
// 响应式数据
|
// 响应式数据
|
||||||
const phoneNumber = ref('');
|
const phoneNumber = ref('');
|
||||||
const password = ref('');
|
const password = ref('');
|
||||||
const agreeAgreement = ref(true); // 默认勾选
|
const agreeAgreement = ref(false); // 默认勾选
|
||||||
const placeholderStyle = ref('font-size:24rpx')
|
const placeholderStyle = ref('font-size:24rpx')
|
||||||
|
|
||||||
// 计算属性:是否可登录(帐号+密码+协议都满足)
|
// 计算属性:是否可登录(帐号+密码+协议都满足)
|
||||||
@@ -118,43 +118,43 @@ const handleLogin = () => {
|
|||||||
username:phoneNumber.value,
|
username:phoneNumber.value,
|
||||||
password:password.value
|
password:password.value
|
||||||
}
|
}
|
||||||
getLoginPassword(params).then(res =>{
|
// getLoginPassword(params).then(res =>{
|
||||||
// console.log('33333',res)
|
// // console.log('33333',res)
|
||||||
if(res.code === 200){
|
// if(res.code === 200){
|
||||||
uni.setStorageSync('token', res.data.token);
|
// uni.setStorageSync('token', res.data.token);
|
||||||
// 存用户ID
|
// // 存用户ID
|
||||||
if(res.data) {
|
// if(res.data) {
|
||||||
// 存当前绑定的小区ID,0 表示未绑定
|
// // 存当前绑定的小区ID,0 表示未绑定
|
||||||
const currentVillageId = res.data.currentVillageId || 0;
|
// const currentVillageId = res.data.currentVillageId || 0;
|
||||||
uni.setStorageSync('currentVillageId', currentVillageId);
|
// uni.setStorageSync('currentVillageId', currentVillageId);
|
||||||
}
|
// }
|
||||||
uni.hideLoading();
|
// uni.hideLoading();
|
||||||
uni.showToast({ title: '登录成功', icon: 'success' });
|
// uni.showToast({ title: '登录成功', icon: 'success' });
|
||||||
setTimeout(() =>{
|
// setTimeout(() =>{
|
||||||
uni.switchTab({
|
// uni.switchTab({
|
||||||
url: '/pages/index/index'
|
// url: '/pages/index/index'
|
||||||
},1000);
|
// },1000);
|
||||||
})
|
// })
|
||||||
}else{
|
// }else{
|
||||||
uni.showToast({ title: res.msg, icon: 'error' });
|
// uni.showToast({ title: res.msg, icon: 'error' });
|
||||||
}
|
// }
|
||||||
|
|
||||||
}).catch(err => {
|
// }).catch(err => {
|
||||||
uni.showToast({
|
// uni.showToast({
|
||||||
title: '网络异常',
|
// title: '网络异常',
|
||||||
icon: 'error'
|
// icon: 'error'
|
||||||
});
|
// });
|
||||||
})
|
// })
|
||||||
|
|
||||||
// 测试
|
// 测试
|
||||||
// uni.showLoading({
|
uni.showLoading({
|
||||||
// title: '登录中...',
|
title: '登录中...',
|
||||||
// mask:true
|
mask:true
|
||||||
// });
|
});
|
||||||
// setTimeout(() => {
|
setTimeout(() => {
|
||||||
// uni.switchTab({ url: '/pages/index/index' });
|
uni.switchTab({ url: '/pages/index/index' });
|
||||||
// }, 1500);
|
}, 1500);
|
||||||
// uni.hideLoading()
|
uni.hideLoading()
|
||||||
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ const submitForm = () => {
|
|||||||
uni.showToast({ title: '提交成功', icon: 'success' })
|
uni.showToast({ title: '提交成功', icon: 'success' })
|
||||||
|
|
||||||
// 提交成功后重置表单/返回上一页
|
// 提交成功后重置表单/返回上一页
|
||||||
// form.value = { title: '', desc: '', phone: '', images: [] }
|
form.value = { title: '', desc: '', phone: '', images: [] }
|
||||||
// 或返回上一页
|
// 或返回上一页
|
||||||
uni.navigateBack({ delta: 3 })
|
uni.navigateBack({ delta: 3 })
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
|||||||
@@ -129,10 +129,10 @@
|
|||||||
<image :src="activity.coverImage" style="width: 100%;height: 100%;"></image>
|
<image :src="activity.coverImage" style="width: 100%;height: 100%;"></image>
|
||||||
</view>
|
</view>
|
||||||
</up-col>
|
</up-col>
|
||||||
<up-col span="10">
|
<up-col span="8">
|
||||||
<view class="demo-layout bg-purple activity-info">
|
<view class="demo-layout bg-purple activity-info">
|
||||||
<view class="activity-title">{{activity.title}}</view>
|
<view class="activity-title">{{activity.title}}</view>
|
||||||
<view class="activity-time">{{activity.startTime}}-{{activity.endTime}}</view>
|
<view class="activity-time">{{formatDate(activity.startTime)}}-{{formatDate(activity.endTime)}}</view>
|
||||||
<view class="activity-organizer">
|
<view class="activity-organizer">
|
||||||
<text>{{activity.createName}}</text>
|
<text>{{activity.createName}}</text>
|
||||||
</view>
|
</view>
|
||||||
@@ -147,6 +147,13 @@
|
|||||||
|
|
||||||
</view>
|
</view>
|
||||||
</scroll-view>
|
</scroll-view>
|
||||||
|
<!-- 空状态 -->
|
||||||
|
<view v-if="activityList.length === 0" class="empty-state">
|
||||||
|
<uni-icons type="info" size="30" color="#ccc"></uni-icons>
|
||||||
|
<text class="empty-text">暂无数据</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
</uni-card>
|
</uni-card>
|
||||||
|
|
||||||
|
|
||||||
@@ -158,6 +165,7 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
import {onLoad,onUnload,onShow} from '@dcloudio/uni-app'
|
import {onLoad,onUnload,onShow} from '@dcloudio/uni-app'
|
||||||
|
import moment from 'moment'
|
||||||
import {getNoticeLatest,getCurrentVillage,getActivitylatest} from "/pageSubPack/api/api.js"
|
import {getNoticeLatest,getCurrentVillage,getActivitylatest} from "/pageSubPack/api/api.js"
|
||||||
|
|
||||||
|
|
||||||
@@ -175,6 +183,11 @@ const noticeText = ref('暂无公告')
|
|||||||
const noticeId = ref('')
|
const noticeId = ref('')
|
||||||
|
|
||||||
// =======方法=======
|
// =======方法=======
|
||||||
|
// 格式化时间
|
||||||
|
const formatDate = (date) => {
|
||||||
|
if (!date) return ''
|
||||||
|
return moment(date).format('YYYY-MM-DD HH:mm')
|
||||||
|
}
|
||||||
// 公告跳转
|
// 公告跳转
|
||||||
const getNoticeMore = () =>{
|
const getNoticeMore = () =>{
|
||||||
uni.setStorageSync('sourcePage',"index")
|
uni.setStorageSync('sourcePage',"index")
|
||||||
@@ -581,7 +594,20 @@ const moreClick = () =>{
|
|||||||
margin-top: 20rpx;
|
margin-top: 20rpx;
|
||||||
color: #666666;
|
color: #666666;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
.empty-state {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 100rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-text {
|
||||||
|
font-size: 32rpx;
|
||||||
|
color: #999;
|
||||||
|
margin-top: 20rpx;
|
||||||
|
margin-bottom: 10rpx;
|
||||||
}
|
}
|
||||||
.look-more-title{
|
.look-more-title{
|
||||||
color: #3E8EFF;
|
color: #3E8EFF;
|
||||||
|
|||||||
Reference in New Issue
Block a user