index.wxml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <view class="step {{'step-'+direction}} l-class" style="{{direction==='row'?'width:'+(1/length)*stepsWidth+'px':'min-height:'+stepMinHeight+'rpx'}}">
  2. <view class="step-container l-step-class {{'step-container-'+direction}}">
  3. <view wx:if="{{custom}}" class="step-custom">
  4. <slot name="dot"/>
  5. </view>
  6. <view wx:else class="l-step-class {{dot && !icon?'step-dot-'+currentStatus.setStatus(activeIndex,index,status)+' step-dot':'step-'+currentStatus.setStatus(activeIndex,index,status)+' step-icon'}}" style="{{dot?currentStatus.dotStyle(activeIndex,index,color):currentStatus.statusStyle(activeIndex,index,color,status)}}">
  7. <l-icon wx:if="{{icon}}" name="{{icon}}" size="{{iconSize}}" color="{{(currentStatus.setStatus(activeIndex,index,status))==='process'?'#3963BC':iconColor}}"/>
  8. <block wx:if="{{!dot && !icon}}">
  9. <view wx:if="{{currentStatus.setStatus(activeIndex,index,status)==='error' || currentStatus.setStatus(activeIndex,index,status)==='finish'}}" class="iconfont icon-{{currentStatus.setStatus(activeIndex,index,status)}}"></view>
  10. <block wx:else>{{index+1}}</block>
  11. </block>
  12. </view>
  13. </view>
  14. <view class="step-content {{'step-content-'+direction}}">
  15. <view class="l-title-class {{activeIndex===index?'step-title-process':'step-title'}}">
  16. {{title}}
  17. </view>
  18. <view class="l-describe-class step-describe">
  19. {{describe}}
  20. <slot name="describe"/>
  21. </view>
  22. </view>
  23. <view class="step-line l-line-class {{'step-line-'+ direction}} {{currentStatus.isReverse(reverse,activeIndex,index)?'step-line-finish':'step-line-wait'}}" style="{{activeIndex>index?('background-color:'+color):''}}" wx:if="{{reverse?(index!==0):(length!==index+1)}}">
  24. </view>
  25. </view>
  26. <wxs module="currentStatus">
  27. var setStatus = function(activeIndex,index,status){
  28. if(activeIndex===index){
  29. return status || 'process'
  30. } else if(activeIndex>index){
  31. return 'finish'
  32. }else{
  33. return 'wait'
  34. }
  35. }
  36. var statusStyle = function(activeIndex,index,color,status){
  37. if(activeIndex===index){
  38. return status==='error'?'':('background-color:' + color)
  39. } else if(activeIndex>index){
  40. return ('border-color:' + color + ';color:' + color)
  41. }else{
  42. return ''
  43. }
  44. }
  45. var dotStyle = function(activeIndex,index,color){
  46. if(activeIndex>=index){
  47. return ('background-color:' + color)
  48. } else{
  49. return ''
  50. }
  51. }
  52. var isReverse = function(reverse,activeIndex,index) {
  53. if(reverse){
  54. return (activeIndex>=index)
  55. }
  56. return (activeIndex>index)
  57. }
  58. module.exports = {
  59. setStatus:setStatus,
  60. statusStyle:statusStyle,
  61. dotStyle:dotStyle,
  62. isReverse:isReverse
  63. }
  64. </wxs>