he wei
2024-09-21 70edda3b00f2528a473c28ec5a50b739ed160f0f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<template>
  <div class="endoscope-video">
    <rtmp-video :url="url"></rtmp-video>
  </div>
</template>
 
<script>
import RtmpVideo from "@/components/rtmpVideo";
export default {
  name: "endoscopeVideo",
  components: { RtmpVideo },
  data() {
    return {
      url: "",
      mac: "",
    };
  },
  methods: {
    getList() {
      this.$axios({
        method: "get",
        url: "http://121.36.27.55:51389/A059Web/webService/getList",
        withCredentials: false,
      })
        .then((res) => {
          let rs = res.data;
          if (rs.code == 200 && rs.data.length) {
            let data = rs.data;
            let mac = data[0].mac;
            let url = data[0].rtmp;
            this.start(mac, url);
          }
        })
        .catch((error) => {
          console.log(error);
        });
    },
    start(mac, url) {
      this.$axios({
        method: "post",
        url: "http://121.36.27.55:51389/A059Web/webService/startTest",
        withCredentials: false,
        params: {
          mac: mac,
        },
      })
        .then((res) => {
          let rs = res.data;
          if (rs.code == 200) {
            this.url = url;
            this.mac = mac;
          }
        })
        .catch((error) => {
          console.log(error);
        });
    },
    stop() {
      let mac = this.mac;
      if (!mac) {
        return;
      }
      this.$axios({
        method: "post",
        url: "http://121.36.27.55:51389/A059Web/webService/stopTest",
        withCredentials: false,
        params: {
          mac: mac,
        },
      })
        .then((res) => {
          console.log("内窥镜MAC:" + mac + "停止推送视频");
        })
        .catch((error) => {
          console.log(error);
        });
    },
  },
  mounted() {
    this.getList();
  },
  beforeDestroy() {
    this.stop();
  },
};
</script>
 
<style scoped>
</style>