优化界面

This commit is contained in:
Leo_Ding 2025-08-12 16:49:19 +08:00
parent 2a48964efb
commit 293b3d8bf3
6 changed files with 128 additions and 121 deletions

View File

@ -397,11 +397,11 @@ export default {
},
previewImage(index) {
if (!this.detailInfo.detailImages || !this.detailInfo.detailImages.length) return;
// if (!this.detailInfo.detailImages || !this.detailInfo.detailImages.length) return;
uni.previewImage({
current: index,
urls: this.detailInfo.detailImages.map(img => img.startsWith('http') ? img : IMAGE_BASE_URL + img)
urls: this.detailInfo.imgs.map(img => img.startsWith('http') ? img : IMAGE_BASE_URL + img)
});
},

View File

@ -48,7 +48,7 @@
<view class="weather-main">
<view class="current-weather">
<image class="weather-icon"
:src="weather.weather ? getWeatherIcon(weather.weather) : '/static/imgs/weather/default.png'"
:src="weather.weather ? getWeatherIcon(weather.weather) : '/static/imgs/weather.png'"
mode="aspectFit"></image>
<text class="current-temp">{{weather.real || '--'}}°</text>
</view>
@ -127,7 +127,7 @@ import Copyright from '@/components/gx-copyright.vue';
import Footer from '@/components/footer_common.vue';
import { get, post } from '@/utils/request';
import { IMAGE_BASE_URL, BASE_URL } from '@/utils/config';
import {navigateTo} from '@/utils/router.js'
export default {
components: {
Footer,
@ -161,9 +161,14 @@ export default {
},
methods: {
goDetail(page) {
if(page==='neighbor'){
navigateTo({url: `/pages/${page}/index`})
}else{
uni.navigateTo({
url: `/pages/${page}/index`
});
}
},
formatDate(date) {
const weekdays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];

View File

@ -39,6 +39,7 @@
<!-- 预约记录列表 -->
<view class="order-list" v-else>
<u-loading-page :loading="dataloading"></u-loading-page>
<view v-if="orderList.length === 0" class="empty-container">
<noData />
</view>
@ -313,6 +314,7 @@
//
async getList() {
try {
wx.showLoading({title:'加载中...',mask:true})
const res = await get('/api/v1/apps/home/metting-room', {
current: 1,
pageSize: 10,
@ -329,12 +331,13 @@
icon: 'none'
});
} finally {
this.isLoading = false;
wx.hideLoading()
}
},
//
async getOrderList() {
try {
wx.showLoading({title:'加载中...',mask:true})
const res = await get('/api/v1/app_auth/metting-room/order', {
current: 1,
pageSize: 10,
@ -352,7 +355,7 @@
icon: 'none'
});
} finally {
this.isLoading = false;
wx.hideLoading()
}
},

View File

@ -52,11 +52,11 @@
height="780px"
v-if="filteredOrders.length === 0"
mode="data"
icon="/static/imgs/noData.jpeg"
icon="/static/imgs/noData.png"
></u-empty>
</view>
</view>
<Footer></Footer>
<!-- <Footer></Footer> -->
<!-- 固定在右侧的发布工单按钮 -->
<view class="fab-container">

View File

@ -17,17 +17,13 @@
</view>
</view>
<!-- 实际列表 -->
<view class="notice-item"
v-for="(item,index) in noticesList"
:key="item.id"
<!-- 滚动区域 -->
<scroll-view scroll-y :style="'height:' + scrollViewHeight + 'px'" @scrolltolower="loadMore"
lower-threshold="100" :scroll-with-animation="true">
<view class="notice-item" v-for="(item,index) in noticesList" :key="item.id"
@click="goNoticeDetail(item.id)">
<image :src="item.cover"
class="notice-image"
mode="aspectFill"
lazy-load
:show-menu-by-longpress="true"
@error="handleImageError(index)"></image>
<image :src="item.cover" class="notice-image" mode="aspectFill" lazy-load
:show-menu-by-longpress="true" @error="handleImageError(index)"></image>
<view class="notice-content">
<view class="notice-title line-clamp-1">{{item.title}}</view>
<view class="notice-description line-clamp-2" v-html="item.desc"></view>
@ -42,31 +38,36 @@
<view class="load-more" v-if="noticesList.length > 0 && currentPage < totalPages">
<text>{{isLoading ? '加载中...' : '上拉加载更多'}}</text>
</view>
</scroll-view>
<!-- 空状态 -->
<view class="empty-state" v-if="noticesList.length === 0 && !isLoading">
<image src="/static/images/empty-notice.png" class="empty-image"></image>
<image src="/static/imgs/noData.png" class="empty-image"></image>
<text class="empty-text">暂无公告</text>
</view>
</view>
</view>
<Copyright/>
<Copyright />
</view>
<!-- 底部导航 -->
<Footer></Footer>
</view>
</template>
<script>
import { get } from '@/utils/request';
import { IMAGE_BASE_URL } from '@/utils/config';
import { formatTime } from '@/utils/timeFormat';
import Footer from '@/components/footer_common.vue';
import {
get
} from '@/utils/request';
import {
IMAGE_BASE_URL
} from '@/utils/config';
import {
formatTime
} from '@/utils/timeFormat';
import Copyright from '@/components/gx-copyright.vue';
export default {
components: { Footer,Copyright },
components: {
Copyright
},
data() {
return {
formatTime,
@ -76,17 +77,27 @@
isLoading: false,
currentPage: 1,
totalPages: 1,
lastRequestTime: 0
lastRequestTime: 0,
scrollViewHeight: 500 // mounted
};
},
mounted() {
this.calculateScrollHeight();
this.getNotices();
this.initScrollListener();
},
beforeDestroy() {
this.removeScrollListener();
},
methods: {
//
calculateScrollHeight() {
const systemInfo = uni.getSystemInfoSync();
const query = uni.createSelectorQuery().in(this);
query.select('.container').boundingClientRect(data => {
if (data) {
//
this.scrollViewHeight = systemInfo.windowHeight - 50;
}
}).exec();
},
async getNotices() {
//
const now = Date.now();
@ -104,23 +115,34 @@
await this.fetchNotices();
},
loadMore() {
if (!this.isLoading && this.currentPage < this.totalPages) {
console.log('触发加载更多,当前页:', this.currentPage);
this.currentPage += 1;
this.fetchNotices();
}
},
async fetchNotices() {
this.isLoading = true;
uni.showLoading({ title: '加载中...', mask: true });
uni.showLoading({
title: '加载中...',
mask: true
});
try {
const res = await get('/api/v1/apps/home/notices', {
current: this.currentPage,
pageSize: 10,
pageSize: 10, // 10
}, {
timeout: 5000 //
timeout: 5000
});
if (res?.success) {
const processedData = res.data.map(item => ({
...item,
cover: this.processImageUrl(item.cover),
desc: this.filterHtmlTags(item.desc) // HTMLXSS
desc: this.filterHtmlTags(item.desc)
}));
if (this.currentPage === 1) {
@ -173,30 +195,6 @@
url: `/pages/serviceNoticeDetail/index?Id=${id}`,
animationType: 'slide-in-right'
});
},
initScrollListener() {
this.onScroll = () => {
const scrollHeight = document.documentElement.scrollHeight;
const scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
const clientHeight = document.documentElement.clientHeight;
// 200px
if (scrollTop + clientHeight >= scrollHeight - 200 &&
this.currentPage < this.totalPages &&
!this.isLoading) {
this.currentPage++;
this.getNotices();
}
};
window.addEventListener('scroll', this.onScroll);
},
removeScrollListener() {
if (this.onScroll) {
window.removeEventListener('scroll', this.onScroll);
}
}
}
};
@ -226,8 +224,7 @@
.content {
flex: 1;
margin-top: 30rpx;
border-radius: 30rpx 30rpx 0 0;
// border-radius: 30rpx 30rpx 0 0;
background-color: rgba(255, 255, 255, 0.85);
padding-bottom: env(safe-area-inset-bottom);
box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.05);
@ -249,6 +246,7 @@
transition: all 0.3s ease;
box-shadow: var(--shadow);
border: 1rpx solid var(--border-color);
margin-bottom: 20rpx;
&:active {
transform: scale(0.98);
@ -381,6 +379,7 @@
0% {
background-position: 100% 50%;
}
100% {
background-position: 0 50%;
}

BIN
static/imgs/weather.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB