wormcase.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. <view class="imgs">
  11. <image src="../../static/js/js/layer/theme/default/loading-2.gif" mode="" class="imgbg"></image>
  12. <image :src="item.img_urls" mode="" class="imgs_img"></image>
  13. </view>
  14. <p>{{item.name}}</p>
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. </template>
  20. <style lang="scss">
  21. .particulars {
  22. width: 100%;
  23. position: relative;
  24. top: 88rpx;
  25. display: flex;
  26. flex-wrap: wrap;
  27. .particulars_item {
  28. width: 50%;
  29. padding: 20rpx;
  30. box-sizing: border-box;
  31. .imgs {
  32. width: 100%;
  33. height: 220rpx;
  34. position: relative;
  35. .imgbg{
  36. width: 50%;
  37. height: 50%;
  38. position: absolute;
  39. top: 25%;
  40. left: 25%;
  41. }
  42. .imgs_img{
  43. width: 100%;
  44. height: 100%;
  45. position: absolute;
  46. top: 0;
  47. left: 0;
  48. }
  49. }
  50. p {
  51. font-size: 24rpx;
  52. }
  53. }
  54. }
  55. </style>
  56. <script>
  57. export default {
  58. data() {
  59. return {
  60. title: '',
  61. content: [],
  62. data: {
  63. code: null,
  64. page: null
  65. }
  66. }
  67. },
  68. methods: {
  69. async getCooperation(data) {
  70. const res = await this.$myRequest({
  71. url: '/api/api_gateway?method=pest.pests.pests_search',
  72. data: {
  73. code: data.code,
  74. page: data.page
  75. }
  76. })
  77. this.content = this.content.concat(res.data)
  78. },
  79. clickLeft() {
  80. uni.navigateTo({
  81. url: "./index"
  82. })
  83. },
  84. introduce(id) {
  85. uni.navigateTo({
  86. url: "./introduce?id=" + id + "&title=" + this.title
  87. })
  88. }
  89. },
  90. onLoad(option) {
  91. this.title = option.name
  92. if (option.name == "虫情百科") {
  93. this.data.code = 2
  94. this.data.page = 1
  95. this.getCooperation(this.data)
  96. } else {
  97. this.data.code = 1
  98. this.data.page = 1
  99. this.getCooperation(this.data)
  100. }
  101. },
  102. onReachBottom() {
  103. this.data.page++
  104. this.getCooperation(this.data)
  105. }
  106. }
  107. </script>
  108. <style>
  109. </style>