4.17websocket调试成功

main
coco1986509808 2023-04-17 19:23:44 +08:00
parent 03ca605c8c
commit d9d7f0ed8e
3 changed files with 59 additions and 41 deletions

View File

@ -1,5 +1,6 @@
window.GLOBAL_CONFIG = { window.GLOBAL_CONFIG = {
apiURL: "http://127.0.0.1:8889/face", apiURL: "http://127.0.0.1:8889/face",
IMG_SERVER_URL: "http://192.168.1.133:9000", IMG_SERVER_URL: "http://192.168.1.133:9000",
SOCKET_URL: "ws://127.0.0.1:1993/task/webSocket", SOCKET_URL: "ws://127.0.0.1:8889/face/webSocketServer",
rtspApi_URL: window.location.protocol + '//' + window.location.hostname + ':' + window.location.port,
} }

View File

@ -11,21 +11,23 @@
</i> </i>
</div> </div>
<div style="width: 528px;height: 190px;margin-bottom: 10px;background: #FFF;border-radius:2px; cursor: pointer;" <div style="width: 528px;height: 190px;margin-bottom: 10px;background: #FFF;border-radius:2px; cursor: pointer;"
v-for="(item,index) in warningList" class="warning-class" @click="openTask(item)"> v-for="(item,index) in videoFaceList" class="warning-class" @click="openTask(item)">
<div <div
style="height:40px;display:flex;align-items: center; justify-content: space-between;border-bottom: 1px solid #F1F8FF;box-sizing: border-box;"> style="height:40px;display:flex;align-items: center; justify-content: space-between;border-bottom: 1px solid #F1F8FF;box-sizing: border-box;">
<i style="font-weight: bold;color: #333333;margin-left: 20px">{{item.cameraRegion}}</i> <!-- <i style="font-weight: bold;color: #333333;margin-left: 20px">{{item.cameraRegion}}</i>-->
<i style="font-weight: bold;color: #333333;margin-left: 20px">{{videoFaceList[index].time}}</i>
<i style="font-weight: bold;color: #333333;margin-right: 20px;">{{item.time}}</i> <i style="font-weight: bold;color: #333333;margin-right: 20px;">{{item.time}}</i>
</div> </div>
<div style="display: flex;align-items: center;height: 150px;margin-left: 34px;"> <div style="display: flex;align-items: center;height: 150px;margin-left: 34px;">
<div style="width: 120px;height: 120px;background: #F1F6F9;"> <div style="width: 120px;height: 120px;background: #F1F6F9;">
<!--<canvas width=120 height=120 :ref="'warningImage'+index"> <!--<canvas width=120 height=120 :ref="'warningImage'+index">
</canvas>--> </canvas>-->
<img style="width: 120px;height: 120px;" :src="item.cphoto" fit="contain"/> <img style="width: 120px;height: 120px;" :src="videoFaceList[index].cphoto" fit="contain"/>
</div> </div>
<div <div
style="width: 120px;height: 120px;background: #F1F6F9;margin: 0 20px;text-align: center;position: relative;"> style="width: 120px;height: 120px;background: #F1F6F9;margin: 0 20px;text-align: center;position: relative;">
<img style="width: 120px;height: 120px;" :src="item.rphoto" /> <!-- src="item.rphoto"-->
<img style="width: 120px;height: 120px;" src="../../../assets/img/warning/zb.png" />
<div <div
style="position: absolute;width: 100%;background-color: red;bottom: 0;opacity: 0.6;background: #000;color: #FFF;line-height: 1.8;"> style="position: absolute;width: 100%;background-color: red;bottom: 0;opacity: 0.6;background: #000;color: #FFF;line-height: 1.8;">
<i>测试库</i> <i>测试库</i>
@ -38,10 +40,11 @@
style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgritem.name}}</i></span> style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgr style="width: 120px;height: 120px;backgritem.name}}</i></span>
<span><i>性别未知</i></span> <span><i>性别未知</i></span>
<span><i>来源测试库</i></span> <span><i>来源测试库</i></span>
<span><i>相似度</i><i <span><i>相似度</i><i style="font-size: 30px;font-weight: 600;color: #FF343E; font-family:Bahnschrift;">
style="font-size: 30px;font-weight: 600;color: #FF343E; font-family:Bahnschrift;">{{item.xsd }}</i></span> {{"99%"+item.xsd}}</i></span>
</div> </div>
<div style="position: absolute;top:0;right: 0;"> <div style="position: absolute;top:0;right: 0;">
<img src="../../../assets/img/warning/jk.png" alt="监控">
<img v-if="item.taskType=='3'" src="../../../assets/img/warning/ts.png" alt="提示"> <img v-if="item.taskType=='3'" src="../../../assets/img/warning/ts.png" alt="提示">
<img v-if="item.taskType=='2'" src="../../../assets/img/warning/jk.png" alt="监控"> <img v-if="item.taskType=='2'" src="../../../assets/img/warning/jk.png" alt="监控">
<img v-if="item.taskType=='1'" src="../../../assets/img/warning/zb.png" alt="抓捕"> <img v-if="item.taskType=='1'" src="../../../assets/img/warning/zb.png" alt="抓捕">
@ -87,12 +90,18 @@
</div> </div>
<!-- 背景图 --> <!-- 背景图 -->
<!-- fits: ['fill', 'contain', 'cover', 'none', 'scale-down'], --> <!-- fits: ['fill', 'contain', 'cover', 'none', 'scale-down'], -->
<div style="width: 100%;display: flex;justify-content: center;background-color: #333;height:600px;"> <div>
<el-image style="width: 100%;" :src="faceBgUrltest" :preview-src-list="[faceBgUrltest]" fit="contain"> <!-- <el-image style="width: 100%;" :src="faceBgUrltest" :preview-src-list="[faceBgUrltest]" fit="contain">-->
<div slot="error" class="image-slot" style="text-align: center;margin-top:270px ;"> <!-- <div slot="error" class="image-slot" style="text-align: center;margin-top:270px ;">-->
<i style="color: #666;font-size: 60px;" class="el-icon-picture-outline"></i> <!-- <i style="color: #666;font-size: 60px;" class="el-icon-picture-outline"></i>-->
<!-- </div>-->
<!-- </el-image>-->
<el-card shadow="never" class="aui-card--fill">
<div style="border: 1px solid #000000;height: 100%;width: 100%;float: left" v-for="item in cameraList">
<video-control :msg=item.rtspUrl></video-control>
</div> </div>
</el-image> <!-- <button style="width: 200px;height: 200px;" @click="plays"></button>-->
</el-card>
</div> </div>
<!-- 抓拍图片详情 --> <!-- 抓拍图片详情 -->
@ -163,13 +172,15 @@
import 'element-ui/lib/theme-chalk/display.css'; import 'element-ui/lib/theme-chalk/display.css';
import Task from './barrier-task' import Task from './barrier-task'
import barrierAllPic from './barrier-all-pic' import barrierAllPic from './barrier-all-pic'
import videoControl from'./video-control'
export default { export default {
directives: { directives: {
clickoutside clickoutside
}, },
components: { components: {
Task, Task,
barrierAllPic barrierAllPic,
videoControl
}, },
data() { data() {
return { return {
@ -200,13 +211,15 @@
totalSnapShot: 0, totalSnapShot: 0,
// //
warningList: [], warningList: [],
videoFaceList:[],
// //
warningType: "", warningType: "",
cameraList:[{ rtspUrl: "rtsp://admin:123uestc@192.168.1.32:554/h264"}],
} }
}, },
mounted() { mounted() {
//this.timer = setInterval(this.get, 1000); //this.timer = setInterval(this.get, 1000);
this.get() // this.get()
}, },
beforeDestroy() {}, beforeDestroy() {},
created() { created() {
@ -218,15 +231,18 @@
methods: { methods: {
get(){ get(){
this.warningList = []; this.videoFaceList = [];
// console.log("this waringlist"+this.warningList); // console.log("this waringlist"+this.warningList);
this.$http.get("/faces/list").then(res => { this.$http.get("/faces/returnList").then(res => {
this.warningList = res.data; this.videoFaceList = res.data;
}) })
}, },
plays(){
this.cameraList.push({rtspUrl: "rtsp://admin:123uestc@192.168.1.32:554/h264"});
},
// 4 // 4
initGetWarningPicture() { initGetWarningPicture() {
this.$http.post("/warning/alarm", { this.$http.post("/faces/compareList", {
"page": { "page": {
"pageNo": 1, "pageNo": 1,
"pageSize": 4, "pageSize": 4,
@ -325,27 +341,15 @@
console.log("WebSocket Connection closed"); console.log("WebSocket Connection closed");
}, },
websocketonmessage(e) { websocketonmessage(e) {
console.log("数据传输")
console.log(e)
// wsjson // wsjson
let wsObj = JSON.parse(e.data) let wsObj = JSON.parse(e.data)
console.log("this wsObj")
console.log(wsObj)
// ws // ws
if (wsObj.code === 200) {
// wsObj.cmd === "BAYONET"
if (wsObj.cmd === "BAYONET") {
this.getPicture(wsObj.data)
}
// wsObj.cmd === "WARNING"
else {
// ws // ws
this.getWarningPicture(wsObj.data) this.getWarningPicture(wsObj)
}
} else if (wsObj.code === 401) {
this.$router.replace({
name: 'login'
})
} else {
this.$message.error(wsObj.message)
this
}
}, },
// //
getPicture(obj) { getPicture(obj) {
@ -383,18 +387,22 @@
*/ */
getWarningPicture(warningData) { getWarningPicture(warningData) {
// warningDataws // warningDataws
if (!Array.isArray(warningData)) {
if (this.warningList.length === 4) { if (this.warningList.length === 4) {
this.warningList.pop() this.warningList.pop()
this.warningList.unshift(warningData) this.warningList.unshift(warningData)
} else { } else {
this.warningList.unshift(warningData) console.log("this warningDAta")
console.log(warningData)
this.warningList = warningData
// this.warningList.unshift(warningData)
console.log("this warningList")
console.log(this.warningList)
} }
// tips // tips
let warningType = this.$refs.notice let warningType = this.$refs.notice
warningType.play() warningType.play()
this.$message.warning("有新的预警信息") // this.$message.warning("")
}
this.warningList.forEach((item, index, arr) => { this.warningList.forEach((item, index, arr) => {
// "1" #FF343E "2" #FFA61A "0" #2FC8FA // "1" #FF343E "2" #FFA61A "0" #2FC8FA
// if (item.taskType == "1" || item.taskType == "2" || item.taskType == "3") { // if (item.taskType == "1" || item.taskType == "2" || item.taskType == "3") {

View File

@ -19,6 +19,15 @@ module.exports = {
overlay: { overlay: {
errors: true, errors: true,
warnings: true warnings: true
},
proxy:{
'/api':{
target:"http://192.168.1.181:8286/",
changeOrigin: true,
pathRewrite: {
'^/api':'/api'
}
}
} }
} }
} }