detail.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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="" style="height:400px">
  7. <view id="myPlayer"></view>
  8. </view>
  9. <view class="btn-box">
  10. <view class="more" @touchstart="configCamera('move', 8)" @touchend="stopConfigCamera()">
  11. <image :src="moreSrc" mode="widthFix"></image>
  12. </view>
  13. <view class="direc">
  14. <view class="top" @touchstart="configCamera('move', 0)" @touchend="stopConfigCamera()">
  15. </view>
  16. <view class="bottom" @touchstart="configCamera('move', 1)" @touchend="stopConfigCamera()">
  17. </view>
  18. <view class="photo" @touchstart="configCamera('takephoto', '')">
  19. </view>
  20. <view class="left" @touchstart="configCamera('move', 2)" @touchend="stopConfigCamera()">
  21. </view>
  22. <view class="right" @touchstart="configCamera('move', 6)" @touchend="stopConfigCamera()">
  23. </view>
  24. </view>
  25. <view class="less" @touchstart="configCamera('move', 9)" @touchend="stopConfigCamera()">
  26. <image :src="lessSrc" mode="widthFix"></image>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import EZUIKit from '../../static/js/ezuikit.js'
  34. export default {
  35. data() {
  36. return {
  37. device_id: '',
  38. accessToken: "",
  39. moreSrc: require('../../static/image/monitor/3.png'),
  40. lessSrc: require('../../static/image/monitor/2.png')
  41. }
  42. },
  43. onLoad(options) {
  44. this.device_id = options.device_id
  45. this.accessToken = options.accessToken
  46. console.log(options)
  47. this.getAddr()
  48. },
  49. methods: {
  50. getAddr() {
  51. setTimeout(() => {
  52. let url = `ezopen://open.ys7.com/${this.device_id}/1.hd.live`
  53. var player = new EZUIKit.EZUIPlayer({
  54. id: 'myPlayer',
  55. url: url,
  56. autoplay: true,
  57. accessToken: this.accessToken,
  58. decoderPath: 'static/js/',
  59. width: 600,
  60. height: 400,
  61. });
  62. player.play();
  63. }, 500)
  64. },
  65. clickLeft() {
  66. uni.navigateBack({
  67. delta: 1
  68. });
  69. },
  70. //上下左右和拍照
  71. configCamera(ctrl, movenum) {
  72. if (ctrl == "takephoto") {
  73. this.$myRequest({
  74. url: "/api/api_gateway?method=camera.camera_manage.camera_takephoto",
  75. data: {
  76. device_id: this.device_id,
  77. }
  78. }).then((res) => {
  79. console.log(111)
  80. // let data = JSON.parse(res.data.data);
  81. // if (data.code == 200) {
  82. // this.picUrl = data.data.picUrl;
  83. // this.takePhotoDialogVisible = true;
  84. // } else {
  85. // this.$message.error(data.msg);
  86. // }
  87. });
  88. } else {
  89. //上下左右、放大、缩小
  90. this.$myRequest({
  91. url: "/api/api_gateway?method=camera.camera_manage.ctrl_camera",
  92. data: {
  93. device_id: this.device_id,
  94. ctrl: ctrl,
  95. movenum: movenum,
  96. }
  97. }).then((res) => {
  98. console.log(222)
  99. // if (res.data.message == '') {
  100. // this.$message.success('指令下发成功')
  101. // // this.stopConfigCamera() //关闭方向
  102. // }
  103. });
  104. }
  105. },
  106. stopConfigCamera() {
  107. this.$myRequest({
  108. url: "/api/api_gateway?method=camera.camera_manage.ctrl_camera",
  109. data: this.qs.stringify({
  110. device_id: this.device_id,
  111. ctrl: "stop",
  112. }),
  113. });
  114. }
  115. }
  116. }
  117. </script>
  118. <style lang="scss">
  119. .btn-box {
  120. margin-top: 20px;
  121. display: flex;
  122. flex-direction: row;
  123. justify-content: space-around;
  124. image {
  125. width: 200rpx;
  126. }
  127. align-items: center;
  128. .direc {
  129. width: 300rpx;
  130. height: 300rpx;
  131. background: url('../../static/image/monitor/1.png');
  132. background-size: 100% auto;
  133. }
  134. }
  135. </style>