index.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <view>
  3. <view style="position: fixed;z-index: 100;">
  4. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" title="病虫害识别"></uni-nav-bar>
  5. </view>
  6. <image :src="path" mode="" class="image"></image>
  7. <view class="recognition" v-if="datasTF">
  8. <p class="recognition_title">{{name}}</p>
  9. <view class="recognition_img">
  10. <image :src="path2" mode=""></image>
  11. </view>
  12. <button class="recognition_details" v-if="tishi" @click="">查看详情</button>
  13. </view>
  14. <view class="datas" v-else>
  15. <p>{{prevention}}</p>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. data() {
  22. return {
  23. path: "",
  24. path2:"",
  25. tishi: true,
  26. name:"",
  27. prevention:"",
  28. datasTF:true
  29. }
  30. },
  31. methods: {
  32. clickLeft() {
  33. uni.switchTab({
  34. url: "../index/index"
  35. })
  36. },
  37. examine(){
  38. this.datasTF = false
  39. }
  40. },
  41. onLoad(option) {
  42. this.path = option.path
  43. console.log(JSON.parse(option.datas).img_urls, option.path)
  44. if (JSON.parse(option.datas).img_urls== undefined ) {
  45. this.name = "识别失败,请换张图片"
  46. this.tishi = false
  47. } else {
  48. this.path2 = JSON.parse(option.datas).img_urls
  49. this.name = JSON.parse(option.datas).name
  50. this.tishi = true
  51. this.prevention = JSON.parse(option.datas).prevention
  52. }
  53. }
  54. }
  55. </script>
  56. <style lang="scss">
  57. .image {
  58. position: absolute;
  59. top: 44px;
  60. width: 100%;
  61. height: 400rpx;
  62. }
  63. .recognition {
  64. position: absolute;
  65. top: 244px;
  66. width: 100%;
  67. height: 800rpx;
  68. .recognition_title {
  69. width: 100%;
  70. text-align: center;
  71. font-size: 36rpx;
  72. font-weight: 700;
  73. margin: 60rpx 0;
  74. }
  75. .recognition_img {
  76. border: 2rpx dashed #06B535;
  77. width: 450rpx;
  78. height: 450rpx;
  79. border-radius: 50%;
  80. margin: 0 auto;
  81. text-align: center;
  82. line-height: 450rpx;
  83. image {
  84. margin-top: 10rpx;
  85. width: 430rpx;
  86. height: 430rpx;
  87. }
  88. }
  89. .recognition_details {
  90. width: 400rpx;
  91. height: 80rpx;
  92. border-radius: 40rpx;
  93. margin: 30rpx auto;
  94. font-size: 30rpx;
  95. background-color: #67B25F;
  96. color: #FFFFFF;
  97. }
  98. }
  99. .datas{
  100. position: absolute;
  101. top: 244px;
  102. width: 90%;
  103. left: 5%;
  104. padding: 20rpx;
  105. }
  106. </style>