自主项目,食堂系统,前端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

  1. <template>
  2. <!--
  3. stepList: [
  4. {
  5. date: '08-28', // 左侧日期 -- 必选
  6. time: '11:22', // 左侧时间 -- 必选
  7. info: '开卡', // 右侧内容 -- 可选
  8. index: '1', // 中间 Index -- 可选
  9. isFinished: true, // 是否已完成(完成 index 为 √)-- 可选
  10. isActive: false, // 是否为当前节点 Active(当前节点 即使完成 index 也不会显示 √)-- 可选
  11. isShowSlot: false // 右侧是否有 Slot(显示在 右侧内容下方)-- 可选
  12. },
  13. {
  14. date: '08-30',
  15. time: '15:33',
  16. info: '激活',
  17. index: '2',
  18. isFinished: false,
  19. isActive: true,
  20. isShowSlot: true
  21. }
  22. ]
  23. slot 示例
  24. <y-steps :stepList="stepList">
  25. <mx-button type="danger" value="激活网点查看" />
  26. </y-steps>
  27. 可按自己需求修改 css 中颜色变量
  28. -->
  29. <view class="steps">
  30. <view
  31. v-for="(step, index) in stepList"
  32. :key="'stepsItem' + index"
  33. :class="['steps-item', step.isActive ? 'steps-item-active' : '', step.isFinished ? 'steps-item-finished' : '']">
  34. <view class="steps-item-index">
  35. <view :class="['line', index != 0 ? '' : 'line-transparent']" :style="{'background-color': color}"></view>
  36. <!-- 完成的 -->
  37. <view v-if="!step.isActive && step.isFinished" class="index index-success" :style="{'background-color': color, 'color': '#fff'}">
  38. <u-icon name="checkmark" size="16"></u-icon>
  39. </view>
  40. <!-- 过程 -->
  41. <view v-else class="index" :style="{'border-color': color, 'color': color}">
  42. <u-icon name="arrow-down" size="16"></u-icon>
  43. <view class="process-line" :style="{'background-color': color}" v-if="index == stepList.length - 1"></view>
  44. </view>
  45. <view :class="['line', index != stepList.length - 1 ? '' : 'line-transparent']" :style="{'background-color': color}"></view>
  46. </view>
  47. <view class="steps-item-right">
  48. <view class="right-info-item">
  49. <view>{{ step.info }}</view>
  50. <view v-if="step.isShowSlot">
  51. <slot></slot>
  52. </view>
  53. <view class="lf-font-24 lf-color-999">{{ step.time }}</view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </template>
  59. <script>
  60. export default {
  61. name: 'YSteps',
  62. props: {
  63. stepList: {
  64. type: Array,
  65. default: () => []
  66. },
  67. color: {
  68. type: String,
  69. default: '#1A35F2'
  70. }
  71. }
  72. };
  73. </script>
  74. <style lang="scss" scoped>
  75. $normolColor: #009688;
  76. $activeColor: #ff3838;
  77. $finishedColor: #4DB6AC;
  78. $normolBgColor: #80CBC4;
  79. $activeBgColor: #F8BBD0;
  80. $finishedBgColor: #B2DFDB;
  81. .steps {
  82. display: flex;
  83. flex-direction: column;
  84. .steps-item {
  85. display: flex;
  86. .steps-item-left {
  87. display: flex;
  88. align-items: center;
  89. color: $normolColor;
  90. .steps-item-left-date {
  91. font-size: 30rpx;
  92. padding-top: 32rpx;
  93. line-height: 40rpx;
  94. }
  95. .steps-item-left-time {
  96. font-size: 26rpx;
  97. }
  98. }
  99. .steps-item-index {
  100. padding: 0 20rpx;
  101. display: flex;
  102. flex-direction: column;
  103. align-items: center;
  104. position: relative;
  105. .line {
  106. flex: 1;
  107. width: 5rpx;
  108. background-color: #1833F2;
  109. position: relative;
  110. z-index: 1;
  111. }
  112. .process-line{
  113. position: absolute;
  114. bottom: 0;
  115. left: 44rpx;
  116. width: 4rpx;
  117. height: 40rpx;
  118. z-index: 0;
  119. }
  120. .line-transparent {
  121. background-color: transparent !important;
  122. }
  123. .index {
  124. width: 50rpx;
  125. height: 50rpx;
  126. font-size: 25rpx;
  127. font-weight: 900;
  128. text-align: center;
  129. line-height: 50rpx;
  130. border-radius: 50rpx;
  131. // color: $normolColor;
  132. // background-color: $normolBgColor;
  133. }
  134. // /deep/ .index-success {
  135. // display: flex;
  136. // justify-content: center;
  137. // align-items: center;
  138. // .uni-icon-success_no_circle {
  139. // color: #1833F2;
  140. // }
  141. // }
  142. }
  143. .steps-item-right {
  144. display: flex;
  145. flex-direction: column;
  146. // padding: 20rpx 0;
  147. font-size: 28rpx;
  148. // color: $normolColor;
  149. .right-info-item {
  150. display: flex;
  151. flex-direction: column;
  152. justify-content: center;
  153. padding: 30rpx;
  154. padding-left: 0rpx;
  155. text {
  156. font-size: 30rpx;
  157. font-weight: 600;
  158. line-height: 30rpx;
  159. }
  160. }
  161. }
  162. }
  163. .steps-item-finished {
  164. .steps-item-left {
  165. color: $finishedColor;
  166. }
  167. .steps-item-index {
  168. .index {
  169. // color: $finishedColor;
  170. // background-color: $finishedBgColor;
  171. // border: 2rpx solid #1833F2;
  172. color: #1833F2;
  173. }
  174. }
  175. // .steps-item-right {
  176. // color: $finishedColor;
  177. // }
  178. }
  179. .steps-item-active {
  180. .steps-item-left {
  181. color: $activeColor;
  182. }
  183. .steps-item-index {
  184. .index {
  185. // color: $activeColor;
  186. // background-color: $activeBgColor;
  187. // background-color: #1833F2;
  188. border: 3rpx solid;
  189. color: #FFFFFF;
  190. }
  191. }
  192. // .steps-item-right {
  193. // color: $activeColor;
  194. // }
  195. }
  196. }
  197. </style>