index.vue 2.3 KB

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