index.vue 2.2 KB

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