修改bug
This commit is contained in:
@@ -221,8 +221,8 @@ const handleLogin = () => {
|
|||||||
if (res.data) {
|
if (res.data) {
|
||||||
uni.setStorageSync('token', res.data.token)
|
uni.setStorageSync('token', res.data.token)
|
||||||
// 存用户ID
|
// 存用户ID
|
||||||
if (res.data.userId) {
|
if (res.data.user.userId) {
|
||||||
uni.setStorageSync('userId', res.data.userId)
|
uni.setStorageSync('userId', res.data.user.userId)
|
||||||
}
|
}
|
||||||
// 清掉上次账号的小区缓存,防止新账号显示旧小区
|
// 清掉上次账号的小区缓存,防止新账号显示旧小区
|
||||||
uni.removeStorageSync('currentVillage')
|
uni.removeStorageSync('currentVillage')
|
||||||
|
|||||||
@@ -118,6 +118,7 @@
|
|||||||
switchVillage({ villageId: selectedItem.value.id }).then((res) =>{
|
switchVillage({ villageId: selectedItem.value.id }).then((res) =>{
|
||||||
if(res.code === 200){
|
if(res.code === 200){
|
||||||
uni.showToast({ title: '切换成功', icon: 'success', duration: 1500 })
|
uni.showToast({ title: '切换成功', icon: 'success', duration: 1500 })
|
||||||
|
uni.hideLoading()
|
||||||
uni.$emit('confirm', selectedItem.value)
|
uni.$emit('confirm', selectedItem.value)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uni.navigateBack()
|
uni.navigateBack()
|
||||||
|
|||||||
@@ -46,8 +46,16 @@
|
|||||||
:current="current"
|
:current="current"
|
||||||
mode="default"
|
mode="default"
|
||||||
>
|
>
|
||||||
<swiper class="swiper-box" :current="current" @change="onSwiperChange" autoplay>
|
<swiper
|
||||||
<swiper-item v-for="(item, index) in bannerList" :key="index">
|
class="swiper-box"
|
||||||
|
:current="current"
|
||||||
|
@change="onSwiperChange"
|
||||||
|
autoplay
|
||||||
|
circular
|
||||||
|
:interval="5000"
|
||||||
|
:duration="500"
|
||||||
|
>
|
||||||
|
<swiper-item v-for="(item, index) in bannerList" :key="item.id || item.url || index">
|
||||||
<view class="swiper-item">
|
<view class="swiper-item">
|
||||||
<image :src="item.url" style="width: 100%; height: 100%"></image>
|
<image :src="item.url" style="width: 100%; height: 100%"></image>
|
||||||
</view>
|
</view>
|
||||||
@@ -166,7 +174,7 @@ import {
|
|||||||
|
|
||||||
// 列表数据状态
|
// 列表数据状态
|
||||||
const current = ref(0)
|
const current = ref(0)
|
||||||
const currentCommunity = ref('请选择小区')
|
const currentCommunity = ref('请先绑定房屋')
|
||||||
const bannerList = ref([])
|
const bannerList = ref([])
|
||||||
const noticeText = ref('暂无公告')
|
const noticeText = ref('暂无公告')
|
||||||
const allCount = ref(0) // 全部巡检
|
const allCount = ref(0) // 全部巡检
|
||||||
@@ -239,7 +247,7 @@ const goToReport = () => {
|
|||||||
// 获取当前小区
|
// 获取当前小区
|
||||||
const currentVillageData = () => {
|
const currentVillageData = () => {
|
||||||
// 先重置,避免新账号无小区时仍显示旧账号的小区
|
// 先重置,避免新账号无小区时仍显示旧账号的小区
|
||||||
currentCommunity.value = '请选择小区'
|
currentCommunity.value = '请先绑定房屋'
|
||||||
getCurrentVillage()
|
getCurrentVillage()
|
||||||
.then(res => {
|
.then(res => {
|
||||||
const data = res.data
|
const data = res.data
|
||||||
@@ -290,7 +298,12 @@ function getbannarData() {
|
|||||||
getBannarList()
|
getBannarList()
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.code === 200 && res.data) {
|
if (res.code === 200 && res.data) {
|
||||||
bannerList.value = res.data
|
// 只有数据真正变化时才更新,避免 swiper 重新渲染导致闪动
|
||||||
|
const newData = res.data
|
||||||
|
const oldData = bannerList.value
|
||||||
|
if (JSON.stringify(newData) !== JSON.stringify(oldData)) {
|
||||||
|
bannerList.value = newData
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
bannerList.value = []
|
bannerList.value = []
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user