1
This commit is contained in:
parent
ac52c0f6b8
commit
7a486377ed
@ -1,16 +1,23 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="sections">
|
<view class="sections">
|
||||||
<view v-for="section in sections" :key="section.key" class="section">
|
<view v-for="section in sections" :key="section.key" class="section">
|
||||||
<view v-if="section.title" class="section__title">{{ section.title }}</view>
|
<view v-if="section.title" class="section__head">
|
||||||
|
<view class="section__bar"></view>
|
||||||
|
<text class="section__title">{{ section.title }}</text>
|
||||||
|
</view>
|
||||||
<view class="grid">
|
<view class="grid">
|
||||||
<view
|
<view
|
||||||
v-for="item in section.leaves"
|
v-for="item in section.leaves"
|
||||||
:key="item.key"
|
:key="item.key"
|
||||||
class="grid__item"
|
class="grid__item"
|
||||||
|
hover-class="grid__item--active"
|
||||||
|
:hover-stay-time="80"
|
||||||
@click="emit('select', item)"
|
@click="emit('select', item)"
|
||||||
>
|
>
|
||||||
<up-icon :name="item.icon || 'grid'" color="#2979ff" size="26"></up-icon>
|
<view class="grid__icon">
|
||||||
<text class="grid__item-text">{{ item.title }}</text>
|
<up-icon :name="item.icon || 'grid'" color="#2979ff" size="26"></up-icon>
|
||||||
|
</view>
|
||||||
|
<text class="grid__text">{{ item.title }}</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -43,34 +50,69 @@ const emit = defineEmits<{ (e: 'select', leaf: EntryLeaf): void }>()
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.sections {
|
.sections {
|
||||||
padding-bottom: 8rpx;
|
padding: 4rpx 0 8rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
.section {
|
.section {
|
||||||
|
&__head {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 28rpx 32rpx 4rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 标题前的渐变小竖条:给每段一个视觉锚点,替代纯文字标题 */
|
||||||
|
&__bar {
|
||||||
|
width: 6rpx;
|
||||||
|
height: 26rpx;
|
||||||
|
margin-right: 14rpx;
|
||||||
|
border-radius: 4rpx;
|
||||||
|
background: linear-gradient(180deg, #2979ff 0%, #6aa8ff 100%);
|
||||||
|
}
|
||||||
|
|
||||||
&__title {
|
&__title {
|
||||||
padding: 16rpx 32rpx 0;
|
font-size: 28rpx;
|
||||||
font-size: 26rpx;
|
font-weight: 600;
|
||||||
color: #909399;
|
color: #303133;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.grid {
|
.grid {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
padding: 8rpx 0 24rpx;
|
padding: 8rpx 12rpx 24rpx;
|
||||||
|
|
||||||
&__item {
|
&__item {
|
||||||
width: 33.333%;
|
width: 33.333%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 24rpx 0;
|
padding: 20rpx 6rpx;
|
||||||
|
border-radius: 16rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__item-text {
|
/* 点按反馈(hover-class 指向本类) */
|
||||||
margin-top: 12rpx;
|
&__item--active {
|
||||||
font-size: 26rpx;
|
background-color: #f2f6ff;
|
||||||
color: #606266;
|
}
|
||||||
|
|
||||||
|
&__icon {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 92rpx;
|
||||||
|
height: 92rpx;
|
||||||
|
border-radius: 26rpx;
|
||||||
|
background: linear-gradient(180deg, #eef4ff 0%, #e2ecff 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
&__text {
|
||||||
|
max-width: 100%;
|
||||||
|
margin-top: 14rpx;
|
||||||
|
font-size: 25rpx;
|
||||||
|
color: #4b5563;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -1,16 +1,40 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="page">
|
<view class="page">
|
||||||
<!-- 顶部欢迎区 -->
|
<!-- 顶部欢迎区:按时间段问候 + 当前身份;未登录时给一个「登录」入口(用户主动点击触发) -->
|
||||||
<view class="hero">
|
<view class="hero">
|
||||||
<view class="hero__title">首页</view>
|
<!-- 装饰光斑(纯视觉,不参与交互) -->
|
||||||
<view class="hero__desc">{{ heroDesc }}</view>
|
<view class="hero__deco hero__deco--lg"></view>
|
||||||
|
<view class="hero__deco hero__deco--sm"></view>
|
||||||
|
|
||||||
|
<view class="hero__row">
|
||||||
|
<view class="hero__text">
|
||||||
|
<view class="hero__greeting">{{ greeting }}</view>
|
||||||
|
<view class="hero__name">{{ heroName }}</view>
|
||||||
|
<view class="hero__desc">{{ heroDesc }}</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 未登录 → 就地弹登录抽屉(不跳页,符合「登录由用户主动触发」的约定) -->
|
||||||
|
<view
|
||||||
|
v-if="!isLogin"
|
||||||
|
class="hero__login"
|
||||||
|
hover-class="hero__login--active"
|
||||||
|
:hover-stay-time="80"
|
||||||
|
@click="goLogin"
|
||||||
|
>
|
||||||
|
<text class="hero__login-text">登录</text>
|
||||||
|
<up-icon name="arrow-right" color="#ffffff" size="11"></up-icon>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 功能入口:本地「常用功能」列表 + 后端菜单分类段(两段形态一致,见 toHomeSections) -->
|
<!-- 功能入口:本地「常用功能」列表 + 后端菜单分类段(两段形态一致,见 toHomeSections) -->
|
||||||
<view class="card">
|
<view class="card">
|
||||||
<!-- 登录后菜单尚未取到时的加载态(避免闪一下空态文案) -->
|
<!-- 登录后菜单尚未取到时的骨架屏(避免闪一下空态文案,也比转圈更贴合最终布局) -->
|
||||||
<view v-if="loading" class="loading">
|
<view v-if="loading" class="skeleton">
|
||||||
<up-loading-icon mode="circle" size="18" text="加载中"></up-loading-icon>
|
<view v-for="n in 6" :key="n" class="skeleton__item">
|
||||||
|
<view class="skeleton__icon"></view>
|
||||||
|
<view class="skeleton__text"></view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 「常用功能」段(本地)+ 后端分类段(如「外仓商品」);重复的 key 会自动去重 -->
|
<!-- 「常用功能」段(本地)+ 后端分类段(如「外仓商品」);重复的 key 会自动去重 -->
|
||||||
@ -45,6 +69,9 @@
|
|||||||
</empty-state>
|
</empty-state>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 未登录:一句轻提示(不阻断浏览,只是说明登录后还能看到什么) -->
|
||||||
|
<view v-if="!isLogin" class="tip">登录后可查看仓库 / 货主等业务功能</view>
|
||||||
|
|
||||||
<!-- 运行信息:用于确认各端编译正常 -->
|
<!-- 运行信息:用于确认各端编译正常 -->
|
||||||
<!-- <view class="card">
|
<!-- <view class="card">
|
||||||
<view class="card__title">运行信息</view>
|
<view class="card__title">运行信息</view>
|
||||||
@ -84,16 +111,31 @@ const userStore = useUserStore()
|
|||||||
const { isLogin, sections, loading, loadEntries, onEntry, goLogin, goMine, emptyStateProps } =
|
const { isLogin, sections, loading, loadEntries, onEntry, goLogin, goMine, emptyStateProps } =
|
||||||
useEntrySections('public')
|
useEntrySections('public')
|
||||||
|
|
||||||
|
/** 按时间段问候(头部第一行,比写死的「首页」更有温度) */
|
||||||
|
const greeting = computed(() => {
|
||||||
|
const hour = new Date().getHours()
|
||||||
|
if (hour < 6) return '夜深了'
|
||||||
|
if (hour < 12) return '早上好'
|
||||||
|
if (hour < 14) return '中午好'
|
||||||
|
if (hour < 18) return '下午好'
|
||||||
|
return '晚上好'
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 头部主标题:登录后显示用户名,未登录显示欢迎语 */
|
||||||
|
const heroName = computed(() => {
|
||||||
|
if (!isLogin.value) return '欢迎使用 WMS'
|
||||||
|
// 微信已登录但未绑定:优先展示用户自己设置的微信昵称
|
||||||
|
if (userStore.isWechatUnbound) return userStore.wechatNickname || '微信用户'
|
||||||
|
return userStore.userName || '已登录'
|
||||||
|
})
|
||||||
|
|
||||||
|
/** 头部副标题:当前身份 / 登录状态摘要 */
|
||||||
const heroDesc = computed(() => {
|
const heroDesc = computed(() => {
|
||||||
if (!isLogin.value) return 'WMS 仓储管理 · 微信小程序端'
|
if (!isLogin.value) return '仓储管理 · 微信小程序端'
|
||||||
// 微信已登录但未绑定:别显示“已登录”这么含糊的文案
|
// 微信已登录但未绑定:别显示“已登录”这么含糊的文案
|
||||||
if (userStore.isWechatUnbound) return '微信已登录 · 待绑定 WMS 账号'
|
if (userStore.isWechatUnbound) return '微信已登录 · 待绑定 WMS 账号'
|
||||||
const parts = [
|
const parts = [userStore.roleTypeLabel, userStore.currentEmployee?.store_name].filter(Boolean)
|
||||||
userStore.userName,
|
return parts.length ? parts.join(' · ') : '仓储管理 · 微信小程序端'
|
||||||
userStore.roleTypeLabel,
|
|
||||||
userStore.currentEmployee?.store_name
|
|
||||||
].filter(Boolean)
|
|
||||||
return parts.length ? parts.join(' · ') : 'WMS 仓储管理 · 微信小程序端'
|
|
||||||
})
|
})
|
||||||
|
|
||||||
/* 空态文案、取数(loadEntries)、点击跳转(onEntry)均收口在 useEntrySections */
|
/* 空态文案、取数(loadEntries)、点击跳转(onEntry)均收口在 useEntrySections */
|
||||||
@ -115,43 +157,155 @@ useEntryScene()
|
|||||||
padding-bottom: 24rpx;
|
padding-bottom: 24rpx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 顶部欢迎区:渐变蓝 + 下沿圆角,卡片上移叠压形成层次 */
|
||||||
.hero {
|
.hero {
|
||||||
padding: 48rpx 32rpx 56rpx;
|
position: relative;
|
||||||
background-color: #2979ff;
|
overflow: hidden;
|
||||||
|
padding: 44rpx 32rpx 100rpx;
|
||||||
|
background: linear-gradient(135deg, #2979ff 0%, #4b93ff 100%);
|
||||||
|
border-radius: 0 0 32rpx 32rpx;
|
||||||
|
|
||||||
&__title {
|
&__deco {
|
||||||
|
position: absolute;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: rgba(255, 255, 255, 0.1);
|
||||||
|
|
||||||
|
&--lg {
|
||||||
|
top: -140rpx;
|
||||||
|
right: -80rpx;
|
||||||
|
width: 300rpx;
|
||||||
|
height: 300rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
&--sm {
|
||||||
|
bottom: -70rpx;
|
||||||
|
left: -40rpx;
|
||||||
|
width: 160rpx;
|
||||||
|
height: 160rpx;
|
||||||
|
background-color: rgba(255, 255, 255, 0.07);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__row {
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__text {
|
||||||
|
flex: 1;
|
||||||
|
/* 允许长用户名截断(flex 子项默认 min-width: auto 会撑破容器) */
|
||||||
|
min-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__greeting {
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: rgba(255, 255, 255, 0.85);
|
||||||
|
}
|
||||||
|
|
||||||
|
&__name {
|
||||||
|
margin-top: 10rpx;
|
||||||
font-size: 44rpx;
|
font-size: 44rpx;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
&__desc {
|
&__desc {
|
||||||
margin-top: 12rpx;
|
margin-top: 10rpx;
|
||||||
font-size: 26rpx;
|
font-size: 26rpx;
|
||||||
color: rgba(255, 255, 255, 0.8);
|
color: rgba(255, 255, 255, 0.8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 未登录时的胶囊登录入口 */
|
||||||
|
&__login {
|
||||||
|
flex-shrink: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-left: 20rpx;
|
||||||
|
padding: 12rpx 24rpx;
|
||||||
|
border-radius: 999rpx;
|
||||||
|
background-color: rgba(255, 255, 255, 0.22);
|
||||||
|
|
||||||
|
&--active {
|
||||||
|
background-color: rgba(255, 255, 255, 0.34);
|
||||||
|
}
|
||||||
|
|
||||||
|
&-text {
|
||||||
|
margin-right: 6rpx;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
margin: 24rpx;
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
/* 上移叠压到欢迎区上(hero 已留出 100rpx 下内边距) */
|
||||||
|
margin: -64rpx 24rpx 24rpx;
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
border-radius: 16rpx;
|
border-radius: 24rpx;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
box-shadow: 0 8rpx 24rpx rgba(41, 121, 255, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
&__title {
|
/* 段标题 + 九宫格的样式在 components/entry-sections(仅本页使用,勿在此重复定义) */
|
||||||
padding: 24rpx 32rpx 8rpx;
|
|
||||||
font-size: 30rpx;
|
/* 未登录时的底部轻提示 */
|
||||||
font-weight: 600;
|
.tip {
|
||||||
color: #303133;
|
margin-top: 48rpx;
|
||||||
|
font-size: 24rpx;
|
||||||
|
color: #a8abb2;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 加载骨架屏:形态与最终九宫格一致,减少加载后的跳动感 */
|
||||||
|
.skeleton {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
padding: 24rpx 12rpx 8rpx;
|
||||||
|
|
||||||
|
&__item {
|
||||||
|
width: 33.333%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
padding: 20rpx 6rpx 24rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__icon {
|
||||||
|
width: 92rpx;
|
||||||
|
height: 92rpx;
|
||||||
|
border-radius: 26rpx;
|
||||||
|
background-color: #f0f2f5;
|
||||||
|
animation: skeleton-pulse 1.4s ease-in-out infinite;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__text {
|
||||||
|
width: 96rpx;
|
||||||
|
height: 24rpx;
|
||||||
|
margin-top: 16rpx;
|
||||||
|
border-radius: 12rpx;
|
||||||
|
background-color: #f0f2f5;
|
||||||
|
animation: skeleton-pulse 1.4s ease-in-out infinite;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 段标题 + 九宫格的样式在 components/entry-sections(首页与「我的」共用,勿在此重复定义) */
|
@keyframes skeleton-pulse {
|
||||||
|
0% {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
.loading {
|
50% {
|
||||||
display: flex;
|
opacity: 0.5;
|
||||||
align-items: center;
|
}
|
||||||
justify-content: center;
|
|
||||||
padding: 56rpx 0;
|
100% {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user