uniapp实现-审批流程效果

一、实现思路

        需要要定义一个变量, 记录当前激活的步骤。通过数组的长度来循环数据,如果有就采用3元一次进行选择。

        把循环里面的变量【name、status、time】, 全部替换为取出的那一项的值。然后继续下一次循环。

        虚拟的数据都是请求来的, 组装为好渲染的格式。

二、实现步骤

        ①view部分展示

 如果有看不懂的代码,请继续往下看,会有解释!!!

	<view class="container" style="margin: 24rpx 0;">
				<view class="overbold" style="margin-bottom: 40rpx;">审批</view>
				<template v-for="(item,index) in funList.RenList">
					<view :key="index" class="flex"
						:style="{ marginBottom: index === funList.RenList.length - 1 ? '24rpx' : '68rpx' }">
						<view class="img-box">
							<image class="figure" :src="item.image" mode="aspectFill"></image>
							<view v-if="index != funList.RenList.length - 1" class="line">
							</view>
						</view>
						<view style="margin-left: 20rpx;">
							<view class="flex" style="width: 518rpx;">
								<view class="changwrod" style="margin-bottom: 8rpx;width: 60%;">{{ item.name }}</view>
								<view v-if="item.status == 1" class="smallword" style="color: #999;">{{ item.time }}
								</view>
							</view>
							<view v-if="item.status == 1" class="smallword" style="color: #31BA3E;">已通过</view>
							<view v-if="item.status == 0" class="smallword" style="color: #666;">待审批</view>
						</view>
					</view>
				</template>
			</view>

代码解释:

代码解释:

 funList.RenList:对象中的数组【考虑到后期交互,也可能单独拿出来】

 :style="{ marginBottom: index === funList.RenList.length - 1 ? '24rpx' : '68rpx' }" 

                这段代码是一个动态的样式绑定,它根据条件来设置元素的 marginBottom 样式属性的值。

具体解释如下:

  • :style 是 Vue/uni-app 中用来动态绑定样式的语法。
  • marginBottom 是 CSS 中的属性,用来设置元素的下边距。
  • index === funList.RenList.length - 1 是一个条件判断表达式,表示如果当前元素的索引(index)等于 funList.RenList 数组的长度减 1。
  • ? '24rpx' : '68rpx' 是一个三元表达式,用于根据条件判断结果设置不同的值。如果条件为真,即当前元素是最后一个元素,那么设置下边距为 '24rpx';否则,设置下边距为 '68rpx'。

        换句话说,这段代码的作用是:如果当前元素是 funList.RenList 数组中的最后一个元素,则设置它的下边距为 '24rpx';否则,设置下边距为 '68rpx'。

        ②JavaScript 内容

               funList: {
			        	//。。。。。交互内容

					RenList: [{
						image: 'https://cdn.uviewui.com/uview/album/1.jpg',
						name: "叶玲",
						time: "2023.12.03 10:30",
						status: 1 // 1已审核 0未审核
					}, {
						image: 'https://cdn.uviewui.com/uview/album/1.jpg',
						name: "大耳朵",
						time: "2023.12.03 10:30",
						status: 0
					}, {
						image: 'https://cdn.uviewui.com/uview/album/1.jpg',
						name: "叶玲",
						time: "2023.12.03 10:30",
						status: 1 // 1已审核 0未审核
					}]
				},

   

     ③css中样式展示

container{
    padding: 32rpx;
    background-color: #fff;
    border-radius: 16rpx;
}
.overbold {
    font-weight: bold;
    color: #1A1A1A;
    font-family: PingFang SC-Bold;
    line-height: 48rpx;
    font-size: 32rpx;
}



.img-box {
        position: relative;

        .figure {
            width: 80rpx;
            height: 80rpx;
            border-radius: 8rpx;
        }

        //中间的间隔线
        .line {
            position: absolute;
            left: 50%;
            top: 130%;
            transform: translate(-50%, -50%);
            width: 6rpx;
            height: 60rpx;
            background-color: rgba(102, 102, 102, 0.5);
        }
    }

三、效果展示

      

以上就是实现审批流程的具体操作。

  • 11
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值