549 lines
12 KiB
Vue
549 lines
12 KiB
Vue
<template>
|
||
<view class="home-container">
|
||
|
||
<!-- 头部信息 -->
|
||
<view class="header">
|
||
<view class="location-info">
|
||
<image class="location" :src="commonEnum.LOCATION"></image>
|
||
<text class="company-name">福鼎创特物联科技有限公司</text>
|
||
<text class="arrow">></text>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 公告栏 -->
|
||
<view class="announcement-bar">
|
||
<image class="announcementIcon" :src="commonEnum.ANNOUNCEMENT_ICON"></image>
|
||
<view class="announcement-box">
|
||
<text class="announcement-text">暂无更多公告! 暂无更多公告! 暂无更多公告!</text>
|
||
</view>
|
||
|
||
</view>
|
||
|
||
<!-- 轮播图 -->
|
||
<view class="banner-section">
|
||
<view class="banner-container">
|
||
<view
|
||
class="banner-card"
|
||
v-for="(banner, index) in bannerList"
|
||
:key="banner.id"
|
||
:class="{ active: currentBannerIndex === index }"
|
||
@click="onBannerClick(index)"
|
||
>
|
||
<view class="banner-left">
|
||
<view class="product-info">
|
||
<text class="flame-icon">🔥</text>
|
||
<text class="product-name">{{banner.name}}</text>
|
||
<text class="product-desc">{{banner.desc}}</text>
|
||
</view>
|
||
<image class="product-image" :src="banner.image" mode="aspectFit"></image>
|
||
</view>
|
||
<view class="banner-right">
|
||
<text class="product-features">{{banner.features}}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<!-- 轮播指示器 -->
|
||
<view class="banner-dots">
|
||
<view
|
||
v-for="(banner, index) in bannerList"
|
||
:key="index"
|
||
class="dot"
|
||
:class="{ active: currentBannerIndex === index }"
|
||
@click="onDotClick(index)"
|
||
></view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 设备列表 -->
|
||
<view class="equipment-section">
|
||
<view class="section-title">我的租赁设备</view>
|
||
<view class="equipment-list">
|
||
<view
|
||
v-for="equipment in equipmentList"
|
||
:key="equipment.id"
|
||
class="equipment-item"
|
||
@click="onEquipmentClick(equipment)"
|
||
>
|
||
<image class="equipment-image" :src="equipment.image" mode="aspectFit"></image>
|
||
<view class="equipment-info">
|
||
<view class="equipment-header">
|
||
<text class="equipment-name">{{equipment.name}}</text>
|
||
<text class="status-badge" :class="equipment.status">{{equipment.status === 'normal' ? '正常' : '异常'}}</text>
|
||
</view>
|
||
<view class="equipment-details">
|
||
<text class="detail-item">租赁时间: {{equipment.startTime}}</text>
|
||
<text class="detail-item">到期时间: {{equipment.endTime}}</text>
|
||
</view>
|
||
<button class="renew-btn" @click.stop="onRenew(equipment)">去续费</button>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 底部导航 -->
|
||
<view class="bottom-nav">
|
||
<view
|
||
v-for="(nav, index) in ['首页', '申请租赁', '个人中心']"
|
||
:key="index"
|
||
class="nav-item"
|
||
:class="{ active: index === 0 }"
|
||
@click="onNavClick(index)"
|
||
>
|
||
<text class="nav-icon">{{index === 0 ? '🏠' : index === 1 ? '➕' : '😊'}}</text>
|
||
<text class="nav-text">{{nav}}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import commonEnum from "../../enum/commonEnum";
|
||
export default {
|
||
data() {
|
||
return {
|
||
commonEnum : commonEnum,
|
||
title: '设备租赁',
|
||
currentBannerIndex: 0,
|
||
bannerList: [
|
||
{
|
||
id: 1,
|
||
name: '渝锦汇',
|
||
desc: '商用节能灶燃烧器',
|
||
features: '商用节能灶燃烧器,高效节能,安全可靠,适用于各类餐饮场所。采用先进燃烧技术,热效率高,节能环保。',
|
||
image: '/static/stove.svg'
|
||
},
|
||
{
|
||
id: 2,
|
||
name: '节能燃烧器',
|
||
desc: '高效节能设备',
|
||
features: '新一代节能燃烧器,热效率提升30%,节能环保,安全可靠。',
|
||
image: '/static/burner.svg'
|
||
},
|
||
{
|
||
id: 3,
|
||
name: '商用炉具',
|
||
desc: '专业厨房设备',
|
||
features: '专业商用炉具,采用不锈钢材质,耐高温,易清洁,适合大型餐饮场所使用。',
|
||
image: '/static/stove.svg'
|
||
},
|
||
{
|
||
id: 4,
|
||
name: '燃气灶具',
|
||
desc: '高效燃气设备',
|
||
features: '高效燃气灶具,燃烧充分,热效率高,节能环保,安全可靠。',
|
||
image: '/static/burner.svg'
|
||
},
|
||
{
|
||
id: 5,
|
||
name: '厨房设备',
|
||
desc: '一体化解决方案',
|
||
features: '提供完整的厨房设备解决方案,从设计到安装,一站式服务。',
|
||
image: '/static/stove.svg'
|
||
}
|
||
],
|
||
equipmentList: [
|
||
{
|
||
id: 1,
|
||
name: '商用节能灶',
|
||
status: 'normal',
|
||
startTime: '2025-07-25 13:23:59',
|
||
endTime: '2026-07-25 13:23:59',
|
||
image: '/static/stove.svg'
|
||
},
|
||
{
|
||
id: 2,
|
||
name: '节能燃烧器',
|
||
status: 'normal',
|
||
startTime: '2025-07-25 13:23:59',
|
||
endTime: '2026-07-25 13:23:59',
|
||
image: '/static/burner.svg'
|
||
}
|
||
]
|
||
}
|
||
},
|
||
onLoad() {
|
||
// 页面加载时的逻辑
|
||
this.startBannerAutoPlay();
|
||
},
|
||
methods: {
|
||
// 轮播图自动播放
|
||
startBannerAutoPlay() {
|
||
setInterval(() => {
|
||
this.currentBannerIndex = (this.currentBannerIndex + 1) % this.bannerList.length;
|
||
}, 3000);
|
||
},
|
||
|
||
// 点击轮播指示器
|
||
onDotClick(index) {
|
||
this.currentBannerIndex = index;
|
||
},
|
||
|
||
// 点击轮播图
|
||
onBannerClick(index) {
|
||
this.currentBannerIndex = index;
|
||
},
|
||
|
||
// 去续费
|
||
onRenew(equipment) {
|
||
uni.showToast({
|
||
title: `正在处理${equipment.name}的续费`,
|
||
icon: 'none'
|
||
});
|
||
},
|
||
|
||
// 点击设备项
|
||
onEquipmentClick(equipment) {
|
||
uni.showToast({
|
||
title: `查看${equipment.name}详情`,
|
||
icon: 'none'
|
||
});
|
||
},
|
||
|
||
// 点击底部导航
|
||
onNavClick(index) {
|
||
const navItems = ['首页', '申请租赁', '个人中心'];
|
||
uni.showToast({
|
||
title: `切换到${navItems[index]}`,
|
||
icon: 'none'
|
||
});
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss" scoped >
|
||
|
||
|
||
.home-container {
|
||
background: linear-gradient(
|
||
to bottom,
|
||
#FFDDCA 0px,
|
||
#FFDDCA 450rpx,
|
||
#f5f5f5 450rpx,
|
||
#f5f5f5 100%
|
||
);
|
||
min-height: 100vh;
|
||
padding-bottom: 120rpx; /* 为底部导航留出空间 */
|
||
max-width: 750rpx;
|
||
margin: 0 auto;
|
||
z-index: -2;
|
||
}
|
||
|
||
/* 头部信息 */
|
||
.header {
|
||
padding: 106rpx 30rpx 20rpx 30rpx;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
.location-info {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 10rpx;
|
||
flex: 1;
|
||
.location{
|
||
width: 27rpx;
|
||
height: 31rpx;
|
||
}
|
||
.company-name {
|
||
color: #3D3D3D;
|
||
font-size: 16px;
|
||
font-weight: 500;
|
||
}
|
||
.arrow {
|
||
font-size: 24rpx;
|
||
color: #666;
|
||
}
|
||
}
|
||
}
|
||
|
||
/* 公告栏 */
|
||
.announcement-bar {
|
||
background: white;
|
||
opacity: 0.5;
|
||
margin: 34rpx 19rpx 0 19rpx;
|
||
padding: 15rpx 30rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 15rpx;
|
||
overflow: hidden;
|
||
height: 34rpx;
|
||
border-radius: 100rpx;
|
||
border: #4cd964 solid 1px;
|
||
.announcementIcon {
|
||
height: 32rpx;
|
||
width: 32rpx;
|
||
flex-shrink: 0;
|
||
}
|
||
.announcement-box{
|
||
flex: 1;
|
||
overflow: hidden;
|
||
position: relative;
|
||
.announcement-text {
|
||
font-size: 13px;
|
||
opacity: 1;
|
||
color: black;
|
||
white-space: nowrap;
|
||
animation: scroll-text 10s linear infinite;
|
||
border: #4cd964 solid 1px;
|
||
display: inline-block;
|
||
padding-left: 100%;
|
||
}
|
||
@keyframes scroll-text {
|
||
0% { transform: translateX(0); }
|
||
100% { transform: translateX(-100%); }
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
/* 轮播图 */
|
||
.banner-section {
|
||
padding: 30rpx;
|
||
}
|
||
|
||
.banner-container {
|
||
position: relative;
|
||
height: 400rpx;
|
||
overflow: hidden;
|
||
border-radius: 20rpx;
|
||
}
|
||
|
||
.banner-card {
|
||
position: absolute;
|
||
top: 0;
|
||
left: 0;
|
||
width: 100%;
|
||
height: 100%;
|
||
background: #fff;
|
||
border-radius: 20rpx;
|
||
padding: 30rpx;
|
||
display: flex;
|
||
gap: 30rpx;
|
||
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.1);
|
||
opacity: 0;
|
||
transform: scale(0.8);
|
||
transition: all 0.5s ease;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.banner-card.active {
|
||
opacity: 1;
|
||
transform: scale(1);
|
||
}
|
||
|
||
.banner-left {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 20rpx;
|
||
flex: 1;
|
||
}
|
||
|
||
.product-info {
|
||
display: flex;
|
||
align-items: center;
|
||
gap: 10rpx;
|
||
}
|
||
|
||
.flame-icon {
|
||
font-size: 24rpx;
|
||
color: #ff4757;
|
||
}
|
||
|
||
.product-name {
|
||
font-size: 28rpx;
|
||
font-weight: bold;
|
||
color: #333;
|
||
}
|
||
|
||
.product-desc {
|
||
font-size: 24rpx;
|
||
color: #666;
|
||
}
|
||
|
||
.product-image {
|
||
width: 200rpx;
|
||
height: 150rpx;
|
||
border-radius: 10rpx;
|
||
background-color: #f8f9fa;
|
||
}
|
||
|
||
.banner-right {
|
||
flex: 1;
|
||
}
|
||
|
||
.product-features {
|
||
font-size: 24rpx;
|
||
color: #666;
|
||
line-height: 1.6;
|
||
}
|
||
|
||
.banner-dots {
|
||
display: flex;
|
||
justify-content: center;
|
||
gap: 15rpx;
|
||
margin-top: 30rpx;
|
||
}
|
||
|
||
.dot {
|
||
width: 20rpx;
|
||
height: 20rpx;
|
||
border-radius: 50%;
|
||
background-color: #ddd;
|
||
transition: all 0.3s ease;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.dot.active {
|
||
background-color: #ff9a9e;
|
||
transform: scale(1.2);
|
||
}
|
||
|
||
/* 设备列表 */
|
||
.equipment-section {
|
||
padding: 0 30rpx;
|
||
}
|
||
|
||
.section-title {
|
||
font-size: 32rpx;
|
||
font-weight: bold;
|
||
color: #333;
|
||
margin-bottom: 20rpx;
|
||
padding: 20rpx 0;
|
||
border-bottom: 1rpx solid #eee;
|
||
}
|
||
|
||
.equipment-list {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 20rpx;
|
||
}
|
||
|
||
.equipment-item {
|
||
background: #fff;
|
||
border-radius: 20rpx;
|
||
padding: 30rpx;
|
||
display: flex;
|
||
gap: 30rpx;
|
||
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.1);
|
||
transition: all 0.3s ease;
|
||
}
|
||
|
||
.equipment-item:active {
|
||
transform: scale(0.98);
|
||
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.15);
|
||
}
|
||
|
||
.equipment-image {
|
||
width: 120rpx;
|
||
height: 120rpx;
|
||
border-radius: 10rpx;
|
||
background-color: #f8f9fa;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.equipment-info {
|
||
flex: 1;
|
||
display: flex;
|
||
flex-direction: column;
|
||
justify-content: space-between;
|
||
}
|
||
|
||
.equipment-header {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
margin-bottom: 15rpx;
|
||
}
|
||
|
||
.equipment-name {
|
||
font-size: 28rpx;
|
||
font-weight: bold;
|
||
color: #333;
|
||
}
|
||
|
||
.status-badge {
|
||
padding: 4rpx 12rpx;
|
||
border-radius: 20rpx;
|
||
font-size: 20rpx;
|
||
color: #fff;
|
||
}
|
||
|
||
.status-badge.normal {
|
||
background-color: #52c41a;
|
||
}
|
||
|
||
.status-badge.warning {
|
||
background-color: #faad14;
|
||
}
|
||
|
||
.status-badge.error {
|
||
background-color: #ff4d4f;
|
||
}
|
||
|
||
.equipment-details {
|
||
display: flex;
|
||
flex-direction: column;
|
||
gap: 8rpx;
|
||
margin-bottom: 15rpx;
|
||
}
|
||
|
||
.detail-item {
|
||
font-size: 24rpx;
|
||
color: #666;
|
||
}
|
||
|
||
.renew-btn {
|
||
align-self: flex-end;
|
||
background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
|
||
color: #fff;
|
||
border: none;
|
||
border-radius: 25rpx;
|
||
padding: 15rpx 30rpx;
|
||
font-size: 24rpx;
|
||
font-weight: 500;
|
||
}
|
||
|
||
/* 底部导航 */
|
||
.bottom-nav {
|
||
position: fixed;
|
||
bottom: 0;
|
||
left: 0;
|
||
right: 0;
|
||
background: #fff;
|
||
display: flex;
|
||
justify-content: space-around;
|
||
align-items: center;
|
||
padding: 20rpx 0;
|
||
box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.1);
|
||
z-index: 1000;
|
||
}
|
||
|
||
.nav-item {
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
gap: 8rpx;
|
||
padding: 10rpx;
|
||
transition: all 0.3s ease;
|
||
}
|
||
|
||
.nav-item:active {
|
||
transform: scale(0.95);
|
||
}
|
||
|
||
.nav-icon {
|
||
font-size: 40rpx;
|
||
color: #999;
|
||
}
|
||
|
||
.nav-text {
|
||
font-size: 20rpx;
|
||
color: #999;
|
||
}
|
||
|
||
.nav-item.active .nav-icon,
|
||
.nav-item.active .nav-text {
|
||
color: #ff9a9e;
|
||
}
|
||
</style>
|