wormcase.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <view>
  3. <view class="status_bar"></view>
  4. <view class="" style="position: relative;top: 44px;">
  5. <view style="position: fixed;z-index: 100;">
  6. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" :title="title"></uni-nav-bar>
  7. </view>
  8. <view class="particulars">
  9. <view class="particulars_item" v-for="(item,index) in content" :key="index" @click="introduce(item.id)">
  10. <image :src="item.img_urls" mode="" class="imgs"></image>
  11. <p>{{item.name}}</p>
  12. </view>
  13. </view>
  14. </view>
  15. </view>
  16. </template>
  17. <style lang="scss">
  18. .particulars {
  19. width: 100%;
  20. position: relative;
  21. top: 88rpx;
  22. display: flex;
  23. flex-wrap: wrap;
  24. .particulars_item {
  25. width: 50%;
  26. padding: 20rpx;
  27. box-sizing: border-box;
  28. .imgs {
  29. width: 100%;
  30. height: 220rpx;
  31. }
  32. p {
  33. font-size: 24rpx;
  34. }
  35. }
  36. }
  37. </style>
  38. <script>
  39. export default {
  40. data() {
  41. return {
  42. title: '',
  43. content: [],
  44. data: {
  45. code: null,
  46. page: null
  47. }
  48. }
  49. },
  50. methods: {
  51. async getCooperation(data) {
  52. const res = await this.$myRequest({
  53. url: '/api/api_gateway?method=pest.pests.pests_search',
  54. data: {
  55. code: data.code,
  56. page: data.page
  57. }
  58. })
  59. this.content = this.content.concat(res.data)
  60. },
  61. clickLeft() {
  62. uni.navigateTo({
  63. url: "./index"
  64. })
  65. },
  66. introduce(id) {
  67. uni.navigateTo({
  68. url: "./introduce?id=" + id + "&title=" + this.title
  69. })
  70. }
  71. },
  72. onLoad(option) {
  73. this.title = option.name
  74. if (option.name == "虫情百科") {
  75. this.data.code = 2
  76. this.data.page = 1
  77. this.getCooperation(this.data)
  78. } else {
  79. this.data.code = 1
  80. this.data.page = 1
  81. this.getCooperation(this.data)
  82. }
  83. },
  84. onReachBottom() {
  85. this.data.page++
  86. this.getCooperation(this.data)
  87. }
  88. }
  89. </script>
  90. <style>
  91. </style>