From 6e14b8dd69d71e7172fbbb539fe95f507d81abff Mon Sep 17 00:00:00 2001 From: linxi <957440651@qq.com> Date: Fri, 4 Sep 2026 11:27:06 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9A5953=20=E3=80=90=E5=95=86=E5=9F=8E?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E3=80=91=E4=BD=BF=E7=94=A8=E6=8C=87?= =?UTF-8?q?=E5=8D=97=E9=A1=B5=E9=9D=A2=E5=88=87=E6=8D=A2=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=97=B6=E9=A1=B5=E9=9D=A2=E5=88=B7=E6=96=B0?= =?UTF-8?q?=EF=BC=8C=E7=9F=AD=E6=9A=82=E5=B1=95=E7=A4=BA=E2=80=9C=E6=9A=82?= =?UTF-8?q?=E6=97=A0=E6=95=B0=E6=8D=AE=E2=80=9D=EF=BC=8C=E9=9C=80=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E9=A1=B5=E9=9D=A2=E5=88=87=E6=8D=A2=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/VideoPlayBackList/VideoPlayBackList.vue | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/pages/VideoPlayBackList/VideoPlayBackList.vue b/pages/VideoPlayBackList/VideoPlayBackList.vue index e74a49a..3256fd7 100644 --- a/pages/VideoPlayBackList/VideoPlayBackList.vue +++ b/pages/VideoPlayBackList/VideoPlayBackList.vue @@ -41,7 +41,9 @@ - + 加载中... + + 暂无数据 @@ -73,12 +75,16 @@ export default { leftHeight: 0, rightHeight: 0, isWait: false, + requestId: 0, pageKeyId: Object.freeze('findVideoList') } }, computed: { hasList() { return this.leftList.length + this.rightList.length > 0 + }, + showEmpty() { + return !this.isWait && !this.hasList } }, onLoad(options) { @@ -106,7 +112,9 @@ export default { changeType(item) { this.type = item.value this.page = 1 - this.resetList() + // 使进行中的请求失效并解锁,避免切换时被上一次请求阻塞 + this.requestId++ + this.isWait = false this.fetchList() }, resetList() { @@ -117,6 +125,7 @@ export default { }, async fetchList() { if (this.isWait) return + const requestId = ++this.requestId this.isWait = true const params = { type: this.type, @@ -125,13 +134,17 @@ export default { } try { const res = await getVideoList(params) + // 请求已被更新的请求(如切换分类)取代,丢弃本次结果 + if (requestId !== this.requestId) return if (res.status === 200) { const items = res.data for (let i = 0; i < items.length; i++) { items[i].hide = true } - // 并行获取所有封面高度 + // 并行获取所有封面高度,完成后一次性替换列表,避免闪现空列表 const heights = await Promise.all(items.map(item => this.getImageHeight(item.cover))) + if (requestId !== this.requestId) return + if (this.page === 1) this.resetList() items.forEach((item, i) => { this.pushToColumn(item, heights[i] + TEXT_HEIGHT) }) @@ -139,7 +152,9 @@ export default { } catch (e) { // 忽略请求或图片尺寸获取失败 } finally { - this.isWait = false + if (requestId === this.requestId) { + this.isWait = false + } } }, getImageHeight(src) { @@ -252,4 +267,11 @@ export default { } } } + +.loading-more { + padding: 24rpx 0; + text-align: center; + font-size: 24rpx; + color: #999; +}