修改跳转问题

This commit is contained in:
zhouyanli
2026-04-20 17:10:47 +08:00
parent 8af229f25b
commit c8940e5b02
9 changed files with 85 additions and 88 deletions

View File

@@ -330,12 +330,15 @@
// 返回 // 返回
const narBack = () =>{ const narBack = () =>{
// uni.navigateBack({ if(uni.getStorageSync('sourcePage') === "index"){
// delta: 1 uni.switchTab({
// }) url:"/pages/index/index"
uni.switchTab({ })
url:"/pages/index/index" }else if(uni.getStorageSync('sourcePage') === "serviceIndex"){
}) uni.switchTab({
url:"/pages/serviceIndex/serviceIndex"
})
}
} }
// 切换选项卡 // 切换选项卡
const switchTab = (tab) => { const switchTab = (tab) => {

View File

@@ -56,7 +56,7 @@
</view> </view>
</up-col> </up-col>
<up-col span="3"> <up-col span="3">
<view class="demo-layout bg-purple-light openClass"> <view class="demo-layout bg-purple-light openClass" @click="payMentClick">
<view class="iconClass"> <view class="iconClass">
<image src="/static/首页/生活缴费.png" mode="" style="width: 70px;height: 70px;border-radius: 8px;"></image> <image src="/static/首页/生活缴费.png" mode="" style="width: 70px;height: 70px;border-radius: 8px;"></image>
</view> </view>
@@ -189,12 +189,13 @@ const activityList = ref([
const currentCommunity = ref('碧桂园小区') const currentCommunity = ref('碧桂园小区')
const bannerList = ref([ const bannerList = ref([
'/static/首页/banner.png', '/static/首页/banner.png',
'/static/bannar2.png'
]) ])
const noticeText = ref('公告公告本小区今天安装了摄像头') const noticeText = ref('公告公告本小区今天安装了摄像头')
// =======方法======= // =======方法=======
const getNoticeMore = () =>{ const getNoticeMore = () =>{
uni.setStorageSync('sourcePage',"index")
uni.navigateTo({ uni.navigateTo({
url:"/pages/notice-list/noticeList" url:"/pages/notice-list/noticeList"
}) })
@@ -218,10 +219,18 @@ onUnload(() => {
// 方法逻辑 // 方法逻辑
const openDoorClick = () =>{ const openDoorClick = () =>{
uni.setStorageSync('sourcePage',"index")
uni.navigateTo({ uni.navigateTo({
url:"/pages/notice-list/oneClickOpen" url:"/pages/notice-list/oneClickOpen"
}) })
} }
// 生活缴费
const payMentClick =() =>{
uni.setStorageSync('sourcePage',"index")
uni.navigateTo({
url:"/pages/payment-list/paymentIndex"
})
}
const navigateToPage = () => { const navigateToPage = () => {
uni.navigateTo({ uni.navigateTo({
@@ -229,18 +238,21 @@ const navigateToPage = () => {
}) })
} }
const onlineRepairClick = () =>{ const onlineRepairClick = () =>{
uni.setStorageSync('sourcePage',"index")
uni.navigateTo({ uni.navigateTo({
url:'/pages/online-repair/onlineRepair' url:'/pages/online-repair/onlineRepair'
}) })
} }
// 访客邀请 // 访客邀请
const visitorClick = () =>{ const visitorClick = () =>{
uni.setStorageSync('sourcePage',"index")
uni.navigateTo({ uni.navigateTo({
url:"/pages/visitor/visitor-list" url:"/pages/visitor/visitor-list"
}) })
} }
// 活动列表的查看更多 // 活动列表的查看更多
const moreClick = () =>{ const moreClick = () =>{
uni.setStorageSync('sourcePage',"index")
uni.navigateTo({ uni.navigateTo({
url:"/pages/activity-list/activityList" url:"/pages/activity-list/activityList"
}) })
@@ -332,7 +344,7 @@ const moreClick = () =>{
} }
.noticeClass{ .noticeClass{
position: relative; position: relative;
top: 167rpx; top: 160rpx;
left: 0; left: 0;
padding: 40rpx 36rpx; padding: 40rpx 36rpx;
} }
@@ -349,7 +361,7 @@ const moreClick = () =>{
} }
.bg-card-open{ .bg-card-open{
position: relative; position: relative;
top: 102rpx; top: 98rpx;
left: 0; left: 0;
padding: 20rpx; padding: 20rpx;
background-color: #fff; background-color: #fff;
@@ -382,7 +394,7 @@ const moreClick = () =>{
// margin-top: 30rpx; // margin-top: 30rpx;
border-radius: 28rpx; border-radius: 28rpx;
position: relative; position: relative;
top:50px; top:45px;
left: 0; left: 0;
.titleLeft{ .titleLeft{
text-align: left; text-align: left;
@@ -400,7 +412,7 @@ const moreClick = () =>{
} }
.activity-card{ .activity-card{
position: relative; position: relative;
top: 45px; top: 40px;
left: 0; left: 0;
bottom: 20; bottom: 20;
} }

View File

@@ -94,50 +94,6 @@ const checkForm = () => {};
onLoad(() =>{ onLoad(() =>{
}); });
// const handleLogin = async () => {
// if (!canLogin.value) return;
// // 防止多次点击触发登录
// // canLogin.value = false;
// // // 2. 空值校验
// if (!phoneNumber.value) {
// uni.showToast({ title: '请输入手机号', icon: 'none' });
// // canLogin.value = true;
// return;
// }
// if (!password.value) {
// uni.showToast({ title: '请输入密码', icon: 'none' });
// // canLogin.value = true;
// return;
// }
// const params = {
// username: phoneNumber.value,
// password: password.value
// };
// try {
// // 3. 调用登录接口
// const res = await getLoginPassword(params);
// // 登录成功逻辑
// // 如果后端返回token这里保存
// // uni.setStorageSync('token', res.token || '');
// uni.showToast({ title: '登录成功', icon: 'success' });
// // 登录成功后再跳转
// setTimeout(() => {
// uni.switchTab({ url: '/pages/index/index' });
// }, 1500);
// } catch (err) {
// // 登录失败逻辑(所有错误:账号不存在/密码错/网络异常都走这里)
// uni.showToast({ title: `${err || '登录失败'}`, icon: 'none' });
// } finally {
// // 无论成功/失败,解锁按钮
// canLogin.value = true;
// }
// };
// 登录逻辑 // 登录逻辑
const handleLogin = () => { const handleLogin = () => {
if (!canLogin.value) return if (!canLogin.value) return
@@ -145,16 +101,16 @@ const handleLogin = () => {
username:phoneNumber.value, username:phoneNumber.value,
password:password.value password:password.value
} }
if (!phoneNumber.value) { // if (!phoneNumber.value) {
uni.showToast({ title: '请输入手机号', icon: 'none' }); // uni.showToast({ title: '请输入手机号', icon: 'none' });
// canLogin.value = true; // // canLogin.value = true;
return; // return;
} // }
if (!password.value) { // if (!password.value) {
uni.showToast({ title: '请输入密码', icon: 'none' }); // uni.showToast({ title: '请输入密码', icon: 'none' });
// canLogin.value = true; // // canLogin.value = true;
return; // return;
} // }
// getLoginPassword(params).then(res =>{ // getLoginPassword(params).then(res =>{
// // console.log('33333',res) // // console.log('33333',res)
// if(res.code === 200){ // if(res.code === 200){
@@ -168,6 +124,9 @@ const handleLogin = () => {
// } // }
// }) // })
uni.showLoading({
title: '登录中...'
});
setTimeout(() => { setTimeout(() => {
uni.switchTab({ url: '/pages/index/index' }); uni.switchTab({ url: '/pages/index/index' });
}, 1500); }, 1500);

View File

@@ -122,12 +122,16 @@
} }
// 返回 // 返回
const narBack = () =>{ const narBack = () =>{
// uni.navigateBack({ if(uni.getStorageSync('sourcePage') === "index"){
// delta: 1 uni.switchTab({
// }) url:"/pages/index/index"
uni.switchTab({ })
url:"/pages/index/index" }else if(uni.getStorageSync('sourcePage') === "serviceIndex"){
}) uni.switchTab({
url:"/pages/serviceIndex/serviceIndex"
})
}
uni.removeStorageSync('sourcePage')
} }
</script> </script>

View File

@@ -68,12 +68,17 @@ const selectDoor = (index) => {
} }
// 返回 // 返回
const narBack = () =>{ const narBack = () =>{
// uni.navigateBack({ if(uni.getStorageSync('sourcePage') === "index"){
// delta: 1 uni.switchTab({
// }) url:"/pages/index/index"
uni.switchTab({ })
url:"/pages/index/index" }else if(uni.getStorageSync('sourcePage') === "serviceIndex"){
}) uni.switchTab({
url:"/pages/serviceIndex/serviceIndex"
})
}
uni.removeStorageSync('sourcePage')
} }
// 确认开门方法 // 确认开门方法
const openDoor = () => { const openDoor = () => {

View File

@@ -164,7 +164,7 @@ const getCommunityList = () =>{
} }
onLoad(() =>{ onLoad(() =>{
getCommunityList() // getCommunityList()
}) })

View File

@@ -153,10 +153,17 @@ function personalClick(){
} }
// 返回上一页 // 返回上一页
const goBack = () => { const goBack = () => {
// uni.navigateBack() if(uni.getStorageSync('sourcePage') === "index"){
uni.switchTab({ uni.switchTab({
url:"/pages/index/index" url:"/pages/index/index"
}) })
}else if(uni.getStorageSync('sourcePage') === "serviceIndex"){
uni.switchTab({
url:"/pages/serviceIndex/serviceIndex"
})
}
uni.removeStorageSync('sourcePage')
} }
// 跳转报修详情 // 跳转报修详情
const goDetail = (item) => { const goDetail = (item) => {

View File

@@ -469,7 +469,7 @@ const submitForm = () => {
} }
.time-value { .time-value {
color: #007aff; color: #000;
} }
.input, .textarea { .input, .textarea {
flex: 1; flex: 1;

View File

@@ -123,10 +123,17 @@ const filterdList = computed(() => {
}) })
// 返回上一页 // 返回上一页
const goBack = () => { const goBack = () => {
// uni.navigateBack() if(uni.getStorageSync('sourcePage') === "index"){
uni.switchTab({ uni.switchTab({
url:"/pages/index/index" url:"/pages/index/index"
}) })
}else if(uni.getStorageSync('sourcePage') === "serviceIndex"){
uni.switchTab({
url:"/pages/serviceIndex/serviceIndex"
})
}
uni.removeStorageSync('sourcePage')
} }
// 查看详情 // 查看详情