Ver Fonte

电话通讯录只显示站内人员

fan há 2 semanas atrás
pai
commit
da315ec1f9

+ 1 - 1
public/js/config.js

@@ -30,7 +30,7 @@ const STATION_LIST = [
 /**
  * 页面内标题 已生效
  */
-const SYSTEM_TITLE = '托克托作业区综合安防平台'
+const SYSTEM_TITLE = '托克托作业区综合安防系统'
 /**
  * 设置浏览器标题 已生效
  */

+ 36 - 16
src/views/basePage/panels/PersonStatistics.vue

@@ -6,16 +6,26 @@
       <div class="person_title">人员信息</div>
       <div class="person_num_box">
         <vue-seamless
+          v-if="personList.length"
           :data="personList"
           class="seamless-warp"
           :class-option="scrollOption"
           ref="seamlessScroll"
           :key="seamLessTimeKey"
         >
-          <div v-if="personList.length">
+          <div>
             <div class="item" v-for="item of personList" :key="item.id">
               <div class="left">
-                <img :src="item.imgUrl" @click="delInfo(item)" />
+                <img
+                  :src="item.imgUrl"
+                  @click="delInfo(item)"
+                  v-if="item.imgUrl"
+                />
+                <img
+                  src="~@/assets/imgs/stationMap/img_无照片.png"
+                  @click="delInfo(item)"
+                  v-else
+                />
               </div>
               <div class="divider"></div>
               <div class="right">
@@ -55,8 +65,10 @@
               </div>
             </div>
           </div>
-          <div v-else>暂无数据</div>
         </vue-seamless>
+        <div v-else class="data-loading">
+          <div>数据加载中</div>
+        </div>
       </div>
       <!-- <div class="person_type_box">
         <div class="person_title">出入设备</div>
@@ -198,7 +210,7 @@ export default {
   components: { BaseTitle, VueSeamless },
   data() {
     return {
-      total: 4,
+      total: 0,
       count: 6,
       seamLessTimeKey: new Date().getTime(),
       seamLessTimeKeyEvent: new Date().getTime(),
@@ -266,17 +278,17 @@ export default {
       },
       defaultPhoto: "~@/assets/imgs/stationMap/img_无照片.png",
       personList: [
-        {
-          id: "1",
-          name: "",
-          pic: "",
-          type: "值班干部",
-          posi: "主任",
-          personType: "员工",
-          comp: "XXXXX公司",
-          phone: 15500001111,
-          imgUrl: "~@/assets/imgs/stationMap/img_无照片.png",
-        },
+        // {
+        //   id: "1",
+        //   name: "",
+        //   pic: "",
+        //   type: "值班干部",
+        //   posi: "主任",
+        //   personType: "员工",
+        //   comp: "XXXXX公司",
+        //   phone: 15500001111,
+        //   imgUrl: "~@/assets/imgs/stationMap/img_无照片.png",
+        // },
       ],
       eventsList: [
         {
@@ -301,6 +313,7 @@ export default {
     };
   },
   created() {
+    this.getMessage();
     // this.openPersonInfo();
     // this.initAccessLogList();
   },
@@ -616,7 +629,14 @@ export default {
       width: 100%;
       height: 342px;
       overflow: hidden;
-
+      .data-loading {
+        width: 100%;
+        height: 342px;
+        display: flex;
+        padding-left: 40%;
+        align-items: center; /*设置侧轴上,子元素的排列方式为居中对齐*/
+        color: #ffffff;
+      }
       .num_content {
         width: 100%;
         height: 168px;

+ 2 - 2
src/views/basePage/panels/RiskHint.vue

@@ -27,7 +27,7 @@
               <span class="type">{{ riskColors[item.level].name }}</span>
               <span class="split"></span>
               <span class="time">{{
-                Dayjs(item.eventTime).format("YYYY-MM-DD HH:mm:ss")
+                Dayjs(item.riskTime).format("YYYY-MM-DD HH:mm:ss")
               }}</span>
             </div>
             <div
@@ -145,7 +145,7 @@ export default {
               e.content,
           };
         });
-        // console.log("风险报警数据", alarmData, this.hintData1);
+        console.log("风险报警数据", alarmData, this.hintData1);
       } catch (err) {}
     },
     openRiskDialog(data) {

+ 104 - 0
src/views/components/dialog/VoiceCallDialog/Dialer.vue

@@ -13,6 +13,7 @@
       >
         {{ number }}
       </el-button>
+      <audio v-show="false" controls autoplay="autoplay" id="audioCtl"></audio>
     </div>
     <!-- 语音输入按钮 -->
     <el-button type="info" @click="startVoiceInput"> 语音输入 </el-button>
@@ -35,11 +36,23 @@ export default {
   },
   data() {
     return {
+      id: this.generateGuid(),
+      baseUrl: "api/webrtc/",
+      pc: null,
       // 拨号盘上的数字和符号
       numbers: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "*", "0", "#"],
     };
   },
   computed: {
+    getOfferUrl() {
+      return `${this.baseUrl}getoffer?id=${this.id}`;
+    },
+    setAnswerUrl() {
+      return `${this.baseUrl}setanswer?id=${this.id}`;
+    },
+    setIceCandidateUrl() {
+      return `${this.baseUrl}addicecandidate?id=${this.id}`;
+    },
     currentPhoneNumber: {
       get() {
         return this.phoneNumber;
@@ -60,10 +73,14 @@ export default {
     callNumber() {
       if (this.currentPhoneNumber) {
         alert(`正在拨打号码: ${this.currentPhoneNumber}`);
+        this.start();
       } else {
         alert("请输入电话号码");
       }
     },
+    downNumber() {
+      this.closePeer();
+    },
     startVoiceInput() {
       const recognition = new (window.SpeechRecognition ||
         window.webkitSpeechRecognition)();
@@ -75,6 +92,93 @@ export default {
       };
       recognition.start();
     },
+
+    generateGuid() {
+      return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(
+        /[xy]/g,
+        function (c) {
+          var r = (Math.random() * 16) | 0,
+            v = c == "x" ? r : (r & 0x3) | 0x8;
+          return v.toString(16);
+        }
+      );
+    },
+    async start() {
+      this.closePeer();
+
+      let videoControl = document.querySelector("#audioCtl");
+
+      const localStream = await navigator.mediaDevices.getUserMedia({
+        video: false,
+        audio: true,
+      });
+      videoControl.srcObject = localStream;
+
+      this.pc = new RTCPeerConnection(null);
+
+      localStream.getTracks().forEach((track) => {
+        console.log("add local track " + track.kind + " to peer connection.");
+        console.log(track);
+        this.pc.addTrack(track, localStream);
+      });
+
+      this.pc.onicegatheringstatechange = function () {
+        console.log("onicegatheringstatechange: " + this.pc.iceGatheringState);
+      }.bind(this);
+
+      this.pc.oniceconnectionstatechange = function () {
+        console.log(
+          "oniceconnectionstatechange: " + this.pc.iceConnectionState
+        );
+      }.bind(this);
+
+      this.pc.onsignalingstatechange = function () {
+        console.log("onsignalingstatechange: " + this.pc.signalingState);
+      }.bind(this);
+
+      this.pc.onicecandidate = async function (event) {
+        if (event.candidate) {
+          console.log("new-ice-candidate:");
+          console.log(event.candidate.candidate);
+          console.log(event.candidate);
+          await fetch(this.setIceCandidateUrl, {
+            method: "POST",
+            body: JSON.stringify(event.candidate),
+            headers: { "Content-Type": "application/json" },
+          });
+        }
+      }.bind(this);
+
+      let offerResponse = await fetch(this.getOfferUrl);
+      let offer = await offerResponse.json();
+      console.log("got offer: " + offer.type + " " + offer.sdp + ".");
+      await this.pc.setRemoteDescription(offer);
+
+      this.pc
+        .createAnswer()
+        .then(
+          function (answer) {
+            return this.pc.setLocalDescription(answer);
+          }.bind(this)
+        )
+        .then(
+          async function () {
+            console.log("Sending answer SDP.");
+            console.log("SDP: " + this.pc.localDescription.sdp);
+            await fetch(this.setAnswerUrl, {
+              method: "POST",
+              body: JSON.stringify(this.pc.localDescription),
+              headers: { "Content-Type": "application/json" },
+            });
+          }.bind(this)
+        );
+    },
+    closePeer() {
+      if (this.pc != null) {
+        console.log("close peer");
+        this.pc.close();
+      }
+    },
   },
 };
 </script>

+ 1 - 1
src/views/components/dialog/VoiceCallDialog/index.vue

@@ -96,7 +96,7 @@ export default {
   methods: {
     async init() {
       try {
-        const res = await getPersonList({});
+        const res = await getPersonList({ type: "255022541838691649" });
         if (res.code === 20000) {
           this.tableConfig.tableData = res.data.content.filter((item) => {
             return item.telephone && item.telephone.length > 0;