wormcase.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. box-sizing: border-box;
  25. .imgs{
  26. width: 100%;
  27. height: 220rpx;
  28. }
  29. p{
  30. font-size: 24rpx;
  31. }
  32. }
  33. }
  34. </style>
  35. <script>
  36. export default {
  37. data() {
  38. return {
  39. title:'',
  40. content:[],
  41. data:{
  42. code:null,
  43. page:null
  44. }
  45. }
  46. },
  47. methods: {
  48. async getCooperation(data) {
  49. const res = await this.$myRequest({
  50. url: '/api/api_gateway?method=pest.pests.pests_search',
  51. data:{
  52. code:data.code,
  53. page:data.page
  54. }
  55. })
  56. this.content=this.content.concat(res.data)
  57. },
  58. clickLeft(){
  59. uni.navigateTo({
  60. url:"./index"
  61. })
  62. },
  63. introduce(id){
  64. uni.navigateTo({
  65. url:"./introduce?id="+id+"&title="+this.title
  66. })
  67. }
  68. },
  69. onLoad(option){
  70. this.title=option.name
  71. if(option.name=="虫情百科"){
  72. this.data.code=2
  73. this.data.page=1
  74. this.getCooperation(this.data)
  75. }else{
  76. this.data.code=1
  77. this.data.page=1
  78. this.getCooperation(this.data)
  79. }
  80. },
  81. onReachBottom() {
  82. this.data.page++
  83. this.getCooperation(this.data)
  84. }
  85. }
  86. </script>
  87. <style>
  88. </style>