Files
sphc/dist/step/index.wxml

82 lines
2.6 KiB
Plaintext
Raw Normal View History

2024-05-06 15:34:15 +08:00
<view class="i-class i-step-item {{parse.getClass(status,current,index)}} {{ direction === 'vertical' ? 'i-step-vertical' : 'i-step-horizontal' }}" style="{{parse.getItemStyle(len,direction)}}">
<view class="i-step-item-ico">
<view class="i-step-ico tctc" wx:if="{{parse.noIco(status,current,index,icon) }}">
<view class="erer"></view>
</view>
<view class="i-step-ico" wx:else style='height:12rpx;'>
<!-- <i-icon i-class="i-step-ico-in" type="{{parse.getIcoClass(status,icon)}}"></i-icon> -->
<image src="/icon/qr.png" style='width:30rpx;height:30rpx;'></image>
</view>
<view class="i-step-line i-donger" wx:if="{{index==0}}"></view>
<view class="i-step-line" wx:if="{{ index !== len - 1&&index!==0}}"></view>
</view>
<view class="i-step-item-main">
<!-- <view class="i-step-item-date" wx:if="{{date!== ''}}">
{{date}}
</view>
<view class="i-step-item-date" wx:else style='margin-right:80rpx;'>
<slot name="date" class="111"></slot>
</view> -->
<view style='flex:1'>
<view class="i-step-item-title" wx:if="{{title !== ''}}">
{{title}}
</view>
<view class="i-step-item-title" wx:else>
<slot name="title"></slot>
</view>
<view class="i-step-item-content" wx:if="{{content !== ''}}">
{{content}}
</view>
<view class="i-step-item-content" wx:else>
<slot name="content"></slot>
</view>
</view>
</view>
</view>
<wxs module="parse">
var allStatus = ['wait', 'process', 'finish', 'error'];
module.exports = {
noIco: function(status, current, index, icon) {
var aindex = allStatus.indexOf(status);
var noIcon = true;
if (index < current || icon !== '') {
noIcon = false;
}
return noIcon;
},
getIcoClass: function(status, ico) {
var class = '';
if (status === 'error') {
class = 'close';
} else {
class = 'right';
}
if (ico !== '') {
class = ico;
}
return class;
},
getItemStyle: function(len, direction) {
if (direction === 'horizontal') {
return 'width :' + 100 / len + '%';
} else {
return 'width : 100%;';
}
},
getClass: function(status, current, index) {
//wait、process、finish、error
var startClass = 'i-step-'
var classes = '';
var cindex = allStatus.indexOf(status);
if (cindex !== -1) {
classes = startClass + allStatus[cindex];
}
if (index < current) {
classes = startClass + 'finish';
} else if (index === current) {
classes = startClass + 'process';
}
return classes;
}
}
</wxs>