修复bug

This commit is contained in:
zhouyanli
2026-08-01 11:56:28 +08:00
parent a34b625092
commit f74fb33e11
30 changed files with 162 additions and 257 deletions

View File

@@ -18,18 +18,9 @@
getPushCID()
// #endif
// 路由分发(同步):所有人先进首页,点击功能再提示登录
// 路由分发:全局拦截器注册(首页 onLoad 中处理首次引导页跳转)
const token = uni.getStorageSync('token') || ''
const hasShowGuide = uni.getStorageSync('hasShowGuide')
// 首次使用:标记引导已看过(不再强制引导页),直接进首页
if (!token && !hasShowGuide) {
console.log('首次启动,标记引导已看过,进入首页')
uni.setStorageSync('hasShowGuide', true)
}
// 所有人统一进首页
console.log('进入首页hasToken=' + !!token + '')
console.log('App 启动hasToken=' + !!token + '')
// 全局 navigateTo 拦截器:未登录用户访问需登录页面时自动跳转登录页
uni.addInterceptor('navigateTo', {

View File

@@ -51,7 +51,6 @@
<image src="https://wuyeadmin.bugtc.com/images/login/password.png" mode="" style="height: 100%;width: 100%;"></image>
</view>
<uni-easyinput class="input-content" type="password" v-model="password"
@input="password = password.replace(/\s/g, '')"
placeholder="请输入密码" :inputBorder="false" maxlength="16" :placeholderStyle="placeholderStyle">
</uni-easyinput>
</view>

View File

@@ -49,7 +49,7 @@
<image src="https://wuyeadmin.bugtc.com/images/login/password.png" mode=""
style="height: 100%;width: 100%;"></image>
</view>
<uni-easyinput class="input-content" type="password" v-model="password" @input="password = password.replace(/\s/g, '')" @blur="validatePassword" @focus="clearPasswordError" placeholder="请输入密码6-16位"
<uni-easyinput class="input-content" type="password" v-model="password" @blur="validatePassword" @focus="clearPasswordError" placeholder="请输入密码6-16位"
:inputBorder="false" maxlength="16" :placeholderStyle="placeholderStyle" />
</view>
<text class="input-error" v-if="passwordError">{{ passwordError }}</text>
@@ -86,6 +86,7 @@
import {
ref,
computed,
watch,
onUnmounted
} from 'vue';
import {
@@ -127,6 +128,18 @@
agreeAgreement.value;
});
// 实时校验密码格式(输入空格或特殊符号立即提示)
watch(password, (val) => {
if (!val) { passwordError.value = ''; return }
if (val.length < 6 || val.length > 16) {
passwordError.value = '密码需 6-16 位'
} else if (/[^a-zA-Z0-9]/.test(val)) {
passwordError.value = '密码格式错误'
} else {
passwordError.value = ''
}
})
// ========== 方法 ==========
const goBack = () => {
uni.navigateBack();
@@ -160,8 +173,8 @@
if (!val) { passwordError.value = ''; return }
if (val.length < 6 || val.length > 16) {
passwordError.value = '密码需 6-16 位'
} else if (/\s/.test(val)) {
passwordError.value = '密码不能包含空格'
} else if (/[^a-zA-Z0-9]/.test(val)) {
passwordError.value = '密码格式错误'
} else {
passwordError.value = ''
}
@@ -288,8 +301,8 @@
uni.showToast({ title: '密码不能超过 16 位', icon: 'none' });
return;
}
if (/\s/.test(password.value)) {
uni.showToast({ title: '密码格式不对,不允许注册', icon: 'none' });
if (/[^a-zA-Z0-9]/.test(password.value)) {
uni.showToast({ title: '密码格式错误', icon: 'none' });
return;
}
if (!agreeAgreement.value) {

View File

@@ -294,16 +294,14 @@
}
const goBack = () => {
uni.removeStorageSync('carNum')
uni.removeStorageSync('carBrand')
uni.removeStorageSync('carModel')
uni.removeStorageSync('carColor')
uni.removeStorageSync('carImageUrl')
uni.removeStorageSync('carBrandId')
uni.removeStorageSync('checkType')
uni.navigateTo({
url: '/pageSubPack/my/myCarIndex'
})
uni.removeStorageSync("carNum")
uni.removeStorageSync("carBrand")
uni.removeStorageSync("carModel")
uni.removeStorageSync("carColor")
uni.removeStorageSync("carImageUrl")
uni.removeStorageSync("carBrandId")
uni.removeStorageSync("checkType")
uni.navigateBack()
}
</script>

View File

@@ -869,25 +869,20 @@
});
const goBack = () => {
uni.removeStorageSync('communityId');
uni.removeStorageSync('communityName');
uni.removeStorageSync('buildingId');
uni.removeStorageSync('buildingName');
uni.removeStorageSync('unitId');
uni.removeStorageSync('unitName');
uni.removeStorageSync('floorId');
uni.removeStorageSync('floorName');
uni.removeStorageSync('houseNumberId');
uni.removeStorageSync('houseNumberName');
uni.removeStorageSync('houseStatus')
uni.removeStorageSync('houseIsDefault')
uni.removeStorageSync('updateHouseId')
uni.navigateTo({
url: '/pageSubPack/my/myHouseIndex',
success: res => {},
fail: () => {},
complete: () => {}
});
uni.removeStorageSync("communityId");
uni.removeStorageSync("communityName");
uni.removeStorageSync("buildingId");
uni.removeStorageSync("buildingName");
uni.removeStorageSync("unitId");
uni.removeStorageSync("unitName");
uni.removeStorageSync("floorId");
uni.removeStorageSync("floorName");
uni.removeStorageSync("houseNumberId");
uni.removeStorageSync("houseNumberName");
uni.removeStorageSync("houseStatus")
uni.removeStorageSync("houseIsDefault")
uni.removeStorageSync("updateHouseId")
uni.navigateBack()
}
</script>
<style lang="scss">

