index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <view class="">
  3. <uni-nav-bar @clickLeft="clickLeft" left-icon="back" left-text="返回" title="监控系统"></uni-nav-bar>
  4. <view class="">
  5. <image src="../../static/image/monitor/banner.png" mode="widthFix"></image>
  6. </view>
  7. <view class="content">
  8. <template v-for="(item,index) in listArr">
  9. <equipItem @click.native="itemClick(item)" v-bind:item="item" :key="index">
  10. <view class="type-name">
  11. <view class="iconfont icon-jiankong"></view>
  12. <text>
  13. 监控
  14. </text>
  15. </view>
  16. </equipItem>
  17. </template>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. import equipItem from "../../components/equip-item/equip-item"
  23. export default {
  24. data() {
  25. return {
  26. listArr: [],
  27. page: 1,
  28. accessToken: '',
  29. counts: ''
  30. }
  31. },
  32. onLoad() {
  33. this.getEquipList()
  34. },
  35. onPullDownRefresh() {
  36. this.page = 1
  37. this.listArr = []
  38. this.getEquipList()
  39. setTimeout(() => {
  40. uni.stopPullDownRefresh()
  41. }, 1000)
  42. },
  43. onReachBottom() {
  44. this.page++
  45. if (this.counts == this.listArr.length) {
  46. return false
  47. }
  48. this.getEquipList()
  49. },
  50. methods: {
  51. async getEquipList() {
  52. const res = await this.$myRequest({
  53. url: '/api/api_gateway?method=camera.camera_manage.list_camera',
  54. data: {
  55. page: this.page
  56. }
  57. })
  58. let data = res.data
  59. let arr = data.map(item => {
  60. return {
  61. ...item,
  62. device_status: item.status
  63. }
  64. })
  65. console.log(arr)
  66. console.log(this.listArr)
  67. this.listArr = [...this.listArr, ...arr]
  68. this.accessToken = res.accessToken
  69. this.counts = res.counts
  70. },
  71. clickLeft() {
  72. uni.switchTab({
  73. url: "../index/index"
  74. })
  75. },
  76. itemClick(item) {
  77. // uni.navigateTo({
  78. // url:"/pages/monitor/detail?device_id="+item.device_id+"&accessToken="+this.accessToken
  79. // })
  80. uni.navigateTo({
  81. url: "/pages/webview?device_id=" + item.device_id + "&accessToken=" + this.accessToken
  82. })
  83. }
  84. },
  85. components: {
  86. equipItem
  87. }
  88. }
  89. </script>
  90. <style lang="scss">
  91. image {
  92. width: 100%;
  93. }
  94. .type-name {
  95. color: #999;
  96. display: flex;
  97. justify-content: flex-start;
  98. font-size: 12px;
  99. text {
  100. margin-left: 10px;
  101. }
  102. }
  103. </style>