修改样式

This commit is contained in:
zhouyanli
2026-04-29 09:07:18 +08:00
parent e3e74a1be0
commit 46c9f6dacc
6 changed files with 53 additions and 109 deletions

View File

@@ -104,107 +104,45 @@ const chooseImg = () => {
// 重新定位 // 重新定位
// 定位并获取具体地点名称 // 定位并获取具体地点名称
const reLocate = () => { const reLocate = () => {
uni.showLoading({ title: '定位中...' }); // 调用微信原生选择位置接口(自带地址解析,无调用上限)
uni.chooseLocation({
// 第一步:获取经纬度 success: (res) => {
uni.getLocation({ // res.address = 具体地址XX市XX区XX街道XX小区
type: 'gcj02', // 微信地图专用坐标系,必须用这个 // res.name = 地点名称XX小区
success: (locRes) => { longitude.value = res.longitude;
// 第二步:通过经纬度逆解析为具体地址 latitude.value = res.latitude;
uni.request({ location.value = res.address; // 显示具体地址
url: 'https://apis.map.qq.com/ws/geocoder/v1/', // 腾讯地图逆地理编码接口(免费) uni.showToast({ title: `定位成功:${res.name}`, icon: 'success' });
data: {
location: `${locRes.latitude},${locRes.longitude}`, // 纬度,经度
key: 'XCNBZ-TJ46B-BCJUZ-JBMIM-LZWRJ-SBBWW', // 替换成你自己的Key下面教你怎么获取
get_poi: 0 // 0=只返回基础地址1=返回周边POI
}, },
success: (geoRes) => { fail: (err) => {
uni.hideLoading(); // 处理权限拒绝/定位失败
if (geoRes.data.status === 0) { if (err.errMsg.includes('auth deny')) {
// 解析成功,获取具体地址 uni.showModal({
const address = geoRes.data.result.address; // 完整地址北京市海淀区中关村南大街5号 title: '需要定位权限',
const formattedAddress = geoRes.data.result.formatted_addresses.recommend; // 推荐地址(更简洁) content: '请允许获取位置信息以显示具体地点',
const province = geoRes.data.result.address_component.province; // 省 confirmText: '去设置',
const city = geoRes.data.result.address_component.city; // 市 success: (modalRes) => {
const district = geoRes.data.result.address_component.district; // 区 if (modalRes.confirm) {
const street = geoRes.data.result.address_component.street; // 街道 uni.openSetting({
success: (settingRes) => {
// 保存数据(按需选择) // 用户开启权限后重新定位
longitude.value = locRes.longitude; if (settingRes.authSetting['scope.userLocation']) {
latitude.value = locRes.latitude; reLocate();
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 { } else {
// 解析地址失败,降级显示经纬度
location.value = `${locRes.longitude},${locRes.latitude}`;
uni.showToast({ title: '定位成功,但无法解析地址', icon: 'none' });
}
},
fail: (geoErr) => {
uni.hideLoading(); uni.hideLoading();
// 接口请求失败,降级显示经纬度 uni.showToast({ title: '定位失败,请重试', icon: 'none' });
location.value = `${locRes.longitude},${locRes.latitude}`; console.error('定位失败:', err);
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 () => { const uploadAllImages = async () => {

View File

@@ -68,7 +68,7 @@ const confirmSelect = () => {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-between; justify-content: space-between;
background: #fff; background: #f9f9f9;
} }
.house-list { .house-list {
flex: 1; flex: 1;
@@ -78,13 +78,14 @@ const confirmSelect = () => {
justify-content: flex-start; justify-content: flex-start;
align-items: center; align-items: center;
padding: 15px 10px; padding: 15px 10px;
border: 1px solid #eee; background-color: #fff;
border-radius: 8px; border-radius: 8px;
margin-bottom: 10px; margin-bottom: 10px;
} }
.house-item.active { .house-item.active {
border-color: #007aff; border-color: #007aff;
background: #f0f8ff; background: #f0f8ff;
border: 1px solid #2F77FD;
} }
.house-name { .house-name {
font-size: 16px; font-size: 16px;
@@ -108,7 +109,8 @@ const confirmSelect = () => {
background: #007aff; background: #007aff;
color: #fff; color: #fff;
border-radius: 8px; border-radius: 8px;
font-size: 16px; font-size: 28rpx;
margin-top: 20px; margin-top: 20px;
margin-bottom: 20rpx;
} }
</style> </style>

View File

@@ -112,6 +112,8 @@ const sendToFriend = () => {
color: #fff; color: #fff;
border-radius: 8rpx; border-radius: 8rpx;
height: 88rpx; height: 88rpx;
font-size: 32rpx; font-size: 28rpx;
line-height: 88rpx;
} }
</style> </style>

View File

@@ -470,7 +470,7 @@ const resetForm = () => {
.submit-btn { .submit-btn {
background-color: #007aff; background-color: #007aff;
color: #fff; color: #fff;
font-size: 32rpx; font-size: 28rpx;
height: 80rpx; height: 80rpx;
line-height: 80rpx; line-height: 80rpx;
border-radius: 8rpx; border-radius: 8rpx;

View File

@@ -167,6 +167,7 @@ const goToQrcode = () => {
color: #fff; color: #fff;
border-radius: 8rpx; border-radius: 8rpx;
height: 88rpx; height: 88rpx;
font-size: 32rpx; font-size: 28rpx;
line-height: 88rpx
} }
</style> </style>

View File

@@ -73,8 +73,8 @@
<!-- 新增邀请按钮 --> <!-- 新增邀请按钮 -->
<view class="add-btn" @click="addInvitation"> <view class="add-btn" @click="addInvitation">
<uni-icons type="plus" size="18" color="#fff"></uni-icons> <!-- <uni-icons type="plus" size="18" color="#fff"></uni-icons> -->
<text class="add-text">新增邀请</text> <text class="add-text">新增邀请+</text>
</view> </view>
</view> </view>
</template> </template>
@@ -332,5 +332,6 @@ const addInvitation = () => {
} }
.add-text { .add-text {
margin-left: 5px; margin-left: 5px;
font-size: 28rpx;
} }
</style> </style>