inl-ui 0.1.129 → 0.1.131
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -49
- package/dist/components/index.cjs +210 -6
- package/dist/components/index.js +209 -6
- package/dist/index.cjs +211 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.js +210 -7
- package/dist/theme/index.js +70 -70
- package/dist/theme/scripts/dark-vars.js +21 -21
- package/dist/theme/scripts/default-vars.js +25 -25
- package/dist/theme/scripts/light-vars.js +22 -22
- package/dist/theme/style/color/bezierEasing.less +110 -110
- package/dist/theme/style/color/colorPalette.less +81 -81
- package/dist/theme/style/color/colors.less +162 -162
- package/dist/theme/style/color/tinyColor.less +1184 -1184
- package/dist/theme/style/compact.less +4 -4
- package/dist/theme/style/dark.less +4 -4
- package/dist/theme/style/default.less +4 -4
- package/dist/theme/style/index.less +2 -2
- package/dist/theme/style/index.tsx +2 -2
- package/dist/theme/style/themes/compact.less +295 -295
- package/dist/theme/style/themes/dark.less +790 -790
- package/dist/theme/style/themes/default.less +1067 -1067
- package/dist/theme/style/themes/index.less +7 -7
- package/dist/theme/style/themes/var-dark.less +343 -343
- package/dist/theme/style/themes/var-default.less +184 -184
- package/dist/theme/style/themes/variable.less +1122 -1122
- package/dist/theme/style/variable.less +4 -4
- package/dist/video/index.cjs +210 -6
- package/dist/video/index.js +211 -8
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
# 工业PC ui库
|
|
2
|
-
|
|
3
|
-
前端通用库,包括组件、hooks、utils等。
|
|
4
|
-
|
|
5
|
-
### 运行
|
|
6
|
-
|
|
7
|
-
+ 开发模式 yarn dev
|
|
8
|
-
+ 生产打包 yarn build
|
|
9
|
-
+ 生成文档 yarn build:docs
|
|
10
|
-
+ 打包图扑工具 yarn buildtp
|
|
11
|
-
|
|
12
|
-
### 使用方法
|
|
13
|
-
|
|
14
|
-
```javascript
|
|
15
|
-
import inl from 'inl-ui';
|
|
16
|
-
import 'inl-ui/dist/style.css';
|
|
17
|
-
|
|
18
|
-
vue.use(inl)
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
### 激活主题
|
|
24
|
-
|
|
25
|
-
**vite.config.ts**
|
|
26
|
-
|
|
27
|
-
```javascript
|
|
28
|
-
const additionalData = require("inl-ui/dist/theme").default;
|
|
29
|
-
|
|
30
|
-
...
|
|
31
|
-
|
|
32
|
-
css: {
|
|
33
|
-
preprocessorOptions: {
|
|
34
|
-
less: {
|
|
35
|
-
javascriptEnabled: true,
|
|
36
|
-
additionalData,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### 文档链接
|
|
43
|
-
|
|
44
|
-
##### [组件文档](./src/components/README.md)
|
|
45
|
-
|
|
46
|
-
##### [hooks文档](./src/hooks/README.md)
|
|
47
|
-
|
|
48
|
-
##### [Utils文档](./src/utils/README.md)
|
|
49
|
-
|
|
1
|
+
# 工业PC ui库
|
|
2
|
+
|
|
3
|
+
前端通用库,包括组件、hooks、utils等。
|
|
4
|
+
|
|
5
|
+
### 运行
|
|
6
|
+
|
|
7
|
+
+ 开发模式 yarn dev
|
|
8
|
+
+ 生产打包 yarn build
|
|
9
|
+
+ 生成文档 yarn build:docs
|
|
10
|
+
+ 打包图扑工具 yarn buildtp
|
|
11
|
+
|
|
12
|
+
### 使用方法
|
|
13
|
+
|
|
14
|
+
```javascript
|
|
15
|
+
import inl from 'inl-ui';
|
|
16
|
+
import 'inl-ui/dist/style.css';
|
|
17
|
+
|
|
18
|
+
vue.use(inl)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### 激活主题
|
|
24
|
+
|
|
25
|
+
**vite.config.ts**
|
|
26
|
+
|
|
27
|
+
```javascript
|
|
28
|
+
const additionalData = require("inl-ui/dist/theme").default;
|
|
29
|
+
|
|
30
|
+
...
|
|
31
|
+
|
|
32
|
+
css: {
|
|
33
|
+
preprocessorOptions: {
|
|
34
|
+
less: {
|
|
35
|
+
javascriptEnabled: true,
|
|
36
|
+
additionalData,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### 文档链接
|
|
43
|
+
|
|
44
|
+
##### [组件文档](./src/components/README.md)
|
|
45
|
+
|
|
46
|
+
##### [hooks文档](./src/hooks/README.md)
|
|
47
|
+
|
|
48
|
+
##### [Utils文档](./src/utils/README.md)
|
|
49
|
+
|
|
@@ -13,6 +13,7 @@ var qiankun = require('qiankun');
|
|
|
13
13
|
var dayjs = require('dayjs');
|
|
14
14
|
require('vite-plugin-qiankun');
|
|
15
15
|
var renderWithQiankun = require('vite-plugin-qiankun/dist/helper');
|
|
16
|
+
var mqtt = require('mqtt');
|
|
16
17
|
var mobile = require('@sszj-temp/mobile');
|
|
17
18
|
var marked = require('marked');
|
|
18
19
|
|
|
@@ -39,6 +40,7 @@ function _interopNamespace(e) {
|
|
|
39
40
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios$2);
|
|
40
41
|
var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
|
|
41
42
|
var dayjs__default = /*#__PURE__*/_interopDefaultLegacy(dayjs);
|
|
43
|
+
var mqtt__default = /*#__PURE__*/_interopDefaultLegacy(mqtt);
|
|
42
44
|
|
|
43
45
|
const config = {
|
|
44
46
|
prefix: "inl",
|
|
@@ -9639,6 +9641,33 @@ var Tree = vue.defineComponent({
|
|
|
9639
9641
|
}
|
|
9640
9642
|
});
|
|
9641
9643
|
|
|
9644
|
+
let client = null;
|
|
9645
|
+
const ip = "10.255.9.121";
|
|
9646
|
+
let connectUrl = `ws://${ip}:8083/mqtt`;
|
|
9647
|
+
const useMqtt = async (options = {}) => {
|
|
9648
|
+
if (client) {
|
|
9649
|
+
return client;
|
|
9650
|
+
}
|
|
9651
|
+
return new Promise(async (resolve, reject) => {
|
|
9652
|
+
const mqttOptions = {
|
|
9653
|
+
url: connectUrl,
|
|
9654
|
+
clientId: `llm_${new Date().getTime()}`,
|
|
9655
|
+
username: "admin",
|
|
9656
|
+
password: "admin123",
|
|
9657
|
+
...options
|
|
9658
|
+
};
|
|
9659
|
+
client = mqtt__default["default"].connect(connectUrl, mqttOptions);
|
|
9660
|
+
client.on("connect", () => {
|
|
9661
|
+
console.log("\u8FDE\u63A5\u6210\u529F");
|
|
9662
|
+
resolve(client);
|
|
9663
|
+
});
|
|
9664
|
+
client.on("error", err => {
|
|
9665
|
+
console.log("\u8FDE\u63A5\u5931\u8D25", err);
|
|
9666
|
+
reject(err);
|
|
9667
|
+
});
|
|
9668
|
+
});
|
|
9669
|
+
};
|
|
9670
|
+
|
|
9642
9671
|
const props$6 = {
|
|
9643
9672
|
// 视频信息|视频源uuid
|
|
9644
9673
|
camera: {
|
|
@@ -9656,7 +9685,7 @@ const props$6 = {
|
|
|
9656
9685
|
// },
|
|
9657
9686
|
btns: {
|
|
9658
9687
|
type: Array,
|
|
9659
|
-
default: ["change", "fill", "look", "stream", "magnify", "direction", "fullScreen", "close"]
|
|
9688
|
+
default: ["vlm", "change", "fill", "look", "stream", "magnify", "direction", "fullScreen", "close"]
|
|
9660
9689
|
},
|
|
9661
9690
|
alarm: {
|
|
9662
9691
|
default: false,
|
|
@@ -9674,11 +9703,13 @@ const VideoBoxV2 = vue.defineComponent({
|
|
|
9674
9703
|
},
|
|
9675
9704
|
emits: ["close", "change"],
|
|
9676
9705
|
setup(_prop, _context) {
|
|
9706
|
+
const videoBoxRef = vue.ref();
|
|
9677
9707
|
const player = vue.ref();
|
|
9678
9708
|
const cameraConfig = vue.ref({});
|
|
9679
9709
|
const streamHistory = vue.ref("");
|
|
9680
9710
|
const streams = vue.ref([]);
|
|
9681
9711
|
const showInfo = vue.ref(true);
|
|
9712
|
+
const showVlmInfo = vue.ref(true);
|
|
9682
9713
|
const magnifyBtn = vue.ref(false);
|
|
9683
9714
|
const videoBtns = [[{
|
|
9684
9715
|
text: "lup",
|
|
@@ -9784,10 +9815,25 @@ const VideoBoxV2 = vue.defineComponent({
|
|
|
9784
9815
|
});
|
|
9785
9816
|
camera.value = res.data.data;
|
|
9786
9817
|
streams.value = JSON.parse(camera.value?.brandTypePo?.streamTypeDict || "[]");
|
|
9818
|
+
console.log("vlmSwitchKey.value", vlmSwitchKey.value);
|
|
9819
|
+
console.log("localStorage.getItem(vlmSwitchKey.value)", localStorage.getItem(vlmSwitchKey.value));
|
|
9820
|
+
if (localStorage.getItem(vlmSwitchKey.value) !== "false") {
|
|
9821
|
+
showVlmInfo.value = true;
|
|
9822
|
+
if (camera.value?.ip && showVlmInfo.value) {
|
|
9823
|
+
initMqtt(camera.value?.ip);
|
|
9824
|
+
}
|
|
9825
|
+
} else {
|
|
9826
|
+
showVlmInfo.value = false;
|
|
9827
|
+
}
|
|
9787
9828
|
};
|
|
9788
9829
|
let timeout;
|
|
9789
9830
|
vue.ref(true);
|
|
9790
|
-
vue.onBeforeUnmount(() => {
|
|
9831
|
+
vue.onBeforeUnmount(() => {
|
|
9832
|
+
if (Mqtt) {
|
|
9833
|
+
Mqtt?.unsubscribe(topic.value);
|
|
9834
|
+
Mqtt = null;
|
|
9835
|
+
}
|
|
9836
|
+
});
|
|
9791
9837
|
const resetZoom = () => {
|
|
9792
9838
|
const chooseFieldDom = document.getElementById("chooseField_" + uuid.value);
|
|
9793
9839
|
chooseFieldDom?.remove();
|
|
@@ -9947,9 +9993,153 @@ const VideoBoxV2 = vue.defineComponent({
|
|
|
9947
9993
|
}, null) : ""])]
|
|
9948
9994
|
});
|
|
9949
9995
|
};
|
|
9996
|
+
let Mqtt = null;
|
|
9997
|
+
const topic = vue.ref("");
|
|
9998
|
+
const {
|
|
9999
|
+
isFullscreen,
|
|
10000
|
+
enter,
|
|
10001
|
+
exit,
|
|
10002
|
+
toggle
|
|
10003
|
+
} = core.useFullscreen(videoBoxRef);
|
|
10004
|
+
vue.watch(() => isFullscreen.value, val => {
|
|
10005
|
+
clearFlogCanvas();
|
|
10006
|
+
});
|
|
10007
|
+
const initMqtt = async ip => {
|
|
10008
|
+
Mqtt = await useMqtt();
|
|
10009
|
+
topic.value = `vlm/${ip}`;
|
|
10010
|
+
Mqtt.subscribe(topic.value, {
|
|
10011
|
+
qos: 2
|
|
10012
|
+
}, err => {
|
|
10013
|
+
if (!err) {
|
|
10014
|
+
console.log(`\u8BA2\u9605\u6210\u529F\u4E3B\u9898:${topic.value}`);
|
|
10015
|
+
} else {
|
|
10016
|
+
console.log(`\u8BA2\u9605\u5931\u8D25:${err}`);
|
|
10017
|
+
}
|
|
10018
|
+
});
|
|
10019
|
+
Mqtt.on("message", onMtMessageFn);
|
|
10020
|
+
};
|
|
10021
|
+
const onMtMessageFn = (topic2, message2) => {
|
|
10022
|
+
const msg = new TextDecoder("utf-8").decode(message2);
|
|
10023
|
+
console.log("msg", JSON.parse(msg));
|
|
10024
|
+
drawFlog(JSON.parse(msg));
|
|
10025
|
+
};
|
|
10026
|
+
let canvasDom = null;
|
|
10027
|
+
let textBox = null;
|
|
10028
|
+
const createFlogCanvas = () => {
|
|
10029
|
+
const box = document.getElementById("videoBox_" + uuid.value);
|
|
10030
|
+
if (!canvasDom) {
|
|
10031
|
+
canvasDom = document.createElement("canvas");
|
|
10032
|
+
canvasDom.id = "canvas_" + uuid.value;
|
|
10033
|
+
canvasDom.width = box.offsetWidth;
|
|
10034
|
+
canvasDom.height = box.offsetHeight;
|
|
10035
|
+
canvasDom.style.position = "absolute";
|
|
10036
|
+
canvasDom.style.top = "0";
|
|
10037
|
+
canvasDom.style.left = "0";
|
|
10038
|
+
canvasDom.style.zIndex = "999";
|
|
10039
|
+
canvasDom.style.pointerEvents = "none";
|
|
10040
|
+
box.appendChild(canvasDom);
|
|
10041
|
+
}
|
|
10042
|
+
if (!textBox) {
|
|
10043
|
+
textBox = document.createElement("div");
|
|
10044
|
+
textBox.id = "textBox_" + uuid.value;
|
|
10045
|
+
textBox.style.position = "absolute";
|
|
10046
|
+
textBox.style.width = "100%";
|
|
10047
|
+
textBox.style.left = "0";
|
|
10048
|
+
textBox.style.zIndex = "1000";
|
|
10049
|
+
textBox.style.pointerEvents = "none";
|
|
10050
|
+
box.appendChild(textBox);
|
|
10051
|
+
}
|
|
10052
|
+
return {
|
|
10053
|
+
canvasDom,
|
|
10054
|
+
textBox,
|
|
10055
|
+
width: box.offsetWidth,
|
|
10056
|
+
height: box.offsetHeight
|
|
10057
|
+
};
|
|
10058
|
+
};
|
|
10059
|
+
const clearFlogCanvas = () => {
|
|
10060
|
+
if (canvasDom) {
|
|
10061
|
+
canvasDom.remove();
|
|
10062
|
+
canvasDom = null;
|
|
10063
|
+
}
|
|
10064
|
+
if (textBox) {
|
|
10065
|
+
textBox.remove();
|
|
10066
|
+
textBox = null;
|
|
10067
|
+
}
|
|
10068
|
+
if (drawCleanTimer) {
|
|
10069
|
+
clearTimeout(drawCleanTimer);
|
|
10070
|
+
drawCleanTimer = null;
|
|
10071
|
+
}
|
|
10072
|
+
};
|
|
10073
|
+
let drawCleanTimer = null;
|
|
10074
|
+
const drawFlog = data => {
|
|
10075
|
+
let {
|
|
10076
|
+
canvasDom: canvasDom2,
|
|
10077
|
+
width,
|
|
10078
|
+
height,
|
|
10079
|
+
textBox: textBox2
|
|
10080
|
+
} = createFlogCanvas();
|
|
10081
|
+
const ctx = canvasDom2.getContext("2d");
|
|
10082
|
+
if (drawCleanTimer) {
|
|
10083
|
+
clearTimeout(drawCleanTimer);
|
|
10084
|
+
ctx.clearRect(0, 0, canvasDom2.width, canvasDom2.height);
|
|
10085
|
+
}
|
|
10086
|
+
if (data.bboxes?.length > 0) {
|
|
10087
|
+
(data.bboxes || []).forEach(rect => {
|
|
10088
|
+
ctx.beginPath();
|
|
10089
|
+
ctx.lineWidth = 2;
|
|
10090
|
+
ctx.strokeStyle = rect.color || "red";
|
|
10091
|
+
ctx.fillStyle = rect.color || "red";
|
|
10092
|
+
ctx.rect(rect.xmin * width, rect.ymin * height, (rect.xmax - rect.xmin) * width, (rect.ymax - rect.ymin) * height);
|
|
10093
|
+
ctx.stroke();
|
|
10094
|
+
});
|
|
10095
|
+
}
|
|
10096
|
+
if (data.text) {
|
|
10097
|
+
const fontSize = 16 * width / 800;
|
|
10098
|
+
const margin = 10;
|
|
10099
|
+
const marginTop = height * 0.1 + margin;
|
|
10100
|
+
textBox2.innerHTML = data.text;
|
|
10101
|
+
textBox2.style.top = marginTop + "px";
|
|
10102
|
+
textBox2.style.backgroundColor = "rgba(255, 255, 255, 0.8)";
|
|
10103
|
+
textBox2.style.color = data.text_color || "red";
|
|
10104
|
+
textBox2.style.fontSize = `${fontSize}px`;
|
|
10105
|
+
textBox2.style.padding = `${margin}px`;
|
|
10106
|
+
} else {
|
|
10107
|
+
removeTxtBox();
|
|
10108
|
+
}
|
|
10109
|
+
drawCleanTimer = setTimeout(() => {
|
|
10110
|
+
ctx.clearRect(0, 0, canvasDom2.width, canvasDom2.height);
|
|
10111
|
+
removeTxtBox();
|
|
10112
|
+
}, data.seconds * 1e3);
|
|
10113
|
+
};
|
|
10114
|
+
const removeTxtBox = () => {
|
|
10115
|
+
textBox.innerHTML = "";
|
|
10116
|
+
textBox.remove();
|
|
10117
|
+
textBox = null;
|
|
10118
|
+
};
|
|
10119
|
+
const vlmSwitchKey = vue.computed(() => {
|
|
10120
|
+
return `showVlmInfo_${camera.value?.uuid}`;
|
|
10121
|
+
});
|
|
10122
|
+
vue.watchEffect(() => {
|
|
10123
|
+
if (showVlmInfo.value) {
|
|
10124
|
+
localStorage.removeItem(vlmSwitchKey.value);
|
|
10125
|
+
} else {
|
|
10126
|
+
localStorage.setItem(vlmSwitchKey.value, "false");
|
|
10127
|
+
let {
|
|
10128
|
+
canvasDom: canvasDom2,
|
|
10129
|
+
textBox: textBox2,
|
|
10130
|
+
width,
|
|
10131
|
+
height
|
|
10132
|
+
} = createFlogCanvas();
|
|
10133
|
+
const ctx = canvasDom2.getContext("2d");
|
|
10134
|
+
clearTimeout(drawCleanTimer);
|
|
10135
|
+
removeTxtBox();
|
|
10136
|
+
ctx.clearRect(0, 0, canvasDom2.width, canvasDom2.height);
|
|
10137
|
+
}
|
|
10138
|
+
});
|
|
9950
10139
|
return () => vue.createVNode("div", {
|
|
9951
10140
|
"id": "videoBox_" + uuid.value,
|
|
9952
|
-
"class": ["videoBox", _prop.alarm ? "alarm" : ""]
|
|
10141
|
+
"class": ["videoBox", _prop.alarm ? "alarm" : ""],
|
|
10142
|
+
"ref": videoBoxRef
|
|
9953
10143
|
}, [camera.value ? vue.createVNode(VideoPlayerV2, {
|
|
9954
10144
|
"ref": player,
|
|
9955
10145
|
"domId": uuid.value,
|
|
@@ -9992,7 +10182,7 @@ const VideoBoxV2 = vue.defineComponent({
|
|
|
9992
10182
|
}, [vue.createVNode("div", null, [info.name ? `${info.name}\uFF1A` : ""]), vue.createVNode("div", {
|
|
9993
10183
|
"class": "value"
|
|
9994
10184
|
}, [info.displayValue && info.displayValue !== "null" ? info.displayValue + " " : ""]), vue.createVNode("div", null, [info.unit])]);
|
|
9995
|
-
})]) : "", vue.createVNode("div", {
|
|
10185
|
+
})]) : "", vue.withDirectives(vue.createVNode("div", {
|
|
9996
10186
|
"class": "footer-min",
|
|
9997
10187
|
"id": "footer_" + uuid.value
|
|
9998
10188
|
}, [vue.createVNode("div", {
|
|
@@ -10003,6 +10193,20 @@ const VideoBoxV2 = vue.defineComponent({
|
|
|
10003
10193
|
}, [_prop.btns.map(btn => {
|
|
10004
10194
|
if (!(camera.value?.brandTypeCode === "MP4" && btn !== "close" && btn !== "fullScreen" && btn !== "look" && btn !== "change")) {
|
|
10005
10195
|
switch (btn) {
|
|
10196
|
+
case "vlm":
|
|
10197
|
+
return vue.createVNode("img", {
|
|
10198
|
+
"title": "\u6253\u5F00/\u5173\u95ED\u591A\u6A21\u6001",
|
|
10199
|
+
"onClick": e => {
|
|
10200
|
+
showVlmInfo.value = !showVlmInfo.value;
|
|
10201
|
+
if (showVlmInfo.value) {
|
|
10202
|
+
initMqtt(camera.value?.ip);
|
|
10203
|
+
} else {
|
|
10204
|
+
Mqtt?.unsubscribe(topic.value);
|
|
10205
|
+
Mqtt = null;
|
|
10206
|
+
}
|
|
10207
|
+
},
|
|
10208
|
+
"src": showVlmInfo.value ? "/micro-assets/inl/video/controls/ai-show.svg" : "/micro-assets/inl/video/controls/ai-hide.svg"
|
|
10209
|
+
}, null);
|
|
10006
10210
|
case "change":
|
|
10007
10211
|
return vue.createVNode("img", {
|
|
10008
10212
|
"title": "\u66F4\u6362\u6444\u50CF\u5934",
|
|
@@ -10124,7 +10328,7 @@ const VideoBoxV2 = vue.defineComponent({
|
|
|
10124
10328
|
return vue.createVNode("img", {
|
|
10125
10329
|
"onClick": e => {
|
|
10126
10330
|
e.stopPropagation();
|
|
10127
|
-
|
|
10331
|
+
toggle();
|
|
10128
10332
|
},
|
|
10129
10333
|
"src": "/micro-assets/inl/video/putUp.png"
|
|
10130
10334
|
}, null);
|
|
@@ -10137,7 +10341,7 @@ const VideoBoxV2 = vue.defineComponent({
|
|
|
10137
10341
|
}, null);
|
|
10138
10342
|
}
|
|
10139
10343
|
}
|
|
10140
|
-
})])]), renderChangeCamera()]);
|
|
10344
|
+
})])]), [[vue.vShow, !isFullscreen.value]]), renderChangeCamera()]);
|
|
10141
10345
|
}
|
|
10142
10346
|
});
|
|
10143
10347
|
var VideoBoxV2$1 = installComponent(VideoBoxV2, "video-box-v2");
|
package/dist/components/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import { loadMicroApp } from 'qiankun';
|
|
|
9
9
|
import dayjs from 'dayjs';
|
|
10
10
|
import 'vite-plugin-qiankun';
|
|
11
11
|
import { qiankunWindow } from 'vite-plugin-qiankun/dist/helper';
|
|
12
|
+
import mqtt from 'mqtt';
|
|
12
13
|
import { XPopup, CommentBlock, setAxiosOption } from '@sszj-temp/mobile';
|
|
13
14
|
import { marked } from 'marked';
|
|
14
15
|
|
|
@@ -9611,6 +9612,33 @@ var Tree = defineComponent({
|
|
|
9611
9612
|
}
|
|
9612
9613
|
});
|
|
9613
9614
|
|
|
9615
|
+
let client = null;
|
|
9616
|
+
const ip = "10.255.9.121";
|
|
9617
|
+
let connectUrl = `ws://${ip}:8083/mqtt`;
|
|
9618
|
+
const useMqtt = async (options = {}) => {
|
|
9619
|
+
if (client) {
|
|
9620
|
+
return client;
|
|
9621
|
+
}
|
|
9622
|
+
return new Promise(async (resolve, reject) => {
|
|
9623
|
+
const mqttOptions = {
|
|
9624
|
+
url: connectUrl,
|
|
9625
|
+
clientId: `llm_${new Date().getTime()}`,
|
|
9626
|
+
username: "admin",
|
|
9627
|
+
password: "admin123",
|
|
9628
|
+
...options
|
|
9629
|
+
};
|
|
9630
|
+
client = mqtt.connect(connectUrl, mqttOptions);
|
|
9631
|
+
client.on("connect", () => {
|
|
9632
|
+
console.log("\u8FDE\u63A5\u6210\u529F");
|
|
9633
|
+
resolve(client);
|
|
9634
|
+
});
|
|
9635
|
+
client.on("error", err => {
|
|
9636
|
+
console.log("\u8FDE\u63A5\u5931\u8D25", err);
|
|
9637
|
+
reject(err);
|
|
9638
|
+
});
|
|
9639
|
+
});
|
|
9640
|
+
};
|
|
9641
|
+
|
|
9614
9642
|
const props$6 = {
|
|
9615
9643
|
// 视频信息|视频源uuid
|
|
9616
9644
|
camera: {
|
|
@@ -9628,7 +9656,7 @@ const props$6 = {
|
|
|
9628
9656
|
// },
|
|
9629
9657
|
btns: {
|
|
9630
9658
|
type: Array,
|
|
9631
|
-
default: ["change", "fill", "look", "stream", "magnify", "direction", "fullScreen", "close"]
|
|
9659
|
+
default: ["vlm", "change", "fill", "look", "stream", "magnify", "direction", "fullScreen", "close"]
|
|
9632
9660
|
},
|
|
9633
9661
|
alarm: {
|
|
9634
9662
|
default: false,
|
|
@@ -9646,11 +9674,13 @@ const VideoBoxV2 = defineComponent({
|
|
|
9646
9674
|
},
|
|
9647
9675
|
emits: ["close", "change"],
|
|
9648
9676
|
setup(_prop, _context) {
|
|
9677
|
+
const videoBoxRef = ref();
|
|
9649
9678
|
const player = ref();
|
|
9650
9679
|
const cameraConfig = ref({});
|
|
9651
9680
|
const streamHistory = ref("");
|
|
9652
9681
|
const streams = ref([]);
|
|
9653
9682
|
const showInfo = ref(true);
|
|
9683
|
+
const showVlmInfo = ref(true);
|
|
9654
9684
|
const magnifyBtn = ref(false);
|
|
9655
9685
|
const videoBtns = [[{
|
|
9656
9686
|
text: "lup",
|
|
@@ -9756,10 +9786,25 @@ const VideoBoxV2 = defineComponent({
|
|
|
9756
9786
|
});
|
|
9757
9787
|
camera.value = res.data.data;
|
|
9758
9788
|
streams.value = JSON.parse(camera.value?.brandTypePo?.streamTypeDict || "[]");
|
|
9789
|
+
console.log("vlmSwitchKey.value", vlmSwitchKey.value);
|
|
9790
|
+
console.log("localStorage.getItem(vlmSwitchKey.value)", localStorage.getItem(vlmSwitchKey.value));
|
|
9791
|
+
if (localStorage.getItem(vlmSwitchKey.value) !== "false") {
|
|
9792
|
+
showVlmInfo.value = true;
|
|
9793
|
+
if (camera.value?.ip && showVlmInfo.value) {
|
|
9794
|
+
initMqtt(camera.value?.ip);
|
|
9795
|
+
}
|
|
9796
|
+
} else {
|
|
9797
|
+
showVlmInfo.value = false;
|
|
9798
|
+
}
|
|
9759
9799
|
};
|
|
9760
9800
|
let timeout;
|
|
9761
9801
|
ref(true);
|
|
9762
|
-
onBeforeUnmount(() => {
|
|
9802
|
+
onBeforeUnmount(() => {
|
|
9803
|
+
if (Mqtt) {
|
|
9804
|
+
Mqtt?.unsubscribe(topic.value);
|
|
9805
|
+
Mqtt = null;
|
|
9806
|
+
}
|
|
9807
|
+
});
|
|
9763
9808
|
const resetZoom = () => {
|
|
9764
9809
|
const chooseFieldDom = document.getElementById("chooseField_" + uuid.value);
|
|
9765
9810
|
chooseFieldDom?.remove();
|
|
@@ -9919,9 +9964,153 @@ const VideoBoxV2 = defineComponent({
|
|
|
9919
9964
|
}, null) : ""])]
|
|
9920
9965
|
});
|
|
9921
9966
|
};
|
|
9967
|
+
let Mqtt = null;
|
|
9968
|
+
const topic = ref("");
|
|
9969
|
+
const {
|
|
9970
|
+
isFullscreen,
|
|
9971
|
+
enter,
|
|
9972
|
+
exit,
|
|
9973
|
+
toggle
|
|
9974
|
+
} = useFullscreen(videoBoxRef);
|
|
9975
|
+
watch(() => isFullscreen.value, val => {
|
|
9976
|
+
clearFlogCanvas();
|
|
9977
|
+
});
|
|
9978
|
+
const initMqtt = async ip => {
|
|
9979
|
+
Mqtt = await useMqtt();
|
|
9980
|
+
topic.value = `vlm/${ip}`;
|
|
9981
|
+
Mqtt.subscribe(topic.value, {
|
|
9982
|
+
qos: 2
|
|
9983
|
+
}, err => {
|
|
9984
|
+
if (!err) {
|
|
9985
|
+
console.log(`\u8BA2\u9605\u6210\u529F\u4E3B\u9898:${topic.value}`);
|
|
9986
|
+
} else {
|
|
9987
|
+
console.log(`\u8BA2\u9605\u5931\u8D25:${err}`);
|
|
9988
|
+
}
|
|
9989
|
+
});
|
|
9990
|
+
Mqtt.on("message", onMtMessageFn);
|
|
9991
|
+
};
|
|
9992
|
+
const onMtMessageFn = (topic2, message2) => {
|
|
9993
|
+
const msg = new TextDecoder("utf-8").decode(message2);
|
|
9994
|
+
console.log("msg", JSON.parse(msg));
|
|
9995
|
+
drawFlog(JSON.parse(msg));
|
|
9996
|
+
};
|
|
9997
|
+
let canvasDom = null;
|
|
9998
|
+
let textBox = null;
|
|
9999
|
+
const createFlogCanvas = () => {
|
|
10000
|
+
const box = document.getElementById("videoBox_" + uuid.value);
|
|
10001
|
+
if (!canvasDom) {
|
|
10002
|
+
canvasDom = document.createElement("canvas");
|
|
10003
|
+
canvasDom.id = "canvas_" + uuid.value;
|
|
10004
|
+
canvasDom.width = box.offsetWidth;
|
|
10005
|
+
canvasDom.height = box.offsetHeight;
|
|
10006
|
+
canvasDom.style.position = "absolute";
|
|
10007
|
+
canvasDom.style.top = "0";
|
|
10008
|
+
canvasDom.style.left = "0";
|
|
10009
|
+
canvasDom.style.zIndex = "999";
|
|
10010
|
+
canvasDom.style.pointerEvents = "none";
|
|
10011
|
+
box.appendChild(canvasDom);
|
|
10012
|
+
}
|
|
10013
|
+
if (!textBox) {
|
|
10014
|
+
textBox = document.createElement("div");
|
|
10015
|
+
textBox.id = "textBox_" + uuid.value;
|
|
10016
|
+
textBox.style.position = "absolute";
|
|
10017
|
+
textBox.style.width = "100%";
|
|
10018
|
+
textBox.style.left = "0";
|
|
10019
|
+
textBox.style.zIndex = "1000";
|
|
10020
|
+
textBox.style.pointerEvents = "none";
|
|
10021
|
+
box.appendChild(textBox);
|
|
10022
|
+
}
|
|
10023
|
+
return {
|
|
10024
|
+
canvasDom,
|
|
10025
|
+
textBox,
|
|
10026
|
+
width: box.offsetWidth,
|
|
10027
|
+
height: box.offsetHeight
|
|
10028
|
+
};
|
|
10029
|
+
};
|
|
10030
|
+
const clearFlogCanvas = () => {
|
|
10031
|
+
if (canvasDom) {
|
|
10032
|
+
canvasDom.remove();
|
|
10033
|
+
canvasDom = null;
|
|
10034
|
+
}
|
|
10035
|
+
if (textBox) {
|
|
10036
|
+
textBox.remove();
|
|
10037
|
+
textBox = null;
|
|
10038
|
+
}
|
|
10039
|
+
if (drawCleanTimer) {
|
|
10040
|
+
clearTimeout(drawCleanTimer);
|
|
10041
|
+
drawCleanTimer = null;
|
|
10042
|
+
}
|
|
10043
|
+
};
|
|
10044
|
+
let drawCleanTimer = null;
|
|
10045
|
+
const drawFlog = data => {
|
|
10046
|
+
let {
|
|
10047
|
+
canvasDom: canvasDom2,
|
|
10048
|
+
width,
|
|
10049
|
+
height,
|
|
10050
|
+
textBox: textBox2
|
|
10051
|
+
} = createFlogCanvas();
|
|
10052
|
+
const ctx = canvasDom2.getContext("2d");
|
|
10053
|
+
if (drawCleanTimer) {
|
|
10054
|
+
clearTimeout(drawCleanTimer);
|
|
10055
|
+
ctx.clearRect(0, 0, canvasDom2.width, canvasDom2.height);
|
|
10056
|
+
}
|
|
10057
|
+
if (data.bboxes?.length > 0) {
|
|
10058
|
+
(data.bboxes || []).forEach(rect => {
|
|
10059
|
+
ctx.beginPath();
|
|
10060
|
+
ctx.lineWidth = 2;
|
|
10061
|
+
ctx.strokeStyle = rect.color || "red";
|
|
10062
|
+
ctx.fillStyle = rect.color || "red";
|
|
10063
|
+
ctx.rect(rect.xmin * width, rect.ymin * height, (rect.xmax - rect.xmin) * width, (rect.ymax - rect.ymin) * height);
|
|
10064
|
+
ctx.stroke();
|
|
10065
|
+
});
|
|
10066
|
+
}
|
|
10067
|
+
if (data.text) {
|
|
10068
|
+
const fontSize = 16 * width / 800;
|
|
10069
|
+
const margin = 10;
|
|
10070
|
+
const marginTop = height * 0.1 + margin;
|
|
10071
|
+
textBox2.innerHTML = data.text;
|
|
10072
|
+
textBox2.style.top = marginTop + "px";
|
|
10073
|
+
textBox2.style.backgroundColor = "rgba(255, 255, 255, 0.8)";
|
|
10074
|
+
textBox2.style.color = data.text_color || "red";
|
|
10075
|
+
textBox2.style.fontSize = `${fontSize}px`;
|
|
10076
|
+
textBox2.style.padding = `${margin}px`;
|
|
10077
|
+
} else {
|
|
10078
|
+
removeTxtBox();
|
|
10079
|
+
}
|
|
10080
|
+
drawCleanTimer = setTimeout(() => {
|
|
10081
|
+
ctx.clearRect(0, 0, canvasDom2.width, canvasDom2.height);
|
|
10082
|
+
removeTxtBox();
|
|
10083
|
+
}, data.seconds * 1e3);
|
|
10084
|
+
};
|
|
10085
|
+
const removeTxtBox = () => {
|
|
10086
|
+
textBox.innerHTML = "";
|
|
10087
|
+
textBox.remove();
|
|
10088
|
+
textBox = null;
|
|
10089
|
+
};
|
|
10090
|
+
const vlmSwitchKey = computed(() => {
|
|
10091
|
+
return `showVlmInfo_${camera.value?.uuid}`;
|
|
10092
|
+
});
|
|
10093
|
+
watchEffect(() => {
|
|
10094
|
+
if (showVlmInfo.value) {
|
|
10095
|
+
localStorage.removeItem(vlmSwitchKey.value);
|
|
10096
|
+
} else {
|
|
10097
|
+
localStorage.setItem(vlmSwitchKey.value, "false");
|
|
10098
|
+
let {
|
|
10099
|
+
canvasDom: canvasDom2,
|
|
10100
|
+
textBox: textBox2,
|
|
10101
|
+
width,
|
|
10102
|
+
height
|
|
10103
|
+
} = createFlogCanvas();
|
|
10104
|
+
const ctx = canvasDom2.getContext("2d");
|
|
10105
|
+
clearTimeout(drawCleanTimer);
|
|
10106
|
+
removeTxtBox();
|
|
10107
|
+
ctx.clearRect(0, 0, canvasDom2.width, canvasDom2.height);
|
|
10108
|
+
}
|
|
10109
|
+
});
|
|
9922
10110
|
return () => createVNode("div", {
|
|
9923
10111
|
"id": "videoBox_" + uuid.value,
|
|
9924
|
-
"class": ["videoBox", _prop.alarm ? "alarm" : ""]
|
|
10112
|
+
"class": ["videoBox", _prop.alarm ? "alarm" : ""],
|
|
10113
|
+
"ref": videoBoxRef
|
|
9925
10114
|
}, [camera.value ? createVNode(VideoPlayerV2, {
|
|
9926
10115
|
"ref": player,
|
|
9927
10116
|
"domId": uuid.value,
|
|
@@ -9964,7 +10153,7 @@ const VideoBoxV2 = defineComponent({
|
|
|
9964
10153
|
}, [createVNode("div", null, [info.name ? `${info.name}\uFF1A` : ""]), createVNode("div", {
|
|
9965
10154
|
"class": "value"
|
|
9966
10155
|
}, [info.displayValue && info.displayValue !== "null" ? info.displayValue + " " : ""]), createVNode("div", null, [info.unit])]);
|
|
9967
|
-
})]) : "", createVNode("div", {
|
|
10156
|
+
})]) : "", withDirectives(createVNode("div", {
|
|
9968
10157
|
"class": "footer-min",
|
|
9969
10158
|
"id": "footer_" + uuid.value
|
|
9970
10159
|
}, [createVNode("div", {
|
|
@@ -9975,6 +10164,20 @@ const VideoBoxV2 = defineComponent({
|
|
|
9975
10164
|
}, [_prop.btns.map(btn => {
|
|
9976
10165
|
if (!(camera.value?.brandTypeCode === "MP4" && btn !== "close" && btn !== "fullScreen" && btn !== "look" && btn !== "change")) {
|
|
9977
10166
|
switch (btn) {
|
|
10167
|
+
case "vlm":
|
|
10168
|
+
return createVNode("img", {
|
|
10169
|
+
"title": "\u6253\u5F00/\u5173\u95ED\u591A\u6A21\u6001",
|
|
10170
|
+
"onClick": e => {
|
|
10171
|
+
showVlmInfo.value = !showVlmInfo.value;
|
|
10172
|
+
if (showVlmInfo.value) {
|
|
10173
|
+
initMqtt(camera.value?.ip);
|
|
10174
|
+
} else {
|
|
10175
|
+
Mqtt?.unsubscribe(topic.value);
|
|
10176
|
+
Mqtt = null;
|
|
10177
|
+
}
|
|
10178
|
+
},
|
|
10179
|
+
"src": showVlmInfo.value ? "/micro-assets/inl/video/controls/ai-show.svg" : "/micro-assets/inl/video/controls/ai-hide.svg"
|
|
10180
|
+
}, null);
|
|
9978
10181
|
case "change":
|
|
9979
10182
|
return createVNode("img", {
|
|
9980
10183
|
"title": "\u66F4\u6362\u6444\u50CF\u5934",
|
|
@@ -10096,7 +10299,7 @@ const VideoBoxV2 = defineComponent({
|
|
|
10096
10299
|
return createVNode("img", {
|
|
10097
10300
|
"onClick": e => {
|
|
10098
10301
|
e.stopPropagation();
|
|
10099
|
-
|
|
10302
|
+
toggle();
|
|
10100
10303
|
},
|
|
10101
10304
|
"src": "/micro-assets/inl/video/putUp.png"
|
|
10102
10305
|
}, null);
|
|
@@ -10109,7 +10312,7 @@ const VideoBoxV2 = defineComponent({
|
|
|
10109
10312
|
}, null);
|
|
10110
10313
|
}
|
|
10111
10314
|
}
|
|
10112
|
-
})])]), renderChangeCamera()]);
|
|
10315
|
+
})])]), [[vShow, !isFullscreen.value]]), renderChangeCamera()]);
|
|
10113
10316
|
}
|
|
10114
10317
|
});
|
|
10115
10318
|
var VideoBoxV2$1 = installComponent(VideoBoxV2, "video-box-v2");
|