Commit 00e7d150 by 潘建波

1.修改flv播放控件到fl.js

2.完成博关算法配置
1 parent 5454a14c
.DS_Store
node_modules
/dist
dist
dist.*
dist.*.*
# local env files
.env.local
.env.*.local
......
This file is too large to display.
No preview for this file type
No preview for this file type
......@@ -17,6 +17,7 @@
"core-js": "^3.3.2",
"echarts": "^4.5.0",
"element-ui": "^2.12.0",
"flv.js": "^1.5.0",
"js-sha1": "^0.6.0",
"moment": "^2.24.0",
"ol": "^6.1.1",
......@@ -43,6 +44,7 @@
"eslint": "^5.16.0",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-vue": "^5.0.0",
"fabric": "^4.4.0",
"generate-asset-webpack-plugin": "^0.3.0",
"node-sass": "^4.12.0",
"prettier": "^1.18.2",
......
{"commit":"226e28357cc713ecc9f9cf3535515e003387c606","commitDate":"2021-2-23 18:45","buildDate":"2021-4-23 11:7","version":"2.1.0","info":"feat✨ 设备树搜索改为服务端搜索"}
\ No newline at end of file
{"commit":"5454a14cc08221039f6a0eb3af9e4064cd8dded4","commitDate":"2021-4-23 11:9","buildDate":"2021-5-11 10:38","version":"2.0.9","info":"feat✨ chrome视频播放"}
\ No newline at end of file
......@@ -15,9 +15,9 @@ export default {
this.$store.dispatch("GetMenuRole", menus).then(res => {});
}
let token = localStorage.getItem("atoken");
if (!token) {
this.$router.push("/login").catch(err => {err});
}
// if (!token) {
// this.$router.push("/").catch(err => {err});
// }
},
mounted() {
window.videoEquitTableHeight = document.body.clientHeight - 142 + "px";
......
......@@ -14,15 +14,15 @@ let flvIP = "";
switch (process.env.NODE_ENV) {
case "development":
wsIP = window.config.https?"192.168.9.227:20070":"192.168.9.233:20080"; // 测试环境url
flvIP = window.config.https?"192.168.9.245:8080":"192.168.9.245:8080";
flvIP = window.config.https?"192.168.9.233:8080":"192.168.9.233:8080";
break;
case "pre":
wsIP = ""; // 预上线环境url
break;
case "production":
wsIP = location.host; // 生产环境url
flvIP = "192.168.9.245" + ":8080"
// flvIP = location.hostname + ":8080"
// flvIP = "192.168.9.245" + ":8080"
flvIP = location.hostname + ":38080"
break;
}
export default {
......
......@@ -12,7 +12,6 @@ switch (process.env.NODE_ENV) {
baseUrl = "https://pre-server.feleti.cn"; // 预上线环境url
break;
case "production":
baseUrl = window.config.https?`https://${location.host}`:`http://${location.host}`; // 生产环境url
break;
}
......
......@@ -217,7 +217,24 @@ Vue.prototype.showLocalTime = function(obj) {
}
return time;
};
/**
*
* @param {*} key
* @param {*} val
*/
Vue.prototype.uuid = function() {
var s = [];
var hexDigits = "0123456789abcdef";
for (var i = 0; i < 36; i++) {
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
}
s[14] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
s[8] = s[13] = s[18] = s[23] = "-";
var uuid = s.join("");
return uuid;
}
/**
* 本地存储相机信息
*/
......
......@@ -322,10 +322,22 @@ a:active{
.video-box .el-radio-button{
display: block;
}
.video-box .safebox .el-radio-button{
display: inline-block;
}
.editbtn .el-radio-button:first-child .el-radio-button__inner{
border:0;
}
.b-box .el-radio-button{
display: inline-block!important;
}
.b-box .el-checkbox.is-bordered+.el-checkbox.is-bordered{
margin-left: 0;
}
.b-box .el-checkbox {
margin-right: 7px;
}
/* 抓拍展示 */
.pic-box {
width: 98%;
......@@ -647,4 +659,12 @@ a:active{
}
.displaybtn-box .playIcon{
font-size: 15px;
}
//@at-root
.b-box .el-checkbox__input.is-disabled+span.el-checkbox__label{
color: #2d8cf0;
}
.b-box .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner::after{
border-color: #2d8cf0;
}
\ No newline at end of file
......@@ -7,7 +7,7 @@ import router from "./router";
import store from "./store";
import resetCss from "./assets/resetElementCss/index.scss";
import api from "./api/install";
import log from "./api/log"
import log from "./api/log";
import "./assets/css/public.css";
import echarts from "echarts";
import "./assets/icon/icon/iconfont.css";
......
......@@ -14,7 +14,7 @@ export default {
let host = `http://${location.host}`;
this.ddLoginUrl = `${
window.config.huasanDD
}&redirect_uri=${`${ window.config.host}/#/ddlogin`}`;
}&redirect_uri=${`${window.config.host}/#/ddlogin`}`;
this.switchLogin();
},
mounted() {},
......@@ -36,7 +36,6 @@ export default {
}, 200);
},
getLoginInfo(code) {
this.$api.login.ddlogin({"code":code.split("=")[1]}).then(res => {
if (res.code == 200) {
this.loginMount(res.data);
......
......@@ -417,9 +417,11 @@ export default {
} else {
return false;
}
});
},
editFun(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
this.$api.ops
......
<template>
<div class="ocxbox">
<canvas id="video1" style="width:100%;height:100%;" class="fvideo"></canvas>
<video id="flvvideo" autoplay style="width: 100%; height: 100%" class="fvideo"></video>
<div class="control" hidden>
<span :class="{'videostatus':true,'el-icon-video-play':videostatus,'el-icon-video-pause':!videostatus }" @click="controlvideo"></span>
<span
:class="{
videostatus: true,
'el-icon-video-play': videostatus,
'el-icon-video-pause': !videostatus,
}"
@click="controlvideo"
></span>
<!-- <span :class="{'el-icon-full-screen':!furllstatus,'el-icon-circle-close':furllstatus,'videostatus':true, 'full-icon':true}" @click="fullvideo" id="full"></span> -->
</div>
</div>
</template>
<script>
var player;
import flv from "flv.js";
export default {
data() {
return {
show: true,
videostatus:false,
furllstatus:false
videostatus: false,
furllstatus: false,
player: "",
};
},
computed: {},
methods: {
controlvideo() {
this.videostatus = !this.videostatus
if(!this.videostatus) {
this.startFunc()
} else {
this.stopFunc()
initflv() {
if (flv.isSupported()) {
this.player = flv.createPlayer({
type: "flv",
});
}
},
fullvideo(ev){
if(!this.furllstatus){
this.furllstatus = true;
this.fullel();
} else {
this.furllstatus = false;
this.exitFullscreen();
}
},
fullel(){
var ele = document.getElementById("full")
if (ele.requestFullscreen) {
ele.requestFullscreen();
} else if (ele.mozRequestFullScreen) {
ele.mozRequestFullScreen();
} else if (ele.webkitRequestFullScreen) {
ele.webkitRequestFullScreen();
}
},
exitFullscreen(){
var de = document
if (de.exitFullscreen) {
de.exitFullscreen();
} else if (de.mozCancelFullScreen) {
de.mozCancelFullScreen();
} else if (de.webkitCancelFullScreen) {
de.webkitCancelFullScreen();
}
},
startFunc(url) {
this.stopFunc()
/**
* 设置解密密码,必须是16字节
*/
player.setCryptoKey("");
/**
* 开始播放,参数为 http-flv或 websocket-flv 的url
*/
player.start(url);
},
stopFunc() {
/**
* 停止播放
*/
player.stop();
let playerel = document.getElementById("flvvideo");
// if (typeof player !== "undefined") {
// if (this.player != null) {
// // this.player.unload();
// // this.player.detachMediaElement();
// // this.player.destroy();
// // this.player = null;
// this.flv_destroy();
// }
// }
this.player = flv.createPlayer({
type: "flv",
isLive: true,
hasAudio: false,
url: url,
});
this.player.attachMediaElement(playerel);
this.player.load();
this.player.play();
},
fullFunc() {
/**
* 全屏播放
*/
player.fullscreen();
flv_start() {
this.player.play();
},
volumeChange(event) {
/**
* 设置音量
* 0.0 ~~ 1.0
* 当为0.0时,完全静音, 最大1.0
*/
player.setVolume(event.target.value / 100.0);
flv_pause() {
this.player.pause();
},
bufferChange(event) {
player.setBufferTime(event.target.value);
flv_destroy() {
this.player.pause();
this.player.unload();
this.player.detachMediaElement();
this.player.destroy();
this.player = null;
},
scaleModeChange(event) {
/**
* 视频缩放模式, 当视频分辨率比例与Canvas显示区域比例不同时,缩放效果不同:
* 0 视频画面完全填充canvas区域,画面会被拉伸 --- 默认值
* 1 视频画面做等比缩放后,对齐Canvas区域,画面不被拉伸,但有黑边
* 2 视频画面做等比缩放后,完全填充Canvas区域,画面不被拉伸,没有黑边,但画面显示不全
* 软解时有效
*/
player.setScaleMode(event.target.value);
}
},
mounted() {
NodePlayer.load(() => {
/**
* 是否打印debug信息
*/
// NodePlayer.debug(true);
player = new NodePlayer();
/**
* 自动测试浏览器是否支持MSE播放,如不支持,仍然使用软解码。
* 紧随 new 后调用
* 不调用则只使用软解
*/
//player.useMSE();
/**
* 传入 canvas视图的id,当使用mse时,自动转换为video标签
*/
player.setView("video1");
/**
* 是否开启屏幕常亮
* 在手机浏览器上,canvas标签渲染视频并不会像video标签那样保持屏幕常亮
* 如果需要该功能, 可以调用此方法, 会有少量cpu消耗, pc浏览器不会执行
*/
player.setKeepScreenOn();
/**
* 设置为等比缩放模式
*/
player.setScaleMode(1);
/**
* 设置最大缓冲时长,单位毫秒,只在软解时有效
*/
player.setBufferTime(1000);
player.on("start", () => {
console.log("player on start");
});
player.on("stop", () => {
console.log("player on stop");
});
player.on("error", e => {
console.log("player on error", e);
});
player.on("videoInfo", (w, h) => {
console.log("player on video info width=" + w + " height=" + h);
});
player.on("audioInfo", (r, c) => {
console.log("player on audio info samplerate=" + r + " channels=" + c);
});
player.on("stats", stats => {
// console.log("player on stats=", stats);
});
player.on("metadata", metadata => {
var m = NodePlayer.AMF.parseScriptData(
metadata.buffer,
0,
metadata.length
);
console.log(m);
});
});
}
mounted() {},
};
</script>
<style lang="stylus">
......@@ -197,7 +88,8 @@ export default {
height: 40px;
width: 100%;
background: rgba(255, 255, 255, 0.2);
display none
display: none;
.videostatus {
cursor: pointer;
color: #fff;
......@@ -205,18 +97,19 @@ export default {
line-height: 40px;
padding-left: 10px;
}
.full-icon{
float right
margin-right 20px
font-size 25px
.full-icon {
float: right;
margin-right: 20px;
font-size: 25px;
}
}
}
.ocxbox:hover {
.control{
// display block
cursor pointer
}
.ocxbox:hover {
.control {
// display block
cursor: pointer;
}
}
</style>
<template>
<div class="ocxbox">
<canvas id="video1" style="width:100%;height:100%;" class="fvideo"></canvas>
<div class="control" hidden>
<span :class="{'videostatus':true,'el-icon-video-play':videostatus,'el-icon-video-pause':!videostatus }" @click="controlvideo"></span>
<!-- <span :class="{'el-icon-full-screen':!furllstatus,'el-icon-circle-close':furllstatus,'videostatus':true, 'full-icon':true}" @click="fullvideo" id="full"></span> -->
</div>
</div>
</template>
<script>
var player;
export default {
data() {
return {
show: true,
videostatus:false,
furllstatus:false
};
},
computed: {},
methods: {
controlvideo() {
this.videostatus = !this.videostatus
if(!this.videostatus) {
this.startFunc()
} else {
this.stopFunc()
}
},
fullvideo(ev){
if(!this.furllstatus){
this.furllstatus = true;
this.fullel();
} else {
this.furllstatus = false;
this.exitFullscreen();
}
},
fullel(){
var ele = document.getElementById("full")
if (ele.requestFullscreen) {
ele.requestFullscreen();
} else if (ele.mozRequestFullScreen) {
ele.mozRequestFullScreen();
} else if (ele.webkitRequestFullScreen) {
ele.webkitRequestFullScreen();
}
},
exitFullscreen(){
var de = document
if (de.exitFullscreen) {
de.exitFullscreen();
} else if (de.mozCancelFullScreen) {
de.mozCancelFullScreen();
} else if (de.webkitCancelFullScreen) {
de.webkitCancelFullScreen();
}
},
startFunc(url) {
this.stopFunc()
/**
* 设置解密密码,必须是16字节
*/
player.setCryptoKey("");
/**
* 开始播放,参数为 http-flv或 websocket-flv 的url
*/
player.start(url);
},
stopFunc() {
/**
* 停止播放
*/
player.stop();
},
fullFunc() {
/**
* 全屏播放
*/
player.fullscreen();
},
volumeChange(event) {
/**
* 设置音量
* 0.0 ~~ 1.0
* 当为0.0时,完全静音, 最大1.0
*/
player.setVolume(event.target.value / 100.0);
},
bufferChange(event) {
player.setBufferTime(event.target.value);
},
scaleModeChange(event) {
/**
* 视频缩放模式, 当视频分辨率比例与Canvas显示区域比例不同时,缩放效果不同:
* 0 视频画面完全填充canvas区域,画面会被拉伸 --- 默认值
* 1 视频画面做等比缩放后,对齐Canvas区域,画面不被拉伸,但有黑边
* 2 视频画面做等比缩放后,完全填充Canvas区域,画面不被拉伸,没有黑边,但画面显示不全
* 软解时有效
*/
player.setScaleMode(event.target.value);
}
},
mounted() {
NodePlayer.load(() => {
/**
* 是否打印debug信息
*/
// NodePlayer.debug(true);
player = new NodePlayer();
/**
* 自动测试浏览器是否支持MSE播放,如不支持,仍然使用软解码。
* 紧随 new 后调用
* 不调用则只使用软解
*/
//player.useMSE();
/**
* 传入 canvas视图的id,当使用mse时,自动转换为video标签
*/
player.setView("video1");
/**
* 是否开启屏幕常亮
* 在手机浏览器上,canvas标签渲染视频并不会像video标签那样保持屏幕常亮
* 如果需要该功能, 可以调用此方法, 会有少量cpu消耗, pc浏览器不会执行
*/
player.setKeepScreenOn();
/**
* 设置为等比缩放模式
*/
player.setScaleMode(1);
/**
* 设置最大缓冲时长,单位毫秒,只在软解时有效
*/
player.setBufferTime(1000);
player.on("start", () => {
console.log("player on start");
});
player.on("stop", () => {
console.log("player on stop");
});
player.on("error", e => {
console.log("player on error", e);
});
player.on("videoInfo", (w, h) => {
console.log("player on video info width=" + w + " height=" + h);
});
player.on("audioInfo", (r, c) => {
console.log("player on audio info samplerate=" + r + " channels=" + c);
});
player.on("stats", stats => {
// console.log("player on stats=", stats);
});
player.on("metadata", metadata => {
var m = NodePlayer.AMF.parseScriptData(
metadata.buffer,
0,
metadata.length
);
console.log(m);
});
});
}
};
</script>
<style lang="stylus">
.ocxbox {
height: 100%;
position: relative;
.fvideo {
height: 100%;
width: 100%;
}
.control {
position: absolute;
bottom: 0;
height: 40px;
width: 100%;
background: rgba(255, 255, 255, 0.2);
display none
.videostatus {
cursor: pointer;
color: #fff;
font-size: 30px;
line-height: 40px;
padding-left: 10px;
}
.full-icon{
float right
margin-right 20px
font-size 25px
}
}
}
.ocxbox:hover {
.control{
// display block
cursor pointer
}
}
</style>
......@@ -76,7 +76,6 @@ export default {
methods: {
handleClick(tab, event) {},
dataInit(cid, type) {
debugger
this.$refs.allalarm.allAlarmData = [];
this.$refs.caralarm.carAlarmData = [];
this.$refs.illegalalarm.illAlarmData = [];
......
......@@ -202,6 +202,10 @@ export default {
this.steam(this.subtaskdata)
},9000)
}
if(this.subtaskdata.task_algo_type == '12') {
this.playurl = {rtsp_url:this.subtaskdata.rtsp_url};
this.$refs.videoplay.videoPlay()
}
this.$api.task.getPlayUrl(this.currentSubtaskId).then(res => {
this.playurl = res;
if (this.playurl.rtsp_url) {
......
......@@ -7,7 +7,8 @@
:before-close="beforeHideModal"
>
<div>
<TraficCanvas
<Behavior :bgUrl="bgUrl" v-if="type == '12'" ref="canvas" :configxml="configxml"></Behavior>
<TraficCanvas
:bgUrl="bgUrl"
v-if="type == '0' || type == '5' || type == '3'"
ref="canvas"
......@@ -47,13 +48,14 @@ import FlowCanvas from "./areaconfig/FlowCanvas";
import SafeCanvas from "./areaconfig/SafeCanvas";
import FaceCanvas from "./areaconfig/FaceCanvas";
import ComplexCanvas from "./areaconfig/ComplexCanvas";
import Behavior from "./areaconfig/Behavior";
import {roi} from "./areaconfig/roi_1"
export default {
data() {
return {
dialogVisible: false,
isShow: false,
type: "0",
type: "9",
btnIsactive: false,
showClose: false,
roiBody: {},
......@@ -61,6 +63,7 @@ export default {
taskData: "",
bgUrl: "",
baseUrl:"",
configxml:"",
fileList:[]
};
},
......@@ -69,7 +72,8 @@ export default {
SafeCanvas,
FlowCanvas,
FaceCanvas,
ComplexCanvas
ComplexCanvas,
Behavior
},
methods: {
showModal: function(data, mtaskdata) {
......@@ -110,10 +114,11 @@ export default {
.catch(err => {
console.log("区域设置截图返回异常:", err.message);
});
this.configxml = data.config;
setTimeout(() => {
_this.$refs.canvas.stageInit();
_this.$refs.canvas.stageInit(data.config);
if (data.rois) {
_this.$refs.canvas.configInit(data.rois[0].roi);
_this.$refs.canvas.configInit(data.rois[0].roi,data.config);
// _this.$refs.canvas.configInit(roi);
}
}, 300);
......@@ -179,7 +184,7 @@ export default {
console.log(error);
}
},
save: function() {
save: function(type) {
if (this.$refs.canvas.roadFlag === false) {
this.$alert("车道线有修改,请检查车道属性是否正确", "提示", {
confirmButtonText: "确定"
......@@ -189,6 +194,7 @@ export default {
return;
}
let XMLStr = this.$refs.canvas.save();
console.log("xxx",XMLStr);
if (this.type == "1" && (XMLStr === "dir" || XMLStr === "in")) {
this.$message({
type: "warning",
......@@ -196,6 +202,11 @@ export default {
});
return;
}
if(this.type == '12') {
let XMLStr = this.$refs.canvas.paramsData;
console.log("12",XMLStr)
this.$parent.submit(XMLStr, "config");
}
this.$parent.submit(XMLStr, "roi", this.taskData);
this.beforeHideModal();
}
......
<template>
<div class="modal-body">
<div class="modal-body safebox">
<div class="modal-lt">
<button v-for="(item,index) in typeData" :class="{'curmodal':index==cindex}" @click="changeLayer(index)" :key="index">{{item}}</button>
</div>
......@@ -13,8 +13,8 @@
</div>
</div>
<div class="modal-lb" id="edit_list" v-if="drawState!=-1">
<el-radio-group v-model="canvasState" @change='changeCanvasState' :disabled='needLine||needRect'>
<el-radio-button :label="1">添加</el-radio-button>
<el-radio-group size="mini" v-model="canvasState" @change='changeCanvasState' :disabled='needLine||needRect'>
<el-radio-button :label="1" >添加</el-radio-button>
<el-radio-button :label="0">编辑</el-radio-button>
</el-radio-group>
<div v-if="!canvasState">
......@@ -859,7 +859,9 @@
}
.modal-body {
/* height: 540px!important; */
height: 540px!important;
overflow: hidden;
margin-bottom: 10px;
}
.modal-lt {
width: 100%;
......@@ -873,7 +875,7 @@
background: #145B93!important
}
.modal-left {
float: left;
float: right;
min-height: 350px;
width: 15%;
color: #fff;
......@@ -883,6 +885,7 @@
position: relative;
float: left;
text-align: center;
margin-left:10px;
}
.modal-left button {
......
export const xml = `<?xml version="1.0" encoding="GBK"?><root><算法功能><行为分析_BG><人员脱岗><算法ID>RegionalInvasion</算法ID><告警门限值>60</告警门限值><告警间隔>5</告警间隔></人员脱岗><人员入侵><算法ID>AbsentDetection</算法ID><方向>1</方向></人员入侵><物品遗留><算法ID>GoodsMovedDeteion</算法ID><灵敏度>60</灵敏度><上报频率>3</上报频率><背景刷新时间>5</背景刷新时间></物品遗留></行为分析_BG></算法功能></root>`
\ No newline at end of file
class draw{
constructor(cav){
this.cav = cav;
}
}
\ No newline at end of file
<template>
<div>
<el-dialog
title="区域设置"
:visible.sync="dialogVisible"
width="1100px"
:before-close="beforeHideModal"
>
<div>
<TraficCanvas
:bgUrl="bgUrl"
v-if="type == '0' || type == '5' || type == '3'"
ref="canvas"
></TraficCanvas>
<FlowCanvas :bgUrl="bgUrl" v-if="type == '1'" ref="canvas"></FlowCanvas>
<SafeCanvas :bgUrl="bgUrl" v-if="type == '2'" ref="canvas"></SafeCanvas>
<FaceCanvas :bgUrl="bgUrl" v-if="type == '4'" ref="canvas"></FaceCanvas>
<ComplexCanvas
:bgUrl="bgUrl"
v-if="type == '7'"
ref="canvas"
></ComplexCanvas>
</div>
<div>
<el-button type="primary" style="float:left; margin-right:10px" @click="down">下载<i class="el-icon-download el-icon--right"></i></el-button>
<el-upload
class="upload-demo"
action=""
:auto-upload="false"
:show-file-list="false"
:on-change="handleChange"
:file-list="fileList">
<el-button type="primary">上传<i class="el-icon-upload el-icon--right"></i></el-button>
<span slot="tip" class="el-upload__tip upinfo"> 手动上传场景图片</span>
</el-upload>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="beforeHideModal">取 消</el-button>
<el-button type="primary" @click="save">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import TraficCanvas from "./areaconfig/TraficCanvas";
import FlowCanvas from "./areaconfig/FlowCanvas";
import SafeCanvas from "./areaconfig/SafeCanvas";
import FaceCanvas from "./areaconfig/FaceCanvas";
import ComplexCanvas from "./areaconfig/ComplexCanvas";
import {roi} from "./areaconfig/roi_1"
export default {
data() {
return {
dialogVisible: false,
isShow: false,
type: "0",
btnIsactive: false,
showClose: false,
roiBody: {},
XMLStr: "",
taskData: "",
bgUrl: "",
baseUrl:"",
fileList:[]
};
},
components: {
TraficCanvas,
SafeCanvas,
FlowCanvas,
FaceCanvas,
ComplexCanvas
},
methods: {
showModal: function(data, mtaskdata) {
var _this = this;
this.$store.commit("setocxstate", 0);
this.taskData = mtaskdata;
this.dialogVisible = true;
this.type = data.algo_type;
// this.type = 2;
this.bgUrl = "";
//获取视频截图
this.$api.task
.cutpic(
mtaskdata.vchan.vdev_unid,
mtaskdata.vchan.vchan_refid,
mtaskdata.subtask_id
)
.then(data => {
if (!data.ecode) {
this.bgUrl = "data:image/png;base64," + data.pic_base64;
this.baseUrl = "data:image/png;base64," + data.pic_base64;
setTimeout(() => {
let img = document.getElementById("pic").childNodes[0];
let canvas = document.createElement("canvas");
canvas.width = 800;
canvas.height = 500;
try {
canvas.getContext("2d").drawImage(img, 0, 0, 800, 500);
_this.bgUrl = canvas.toDataURL("image/webp");
} catch (error) {
console.log(error);
}
}, 500);
} else {
alert("区域设置截图失败!" + data.enote);
}
})
.catch(err => {
console.log("区域设置截图返回异常:", err.message);
});
setTimeout(() => {
_this.$refs.canvas.stageInit();
if (data.rois) {
_this.$refs.canvas.configInit(data.rois[0].roi);
// _this.$refs.canvas.configInit(roi);
}
}, 300);
},
handleChange(file, fileLis){
this.bgUrl = URL.createObjectURL(file.raw);
setTimeout(() => {
let img = document.getElementById("pic").childNodes[0];
let canvas = document.createElement("canvas");
canvas.width = 800;
canvas.height = 500;
try {
canvas.getContext("2d").drawImage(img, 0, 0, 800, 500);
_this.bgUrl = canvas.toDataURL("image/webp");
} catch (error) {
console.log(error);
}
}, 500);
},
down(){
this.downloadurl(this.baseUrl,'scenes_pic')
},
downloadurl(content, fileName) { //下载base64图片
var base64ToBlob = function(code) {
let parts = code.split(';base64,');
let contentType = parts[0].split(':')[1];
let raw = window.atob(parts[1]);
let rawLength = raw.length;
let uInt8Array = new Uint8Array(rawLength);
for(let i = 0; i < rawLength; ++i) {
uInt8Array[i] = raw.charCodeAt(i);
}
return new Blob([uInt8Array], {
type: contentType
});
};
let aLink = document.createElement('a');
let blob = base64ToBlob(content); //new Blob([content]);
let evt = document.createEvent("HTMLEvents");
evt.initEvent("click", true, true); //initEvent 不加后两个参数在FF下会报错 事件类型,是否冒泡,是否阻止浏览器的默认行为
aLink.download = fileName;
aLink.href = URL.createObjectURL(blob);
aLink.click();
},
beforeHideModal: function() {
this.$store.commit("setocxstate", 1);
this.dialogVisible = false;
this.$refs.canvas.clear();
this.$refs.canvas.cindex = 0;
this.bgUrl = "";
},
getType: function() {
if (this.$parent.subTaskInfo) {
this.type = this.$parent.subTaskInfo.task_algo_type;
} else {
this.type = this.$parent.$parent.subTaskInfo.task_algo_type;
}
this.XMLStr = "";
this.btnIsactive = true;
try {
this.EditList(1);
} catch (error) {
console.log(error);
}
},
save: function() {
if (this.$refs.canvas.roadFlag === false) {
this.$alert("车道线有修改,请检查车道属性是否正确", "提示", {
confirmButtonText: "确定"
});
//xieminghui
// this.$refs.canvas.roadFlag = "confirm";
return;
}
let XMLStr = this.$refs.canvas.save();
if (this.type == "1" && (XMLStr === "dir" || XMLStr === "in")) {
this.$message({
type: "warning",
message: "请检查配置是否正确"
});
return;
}
this.$parent.submit(XMLStr, "roi", this.taskData);
this.beforeHideModal();
}
}
};
</script>
<style lang="stylus" scoped></style>
......@@ -41,7 +41,9 @@
<el-option value="" label="--"></el-option>
<el-option value="0" label="交通"></el-option>
<el-option value="1" label="客流"></el-option>
<el-option value="2" label="安防"></el-option>
<el-option value="2" label="行为分析"></el-option>
<el-option value="12" label="行为分析_BG"></el-option>
<el-option value="3" label="违停"></el-option>
<el-option value="5" label="交通行人"></el-option>
</el-select>
......
......@@ -56,7 +56,7 @@
<el-option value="" label="全部"></el-option>
<el-option value="0" label="交通"></el-option>
<el-option value="1" label="客流"></el-option>
<el-option value="2" label="行为分析"></el-option>
<el-option value="12" label="行为分析"></el-option>
<el-option value="7" label="综合流量"></el-option>
<!-- <el-option value="4" label='人脸'></el-option> -->
</el-select>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!