View File

@@ -324,23 +324,19 @@
}
const goBack = () => {
uni.removeStorageSync('communityId')
uni.removeStorageSync('communityName')
// uni.removeStorageSync('bindHouseId')
// uni.removeStorageSync('bindHouseName')
uni.removeStorageSync('checkType')
uni.removeStorageSync('parkingLotId')
uni.removeStorageSync('parkingLotName')
uni.removeStorageSync('parkingSpaceId')
uni.removeStorageSync('parkingStatus')
uni.removeStorageSync('parkingSpaceName')
uni.removeStorageSync('bindCarId')
uni.removeStorageSync('bindCarName')
uni.removeStorageSync('ownerId')
uni.removeStorageSync('ownerName')
uni.navigateTo({
url: '/pageSubPack/my/myParkingSpaceIndex'
})
uni.removeStorageSync("communityId")
uni.removeStorageSync("communityName")
uni.removeStorageSync("checkType")
uni.removeStorageSync("parkingLotId")
uni.removeStorageSync("parkingLotName")
uni.removeStorageSync("parkingSpaceId")
uni.removeStorageSync("parkingStatus")
uni.removeStorageSync("parkingSpaceName")
uni.removeStorageSync("bindCarId")
uni.removeStorageSync("bindCarName")
uni.removeStorageSync("ownerId")
uni.removeStorageSync("ownerName")
uni.navigateBack()
}
</script>

View File

@@ -190,9 +190,7 @@
}
const goBack = () => {
uni.navigateTo({
url: '/pageSubPack/my/addParkingSpace'
})
uni.navigateBack()
}
</script>

View File

@@ -211,12 +211,7 @@
}
const goBack = () => {
uni.navigateTo({
url: '/pageSubPack/my/addParkingSpace',
success: res => {},
fail: () => {},
complete: () => {}
})
uni.navigateBack()
}
</script>

View File

@@ -140,9 +140,7 @@
}
const goBack = () => {
uni.navigateTo({
url: '/pageSubPack/my/myCarIndex'
})
uni.navigateBack()
}
</script>

View File

