Supervisory.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <view>
  3. <view class="onekeep" v-for="(item,index) in keeplist" :key="item.id">
  4. <view class="onekeeplabel" @click="optionShow(index)">
  5. <text>{{item.poleGroupName}}</text>
  6. </view>
  7. <view class="twokeep" v-for="(item2,index2) in item.cameraList" :key="item2.id" v-show="item.show">
  8. <text>{{item2.poleGroupName}}</text>
  9. <button type="primary" @click="lookVedio(index,index2)">查看</button>
  10. </view>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. import {
  16. direct
  17. } from '../api/Supervisory/Supervisory.js'
  18. export default {
  19. data() {
  20. return {
  21. keeplist: []
  22. };
  23. },
  24. methods: {
  25. lookVedio(index,index2){
  26. uni.navigateTo({
  27. url:'/pages/Supervisory_keep/Supervisory_keep?index=' + index + '&index2=' + index2,
  28. })
  29. },
  30. optionShow(index){
  31. var that = this
  32. var keeplist = that.keeplist
  33. keeplist[index].show == true ? keeplist[index].show = false : keeplist[index].show = true
  34. that.keeplist = keeplist
  35. }
  36. },
  37. onLoad() {
  38. direct().then(res => {
  39. if (res.code == 200) {
  40. var keeplist = res.data
  41. for(let arr of keeplist){
  42. arr.show = false
  43. }
  44. this.keeplist = keeplist
  45. }
  46. })
  47. },
  48. onShow() {
  49. if(this.keeplist.length == 0){
  50. direct().then(res => {
  51. if (res.code == 200) {
  52. var keeplist = res.data
  53. for(let arr of keeplist){
  54. arr.show = false
  55. }
  56. this.keeplist = keeplist
  57. }
  58. })
  59. }
  60. }
  61. }
  62. </script>
  63. <style lang="scss">
  64. .onekeep{
  65. margin-bottom: 4rpx;
  66. width: 750rpx;
  67. }
  68. .onekeeplabel{
  69. width: 750rpx;
  70. height: 110rpx;
  71. background-color: #333333;
  72. color: #ffffff;
  73. position: relative;
  74. text{
  75. font-size: 36rpx;
  76. position: absolute;
  77. left: 20rpx;
  78. top: 37rpx;
  79. }
  80. }
  81. .twokeep{
  82. width: 750rpx;
  83. height: 100rpx;
  84. position: relative;
  85. border-bottom: 1px royalblue solid;
  86. text{
  87. position: absolute;
  88. top: 34rpx;
  89. font-size: 32rpx;
  90. left: 30rpx;
  91. }
  92. button{
  93. width: 140rpx;
  94. height: 80rpx;
  95. position: absolute;
  96. font-size: 32rpx;
  97. top: 10rpx;
  98. right: 30rpx;
  99. display: flex;
  100. align-items: center;
  101. justify-content: center;
  102. }
  103. }
  104. </style>