mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 19:03:27 +08:00
Merge branch 'feat/bob_sk' into 'dev'
uniapp【新增】:首页新增骨架屏 See merge request jianweie/coreshoppro!64
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<template v-if="props.needSkeleton">
|
<template v-if="props.needSkeleton">
|
||||||
<uv-skeletons :skeleton="props.skeleton" :loading="props.skeletonLoading">
|
<uv-skeletons style="padding:20rpx" class="coreshop-skeleton" :skeleton="props.skeleton"
|
||||||
|
:loading="props.skeletonLoading">
|
||||||
<coreshop-page-content v-bind="props">
|
<coreshop-page-content v-bind="props">
|
||||||
<slot name="default" />
|
<slot name="default" />
|
||||||
</coreshop-page-content>
|
</coreshop-page-content>
|
||||||
@@ -13,7 +14,8 @@
|
|||||||
</coreshop-page-content>
|
</coreshop-page-content>
|
||||||
<template v-if="props.needLoadingPage">
|
<template v-if="props.needLoadingPage">
|
||||||
<uv-loading-page :loading="props.loadingPage" :loading-text="props.loadingText"
|
<uv-loading-page :loading="props.loadingPage" :loading-text="props.loadingText"
|
||||||
:font-size="props.loadingTextFontSize" :color="props.loadingColor" :loadingColor="loadingColor" :bgColor="props.loadingBgColor"></uv-loading-page>
|
:font-size="props.loadingTextFontSize" :color="props.loadingColor" :loadingColor="loadingColor"
|
||||||
|
:bgColor="props.loadingBgColor"></uv-loading-page>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
@@ -30,7 +32,7 @@
|
|||||||
handleCustomRouteJump : () => void | null,
|
handleCustomRouteJump : () => void | null,
|
||||||
showLoginModalDom : boolean;
|
showLoginModalDom : boolean;
|
||||||
needSkeleton : boolean;
|
needSkeleton : boolean;
|
||||||
skeleton ?: Array<any>;
|
skeleton ?: Array<{ [key : string] : any }>;
|
||||||
skeletonLoading : boolean;
|
skeletonLoading : boolean;
|
||||||
placeholder : boolean;
|
placeholder : boolean;
|
||||||
loadingPage : boolean;
|
loadingPage : boolean;
|
||||||
@@ -38,7 +40,7 @@
|
|||||||
loadingText : string;
|
loadingText : string;
|
||||||
loadingTextFontSize : string;
|
loadingTextFontSize : string;
|
||||||
loadingBgColor : string;
|
loadingBgColor : string;
|
||||||
loadingColor:string;
|
loadingColor : string;
|
||||||
}>(), {
|
}>(), {
|
||||||
isBack: true,
|
isBack: true,
|
||||||
bgColor: '#eef2f6',
|
bgColor: '#eef2f6',
|
||||||
@@ -51,12 +53,7 @@
|
|||||||
handleCustomRouteJump: null,
|
handleCustomRouteJump: null,
|
||||||
showLoginModalDom: false,
|
showLoginModalDom: false,
|
||||||
needSkeleton: false,
|
needSkeleton: false,
|
||||||
skeleton: [{
|
skeleton: [],
|
||||||
type: 'line',
|
|
||||||
num: 3,
|
|
||||||
gap: '20rpx',
|
|
||||||
style: ['width: 200rpx;marginBottom: 50rpx;', 'height: 100rpx;', 'width: 500rpx;'],
|
|
||||||
}],
|
|
||||||
skeletonLoading: false,
|
skeletonLoading: false,
|
||||||
placeholder: true,
|
placeholder: true,
|
||||||
loadingPage: false,
|
loadingPage: false,
|
||||||
@@ -64,8 +61,29 @@
|
|||||||
loadingText: '加载中...',
|
loadingText: '加载中...',
|
||||||
loadingTextFontSize: '24rpx',
|
loadingTextFontSize: '24rpx',
|
||||||
loadingBgColor: 'rgba(255, 255, 255, 0.2)',
|
loadingBgColor: 'rgba(255, 255, 255, 0.2)',
|
||||||
loadingColor:'#d33123'
|
loadingColor: '#d33123'
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.coreshop-skeleton {
|
||||||
|
padding: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.uv-skeleton) {
|
||||||
|
padding: 20rpx;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.coreshop-skeleton {
|
||||||
|
padding: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uv-skeleton {
|
||||||
|
padding: 20rpx !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.uv-skeleton) {
|
||||||
|
padding: 20rpx !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -15,7 +15,6 @@ export const useSystemInfo = () => {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
const systemInfo = uni.getSystemInfoSync();
|
const systemInfo = uni.getSystemInfoSync();
|
||||||
state.systemInfo = systemInfo;
|
state.systemInfo = systemInfo;
|
||||||
|
|
||||||
// #ifndef APP
|
// #ifndef APP
|
||||||
const menuButton = uni.getMenuButtonBoundingClientRect();
|
const menuButton = uni.getMenuButtonBoundingClientRect();
|
||||||
state.menuButtonHeight = menuButton.height + (menuButton.top - systemInfo.statusBarHeight) * 2;
|
state.menuButtonHeight = menuButton.height + (menuButton.top - systemInfo.statusBarHeight) * 2;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<coreshop-page :isBack="false" bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom
|
<coreshop-page :isBack="false" bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom needSkeleton :skeleton="skeleton"
|
||||||
needLoadingPage :loadingPage="loading">
|
:skeletonLoading="loading">
|
||||||
<view class="layout-home-page page-bg">
|
<view class="layout-home-page page-bg">
|
||||||
<image class="home-bg" :src="handleStaticResources('/static/images/home-bg.jpg')"></image>
|
<image class="home-bg" :src="handleStaticResources('/static/images/home-bg.jpg')"></image>
|
||||||
<uv-navbar :title="shopConfigStore.config?.shopName"
|
<uv-navbar :title="shopConfigStore.config?.shopName"
|
||||||
@@ -38,6 +38,7 @@
|
|||||||
import { UserToken, onHomePageShow, shareUrl } from '@/core/consts';
|
import { UserToken, onHomePageShow, shareUrl } from '@/core/consts';
|
||||||
import { useUserInfoStore, useShopConfigStore } from '@/core/store';
|
import { useUserInfoStore, useShopConfigStore } from '@/core/store';
|
||||||
import { ShareClientEnum, ShareModelEnum, ShareEnum } from '@/core/enum';
|
import { ShareClientEnum, ShareModelEnum, ShareEnum } from '@/core/enum';
|
||||||
|
import { skeleton } from './skeleton'
|
||||||
|
|
||||||
/** 获取项目配置 */
|
/** 获取项目配置 */
|
||||||
const shopConfigStore = useShopConfigStore();
|
const shopConfigStore = useShopConfigStore();
|
||||||
@@ -47,6 +48,8 @@
|
|||||||
|
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const handleuQueryPageConfig = useLoadingFn(getPageConfig, loading);
|
const handleuQueryPageConfig = useLoadingFn(getPageConfig, loading);
|
||||||
|
|
||||||
const state = reactive<{
|
const state = reactive<{
|
||||||
@@ -130,4 +133,11 @@
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@import './home.scss';
|
@import './home.scss';
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.page-bg,
|
||||||
|
page {
|
||||||
|
background-color: #ffffff !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
52
CoreCms.Net.Uni-App/CoreShop/pages/home/skeleton.ts
Normal file
52
CoreCms.Net.Uni-App/CoreShop/pages/home/skeleton.ts
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
export const skeleton = [
|
||||||
|
{
|
||||||
|
type: 'flex',
|
||||||
|
num: 1,
|
||||||
|
children: [{
|
||||||
|
type: 'line',
|
||||||
|
num: 1,
|
||||||
|
style: 'height:300rpx;marginLeft:20rpx;marginRight: 20rpx;marginTop:20rpx'
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
30, {
|
||||||
|
type: 'flex',
|
||||||
|
num: 2,
|
||||||
|
children: [{
|
||||||
|
type: 'custom',
|
||||||
|
style: 'width:98rpx;height:98rpx;marginLeft:20rpx;border-radius: 100%;'
|
||||||
|
}, {
|
||||||
|
type: 'custom',
|
||||||
|
style: 'width:98rpx;height:98rpx;marginLeft:20rpx;border-radius: 100%;'
|
||||||
|
}, {
|
||||||
|
type: 'custom',
|
||||||
|
style: 'width:98rpx;height:98rpx;marginLeft:20rpx;border-radius: 100%;'
|
||||||
|
}, {
|
||||||
|
type: 'custom',
|
||||||
|
style: 'width:98rpx;height:98rpx;marginLeft:20rpx;border-radius: 100%;'
|
||||||
|
}, {
|
||||||
|
type: 'custom',
|
||||||
|
style: 'width:98rpx;height:98rpx;marginLeft:20rpx;border-radius: 100%;'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'custom',
|
||||||
|
style: 'width:98rpx;height:98rpx;marginLeft:20rpx;border-radius: 100%;'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
30,
|
||||||
|
30, {
|
||||||
|
type: 'flex',
|
||||||
|
num: 5,
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
type: 'custom',
|
||||||
|
style: 'width:160rpx;height:160rpx;marginLeft: 20rpx;marginRight: 20rpx;'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'line',
|
||||||
|
num: 3,
|
||||||
|
gap: '30rpx',
|
||||||
|
style: ["marginRight: 20rpx;", "marginRight: 20rpx;", "marginRight: 20rpx;"]
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
]
|
||||||
Reference in New Issue
Block a user