@@ -134,11 +134,9 @@ const onSubmit = () => {
}
// 返回
const goBack = () => {
uni.navigateTo({
url: '/pageSubPack/my/settingIndex'
})
}
const goBack = () => {
uni.navigateBack()
}
// 页面卸载清除定时器
onUnmounted(() => {

View File

@@ -80,9 +80,7 @@ import { authChangePassword } from '../api/apiSub.js'
}
const goBack = () =>{
uni.navigateTo({
url: '/pageSubPack/my/settingIndex',
});
uni.navigateBack()
}
</script>

View File

@@ -91,11 +91,9 @@ const onDeleteAccount = () => {
})
}
const goBack = () => {
uni.navigateTo({
url: '/pageSubPack/my/settingIndex',
});
}
const goBack = () => {
uni.navigateBack()
}
// 页面进入时开始倒计时
onMounted(() => {

View File

@@ -249,9 +249,7 @@
}
const goBack = () => {
uni.navigateTo({
url: '/pageSubPack/my/myHouseIndex'
})
uni.navigateBack()
}
</script>

View File

@@ -129,9 +129,7 @@
}
const goBack = () => {
uni.switchTab({
url: '/pages/myIndex/myIndex'
})
uni.navigateBack()
}
</script>

View File

@@ -46,7 +46,7 @@
<text
class="value">{{ item.houseStatus==0?'自住':item.houseStatus==1?'闲置':item.houseStatus==2?'租赁':item.houseStatus==3?'其他':''}}</text>
</view>
<view class="defaultBox" v-if="item.certificationStatus=='1'&&!item.isDefault==1">
<view class="defaultBox" >
<text class="set-default">设为默认</text>
<switch class="no-cross-switch" :checked="item.isDefault==1" color="#1677ff"
@change="onSwitchChange($event,item)" @click.stop />
@@ -144,10 +144,6 @@
const onSwitchChange = async (e, i) => {
// uni.showLoading({
// title: '设置中...',
// mask: true
// });
try {
const res = await setMyHouseDefault({
@@ -155,17 +151,15 @@
})
const data = res
if (data.code === 200) {
// uni.hideLoading();
pageNum.value = 1
noMoreData.value = false
getList()
uni.setStorageSync('houseIsDefault', e.detail.value)
uni.showToast({
title: '设置默认房屋成功',
title: res.msg || '设置默认房屋成功',
icon: 'none'
});
} else {
// uni.hideLoading();
uni.showToast({
title: res.msg,
icon: 'none'
@@ -205,12 +199,7 @@
}
const goBack = () => {
uni.switchTab({
url: '/pages/myIndex/myIndex',
success: res => {},
fail: () => {},
complete: () => {}
});
uni.navigateBack()
}
</script>

View File

@@ -164,9 +164,7 @@
}
const goBack = () => {
uni.switchTab({
url: '/pages/myIndex/myIndex'
})
uni.navigateBack()
}
</script>

View File

@@ -258,9 +258,7 @@
}
const goBack = () => {
uni.navigateTo({
url: '/pageSubPack/my/myParkingSpaceIndex'
})
uni.navigateBack()
}
</script>

View File

@@ -152,22 +152,20 @@
// 返回新增
const goBackAdd = () => {
if (checkType.value === '楼栋') {
uni.removeStorageSync('buildingId')
uni.removeStorageSync('buildingName')
} else if (checkType.value === '单元') {
uni.removeStorageSync('unitId')
uni.removeStorageSync('unitName')
} else if (checkType.value === '楼层') {
uni.removeStorageSync('floorId')
uni.removeStorageSync('floorName')
} else if (checkType.value === '户号') {
uni.removeStorageSync('houseNumberId')
uni.removeStorageSync('houseNumberName')
if (checkType.value === "楼栋") {
uni.removeStorageSync("buildingId")
uni.removeStorageSync("buildingName")
} else if (checkType.value === "单元") {
uni.removeStorageSync("unitId")
uni.removeStorageSync("unitName")
} else if (checkType.value === "楼层") {
uni.removeStorageSync("floorId")
uni.removeStorageSync("floorName")
} else if (checkType.value === "户号") {
uni.removeStorageSync("houseNumberId")
uni.removeStorageSync("houseNumberName")
}
uni.navigateTo({
url: '/pageSubPack/my/addHouse'
})
uni.navigateBack()
}
// 获取数据
const getList = async (type) => {

View File

@@ -152,15 +152,9 @@
}
const goBackAdd = () => {
uni.removeStorageSync('carBrandId');
uni.removeStorageSync('carBrandName');
uni.navigateTo({
url: '/pageSubPack/my/addCar',
success: res => {},
fail: () => {},
complete: () => {}
});
uni.removeStorageSync("carBrandId");
uni.removeStorageSync("carBrandName");
uni.navigateBack()
}
onShow(() => {})

View File

@@ -171,9 +171,7 @@
}
const goBack = () => {
uni.navigateTo({
url: '/pageSubPack/my/addParkingSpace'
})
uni.navigateBack()
}
</script>

View File

@@ -146,16 +146,14 @@
}
const goBackAdd = () => {
if (checkType.value == '停车场') {
uni.removeStorageSync('parkingLotId')
uni.removeStorageSync('parkingLotName')
} else if (checkType.value == '车位编号') {
uni.removeStorageSync('parkingSpaceId')
uni.removeStorageSync('parkingSpaceName')
if (checkType.value == "停车场") {
uni.removeStorageSync("parkingLotId")
uni.removeStorageSync("parkingLotName")
} else if (checkType.value == "车位编号") {
uni.removeStorageSync("parkingSpaceId")
uni.removeStorageSync("parkingSpaceName")
}
uni.navigateTo({
url: '/pageSubPack/my/addParkingSpace'
})
uni.navigateBack()
}
</script>

View File

@@ -146,25 +146,9 @@
}
const goBackAdd = () => {
uni.removeStorageSync('communityId');
uni.removeStorageSync('communityName');
if (sourcePage.value == 'addHouse') {
uni.navigateTo({
url: '/pageSubPack/my/addHouse',
success: res => {},
fail: () => {},
complete: () => {}
});
} else if (sourcePage.value == 'addParkingSpace') {
uni.navigateTo({
url: '/pageSubPack/my/addParkingSpace',
success: res => {},
fail: () => {},
complete: () => {}
});
} else {
}
uni.removeStorageSync("communityId");
uni.removeStorageSync("communityName");
uni.navigateBack()
}
</script>

View File

@@ -58,12 +58,12 @@
title: '注销账号',
type: 'arrow'
},
{
title: '升级版本',
type: 'text',
value: '当前版本 1.0.0',
valueClass: 'item-version'
}
// {
// title: '升级版本',
// type: 'text',
// value: '当前版本 1.0.0',
// valueClass: 'item-version'
// }
])
// 格式化字节大小
@@ -105,8 +105,10 @@
currentVersion.value = manifest.version
}
// #endif
if (settingList.value[5]) {
settingList.value[5].value = '当前版本 ' + currentVersion.value
}
}
// 版本号比较v1 > v2 返回 1v1 = v2 返回 0v1 < v2 返回 -1
const compareVersion = (v1, v2) => {
@@ -247,7 +249,12 @@
url: '/pageSubPack/my/changePwd'
});
} else if (item.title == '清除缓存') {
uni.clearStorageSync();
// 保存登录相关数据,清完恢复
const preserveKeys = ['token', 'userId', 'currentVillageId', 'hasShowGuide', 'push_cid']
const saved = {}
preserveKeys.forEach(key => { saved[key] = uni.getStorageSync(key) })
uni.clearStorageSync()
preserveKeys.forEach(key => { if (saved[key]) uni.setStorageSync(key, saved[key]) })
// #ifdef APP-PLUS
plus.cache.clear(() => {})
// #endif
@@ -279,52 +286,30 @@
title: '提示',
content: '确定要退出当前账号吗?',
success: (res) => {
if (res.confirm) {
uni.showLoading({
title: '退出中...',
mask: true
});
if (!res.confirm) return
uni.showLoading({ title: '退出中...', mask: true })
const clearAndGo = () => {
uni.removeStorageSync('token')
uni.removeStorageSync('userId')
uni.removeStorageSync('currentVillageId')
uni.hideLoading()
uni.hideToast()
uni.reLaunch({ url: '/pageSubPack/loginSub/login?mode=pwd' })
}
authLogout().then(res => {
if (res.code === 200) {
// 清除本地登录凭证
uni.removeStorageSync('token');
uni.removeStorageSync('userId');
uni.removeStorageSync('currentVillageId');
uni.hideLoading();
uni.showToast({
title: '退出成功',
icon: 'success'
});
setTimeout(() => {
uni.hideLoading();
uni.reLaunch({
url: '/pageSubPack/loginSub/login?mode=pwd'
});
}, 1500);
uni.hideLoading()
uni.showToast({ title: '退出成功', icon: 'success' })
setTimeout(clearAndGo, 1500)
} else {
// 即使服务端返回失败,也清除本地数据并跳转登录页
uni.removeStorageSync('token');
uni.removeStorageSync('userId');
uni.removeStorageSync('currentVillageId');
uni.hideLoading();
uni.reLaunch({
url: '/pageSubPack/loginSub/login?mode=pwd'
});
clearAndGo()
}
}).catch(err => {
console.log(err);
// 网络异常时也清除本地数据并跳转登录页
uni.removeStorageSync('token');
uni.removeStorageSync('userId');
uni.removeStorageSync('currentVillageId');
uni.hideLoading();
uni.reLaunch({
url: '/pageSubPack/loginSub/login?mode=pwd'
});
console.log(err)
clearAndGo()
})
}
}
})
}

