diff --git a/property-uniapp-project/manifest.json b/property-uniapp-project/manifest.json
index 6659695..d0d48a5 100644
--- a/property-uniapp-project/manifest.json
+++ b/property-uniapp-project/manifest.json
@@ -54,7 +54,16 @@
"setting" : {
"urlCheck" : false
},
- "usingComponents" : true
+ "usingComponents" : true,
+ "requiredPrivateInfos": [
+ "getLocation", // 定位接口(必填)
+ "chooseLocation" // 如果用到选择位置也加
+ ],
+ "permission": {
+ "scope.userLocation": {
+ "desc": "你的位置信息将用于活动地点定位、签到验证等功能"
+ }
+ }
},
"mp-alipay" : {
"usingComponents" : true
diff --git a/property-uniapp-project/pageSubPack/activity-list/activityList.vue b/property-uniapp-project/pageSubPack/activity-list/activityList.vue
index 9203bfd..f250d63 100644
--- a/property-uniapp-project/pageSubPack/activity-list/activityList.vue
+++ b/property-uniapp-project/pageSubPack/activity-list/activityList.vue
@@ -249,7 +249,7 @@ const loadMoreData = () => {
*/
const formatDate = (date) => {
if (!date) return ''
- return moment(date).format('YYYY-MM-DD HH:mm:ss')
+ return moment(date).format('YYYY-MM-DD HH:mm')
}
/**
diff --git a/property-uniapp-project/pageSubPack/activity-list/activityListDetails.vue b/property-uniapp-project/pageSubPack/activity-list/activityListDetails.vue
index d1b5170..18139c9 100644
--- a/property-uniapp-project/pageSubPack/activity-list/activityListDetails.vue
+++ b/property-uniapp-project/pageSubPack/activity-list/activityListDetails.vue
@@ -37,20 +37,20 @@
报名截止时间
- {{activityConent.applyDeadline}}
+ {{formatTime(activityConent.applyDeadline)}}
活动时间
- {{activityConent.startTime}} 至 {{activityConent.endTime}}
+ {{formatTime(activityConent.startTime)}} 至 {{formatTime(activityConent.endTime)}}
签到时间
- {{activityConent.signinStartTime}} 至 {{activityConent.signinEndTime}}
+ {{formatTime(activityConent.signinStartTime)}} 至 {{formatTime(activityConent.signinEndTime)}}
@@ -97,7 +97,7 @@
活动详情
- {{activityConent.content}}
+ {{activityConent.content || "暂无"}}
@@ -168,7 +168,7 @@
-
+
@@ -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) =>{
navTitle.value = option?.title
curActivityId.value = option?.id
// 处理applied参数(可能是字符串类型,需要转布尔)
hasSigned.value = option?.applied === 'true' || option?.applied === true
// 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{
const res = await cancelActivity(curActivityId.value)
if(res.code === 200){
- hasSigned.value = true // 报名成功后更新状态
+ hasSigned.value = false // 报名成功后更新状态
uni.showToast({
title: '取消报名成功',
icon:"success"
@@ -364,7 +382,7 @@ const cancelActivityData = async () =>{
setTimeout(() =>{
uni.$emit('refreshActivityList', {
activityId: curActivityId.value,
- isSigned: true
+ isSigned: false
})
uni.navigateBack()
},1500)
@@ -414,12 +432,6 @@ const liveClick = () =>{
// 监听实况列表刷新
// ---------
-onLoad(() =>{
- uni.$on('refreshLiveList', () => {
- getLiveActivityList();
- });
- getLiveActivityList()
-})
onUnload(() => {
uni.$off('refreshLiveList')
})
@@ -446,6 +458,12 @@ const showToastMessage = (message) => {
flex-direction: column;
background: linear-gradient(to bottom left, #E2F0FF 0%, #ffffff 50%)
}
+/* 状态栏 */
+.status_bar {
+ height: 46px;
+ width: 100%;
+}
+
/* 顶部导航栏 */
.nav-bar {
height: 90rpx;
@@ -489,10 +507,6 @@ const showToastMessage = (message) => {
overflow-y: auto;
margin-bottom: 120rpx;
}
- .status_bar {
- height: 46px;
- width: 100%;
-}
/* 选项卡 */
.tabs {
diff --git a/property-uniapp-project/pageSubPack/activity-list/live-add.vue b/property-uniapp-project/pageSubPack/activity-list/live-add.vue
index 114c2a9..328e0b2 100644
--- a/property-uniapp-project/pageSubPack/activity-list/live-add.vue
+++ b/property-uniapp-project/pageSubPack/activity-list/live-add.vue
@@ -98,29 +98,113 @@ const chooseImg = () => {
};
// 删除图片
-const deleteImg = (index) => {
- imgList.value.splice(index, 1);
-};
+ const deleteImg = (index) => {
+ imgList.value.splice(index, 1);
+ };
-// 重新定位
-const reLocate = () => {
- uni.showLoading({ title: '定位中...' });
- uni.getLocation({
- type: 'gcj02',
- success: (res) => {
- uni.hideLoading();
- longitude.value = res.longitude;
- latitude.value = res.latitude;
- location.value = `${res.longitude},${res.latitude}`;
- uni.showToast({ title: '定位成功', icon: 'success' });
- },
- fail: (err) => {
- uni.hideLoading();
- uni.showToast({ title: '定位失败,请检查权限', icon: 'none' });
- console.error('定位失败:', err);
- }
- });
-};
+ // 重新定位
+ // 定位并获取具体地点名称
+ const reLocate = () => {
+ uni.showLoading({ title: '定位中...' });
+
+ // 第一步:获取经纬度
+ uni.getLocation({
+ type: 'gcj02', // 微信地图专用坐标系,必须用这个
+ success: (locRes) => {
+ // 第二步:通过经纬度逆解析为具体地址
+ uni.request({
+ url: 'https://apis.map.qq.com/ws/geocoder/v1/', // 腾讯地图逆地理编码接口(免费)
+ data: {
+ location: `${locRes.latitude},${locRes.longitude}`, // 纬度,经度
+ key: 'XCNBZ-TJ46B-BCJUZ-JBMIM-LZWRJ-SBBWW', // 替换成你自己的Key(下面教你怎么获取)
+ get_poi: 0 // 0=只返回基础地址,1=返回周边POI
+ },
+ 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.showToast({ title: '定位失败,请检查权限', icon: 'none' });
+ 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 () => {
diff --git a/property-uniapp-project/pageSubPack/loginSub/login.vue b/property-uniapp-project/pageSubPack/loginSub/login.vue
index b72c0fc..b9f552e 100644
--- a/property-uniapp-project/pageSubPack/loginSub/login.vue
+++ b/property-uniapp-project/pageSubPack/loginSub/login.vue
@@ -93,7 +93,7 @@ const phoneNumber = ref('');
const verifyCode = ref('');
const placeholderStyle = ref('font-size:24rpx')
// 是否同意协议
-const agreeAgreement = ref(true); // 默认勾选
+const agreeAgreement = ref(false); // 默认勾选
// 倒计时(秒)
const countDown = ref(0);
// 定时器
@@ -173,42 +173,50 @@ const handleLogin = () => {
smsCode:'123456',
scene:'login',
}
- getLoginBySms(params).then(res =>{
- if(res.code === 200){
- if(res.data){
- uni.setStorageSync('token', res.data.token);
- // 存用户ID
- if(res.data.userId) {
- uni.setStorageSync('userId', res.data.userId);
- }
- // 存当前绑定的小区ID,0 表示未绑定
- const currentVillageId = res.data.currentVillageId || 0;
- uni.setStorageSync('currentVillageId', currentVillageId);
- uni.hideLoading();
- uni.showToast({ title: '登录成功', icon: 'success' });
- setTimeout(() =>{
- uni.switchTab({ url: '/pages/index/index' });
- },1500)
- }else{
- uni.showToast({ title: '登录失败', icon: 'error' });
- }
+ // getLoginBySms(params).then(res =>{
+ // if(res.code === 200){
+ // if(res.data){
+ // uni.setStorageSync('token', res.data.token);
+ // // 存用户ID
+ // if(res.data.userId) {
+ // uni.setStorageSync('userId', res.data.userId);
+ // }
+ // // 存当前绑定的小区ID,0 表示未绑定
+ // const currentVillageId = res.data.currentVillageId || 0;
+ // uni.setStorageSync('currentVillageId', currentVillageId);
+ // uni.hideLoading();
+ // uni.showToast({ title: '登录成功', icon: 'success' });
+ // setTimeout(() =>{
+ // uni.switchTab({ url: '/pages/index/index' });
+ // },1500)
+ // }else{
+ // uni.showToast({ title: '登录失败', icon: 'error' });
+ // }
- }else{
- uni.showToast({ title:'登录失败', icon: 'error' });
- }
+ // }else{
+ // uni.showToast({ title:'登录失败', icon: 'error' });
+ // }
- }).catch(err => {
- uni.showToast({
- title: '网络异常,请重试',
- icon: 'error'
- });
- })
+ // }).catch(err => {
+ // uni.showToast({
+ // title: '网络异常,请重试',
+ // icon: 'error'
+ // });
+ // })
// 模拟登录请求
- // uni.showLoading({
- // title: '登录中...'
- // });
+ uni.showLoading({
+ title: '登录中...'
+ });
+ uni.showToast({
+ title:"登录成功",
+ icon:'success'
+ })
+ setTimeout(() =>{
+ uni.switchTab({ url: '/pages/index/index' });
+ },1500)
+ uni.hideLoading()
};
// ========== 生命周期 ==========
diff --git a/property-uniapp-project/pageSubPack/loginSub/pwd-login.vue b/property-uniapp-project/pageSubPack/loginSub/pwd-login.vue
index 1183ded..f8c8afb 100644
--- a/property-uniapp-project/pageSubPack/loginSub/pwd-login.vue
+++ b/property-uniapp-project/pageSubPack/loginSub/pwd-login.vue
@@ -72,7 +72,7 @@ import {getLoginPassword} from '../api/api.js'
// 响应式数据
const phoneNumber = ref('');
const password = ref('');
-const agreeAgreement = ref(true); // 默认勾选
+const agreeAgreement = ref(false); // 默认勾选
const placeholderStyle = ref('font-size:24rpx')
// 计算属性:是否可登录(帐号+密码+协议都满足)
@@ -118,43 +118,43 @@ const handleLogin = () => {
username:phoneNumber.value,
password:password.value
}
- getLoginPassword(params).then(res =>{
- // console.log('33333',res)
- if(res.code === 200){
- uni.setStorageSync('token', res.data.token);
- // 存用户ID
- if(res.data) {
- // 存当前绑定的小区ID,0 表示未绑定
- const currentVillageId = res.data.currentVillageId || 0;
- uni.setStorageSync('currentVillageId', currentVillageId);
- }
- uni.hideLoading();
- uni.showToast({ title: '登录成功', icon: 'success' });
- setTimeout(() =>{
- uni.switchTab({
- url: '/pages/index/index'
- },1000);
- })
- }else{
- uni.showToast({ title: res.msg, icon: 'error' });
- }
+ // getLoginPassword(params).then(res =>{
+ // // console.log('33333',res)
+ // if(res.code === 200){
+ // uni.setStorageSync('token', res.data.token);
+ // // 存用户ID
+ // if(res.data) {
+ // // 存当前绑定的小区ID,0 表示未绑定
+ // const currentVillageId = res.data.currentVillageId || 0;
+ // uni.setStorageSync('currentVillageId', currentVillageId);
+ // }
+ // uni.hideLoading();
+ // uni.showToast({ title: '登录成功', icon: 'success' });
+ // setTimeout(() =>{
+ // uni.switchTab({
+ // url: '/pages/index/index'
+ // },1000);
+ // })
+ // }else{
+ // uni.showToast({ title: res.msg, icon: 'error' });
+ // }
- }).catch(err => {
- uni.showToast({
- title: '网络异常',
- icon: 'error'
- });
- })
+ // }).catch(err => {
+ // uni.showToast({
+ // title: '网络异常',
+ // icon: 'error'
+ // });
+ // })
// 测试
- // uni.showLoading({
- // title: '登录中...',
- // mask:true
- // });
- // setTimeout(() => {
- // uni.switchTab({ url: '/pages/index/index' });
- // }, 1500);
- // uni.hideLoading()
+ uni.showLoading({
+ title: '登录中...',
+ mask:true
+ });
+ setTimeout(() => {
+ uni.switchTab({ url: '/pages/index/index' });
+ }, 1500);
+ uni.hideLoading()
};
diff --git a/property-uniapp-project/pageSubPack/online-repair/publicRepair.vue b/property-uniapp-project/pageSubPack/online-repair/publicRepair.vue
index 5615129..123c36b 100644
--- a/property-uniapp-project/pageSubPack/online-repair/publicRepair.vue
+++ b/property-uniapp-project/pageSubPack/online-repair/publicRepair.vue
@@ -147,7 +147,7 @@ const submitForm = () => {
uni.showToast({ title: '提交成功', icon: 'success' })
// 提交成功后重置表单/返回上一页
- // form.value = { title: '', desc: '', phone: '', images: [] }
+ form.value = { title: '', desc: '', phone: '', images: [] }
// 或返回上一页
uni.navigateBack({ delta: 3 })
}, 1000)
diff --git a/property-uniapp-project/pages/index/index.vue b/property-uniapp-project/pages/index/index.vue
index 51e210d..e4e274e 100644
--- a/property-uniapp-project/pages/index/index.vue
+++ b/property-uniapp-project/pages/index/index.vue
@@ -129,10 +129,10 @@
-
+
{{activity.title}}
- {{activity.startTime}}-{{activity.endTime}}
+ {{formatDate(activity.startTime)}}-{{formatDate(activity.endTime)}}
{{activity.createName}}
@@ -147,6 +147,13 @@
+
+
+
+ 暂无数据
+
+
+
@@ -158,6 +165,7 @@