results.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <template>
  2. <view>
  3. <view class="images_box">
  4. <p class="title">图片标记</p>
  5. <view class="images">
  6. <image :src="'http://www.hnyfwlw.com:8006/bigdata_app'+'/image/cb/jiazai.ui.gif'" mode="" class="jiazai"></image>
  7. <image :src="resuils.image" mode="" @click="examine(resuils)"></image>
  8. <view class="imgbg" v-if="imgbg">
  9. <image src="../../../../static/images/cb/6286299.gif" mode="" class="img"></image>
  10. </view>
  11. </view>
  12. <view class="btn">
  13. <p class="btn_box" @click="anew">重新识别</p>
  14. </view>
  15. </view>
  16. <view class="information">
  17. <p class="title">识别结果</p>
  18. <view class="information_data" v-for="item,index in resuils.result">
  19. <p>害虫名称:<span>{{item.result_list}}</span></p>
  20. <p>害虫数量:<span>{{item.nums}}只</span></p>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. data() {
  28. return {
  29. resuils:{},
  30. id:"",
  31. imgbg:false,
  32. }
  33. },
  34. methods: {
  35. //forecast.forecast_system.equip_photo_discern识别 see again
  36. async discern(ret) { //识别图片
  37. const res = await this.$myRequest({
  38. url: '/api/api_gateway?method=forecast.forecast_system.equip_photo_discern',
  39. data: {
  40. img_id: this.id,
  41. ret: ret
  42. }
  43. })
  44. console.log(res)
  45. if(res){
  46. uni.showToast({
  47. title: '识别成功!',
  48. duration: 2000
  49. });
  50. this.resuils = res
  51. this.imgbg =false
  52. }else{
  53. uni.showToast({
  54. title: '识别失败!',
  55. duration: 2000,
  56. icon:"none"
  57. });
  58. this.imgbg =false
  59. }
  60. },
  61. anew(){
  62. this.discern("again")
  63. this.imgbg =true
  64. },
  65. examine(url) {
  66. console.log(url)
  67. var imgarr = []
  68. imgarr.push(url.image)
  69. console.log(imgarr)
  70. uni.previewImage({
  71. urls: imgarr
  72. });
  73. },
  74. },
  75. onLoad(option) {
  76. this.id = option.id
  77. this.discern("see")
  78. }
  79. }
  80. </script>
  81. <style lang="scss">
  82. .images_box{
  83. width: 90%;
  84. margin: 0 auto;
  85. padding-top: 20rpx;
  86. .title{
  87. border-left: 10rpx solid #71cd9a;
  88. padding-left: 20rpx;
  89. font-size: 30rpx;
  90. }
  91. .images{
  92. margin: 20rpx 0;
  93. width: 100%;
  94. height: 480rpx;
  95. position: relative;
  96. image{
  97. width: 100%;
  98. position: absolute;
  99. top: 0;
  100. left: 0;
  101. }
  102. .jiazai{
  103. width: 480rpx;
  104. height: 400rpx;
  105. position: absolute;
  106. top: 50%;
  107. left: 50%;
  108. margin-top: -240rpx;
  109. margin-left: -240rpx;
  110. }
  111. .imgbg{
  112. width: 100%;
  113. height: 480rpx;
  114. position: absolute;
  115. top: 0;
  116. left: 0;
  117. background-color: rgba(0,0,0,0.5);
  118. .img{
  119. width: 430rpx;
  120. height: 400rpx;
  121. position: absolute;
  122. top: 50%;
  123. left: 50%;
  124. margin-top: -200rpx;
  125. margin-left: -220rpx;
  126. }
  127. }
  128. }
  129. .btn{
  130. width: 100%;
  131. display: flex;
  132. justify-content: flex-end;
  133. .btn_box{
  134. width: 200rpx;
  135. height: 60rpx;
  136. background-color: #fbb40a;
  137. color: #FFFFFF;
  138. text-align: center;
  139. line-height: 60rpx;
  140. margin-left: -10rpx;
  141. }
  142. }
  143. }
  144. .information{
  145. width: 90%;
  146. margin: 0 auto;
  147. padding-top: 20rpx;
  148. .title{
  149. border-left: 10rpx solid #71cd9a;
  150. padding-left: 20rpx;
  151. font-size: 30rpx;
  152. }
  153. .information_data{
  154. margin: 30rpx;
  155. display: flex;
  156. box-shadow: 0 0 10rpx #e8e5f7;
  157. padding: 20rpx 10rpx;
  158. p{
  159. margin-right: 20rpx;
  160. font-size: 28rpx;
  161. span{
  162. color: #FF0000;
  163. }
  164. }
  165. }
  166. }
  167. </style>