优化登录提示语,优化request错误返回提示语

This commit is contained in:
zhouyanli
2026-05-12 17:33:46 +08:00
parent f2f5c5e050
commit fa017d657f
8 changed files with 119 additions and 39 deletions

View File

@@ -165,7 +165,7 @@
import { ref } from 'vue'
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,getBannarList} from "/pageSubPack/api/api.js"
// 列表数据状态
@@ -176,7 +176,7 @@ const currentCommunity = ref('请认证小区')
const currentVillageId = ref('')
const bannerList = ref([
// 'http://47.104.199.163:9090/images/home/banner.png',
"http://47.104.199.163:9090/images/propertyImgs/serviceImg2.png"
// "http://47.104.199.163:9090/images/propertyImgs/serviceImg2.png"
])
const noticeText = ref('暂无公告')
@@ -195,6 +195,20 @@ const getNoticeMore = () =>{
url:"/pageSubPack/notice-list/noticeList"
})
}
// 获取bannar列表
const getbannarData = async () =>{
try{
const res = await getBannarList({villageId:uni.getStorageSync('currentVillageId')})
if(res.code === 200){
bannerList.value = res.data.map(item =>item.url)
}else{
uni.showToast({title:'获取失败',icon:'error'})
}
}catch (err){
const msg = err?.msg || (typeof err === 'string' ? err : '获取失败')
uni.showToast({title: msg,icon:'error'})
}
}
// 接收选择小区返回的参数
const slelctHomeData = (data) =>{
// console.log('收到B页面返回的数据', data)
@@ -221,7 +235,7 @@ const getCurrentCommunityData = () => {
}
}).catch(err =>{
uni.showToast({
title: '网络异常',
title: err.msg || '网络异常',
icon: 'error'
});
})
@@ -251,7 +265,7 @@ const getNoticeData = async() =>{
} catch (err) {
// console.error('获取通知数据异常:', err)
uni.showToast({
title: err.msg,
title: err.msg || '网络异常',
icon: 'error',
duration: 1000
})
@@ -276,6 +290,7 @@ onLoad(() => {
}
getNoticeData()
getNewActivityList()
getbannarData()
})
// 页面销毁时移除监听(防止内存泄漏)
@@ -387,7 +402,7 @@ const moreClick = () =>{
width: 100%;
background: repeating-linear-gradient(to right, #EDF4FA , #C0E4FB);
position: absolute;
}
.status_bar {
height: 46px;