photoImage.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <template>
  2. <view class="photo-image">
  3. <view class="photo-image__tabs">
  4. <view
  5. class="photo-image__tab"
  6. v-for="(tab, index) in tabs"
  7. :key="index"
  8. :class="{ active: activeTab === index }"
  9. @click="activeTab = index"
  10. >
  11. <text class="tab-text">{{ tab }}</text>
  12. </view>
  13. </view>
  14. <view class="photo-image__content">
  15. <view class="photo-image__grid">
  16. <view class="photo-image__item" v-for="(item, index) in images" :key="index" @click="handleClick(item)">
  17. <view class="photo-image__item-img-container">
  18. <image
  19. class="photo-image__item-img"
  20. src="https://trae-api-cn.mchost.guru/api/ide/v1/text_to_image?prompt=insects%20on%20a%20white%20surface&image_size=square"
  21. mode="aspectFill"
  22. />
  23. </view>
  24. <view class="photo-image__item-time">
  25. 2025-12-28 08:00:00
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. data() {
  35. return {
  36. activeTab: 0,
  37. tabs: ['全部', '稻飞虱', '水龟虫', '蝼蛄', '系统','全部', '稻飞虱', '水龟虫', '蝼蛄', '系统'],
  38. images: Array(12).fill(0) // 生成12个图片项
  39. };
  40. },
  41. methods: {
  42. handleClick(item) {
  43. uni.navigateTo({
  44. url: '/pages/cbd/devicePhoto?devicePhoto=' + item
  45. })
  46. }
  47. },
  48. };
  49. </script>
  50. <style lang="scss" scoped>
  51. .photo-image {
  52. width: 100%;
  53. box-sizing: border-box;
  54. &__header {
  55. margin-bottom: 32rpx;
  56. white-space: nowrap;
  57. &::-webkit-scrollbar {
  58. display: none;
  59. }
  60. }
  61. &__tabs {
  62. box-sizing: border-box;
  63. width: 100%;
  64. overflow-x: auto;
  65. overflow-y: hidden;
  66. white-space: nowrap;
  67. // 去掉滚动条
  68. -ms-overflow-style: none;
  69. scrollbar-width: none;
  70. }
  71. .photo-image__content{
  72. padding: 30rpx;
  73. background: #ffffff;
  74. border-radius: 16rpx;
  75. margin-top: 30rpx;
  76. }
  77. &__tab {
  78. position: relative;
  79. display: inline-block;
  80. box-sizing: border-box;
  81. margin-right: 16rpx;
  82. background: #ffffff;
  83. color: #999999;
  84. font-family: "Source Han Sans CN VF";
  85. font-size: 28rpx;
  86. padding: 10rpx 32rpx;
  87. border-radius: 8rpx;
  88. &:last-child {
  89. margin-right: 0;
  90. }
  91. .tab-text {
  92. margin-right: 8rpx;
  93. }
  94. .tab-check {
  95. color: #4CAF50;
  96. font-weight: bold;
  97. }
  98. &.active {
  99. color: #0BBC58;
  100. font-weight: 500;
  101. }
  102. .tab-underline {
  103. position: absolute;
  104. bottom: 0;
  105. left: 0;
  106. right: 0;
  107. height: 4rpx;
  108. background: #4CAF50;
  109. border-radius: 2rpx;
  110. }
  111. }
  112. &__item {
  113. position: relative;
  114. width: 33.33%;
  115. padding: 0 10rpx;
  116. box-sizing: border-box;
  117. display: inline-block;
  118. margin-bottom: 24rpx;
  119. &-img-container {
  120. width: 100%;
  121. padding-bottom: 100%;
  122. position: relative;
  123. border-radius: 8rpx;
  124. overflow: hidden;
  125. background-color: #f5f5f5;
  126. border: 2rpx solid #333;
  127. }
  128. &-img {
  129. position: absolute;
  130. top: 0;
  131. left: 0;
  132. width: 100%;
  133. height: 100%;
  134. }
  135. &-time {
  136. position: absolute;
  137. bottom: 10rpx;
  138. margin-top: 12rpx;
  139. font-size: 22rpx;
  140. color: #666;
  141. text-align: center;
  142. }
  143. }
  144. }
  145. </style>