fxyk-progress.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <view class="progress" :style="bgColor">
  3. <view v-if="wcDay" class="progress-item" :style="itemWidth">{{ wcDay }}天</view>
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. props: {
  9. // 项目情况 1 已完成 2 进行中 3已终止
  10. status: {
  11. type: Number,
  12. default: 1
  13. },
  14. // 已完成工作天数
  15. wcDay: {
  16. type: Number,
  17. default: 0
  18. },
  19. // 额定项目天数
  20. edDay: {
  21. type: Number,
  22. default: 30
  23. }
  24. },
  25. computed: {
  26. bgColor() {
  27. if ( this.status === 2 ){
  28. return {'background-color': '#D4D4D4'}
  29. } else if ( this.status === 3 ) {
  30. return {'background-color': '#FF0014'}
  31. }
  32. },
  33. itemWidth() {
  34. return {'width': this.wcDay/this.edDay*100+'%' }
  35. }
  36. }
  37. }
  38. </script>
  39. <style lang="scss" scoped>
  40. page {
  41. width: 100%;
  42. height: 100%;
  43. }
  44. .content {
  45. width: 100%;
  46. height: 100%;
  47. }
  48. .progress {
  49. height: 48rpx;
  50. border-radius: 21rpx;
  51. background-color: #D4D4D4;
  52. .progress-item {
  53. background: #007aff;
  54. height: 48rpx;
  55. border-radius: 21rpx;
  56. font-size: 25rpx;
  57. font-family: SimSun;
  58. font-weight: 400;
  59. text-align: center;
  60. line-height: 48rpx;
  61. color: #FDFCFC;
  62. }
  63. }
  64. </style>