Commit d36bd5ee by Lin

feat: 骨架屏/切换优化

1 parent 99fa49ed
......@@ -959,7 +959,6 @@ getCustomerListImpl = async (append: boolean): Promise<void> => {
if (append) {
customerFilePageNum.value = customerFilePageNum.value + 1
pageBumped = true
customerListLoadingMore.value = true
} else {
customerListHasMore.value = true
}
......@@ -968,10 +967,11 @@ getCustomerListImpl = async (append: boolean): Promise<void> => {
console.warn('[getCustomerList] 无登录门店信息,跳过客户档案列表请求')
if (pageBumped) {
customerFilePageNum.value = customerFilePageNum.value - 1
customerListLoadingMore.value = false
}
return
}
// 首屏/筛选重置与加载更多统一置位,供列表骨架屏、底部「加载中」与空态判断使用(append=false 原先未置 true,导致首屏一直空白)
customerListLoadingMore.value = true
try {
const res = await getCustomerFileList(fileParams)
console.log('[ReceptionCenter] 获取客户列表res', res)
......@@ -1040,9 +1040,7 @@ getCustomerListImpl = async (append: boolean): Promise<void> => {
}
uni.showToast({ title: '网络异常,请稍后重试', icon: 'none' })
} finally {
if (append == true) {
customerListLoadingMore.value = false
}
customerListLoadingMore.value = false
}
}
......@@ -1060,7 +1058,6 @@ getReceptionRecordListImpl = async (append: boolean): Promise<void> => {
if (append) {
receptionPageNum.value = receptionPageNum.value + 1
pageBumped = true
receptionListLoadingMore.value = true
} else {
receptionListHasMore.value = true
}
......@@ -1069,10 +1066,10 @@ getReceptionRecordListImpl = async (append: boolean): Promise<void> => {
console.warn('[getReceptionRecordList] 无登录门店信息,跳过接待复盘列表请求')
if (pageBumped) {
receptionPageNum.value = receptionPageNum.value - 1
receptionListLoadingMore.value = false
}
return
}
receptionListLoadingMore.value = true
console.log("receptionParams接待复盘参数",receptionParams);
try {
const res = await getReceptionList(receptionParams)
......@@ -1142,9 +1139,7 @@ getReceptionRecordListImpl = async (append: boolean): Promise<void> => {
}
uni.showToast({ title: '网络异常,请稍后重试', icon: 'none' })
} finally {
if (append == true) {
receptionListLoadingMore.value = false
}
receptionListLoadingMore.value = false
}
}
......
<template>
<!-- 客户录入列表:与 customervisits.customerInfoPage 字段对齐(ownerPhone / brandModel / customerTagName / arrivalDate / ownerName) -->
<view :class="['customer-entry-list', isListDualColumn ? 'customer-entry-list-landscape' : '']">
<!-- 首次加载:列表为空时,用骨架卡片占位,避免空白 -->
<!-- 首次加载:列表为空时,用骨架卡片占位,避免空白(v-if 与 v-for 分节点,避免与编译器优先级问题) -->
<view
v-if="loading && (props.customerList == null || props.customerList.length == 0)"
v-for="i in skeletonCardCount"
:key="'entry-skeleton-' + i"
:class="['list-card', 'list-card-entry', 'glass-card', isListDualColumn ? 'list-card-entry-landscape' : '']"
:class="['customer-entry-skeleton-wrap', isListDualColumn ? 'customer-entry-skeleton-wrap-landscape' : '']"
>
<un-skeleton rows="4" title loading></un-skeleton>
<view
v-for="i in skeletonCardCount"
:key="'entry-skeleton-' + i"
:class="['list-card', 'list-card-entry', 'glass-card', isListDualColumn ? 'list-card-entry-landscape' : '']"
>
<un-skeleton rows="4" title loading></un-skeleton>
</view>
</view>
<view
v-else
......@@ -76,7 +80,7 @@ const props = defineProps<{
}>()
const loading = computed<boolean>(() => props.loading === true)
const skeletonCardCount = 3
const skeletonCardCount = 4
/** 是否横屏(w > h)。uni-app x UTS 当前编译目标不支持 onWindowResize,使用轮询响应旋转 */
const isLandscape = ref(false)
......@@ -328,6 +332,17 @@ function onEntryCardMaskDelete(item: UTSJSONObject): void {
width: 100%;
}
.customer-entry-skeleton-wrap {
flex-direction: column;
width: 100%;
}
.customer-entry-skeleton-wrap-landscape {
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
}
.customer-entry-list-landscape {
flex-direction: row;
flex-wrap: wrap;
......
......@@ -3,12 +3,16 @@
<view :class="['reception-record-list', isListDualColumn ? 'reception-record-list-landscape' : '']">
<!-- 首次加载:列表为空时,用骨架卡片占位,避免空白 -->
<view
v-if="!loading && (props.receptionRecordList == null || props.receptionRecordList.length == 0)"
v-for="i in skeletonCardCount"
:key="'reception-skeleton-' + i"
:class="['list-card', 'glass-card', isListDualColumn ? 'list-card-landscape' : '']"
v-if="loading && (props.receptionRecordList == null || props.receptionRecordList.length == 0)"
:class="['reception-record-skeleton-wrap', isListDualColumn ? 'reception-record-skeleton-wrap-landscape' : '']"
>
<un-skeleton rows="4" title loading></un-skeleton>
<view
v-for="i in skeletonCardCount"
:key="'reception-skeleton-' + i"
:class="['list-card', 'glass-card', isListDualColumn ? 'list-card-landscape' : '']"
>
<un-skeleton rows="3" title loading></un-skeleton>
</view>
</view>
<view
v-else
......@@ -64,7 +68,7 @@ const props = defineProps<{
}>()
const loading = computed<boolean>(() => props.loading === true)
const skeletonCardCount = 3
const skeletonCardCount = 4
/** 是否横屏(w > h)。uni-app x UTS 当前编译目标不支持 onWindowResize,使用轮询响应旋转 */
const isLandscape = ref(false)
......@@ -307,6 +311,17 @@ function onCardClick(item: UTSJSONObject): void {
justify-content: space-between;
}
.reception-record-skeleton-wrap {
flex-direction: column;
width: 100%;
}
.reception-record-skeleton-wrap-landscape {
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
}
.glass-card {
background-color: rgba(255, 255, 255, 0.85);
border: 1px solid rgba(255, 255, 255, 0.6);
......
......@@ -112,6 +112,7 @@
v-if="showCustomerEmpty != true"
:customer-list="customerList"
:entry-filter-index="entryFilterIndex"
:loading="customerListLoadingMore == true && customerList.length == 0"
@entry-click="emit('entryClick', $event)"
@entry-edit="emit('entryEdit', $event)"
@entry-delete="emit('entryDelete', $event)"
......@@ -123,6 +124,7 @@
<ListReception
v-if="showReceptionEmpty != true"
:reception-record-list="receptionRecordList"
:loading="receptionListLoadingMore == true && receptionRecordList.length == 0"
@reception-click="emit('receptionClick', $event)"
/>
</view>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!