imgpage.vue 4.3 KB

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