detail.vue 3.5 KB

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