Files
zgty-mas-m/pages/index/menu.vue
2025-09-30 00:08:23 +08:00

266 lines
5.3 KiB
Vue

<!-- 菜单页面 -->
<template>
<s-layout
title="菜单"
tabbar="/pages/index/menu"
navbar="custom"
onShareAppMessage
>
<view class="menu-container">
<!-- 轮播图 -->
<view class="swiper-section">
<swiper
class="swiper-container"
:indicator-dots="true"
:autoplay="true"
:interval="3000"
:duration="500"
indicator-color="rgba(255, 255, 255, 0.3)"
indicator-active-color="#fff"
circular
>
<swiper-item v-for="(item, index) in swiperList" :key="index">
<view class="swiper-item">
<image :src="item.image" mode="aspectFill" class="swiper-image" />
</view>
</swiper-item>
</swiper>
</view>
<!-- 工作台 -->
<view class="section">
<view class="section-title">工作台</view>
<view class="grid-container">
<view
class="grid-item"
v-for="(item, index) in quickMenuList"
:key="index"
@click="handleMenuClick(item)"
>
<view class="item-icon" :style="{ background: item.bg }">
<u-icon
:name="item.icon"
size="24"
:color="item.color"
/>
</view>
<view class="item-title">{{ item.title }}</view>
</view>
</view>
</view>
</view>
</s-layout>
</template>
<script>
import sheep from '@/sheep';
export default {
onShow() {
const userStore = sheep.$store('user');
if (!userStore.isLogin) {
sheep.$router.redirect('/pages/login/index');
}
},
data() {
return {
// 轮播图数据
swiperList: [
{
image: '/static/images/swiper/bg1.png',
title: '轮播图1'
},
{
image: '/static/images/swiper/bg2.png',
title: '轮播图2'
},
{
image: '/static/images/swiper/bg3.png',
title: '轮播图3'
}
],
// 工作台功能数据
quickMenuList: [
{
title: 'Demo',
icon: 'file-text',
color: '#fff',
bg: '#3c9cff',
path: '/pages/app/democontract/index'
},
]
};
},
methods: {
// 处理菜单点击
handleMenuClick(item) {
sheep.$router.go(item.path);
}
}
};
</script>
<style lang="scss" scoped>
.menu-container {
min-height: 100vh;
background-color: #f8f9fa;
padding: 20rpx;
}
/* 轮播图样式 */
.swiper-section {
margin-bottom: 30rpx;
.swiper-container {
height: 300rpx;
border-radius: 20rpx;
overflow: hidden;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.1);
.swiper-item {
width: 100%;
height: 100%;
.swiper-image {
width: 100%;
height: 100%;
object-fit: cover;
}
}
}
}
.section {
margin-bottom: 40rpx;
.section-title {
font-size: 32rpx;
font-weight: 600;
color: #303133;
margin-bottom: 30rpx;
padding-left: 10rpx;
}
}
/* 快捷功能网格布局 */
.grid-container {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 20rpx;
.grid-item {
background: #fff;
border-radius: 16rpx;
padding: 30rpx 20rpx;
display: flex;
flex-direction: column;
align-items: center;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
transition: all 0.3s ease;
&:active {
transform: translateY(2rpx);
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
}
.item-icon {
width: 80rpx;
height: 80rpx;
border-radius: 20rpx;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 16rpx;
}
.item-title {
font-size: 24rpx;
color: #606266;
text-align: center;
line-height: 1.2;
}
}
}
/* 管理功能列表布局 */
.list-container {
background: #fff;
border-radius: 16rpx;
padding: 0 30rpx;
box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
.list-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 30rpx 0;
border-bottom: 1px solid #f5f5f5;
transition: background-color 0.3s ease;
&:last-child {
border-bottom: none;
}
&:active {
background-color: #f8f9fa;
}
.item-left {
display: flex;
align-items: center;
flex: 1;
.item-icon-small {
width: 64rpx;
height: 64rpx;
border-radius: 12rpx;
display: flex;
align-items: center;
justify-content: center;
margin-right: 24rpx;
}
.item-info {
flex: 1;
.item-title {
font-size: 28rpx;
color: #303133;
margin-bottom: 8rpx;
font-weight: 500;
}
.item-desc {
font-size: 22rpx;
color: #909399;
line-height: 1.3;
}
}
}
}
}
/* 响应式调整 */
@media screen and (max-width: 750rpx) {
.grid-container {
grid-template-columns: repeat(2, 1fr);
gap: 16rpx;
}
.grid-item {
padding: 24rpx 16rpx;
.item-icon {
width: 64rpx;
height: 64rpx;
}
.item-title {
font-size: 22rpx;
}
}
}
</style>