pestArchive.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <view class="pest-archive" v-if="pest_info.name">
  3. <view class="pest-archive__header">
  4. <view class="pest-archive__title">虫害档案</view>
  5. </view>
  6. <view
  7. class="pest-card"
  8. @tap="handleCardClick()"
  9. >
  10. <view class="pest-card__image">
  11. <image :src="pest_info.img_urls" mode="aspectFill" class="pest-img"></image>
  12. </view>
  13. <view class="pest-card__info">
  14. <view class="pest-card__top">
  15. <view class="pest-card__name">
  16. 名称
  17. </view>
  18. <view class="pest-card__status">
  19. {{ pest_info.name || '未知' }}
  20. </view>
  21. </view>
  22. <view class="pest-card__top">
  23. <view class="pest-card__name">
  24. 害虫信息
  25. </view>
  26. <view class="pest-card__status" style="height:200rpx;overflow: auto;">
  27. {{ pest_info.prevention || '未知' }}
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <u-popup v-model="showDetail" mode="bottom" border-radius="32">
  33. <view class="pest-card__detail">
  34. <view class="pest-card__image">
  35. <image :src="pest_info.img_urls" mode="aspectFill" class="pest-img"></image>
  36. </view>
  37. <view>
  38. {{ pest_info.name || '未知' }}
  39. </view>
  40. <view>
  41. {{ pest_info.prevention || '未知' }}
  42. </view>
  43. </view>
  44. </u-popup>
  45. </view>
  46. </template>
  47. <script>
  48. export default {
  49. props: {
  50. scrollHeight: {
  51. type: String,
  52. default: '500rpx'
  53. },
  54. pest_info: {
  55. type: Object,
  56. default: () => ({})
  57. }
  58. },
  59. data() {
  60. return {
  61. showDetail: false,
  62. }
  63. },
  64. methods: {
  65. showPestDetail(){
  66. this.showDetail = true;
  67. },
  68. handleCardClick() {
  69. this.showPestDetail()
  70. this.$emit('click', this.pest_info)
  71. }
  72. }
  73. }
  74. </script>
  75. <style lang="scss" scoped>
  76. .pest-archive {
  77. width: 100%;
  78. padding: 32rpx;
  79. margin-top: 24rpx;
  80. box-sizing: border-box;
  81. background: #fff;
  82. border-radius: 16rpx;
  83. }
  84. .pest-archive__header {
  85. display: flex;
  86. justify-content: space-between;
  87. align-items: center;
  88. margin-bottom: 24rpx;
  89. }
  90. .pest-archive__title {
  91. font-size: 32rpx;
  92. color: #042118;
  93. font-family: 'Source Han Sans CN VF';
  94. font-weight: 500;
  95. }
  96. .pest-archive__add {
  97. width: 56rpx;
  98. height: 56rpx;
  99. border-radius: 50%;
  100. background: linear-gradient(135deg, #00D26A 0%, #00B55A 100%);
  101. display: flex;
  102. align-items: center;
  103. justify-content: center;
  104. box-shadow: 0 4rpx 12rpx rgba(0, 210, 106, 0.3);
  105. .add-icon {
  106. font-size: 40rpx;
  107. color: #fff;
  108. line-height: 1;
  109. font-weight: 300;
  110. }
  111. }
  112. .pest-card__detail{
  113. height: 70vh;
  114. padding: 40rpx;
  115. }
  116. .pest-archive__list {
  117. width: 100%;
  118. }
  119. .pest-card {
  120. display: flex;
  121. padding: 24rpx;
  122. margin-bottom: 16rpx;
  123. background: #F7F8F9;
  124. border-radius: 16rpx;
  125. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
  126. &:last-child {
  127. margin-bottom: 0;
  128. }
  129. &:active {
  130. opacity: 0.8;
  131. }
  132. }
  133. .pest-card__image {
  134. width: 200rpx;
  135. height: 200rpx;
  136. border-radius: 12rpx;
  137. overflow: hidden;
  138. flex-shrink: 0;
  139. margin-right: 20rpx;
  140. background: #e0e0e0;
  141. .pest-img {
  142. width: 100%;
  143. height: 100%;
  144. }
  145. }
  146. .pest-card__info {
  147. padding: 4rpx 0;
  148. }
  149. .pest-card__top {
  150. display: flex;
  151. }
  152. .pest-card__name {
  153. font-size: 26rpx;
  154. color: #999999;
  155. font-family: "Source Han Sans CN VF";
  156. font-weight: 400;
  157. width: 110rpx;
  158. }
  159. .pest-card__status {
  160. width: 270rpx;
  161. color: #303133;
  162. font-size: 26srpx;
  163. font-weight: 500;
  164. &.status--handled {
  165. background: rgba(0, 210, 106, 0.15);
  166. color: #00B55A;
  167. }
  168. &.status--handling {
  169. background: rgba(255, 149, 0, 0.15);
  170. color: #FF9500;
  171. }
  172. &.status--pending {
  173. background: rgba(255, 53, 70, 0.15);
  174. color: #FF3546;
  175. }
  176. }
  177. .pest-card__time {
  178. font-size: 24rpx;
  179. color: #86909C;
  180. margin-top: 8rpx;
  181. }
  182. .pest-card__desc {
  183. font-size: 26rpx;
  184. color: #4E5969;
  185. margin-top: 12rpx;
  186. overflow: hidden;
  187. text-overflow: ellipsis;
  188. display: -webkit-box;
  189. -webkit-line-clamp: 2;
  190. line-clamp: 2;
  191. -webkit-box-orient: vertical;
  192. line-height: 1.5;
  193. }
  194. </style>