wormcase.vue 1.6 KB

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