Commit 95707f52 by liimin

refactor(skeleton): 替换通用骨架屏组件为专用组件

- 将 AccountList 组件中的 ListSkeleton 替换为 SingleColumnSkeleton
- 将 MerchantList 组件中的 ListSkeleton 替换为 MerchantListSkeleton
- 将 Scene 组件中的 ListSkeleton 替换为 SingleColumnSkeleton
- 新增 MerchantListSkeleton 组件,用于商户列表骨架屏展示
- 新增 SingleColumnSkeleton 组件,用于单列布局骨架屏展示
- 为骨架屏组件添加流光动画效果提升用户体验
- 优化骨架屏组件的布局和样式适配不同场景需求
1 parent 163cdba7
<template> <template>
<!-- 保持单根节点,确保父组件 v-show 生效 --> <!-- 保持单根节点,确保父组件 v-show 生效 -->
<view class="fade-in-up"> <view class="fade-in-up">
<ListSkeleton v-if="!flag" /> <SingleColumnSkeleton v-if="!flag" :count="4" />
<view v-else class="list-container"> <view v-else class="list-container">
<template v-if="loginUserInfoList.length > 0"> <template v-if="loginUserInfoList.length > 0">
<view v-for="(item, index) in loginUserInfoList" <view v-for="(item, index) in loginUserInfoList"
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
import { defineExpose, onMounted, ref } from "vue"; import { defineExpose, onMounted, ref } from "vue";
import { apiGetListSelectAccount, apiGetSceneMerchantRefStoreList, apiSelectAccountLogin } from "@/api/user-api.uts"; import { apiGetListSelectAccount, apiGetSceneMerchantRefStoreList, apiSelectAccountLogin } from "@/api/user-api.uts";
import ListSkeleton from "@/components/Skeleton/ListSkeleton.uvue"; import SingleColumnSkeleton from "./Skeleton/SingleColumnSkeleton.uvue";
import { storage } from "@/utils/storage.uts"; import { storage } from "@/utils/storage.uts";
type AccountItem = { type AccountItem = {
......
<template> <template>
<view class="fade-in-up"> <view class="fade-in-up">
<ListSkeleton v-if="!flag" /> <MerchantListSkeleton v-if="!flag" :count="6" />
<view v-if="flag" class="list-container"> <view v-if="flag" class="list-container">
<template v-if="loginUserInfoList.length > 0"> <template v-if="loginUserInfoList.length > 0">
<view v-for="(item, index) in loginUserInfoList" <view v-for="(item, index) in loginUserInfoList"
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
import { defineExpose, ref } from "vue"; import { defineExpose, ref } from "vue";
import { apiGetSceneMerchantRefStoreList, apiGetYqMerchantSceneConfigAPI, apiSelectMerchantScene } from "@/api/user-api.uts"; import { apiGetSceneMerchantRefStoreList, apiGetYqMerchantSceneConfigAPI, apiSelectMerchantScene } from "@/api/user-api.uts";
import ListSkeleton from "@/components/Skeleton/ListSkeleton.uvue"; import MerchantListSkeleton from "./Skeleton/MerchantListSkeleton.uvue";
import { storage } from "@/utils/storage.uts"; import { storage } from "@/utils/storage.uts";
type MerchantItem = { type MerchantItem = {
......
<template> <template>
<view class="fade-in-up"> <view class="fade-in-up">
<ListSkeleton v-if="loading" /> <SingleColumnSkeleton v-if="loading" :count="3" />
<view v-else class="list-container"> <view v-else class="list-container">
<template v-if="sceneList.length > 0"> <template v-if="sceneList.length > 0">
<view v-for="(item, index) in sceneList" <view v-for="(item, index) in sceneList"
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
import { defineExpose, ref } from "vue"; import { defineExpose, ref } from "vue";
import { apiGetMerchantBrand, apiSelectMerchantScene } from "@/api/user-api.uts"; import { apiGetMerchantBrand, apiSelectMerchantScene } from "@/api/user-api.uts";
import ListSkeleton from "@/components/Skeleton/ListSkeleton.uvue"; import SingleColumnSkeleton from "./Skeleton/SingleColumnSkeleton.uvue";
import { storage } from "@/utils/storage.uts"; import { storage } from "@/utils/storage.uts";
type SceneItem = { type SceneItem = {
......
<template>
<view class="merchant-skeleton-wrap">
<view class="skeleton-grid-container">
<view v-for="i in count" :key="i"
class="skeleton-item"
:class="[(i + 1) % 2 === 0 ? 'item-even' : '']">
<view class="skeleton-shimmer"></view>
<view class="skeleton-badge"></view>
<view class="skeleton-info">
<view class="skeleton-line skeleton-name"></view>
<view class="skeleton-line skeleton-id"></view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
defineProps({
count: {
type: Number,
default: 6
}
});
</script>
<style scoped lang="scss">
.merchant-skeleton-wrap {
width: 100%;
box-sizing: border-box;
}
.skeleton-grid-container {
display: flex;
flex-direction: row;
flex-wrap: wrap;
width: 100%;
}
.skeleton-item {
min-height: 72px;
background-color: #f5f5f5;
border-radius: 14px;
padding: 12px 14px;
display: flex;
flex-direction: row;
align-items: center;
width: 48%;
margin-right: 4%;
margin-bottom: 12px;
box-sizing: border-box;
position: relative;
overflow: hidden;
// 每行第二个元素去掉右边距
&.item-even {
margin-right: 0;
}
// 流光效果层
.skeleton-shimmer {
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(
90deg,
transparent 0%,
rgba(255, 255, 255, 0.3) 50%,
transparent 100%
);
animation: skeleton-shimmer 1.5s infinite;
pointer-events: none;
}
.skeleton-badge {
width: 36px;
height: 36px;
border-radius: 10px;
background-color: #e0e0e0;
margin-right: 10px;
flex-shrink: 0;
}
.skeleton-info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
min-width: 0;
.skeleton-line {
height: 12px;
border-radius: 6px;
background-color: #e0e0e0;
margin-bottom: 6px;
&:last-child {
margin-bottom: 0;
}
}
.skeleton-name {
width: 70%;
height: 13px;
}
.skeleton-id {
width: 50%;
height: 10px;
}
}
}
@keyframes skeleton-shimmer {
0% {
left: -100%;
}
100% {
left: 100%;
}
}
</style>
<template>
<view class="single-column-skeleton-wrap">
<view v-for="i in count" :key="i" class="skeleton-item">
<view class="skeleton-shimmer"></view>
<view class="skeleton-left">
<view class="skeleton-avatar"></view>
</view>
<view class="skeleton-right">
<view class="skeleton-line skeleton-title"></view>
<view class="skeleton-line skeleton-subtitle"></view>
</view>
</view>
</view>
</template>
<script setup lang="uts">
defineProps({
count: {
type: Number,
default: 4
}
});
</script>
<style scoped lang="scss">
.single-column-skeleton-wrap {
width: 100%;
box-sizing: border-box;
}
.skeleton-item {
min-height: 92px;
background-color: #f5f5f5;
border-radius: 16px;
padding: 18px;
display: flex;
flex-direction: row;
align-items: center;
margin-bottom: 16px;
position: relative;
overflow: hidden;
&:last-child {
margin-bottom: 0;
}
// 流光效果层
.skeleton-shimmer {
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(
90deg,
transparent 0%,
rgba(255, 255, 255, 0.3) 50%,
transparent 100%
);
animation: skeleton-shimmer 1.5s infinite;
pointer-events: none;
}
.skeleton-left {
margin-right: 16px;
flex-shrink: 0;
.skeleton-avatar {
width: 52px;
height: 52px;
border-radius: 26px;
background-color: #e0e0e0;
}
}
.skeleton-right {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
.skeleton-line {
height: 14px;
border-radius: 7px;
background-color: #e0e0e0;
margin-bottom: 8px;
&:last-child {
margin-bottom: 0;
}
}
.skeleton-title {
width: 60%;
height: 16px;
}
.skeleton-subtitle {
width: 40%;
height: 12px;
}
}
}
@keyframes skeleton-shimmer {
0% {
left: -100%;
}
100% {
left: 100%;
}
}
</style>
...@@ -1241,27 +1241,6 @@ onUnmounted(() => { ...@@ -1241,27 +1241,6 @@ onUnmounted(() => {
<style scoped lang="scss"> <style scoped lang="scss">
@import "./styles/common.scss"; @import "./styles/common.scss";
<<<<<<< HEAD
// @import "./styles/landscape.scss";
// @import "./styles/portrait.scss";
.reception-shell-page {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
.reception-shell-page :deep(.scene-shell-root) {
flex: 1;
min-height: 0;
min-width: 0;
width: 100%;
height: 100%;
}
=======
>>>>>>> e9b81af8 (refactor(reception): 移除不必要的样式和优化接待中心布局)
/* 接待中心页面包一层:供预录表单绝对定位覆盖 */ /* 接待中心页面包一层:供预录表单绝对定位覆盖 */
.reception-center-page { .reception-center-page {
flex: 1; flex: 1;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!