自主项目,食堂系统,前端uniapp
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

203 lines
4.8 KiB

<template>
<!--
stepList: [
{
date: '08-28', // 左侧日期 -- 必选
time: '11:22', // 左侧时间 -- 必选
info: '开卡', // 右侧内容 -- 可选
index: '1', // 中间 Index -- 可选
isFinished: true, // 是否已完成(完成 index 为 √)-- 可选
isActive: false, // 是否为当前节点 Active(当前节点 即使完成 index 也不会显示 √)-- 可选
isShowSlot: false // 右侧是否有 Slot(显示在 右侧内容下方)-- 可选
},
{
date: '08-30',
time: '15:33',
info: '激活',
index: '2',
isFinished: false,
isActive: true,
isShowSlot: true
}
]
slot 示例
<y-steps :stepList="stepList">
<mx-button type="danger" value="激活网点查看" />
</y-steps>
可按自己需求修改 css 中颜色变量
-->
<view class="steps">
<view
v-for="(step, index) in stepList"
:key="'stepsItem' + index"
:class="['steps-item', step.isActive ? 'steps-item-active' : '', step.isFinished ? 'steps-item-finished' : '']">
<view class="steps-item-index">
<view :class="['line', index != 0 ? '' : 'line-transparent']" :style="{'background-color': color}"></view>
<!-- 完成的 -->
<view v-if="!step.isActive && step.isFinished" class="index index-success" :style="{'background-color': color, 'color': '#fff'}">
<u-icon name="checkmark" size="16"></u-icon>
</view>
<!-- 过程 -->
<view v-else class="index" :style="{'border-color': color, 'color': color}">
<u-icon name="arrow-down" size="16"></u-icon>
<view class="process-line" :style="{'background-color': color}" v-if="index == stepList.length - 1"></view>
</view>
<view :class="['line', index != stepList.length - 1 ? '' : 'line-transparent']" :style="{'background-color': color}"></view>
</view>
<view class="steps-item-right">
<view class="right-info-item">
<view>{{ step.info }}</view>
<view v-if="step.isShowSlot">
<slot></slot>
</view>
<view class="lf-font-24 lf-color-999">{{ step.time }}</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'YSteps',
props: {
stepList: {
type: Array,
default: () => []
},
color: {
type: String,
default: '#1A35F2'
}
}
};
</script>
<style lang="scss" scoped>
$normolColor: #009688;
$activeColor: #ff3838;
$finishedColor: #4DB6AC;
$normolBgColor: #80CBC4;
$activeBgColor: #F8BBD0;
$finishedBgColor: #B2DFDB;
.steps {
display: flex;
flex-direction: column;
.steps-item {
display: flex;
.steps-item-left {
display: flex;
align-items: center;
color: $normolColor;
.steps-item-left-date {
font-size: 30rpx;
padding-top: 32rpx;
line-height: 40rpx;
}
.steps-item-left-time {
font-size: 26rpx;
}
}
.steps-item-index {
padding: 0 20rpx;
display: flex;
flex-direction: column;
align-items: center;
position: relative;
.line {
flex: 1;
width: 5rpx;
background-color: #1833F2;
position: relative;
z-index: 1;
}
.process-line{
position: absolute;
bottom: 0;
left: 44rpx;
width: 4rpx;
height: 40rpx;
z-index: 0;
}
.line-transparent {
background-color: transparent !important;
}
.index {
width: 50rpx;
height: 50rpx;
font-size: 25rpx;
font-weight: 900;
text-align: center;
line-height: 50rpx;
border-radius: 50rpx;
// color: $normolColor;
// background-color: $normolBgColor;
}
// /deep/ .index-success {
// display: flex;
// justify-content: center;
// align-items: center;
// .uni-icon-success_no_circle {
// color: #1833F2;
// }
// }
}
.steps-item-right {
display: flex;
flex-direction: column;
// padding: 20rpx 0;
font-size: 28rpx;
// color: $normolColor;
.right-info-item {
display: flex;
flex-direction: column;
justify-content: center;
padding: 30rpx;
padding-left: 0rpx;
text {
font-size: 30rpx;
font-weight: 600;
line-height: 30rpx;
}
}
}
}
.steps-item-finished {
.steps-item-left {
color: $finishedColor;
}
.steps-item-index {
.index {
// color: $finishedColor;
// background-color: $finishedBgColor;
// border: 2rpx solid #1833F2;
color: #1833F2;
}
}
// .steps-item-right {
// color: $finishedColor;
// }
}
.steps-item-active {
.steps-item-left {
color: $activeColor;
}
.steps-item-index {
.index {
// color: $activeColor;
// background-color: $activeBgColor;
// background-color: #1833F2;
border: 3rpx solid;
color: #FFFFFF;
}
}
// .steps-item-right {
// color: $activeColor;
// }
}
}
</style>