View File

@@ -184,7 +184,7 @@
weixin.launchMiniProgram({
id: 'gh_a765aef0172c',
type: 1, // 0 正式版 / 1测试版 / 2预览版
type: 0, // 0 正式版 / 1测试版 / 2预览版
path: 'pages/arrearsPayment/arrearsPayment?' + queryString,
}, (res) => {
console.log('回调---回调结果App', JSON.stringify(res))

View File

@@ -229,6 +229,7 @@
}
const goToAdd = (type) => {
uni.setStorageSync('addPaymentType', type.name)
if (type.name == '燃气' || type.name == '暖气') {
uni.navigateTo({
url: '/pageSubPack/payment-list/selectPaymentEntity'
@@ -238,7 +239,6 @@
url: '/pageSubPack/payment-list/addHydropower'
})
}
uni.setStorageSync('addPaymentType', type.name)
}
// 获取缴费列表

View File

@@ -289,11 +289,9 @@ const submitForm = async () => {
}
// 返回
const goBack = () => {
uni.navigateTo({
url: '/pageSubPack/service-list/complaintsSuggestionsIndex'
})
}
const goBack = () => {
uni.navigateBack()
}
</script>
<style lang="scss">
page {

View File

@@ -119,11 +119,9 @@ const previewImage = (index) => {
}
// 返回
const goBack = () => {
uni.navigateTo({
url: '/pageSubPack/service-list/complaintsSuggestionsIndex'
})
}
const goBack = () => {
uni.navigateBack()
}
</script>
<style lang="scss">

View File

@@ -1,12 +1,5 @@
{
"pages": [{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
},
{
"path": "pages/navigation/navigation",
"style": {
"navigationBarTitleText": "引导页",
@@ -15,6 +8,13 @@
"navigationStyle": "custom"
}
},
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "",
"navigationStyle": "custom"
}
},
{
"path": "pages/serviceIndex/serviceIndex",
"style": {

View File

@@ -242,7 +242,11 @@
currentVillageId.value = ''
}
}).catch(err => {
// 有 token 才提示错误(无 token 用户正常浏览首页API 401 属于预期行为)
const token = uni.getStorageSync('token')
if (token) {
uni.showToast({ title: err.msg || '网络异常', icon: 'error' })
}
})
}

View File

@@ -80,11 +80,8 @@ const tokenSave = uni.getStorageSync('token')
const needRedirect = hasShowGuide || tokenSave
if (needRedirect) {
if (tokenSave) {
// 已登录或已看过引导页:直接进首页
uni.reLaunch({ url: '/pages/index/index' })
} else if (hasShowGuide) {
uni.reLaunch({ url: '/pageSubPack/loginSub/login?mode=pwd' })
}
}
// ========== 响应式数据 ==========
@@ -122,17 +119,10 @@ const handleBtnClick = () => {
isNavigating.value = true;
// 记录引导已完成
uni.setStorageSync('hasShowGuide', true);
// 检查是否已有登录 token有则直接进首页,否则跳转登录页
const token = uni.getStorageSync('token');
if (token) {
// 直接进首页(未登录用户可正常浏览首页,需登录的功能由点击拦截处理)
uni.switchTab({
url: '/pages/index/index'
})
} else {
uni.navigateTo({
url: "/pageSubPack/loginSub/login?mode=pwd"
})
}
}
};
</script>