imgpage.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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. <p class="tishi" v-if="tishi">暂无数据</p>
  7. <view class="imglist">
  8. <view class="imglist_box" v-for="(item,index) in imglists" :key="index">
  9. <view class="imglist_left">
  10. <image src="../../../../static/image/cb/jiazai.ui.gif" mode=""></image>
  11. <image :src="item.addr" mode=""></image>
  12. </view>
  13. <view class="imglist_right">
  14. <p @click="delimg(item.id)">
  15. <u-icon name="shanchuerp" custom-prefix="custom-icon" class="icon_left"></u-icon>删除
  16. </p>
  17. <p @click="shibie(item.id)">
  18. <u-icon name="eye-fill" custom-prefix="custom-icon" class="icon_left"></u-icon>识别
  19. </p>
  20. <p @click="tongji(item.id)">
  21. <u-icon name="mulu" custom-prefix="custom-icon" class="icon_left"></u-icon>手动统计
  22. </p>
  23. <p @click="add(item.id)">
  24. <u-icon name="xiezi" custom-prefix="custom-icon" class="icon_left"></u-icon>手动添加
  25. </p>
  26. <p>{{item.addtime|timeFormat()}}</p>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. data() {
  35. return {
  36. page: 1,
  37. imglists: [],
  38. tishi:true
  39. }
  40. },
  41. methods: {
  42. //forecast.forecast_system.equip_photofo
  43. async imglistdata() { //获取图片列表
  44. const res = await this.$myRequest({
  45. url: '/api/api_gateway?method=forecast.forecast_system.equip_photo',
  46. data: {
  47. device_id: this.device_id,
  48. page: this.page,
  49. ret: "list"
  50. }
  51. })
  52. this.imglists = this.imglists.concat(res.data)
  53. console.log(this.imglists)
  54. if(this.imglists.length==0){
  55. this.tishi = true
  56. }else{
  57. this.tishi = false
  58. }
  59. },
  60. //forecast.forecast_system.equip_photo_del
  61. async del(id) { //删除图片
  62. const res = await this.$myRequest({
  63. url: '/api/api_gateway?method=forecast.forecast_system.equip_photo_del',
  64. data: {
  65. device_id: this.device_id,
  66. addrlist: id
  67. }
  68. })
  69. },
  70. //forecast.forecast_system.equip_photo_discern识别
  71. async discern(id) { //识别图片
  72. const res = await this.$myRequest({
  73. url: '/api/api_gateway?method=forecast.forecast_system.equip_photo_discern',
  74. data: {
  75. img_id: id,
  76. ret:"see"
  77. }
  78. })
  79. },
  80. //forecast.forecast_system.equip_photo_species pest_list
  81. //forecast.forecast_system.equip_photo_species统计
  82. async species(id) { //统计
  83. const res = await this.$myRequest({
  84. url: '/api/api_gateway?method=forecast.forecast_system.equip_photo_species',
  85. data: {
  86. ret:"photo_desc",
  87. img_id: id
  88. }
  89. })
  90. },
  91. clickLeft() {
  92. uni.navigateBack({
  93. delta: 1
  94. })
  95. },
  96. delimg(id) { //删除图片
  97. uni.showModal({
  98. title: '提示',
  99. content: '是否删除此图片?',
  100. success: function(res) {
  101. if (res.confirm) {
  102. // this.del(id)
  103. console.log('用户点击确定');
  104. } else if (res.cancel) {
  105. console.log('用户点击取消');
  106. }
  107. }
  108. });
  109. },
  110. shibie(id){//识别
  111. this.discern(id)
  112. },
  113. tongji(id){//统计
  114. this.species(id)
  115. },
  116. add(id){
  117. uni.navigateTo({
  118. url:"./addimg?id="+id+"&device_id"+this.device_id
  119. })
  120. }
  121. },
  122. onLoad(option) {
  123. this.device_id = option.device_id
  124. this.imglistdata()
  125. },
  126. onReachBottom(){
  127. this.page++
  128. this.imglistdata()
  129. }
  130. }
  131. </script>
  132. <style lang="scss">
  133. .tishi{
  134. position: absolute;
  135. top: 84px;
  136. width: 95%;
  137. left: 2.5%;
  138. text-align: center;
  139. font-size: 40rpx;
  140. }
  141. .imglist {
  142. position: absolute;
  143. top: 54px;
  144. width: 95%;
  145. left: 2.5%;
  146. .imglist_box {
  147. display: flex;
  148. box-shadow: 0 0 10rpx #bcb9ca;
  149. padding: 20rpx;
  150. margin-bottom: 20rpx;
  151. }
  152. .imglist_left {
  153. width: 50%;
  154. position: relative;
  155. image {
  156. position: absolute;
  157. top: 0;
  158. left: 0;
  159. width: 100%;
  160. height: 280rpx;
  161. }
  162. }
  163. .imglist_right {
  164. margin-left: 40rpx;
  165. padding: 10rpx 0;
  166. p {
  167. margin-bottom: 24rpx;
  168. font-size: 24rpx;
  169. .icon_left {
  170. margin-right: 20rpx;
  171. color: #56C877;
  172. font-size: 32rpx;
  173. }
  174. }
  175. p:last-child {
  176. margin-bottom: 0;
  177. }
  178. }
  179. }
  180. </style>