details.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <!-- 可视监控详情 -->
  3. <view class="page-panel">
  4. <!-- 监控区域 -->
  5. <view class="monitor-area">
  6. <image src="@/static/demo/demo1.png" mode="widthFix"></image>
  7. </view>
  8. <!-- 监控工具 -->
  9. <view class="monitor-tools">
  10. <view class="row-center tools-btn" @click="controlDirection(8)">
  11. <text>+</text>
  12. </view>
  13. <view class="tools-control">
  14. <view class="slice up" @click="controlDirection(0)"></view>
  15. <view class="slice down" @click="controlDirection(1)"></view>
  16. <view class="slice left" @click="controlDirection(2)"></view>
  17. <view class="slice right" @click="controlDirection(3)"></view>
  18. <view class="tools-btn"></view>
  19. </view>
  20. <view class="row-center tools-btn" @click="controlDirection(9)">
  21. <text>━</text>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. import {
  28. getCameraAddress,
  29. controlCamera
  30. } from '@/api/camera.js'
  31. export default {
  32. data() {
  33. return {
  34. deviceId: '', // 设备号
  35. // 播放地址
  36. cameraAddress: '',
  37. // 控制参数
  38. controlParams: {
  39. device_id: '', //设备号
  40. ctrl: 'move', //move 控制球机转动 stop 停止球机转动, 转动后需调用停止接口,不然会造成球机一直转
  41. movenum: 0, // 0-上,1-下,2-左,3-右,8-放大,9-缩小
  42. }
  43. };
  44. },
  45. onLoad(options) {
  46. this.deviceId = options.id;
  47. },
  48. methods: {
  49. // 获取监控播放地址
  50. async getCameraAddress() {
  51. device_id
  52. getCameraAddress({
  53. device_id: this.deviceId
  54. })
  55. },
  56. // 控制摄像机
  57. async controlDirection(movenum) {
  58. this.controlParams.movenum = movenum;
  59. this.controlParams.ctrl = 'move'
  60. let res = await controlCamera(this.controlParams);
  61. if (!res.data) {
  62. return;
  63. }
  64. this.controlParams.ctrl = 'stop'
  65. await controlCamera(this.controlParams);
  66. }
  67. }
  68. }
  69. </script>
  70. <style lang="scss">
  71. // 监控区域
  72. .monitor-area {
  73. overflow: hidden;
  74. height: 510rpx;
  75. border-radius: 5rpx;
  76. margin-bottom: 24rpx;
  77. }
  78. .monitor-tools {
  79. display: flex;
  80. align-items: center;
  81. justify-content: space-between;
  82. padding: 24rpx;
  83. }
  84. .tools-control {
  85. position: relative;
  86. width: 305rpx;
  87. height: 305rpx;
  88. margin: 0 60rpx;
  89. background-image: linear-gradient(to right, #323e4d, #444d5e);
  90. border-radius: 100%;
  91. .tools-btn {
  92. position: absolute;
  93. top: 0;
  94. bottom: 0;
  95. left: 0;
  96. right: 0;
  97. margin: auto;
  98. }
  99. .slice {
  100. position: absolute;
  101. display: flex;
  102. align-items: center;
  103. justify-content: center;
  104. width: 97rpx;
  105. height: 97rpx;
  106. margin: auto;
  107. &:before {
  108. content: '';
  109. display: block;
  110. width: 0;
  111. margin-right: -24rpx;
  112. border-color: transparent transparent transparent $color-primary;
  113. border-width: 24rpx;
  114. border-style: solid;
  115. transform: scaleY(0.6);
  116. }
  117. &:active {
  118. opacity: .3;
  119. }
  120. }
  121. .up {
  122. top: 0;
  123. left: 0;
  124. right: 0;
  125. transform: rotateZ(-90deg);
  126. }
  127. .down {
  128. bottom: 0;
  129. left: 0;
  130. right: 0;
  131. transform: rotateZ(90deg);
  132. }
  133. .left {
  134. top: 0;
  135. bottom: 0;
  136. left: 0;
  137. transform: rotateZ(180deg);
  138. }
  139. .right {
  140. top: 0;
  141. bottom: 0;
  142. right: 0;
  143. }
  144. }
  145. .tools-btn {
  146. width: 110rpx;
  147. height: 110rpx;
  148. font-size: 40rpx;
  149. font-weight: bold;
  150. color: $color-primary;
  151. line-height: 1;
  152. background: #434C5D;
  153. border-radius: 100%;
  154. &:active {
  155. text {
  156. opacity: .3;
  157. }
  158. }
  159. }
  160. </style>