首页滚动、单体电池滚动

This commit is contained in:
2025-08-05 17:26:18 +08:00
parent 4a2d3de48b
commit bc18edead5
3 changed files with 33 additions and 29 deletions

View File

@ -13,7 +13,8 @@
"path": "pages/index", "path": "pages/index",
"style": { "style": {
"navigationBarTitleText": "移动端框架", "navigationBarTitleText": "移动端框架",
"navigationStyle": "custom" "navigationStyle": "custom",
"onReachBottomDistance": 100
} }
}, { }, {
"path": "pages/work/index", "path": "pages/work/index",

View File

@ -12,21 +12,19 @@
</uni-col> </uni-col>
</uni-row> </uni-row>
</view> </view>
<scroll-view class="scroll-y" :scroll-y="true" @scrolltolower="lower" scrolltoupper="upper"> <view v-if="list.length===0" class="no-data">暂无数据</view>
<view class="content"> <view class="content scroll-y" v-else>
<view class="item-list" v-for="item in list" :key="item.ticketNo+'ticket'" @click="toDetail(item.id)"> <view class="item-list" v-for="item in list" :key="item.ticketNo+'ticket'" @click="toDetail(item.id)">
<view class="item-title" :class="item.status === 1 ? 'done' : 'undone'">工单号{{item.ticketNo}}</view> <view class="item-title" :class="item.status === 1 ? 'done' : 'undone'">工单号{{item.ticketNo}}</view>
<view class="item-content"> <view class="item-content">
<view class="item-info">工单标题:{{item.title}}</view> <view class="item-info">工单标题:{{item.title}}</view>
<view class="item-info">问题描述:{{item.content}}</view> <view class="item-info">问题描述:{{item.content}}</view>
<view class="item-info">工单状态:{{ticketStatusOptions[item.status]}}</view> <view class="item-info">工单状态:{{ticketStatusOptions[item.status]}}</view>
<view class="item-info">预期完成时间:{{item.expectedCompleteTime || '-'}}</view> <view class="item-info">预期完成时间:{{item.expectedCompleteTime || '-'}}</view>
<view class="item-info">处理人:{{item.workName || '-'}}</view> <view class="item-info">处理人:{{item.workName || '-'}}</view>
</view>
</view> </view>
<view v-if="list.length===0" class="no-data">暂无数据</view>
</view> </view>
</scroll-view> </view>
</view> </view>
</template> </template>
<script> <script>
@ -58,15 +56,6 @@
this.reset() this.reset()
this.init() this.init()
}, },
lower() {
if (this.list.length >= this.total) {
return console.log('数据已经加载完成')
}
this.pageNum += 1;
this.init().catch(() => {
this.pageNum -= 1
})
},
init() { init() {
//0:'待处理', 1:'已处理', 2:'处理中' //0:'待处理', 1:'已处理', 2:'处理中'
let url = `/ticket/list?pageNum=${this.pageNum}&pageSize=${this.pageSize}` let url = `/ticket/list?pageNum=${this.pageNum}&pageSize=${this.pageSize}`
@ -93,6 +82,17 @@
this.pageNum = 1 this.pageNum = 1
} }
}, },
onReachBottom() {
console.log('触底了')
if (this.list.length >= this.total) {
return console.log('数据已经加载完成')
}
this.pageNum += 1;
this.init().catch(() => {
this.pageNum -= 1
})
},
onShow() { onShow() {
this.reset() this.reset()
this.init() this.init()
@ -135,7 +135,7 @@
} }
.scroll-y { .scroll-y {
height: calc(100vh - var(--window-bottom) - var(--window-top)); // height: calc(100vh - var(--window-bottom) - var(--window-top));
z-index: 1; z-index: 1;
} }

View File

@ -126,6 +126,14 @@
onPageScroll(e) { onPageScroll(e) {
this.pageScrollTop = e.scrollTop this.pageScrollTop = e.scrollTop
}, },
onReachBottom() {
console.log('触底了')
if (this.list.length >= this.total) {
return console.log('数据已经加载完成')
}
this.pageNum += 1 //每次搜索从1开始搜索
this.getTableData()
},
methods: { methods: {
openSearch() { openSearch() {
this.$refs.searchPopup.open() this.$refs.searchPopup.open()
@ -146,11 +154,6 @@
deviceId deviceId
}, dataType) }, dataType)
}, },
onReachBottom() {
console.log('触底了')
this.pageNum += 1 //每次搜索从1开始搜索
this.getTableData()
},
// 搜索 // 搜索
onSearch() { onSearch() {
this.pageNum = 1 //每次搜索从1开始搜索 this.pageNum = 1 //每次搜索从1开始搜索