index.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <template>
  2. <!-- 病虫害百科 -->
  3. <view>
  4. <ui-search placeholder="请输入害虫名字" @confirm="searchLampList"></ui-search>
  5. <ui-tabs :list="tabs" :active="tabValue"></ui-tabs>
  6. <!-- 病虫害百科列表 -->
  7. <view class="page-panel pest-panel">
  8. <block v-for="(item,index) in pestList" :key="index">
  9. <view class="pest-item">
  10. <image class="pic" mode="aspectFill" :src="item.img_urls"></image>
  11. <view class="row-center p-10">
  12. <text class="text">{{item.name}}</text>
  13. </view>
  14. </view>
  15. </block>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. import {
  21. loadPestList
  22. } from '@/api/pest.js'
  23. export default {
  24. data() {
  25. return {
  26. // 病虫害百科列表
  27. pestList: [],
  28. tabValue: 1, // 当前状态
  29. // 搜索条件列表
  30. params: {
  31. code: 1,
  32. page: 1,
  33. page_size: 8,
  34. pest_name: ''
  35. },
  36. // tabs列表
  37. tabs: [{
  38. text: '虫害百科',
  39. value: 1
  40. }, {
  41. text: '病虫害百科',
  42. value: 2
  43. }, ]
  44. };
  45. },
  46. onLoad() {
  47. this.getPestList();
  48. },
  49. methods: {
  50. // 获取虫害列表
  51. async getPestList() {
  52. let res = await loadPestList(this.params);
  53. }
  54. }
  55. }
  56. </script>
  57. <style lang="scss">
  58. // 病虫害百科面板
  59. .pest-panel {
  60. display: flex;
  61. flex-wrap: wrap;
  62. padding: 24rpx;
  63. }
  64. // 病虫害百科列表项
  65. .pest-item {
  66. width: 336rpx;
  67. margin-right: 28rpx;
  68. margin-bottom: 24rpx;
  69. border-radius: 12rpx;
  70. border: 1rpx solid #F1F1F1;
  71. &:nth-child(2n) {
  72. margin-right: 0;
  73. }
  74. .pic {
  75. display: block;
  76. width: 336rpx;
  77. height: 255rpx;
  78. border-radius: 4rpx;
  79. }
  80. .text {
  81. font-size: 20rpx;
  82. color: #666666;
  83. }
  84. .tips {
  85. width: 24rpx;
  86. height: 24rpx;
  87. background: #07F546;
  88. border-radius: 100%;
  89. }
  90. }
  91. </style>