reportCarousel.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <view class="report-carousel">
  3. <swiper class="swiper" :indicator-dots="true" :autoplay="true" :interval="3000" :duration="500" circular>
  4. <!-- 月度报告 -->
  5. <swiper-item class="swiper-item" @click="navigateToReport('MONTH')">
  6. <view class="carousel-content">
  7. <image class="carousel-image" src="/static/images/monthReport.png" mode="aspectFill" />
  8. <view class="image-tag">{{ monthReportTime }}</view>
  9. </view>
  10. </swiper-item>
  11. <!-- 季度报告 -->
  12. <swiper-item class="swiper-item" @click="navigateToReport('QUARTER')">
  13. <view class="carousel-content">
  14. <image class="carousel-image" src="/static/images/quarterReport.png" mode="aspectFill" />
  15. <view class="image-tag">{{ quarterReportTime }}</view>
  16. </view>
  17. </swiper-item>
  18. <!-- 年度报告 -->
  19. <swiper-item class="swiper-item" @click="navigateToReport('YEAR')">
  20. <view class="carousel-content">
  21. <image class="carousel-image" src="/static/images/yearReport.png" mode="aspectFill" />
  22. <view class="image-tag">{{ yearReportTime }}</view>
  23. </view>
  24. </swiper-item>
  25. </swiper>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. name: 'ReportCarousel',
  31. computed: {
  32. // 月度报告时间 - 上个月(2026年3月)
  33. monthReportTime() {
  34. const now = new Date()
  35. const lastMonth = new Date(now.getFullYear(), now.getMonth() - 1, 1)
  36. const year = lastMonth.getFullYear()
  37. const month = lastMonth.getMonth() + 1
  38. return `${year}年${month}月`
  39. },
  40. // 季度报告时间 - 上一季度(2026年第一季度)
  41. quarterReportTime() {
  42. const now = new Date()
  43. const currentQuarter = Math.floor((now.getMonth()) / 3) + 1
  44. const lastQuarter = currentQuarter === 1 ? 4 : currentQuarter - 1
  45. const year = currentQuarter === 1 ? now.getFullYear() - 1 : now.getFullYear()
  46. return `${year}年第${lastQuarter}季度`
  47. },
  48. // 年度报告时间 - 上一年(2025年)
  49. yearReportTime() {
  50. const now = new Date()
  51. const lastYear = now.getFullYear() - 1
  52. return `${lastYear}年`
  53. }
  54. },
  55. methods: {
  56. // 跳转到质控分析报告页面
  57. navigateToReport(dateRangeQueryType) {
  58. uni.navigateTo({
  59. url: `/pages/qualityControlAnalysisReport/index?dateRangeQueryType=${dateRangeQueryType}`
  60. })
  61. }
  62. }
  63. }
  64. </script>
  65. <style lang="scss" scoped>
  66. .report-carousel {
  67. margin-bottom: 20rpx;
  68. // margin: 0 32rpx 32rpx 32rpx;
  69. border-radius: 24rpx;
  70. overflow: hidden;
  71. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.1);
  72. }
  73. .swiper {
  74. height: 300rpx;
  75. }
  76. .swiper-item {
  77. display: flex;
  78. justify-content: center;
  79. align-items: center;
  80. background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  81. }
  82. .carousel-content {
  83. position: relative;
  84. width: 100%;
  85. height: 100%;
  86. }
  87. .carousel-image {
  88. width: 100%;
  89. height: 100%;
  90. object-fit: cover;
  91. }
  92. // 图片左上角标签样式
  93. .image-tag {
  94. position: absolute;
  95. top: 0rpx;
  96. left: 0rpx;
  97. background-color: #C5E3FF;
  98. color: #0A46A7;
  99. padding: 8rpx 16rpx;
  100. border-radius: 20rpx 0 20rpx 0;
  101. font-size: 24rpx;
  102. font-weight: bold;
  103. z-index: 10;
  104. }
  105. </style>