Compare commits
6 Commits
9ddb412b7a
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| ced4a5177f | |||
| cce863c590 | |||
| 09539ecfb8 | |||
| fee33a68c6 | |||
| 8584cc78b2 | |||
| 7d604dcd53 |
@ -5,8 +5,8 @@ VITE_APP_TITLE = 云平台管理系统
|
|||||||
VITE_APP_ENV = 'development'
|
VITE_APP_ENV = 'development'
|
||||||
|
|
||||||
# 开发环境
|
# 开发环境
|
||||||
# VITE_APP_BASE_API = 'http://139.224.253.23:8000'
|
VITE_APP_BASE_API = 'http://192.168.2.34:8000'
|
||||||
VITE_APP_BASE_API = 'https://www.cnxhyc.com/jq'
|
#VITE_APP_BASE_API = 'https://www.cnxhyc.com/jq'
|
||||||
# VITE_APP_BASE_API = 'http://192.168.110.57:8000'
|
# VITE_APP_BASE_API = 'http://192.168.110.57:8000'
|
||||||
#代永飞接口
|
#代永飞接口
|
||||||
# VITE_APP_BASE_API = 'http://457102h2d6.qicp.vip:24689'
|
# VITE_APP_BASE_API = 'http://457102h2d6.qicp.vip:24689'
|
||||||
|
|||||||
@ -35,11 +35,13 @@
|
|||||||
"image-conversion": "2.1.1",
|
"image-conversion": "2.1.1",
|
||||||
"js-cookie": "3.0.5",
|
"js-cookie": "3.0.5",
|
||||||
"jsencrypt": "3.3.2",
|
"jsencrypt": "3.3.2",
|
||||||
|
"lamejs": "^1.2.1",
|
||||||
"mitt": "^3.0.1",
|
"mitt": "^3.0.1",
|
||||||
"nprogress": "0.2.0",
|
"nprogress": "0.2.0",
|
||||||
"paho-mqtt": "^1.1.0",
|
"paho-mqtt": "^1.1.0",
|
||||||
"pinia": "3.0.2",
|
"pinia": "3.0.2",
|
||||||
"qrcode-vue3": "^1.7.1",
|
"qrcode-vue3": "^1.7.1",
|
||||||
|
"recorder-core": "^1.3.25011100",
|
||||||
"screenfull": "6.0.2",
|
"screenfull": "6.0.2",
|
||||||
"vue": "3.5.13",
|
"vue": "3.5.13",
|
||||||
"vue-cropper": "1.1.1",
|
"vue-cropper": "1.1.1",
|
||||||
@ -72,7 +74,7 @@
|
|||||||
"sass": "1.87.0",
|
"sass": "1.87.0",
|
||||||
"terser": "^5.43.1",
|
"terser": "^5.43.1",
|
||||||
"typescript": "~5.8.3",
|
"typescript": "~5.8.3",
|
||||||
"unocss": "^66.0.0",
|
"unocss": "^0.58.0",
|
||||||
"unplugin-auto-import": "19.1.2",
|
"unplugin-auto-import": "19.1.2",
|
||||||
"unplugin-icons": "22.1.0",
|
"unplugin-icons": "22.1.0",
|
||||||
"unplugin-vue-components": "28.5.0",
|
"unplugin-vue-components": "28.5.0",
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import { param } from '@/utils';
|
||||||
import request from '@/utils/request';
|
import request from '@/utils/request';
|
||||||
|
|
||||||
// 详情信息
|
// 详情信息
|
||||||
@ -7,10 +8,20 @@ export const deviceDeatil = (id: string) => {
|
|||||||
method: 'get',
|
method: 'get',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
// 灯光模式
|
// 警示灯爆闪模式
|
||||||
|
export const strobeMode = (data: any) => {
|
||||||
|
return request({
|
||||||
|
url: `/api/hby100j/device/strobeMode`,
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// 灯光亮度
|
||||||
function lightModeSettings (data: any) {
|
function lightModeSettings (data: any) {
|
||||||
return request({
|
return request({
|
||||||
url: `/app/hby100j/device/lightAdjustment`,
|
url: `/api/hby100j/device/lightAdjustment`,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
});
|
});
|
||||||
@ -18,7 +29,7 @@ function lightModeSettings (data: any) {
|
|||||||
//频率调节
|
//频率调节
|
||||||
function staticPowerSetting (data: any) {
|
function staticPowerSetting (data: any) {
|
||||||
return request({
|
return request({
|
||||||
url: `/app/hby100j/device/strobeFrequency`,
|
url: `/api/hby100j/device/strobeFrequency`,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
});
|
});
|
||||||
@ -26,7 +37,7 @@ function staticPowerSetting (data: any) {
|
|||||||
// 修改音量
|
// 修改音量
|
||||||
function settingUpdateVolume (data: any) {
|
function settingUpdateVolume (data: any) {
|
||||||
return request({
|
return request({
|
||||||
url: `/app/hby100j/device/updateVolume`,
|
url: `/api/hby100j/device/updateVolume`,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
});
|
});
|
||||||
@ -35,17 +46,90 @@ function settingUpdateVolume (data: any) {
|
|||||||
// 强制报警
|
// 强制报警
|
||||||
function SosSetting (data: any) {
|
function SosSetting (data: any) {
|
||||||
return request({
|
return request({
|
||||||
url: `/app/hby100j/device/forceAlarmActivation`,
|
url: `/api/hby100j/device/forceAlarmActivation`,
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data
|
data: data
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
// 语音列表
|
||||||
|
function queryAudioFileList (params: any) {
|
||||||
|
return request({
|
||||||
|
url: `/app/video/queryAudioFileList`,
|
||||||
|
method: 'get',
|
||||||
|
params: params
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 提取文本内容
|
||||||
|
function extractText (data: any) {
|
||||||
|
return request({
|
||||||
|
url: `/app/video/extract`,
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 上传音频文件
|
||||||
|
function uploadAudioToOss (data: any) {
|
||||||
|
return request({
|
||||||
|
url: `/app/video/uploadAudioToOss`,
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// 文本转语音
|
||||||
|
export function videTtsToOss(data:any) {
|
||||||
|
return request({
|
||||||
|
url: `/app/video/ttsToOss`,
|
||||||
|
method: 'post',
|
||||||
|
data:data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 重命名
|
||||||
|
export function videRenameAudioFile(data:any) {
|
||||||
|
return request({
|
||||||
|
url: `/app/video/renameAudioFile`,
|
||||||
|
method: 'post',
|
||||||
|
data:data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 删除语音文件列表
|
||||||
|
export function deviceDeleteAudioFile(params:any) {
|
||||||
|
return request({
|
||||||
|
url: `/app/video/deleteAudioFile`,
|
||||||
|
method: 'get',
|
||||||
|
params:params
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新语音,使用语音
|
||||||
|
export function deviceUpdateVoice(data:any) {
|
||||||
|
return request({
|
||||||
|
url: `/app/hby100j/device/updateVoice`,
|
||||||
|
method: 'post',
|
||||||
|
data:data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 语音播放
|
||||||
|
export function deviceVoiceBroadcast(data:any) {
|
||||||
|
return request({
|
||||||
|
url: `/app/hby100j/device/voiceBroadcast`,
|
||||||
|
method: 'post',
|
||||||
|
data:data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
deviceDeatil,
|
deviceDeatil,
|
||||||
lightModeSettings:lightModeSettings,
|
lightModeSettings:lightModeSettings,
|
||||||
SosSetting:SosSetting,
|
SosSetting:SosSetting,
|
||||||
staticPowerSetting:staticPowerSetting,
|
staticPowerSetting:staticPowerSetting,
|
||||||
settingUpdateVolume:settingUpdateVolume
|
settingUpdateVolume:settingUpdateVolume,
|
||||||
|
queryAudioFileList,
|
||||||
|
videRenameAudioFile,
|
||||||
|
deviceDeleteAudioFile,
|
||||||
|
deviceUpdateVoice,
|
||||||
|
videTtsToOss,
|
||||||
|
uploadAudioToOss,
|
||||||
|
extractText,
|
||||||
|
strobeMode,
|
||||||
|
deviceVoiceBroadcast
|
||||||
};
|
};
|
||||||
@ -1,3 +1,5 @@
|
|||||||
|
import { string } from "vue-types";
|
||||||
|
|
||||||
export interface deviceQuery {
|
export interface deviceQuery {
|
||||||
groupId: string;
|
groupId: string;
|
||||||
pageNum: number;
|
pageNum: number;
|
||||||
@ -39,7 +41,9 @@ export interface DeviceDetail {
|
|||||||
strobeFrequency: string;
|
strobeFrequency: string;
|
||||||
volume: string;
|
volume: string;
|
||||||
chargeState: string;
|
chargeState: string;
|
||||||
alarmStatus: number
|
alarmStatus: number,
|
||||||
|
voiceStrobeAlarm?:number
|
||||||
|
voiceBroadcast?:number
|
||||||
}
|
}
|
||||||
// 定义灯光模式的类型接口
|
// 定义灯光模式的类型接口
|
||||||
export interface LightMode {
|
export interface LightMode {
|
||||||
|
|||||||
BIN
src/assets/images/dw.png
Normal file
|
After Width: | Height: | Size: 523 B |
BIN
src/assets/images/haiba.png
Normal file
|
After Width: | Height: | Size: 1001 B |
BIN
src/assets/images/haibaRelative.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
src/assets/images/hb.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
src/assets/images/hbAc.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
src/assets/images/jieN.png
Normal file
|
After Width: | Height: | Size: 994 B |
BIN
src/assets/images/jieN_HL.png
Normal file
|
After Width: | Height: | Size: 1014 B |
BIN
src/assets/images/jwd.png
Normal file
|
After Width: | Height: | Size: 330 B |
BIN
src/assets/images/location.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
src/assets/images/lonlat.png
Normal file
|
After Width: | Height: | Size: 877 B |
BIN
src/assets/images/ly.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
src/assets/images/lz.png
Normal file
|
After Width: | Height: | Size: 3.1 KiB |
BIN
src/assets/images/rg1.png
Normal file
|
After Width: | Height: | Size: 304 B |
BIN
src/assets/images/rg1Ac.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
src/assets/images/sgWarn.png
Normal file
|
After Width: | Height: | Size: 768 B |
BIN
src/assets/images/sos.png
Normal file
|
After Width: | Height: | Size: 849 B |
BIN
src/assets/images/sos_HL.png
Normal file
|
After Width: | Height: | Size: 865 B |
BIN
src/assets/images/superStrong.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
src/assets/images/superStrong_HL.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
src/assets/images/work.png
Normal file
|
After Width: | Height: | Size: 989 B |
BIN
src/assets/images/work_HL.png
Normal file
|
After Width: | Height: | Size: 992 B |
BIN
src/assets/images/zk.png
Normal file
|
After Width: | Height: | Size: 320 B |
BIN
src/assets/images/zt.png
Normal file
|
After Width: | Height: | Size: 125 B |
BIN
src/assets/images/组 62.png
Normal file
|
After Width: | Height: | Size: 992 B |
@ -59,7 +59,7 @@ const props = defineProps({
|
|||||||
// 大小限制(MB)
|
// 大小限制(MB)
|
||||||
fileSize: propTypes.number.def(200),
|
fileSize: propTypes.number.def(200),
|
||||||
// 文件类型, 例如['png', 'jpg', 'jpeg']
|
// 文件类型, 例如['png', 'jpg', 'jpeg']
|
||||||
fileType: propTypes.array.def(['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'pdf','apk','wgt','html','mp3','mp4']),
|
fileType: propTypes.array.def(['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'txt', 'pdf','apk','wgt','html','mp3','mp4','ttf']),
|
||||||
// 是否显示提示
|
// 是否显示提示
|
||||||
isShowTip: propTypes.bool.def(true),
|
isShowTip: propTypes.bool.def(true),
|
||||||
// 禁用组件(仅查看文件)
|
// 禁用组件(仅查看文件)
|
||||||
|
|||||||
@ -19,7 +19,7 @@ const getMqttConfig = () => {
|
|||||||
// 检测当前页面协议(http: 或 https:)
|
// 检测当前页面协议(http: 或 https:)
|
||||||
//const isHttps = window.location.protocol === 'https:';
|
//const isHttps = window.location.protocol === 'https:';
|
||||||
|
|
||||||
const isHttps = import.meta.env.VITE_APP_ENV === 'production' || window.location.protocol === 'https:';
|
const isHttps =true;// import.meta.env.VITE_APP_ENV === 'production' || window.location.protocol === 'https:';
|
||||||
console.log(isHttps,'检测环境');
|
console.log(isHttps,'检测环境');
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -222,9 +222,7 @@ export function useMqtt() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const message = new Paho.Message(
|
const message = new Paho.Message(payload);
|
||||||
typeof payload === 'string' ? payload : payload.toString()
|
|
||||||
);
|
|
||||||
|
|
||||||
message.destinationName = topic;
|
message.destinationName = topic;
|
||||||
message.qos = options.qos;
|
message.qos = options.qos;
|
||||||
|
|||||||
264
src/views/controlCenter/6075J/TextToHex.vue
Normal file
@ -0,0 +1,264 @@
|
|||||||
|
<template>
|
||||||
|
<div class="text-to-hex">
|
||||||
|
<canvas
|
||||||
|
ref="canvasRef"
|
||||||
|
:width="currentCanvasWidth"
|
||||||
|
:height="currentCanvasHeight"
|
||||||
|
class="offscreen-canvas"
|
||||||
|
></canvas>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, computed, onMounted } from 'vue';
|
||||||
|
|
||||||
|
// Props 定义
|
||||||
|
const props = defineProps({
|
||||||
|
txts: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
validator: (value) => value.every(item => typeof item === 'string')
|
||||||
|
},
|
||||||
|
fontSize: {
|
||||||
|
type: Number,
|
||||||
|
default: 16,
|
||||||
|
validator: (value) => value > 0 && value <= 100
|
||||||
|
},
|
||||||
|
bgColor: {
|
||||||
|
type: String,
|
||||||
|
default: "#ffffff"
|
||||||
|
},
|
||||||
|
color: {
|
||||||
|
type: String,
|
||||||
|
default: "#000000"
|
||||||
|
},
|
||||||
|
fontFamily: {
|
||||||
|
type: String,
|
||||||
|
default: "PingFang SC, Microsoft YaHei, Arial, sans-serif"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 响应式数据
|
||||||
|
const canvasRef = ref(null);
|
||||||
|
const currentCanvasWidth = ref(0);
|
||||||
|
const currentCanvasHeight = ref(0);
|
||||||
|
let ctx = null;
|
||||||
|
const canvasWarmed = ref(false);
|
||||||
|
|
||||||
|
// 计算属性
|
||||||
|
const validTxts = computed(() => {
|
||||||
|
return props.txts.filter(line => line && line.trim() !== '');
|
||||||
|
});
|
||||||
|
|
||||||
|
// 获取字符实际宽度
|
||||||
|
const getCharWidth = (char) => {
|
||||||
|
if (!ctx) return props.fontSize * 0.6;
|
||||||
|
ctx.font = `${props.fontSize}px ${props.fontFamily}`;
|
||||||
|
return ctx.measureText(char).width;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 计算整行宽度(精确)
|
||||||
|
const calcLineWidth = (textLine) => {
|
||||||
|
if (!ctx) return textLine.length * props.fontSize * 0.6;
|
||||||
|
|
||||||
|
ctx.font = `${props.fontSize}px ${props.fontFamily}`;
|
||||||
|
let totalWidth = 0;
|
||||||
|
for (let i = 0; i < textLine.length; i++) {
|
||||||
|
totalWidth += ctx.measureText(textLine[i]).width;
|
||||||
|
}
|
||||||
|
return Math.ceil(totalWidth);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 清除Canvas内容
|
||||||
|
const clearCanvas = () => {
|
||||||
|
if (!ctx) return;
|
||||||
|
ctx.fillStyle = props.bgColor;
|
||||||
|
ctx.fillRect(0, 0, currentCanvasWidth.value, currentCanvasHeight.value);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 预热画布
|
||||||
|
const warmupCanvas = async () => {
|
||||||
|
if (canvasWarmed.value || !ctx) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
currentCanvasWidth.value = 16;
|
||||||
|
currentCanvasHeight.value = 16;
|
||||||
|
|
||||||
|
clearCanvas();
|
||||||
|
|
||||||
|
ctx.fillStyle = props.color;
|
||||||
|
ctx.font = `${props.fontSize}px ${props.fontFamily}`;
|
||||||
|
ctx.textBaseline = 'middle';
|
||||||
|
ctx.fillText('测', 0, 8);
|
||||||
|
|
||||||
|
// 等待字体加载完成
|
||||||
|
await document.fonts.ready;
|
||||||
|
|
||||||
|
// 获取像素数据验证画布可用
|
||||||
|
const imageData = ctx.getImageData(0, 0, 16, 16);
|
||||||
|
if (imageData) {
|
||||||
|
canvasWarmed.value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 额外等待确保字体完全渲染
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 100));
|
||||||
|
} catch (ex) {
|
||||||
|
console.log("画布预热异常:", ex);
|
||||||
|
canvasWarmed.value = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 像素数据转16进制矩阵
|
||||||
|
const convertCharToMatrix = (imageData, width, height) => {
|
||||||
|
let matrix = [];
|
||||||
|
const data = imageData.data;
|
||||||
|
|
||||||
|
// 只处理16x16的字符矩阵
|
||||||
|
for (let y = 0; y < 16; y++) {
|
||||||
|
let byte1 = 0, byte2 = 0;
|
||||||
|
|
||||||
|
for (let x = 0; x < 16; x++) {
|
||||||
|
// 计算实际像素位置(需要考虑画布可能比16宽)
|
||||||
|
let actualX = Math.floor(x * width / 16);
|
||||||
|
let actualY = Math.floor(y * height / 16);
|
||||||
|
let index = (actualY * width + actualX) * 4;
|
||||||
|
|
||||||
|
let red = data[index];
|
||||||
|
let green = data[index + 1];
|
||||||
|
let blue = data[index + 2];
|
||||||
|
|
||||||
|
// 判断是否为非背景色(根据颜色阈值)
|
||||||
|
// let isBlack = !(red > 200 && green > 200 && blue > 200);
|
||||||
|
let gray = (red + green + blue) / 3;
|
||||||
|
let isBlack = gray < 255 ;
|
||||||
|
if (x < 8) {
|
||||||
|
if (isBlack) {
|
||||||
|
byte1 |= 0x80 >> x;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (isBlack) {
|
||||||
|
byte2 |= 0x80 >> (x - 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
matrix.push('0x' + byte1.toString(16).padStart(2, '0').toUpperCase());
|
||||||
|
matrix.push('0x' + byte2.toString(16).padStart(2, '0').toUpperCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
return matrix;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 绘制单个字符并获取像素数据
|
||||||
|
const drawChar = async (char) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
try {
|
||||||
|
// 获取字符宽度
|
||||||
|
const charWidth = getCharWidth(char);
|
||||||
|
const canvasWidth = Math.max(16, Math.ceil(charWidth));
|
||||||
|
|
||||||
|
// 调整画布尺寸
|
||||||
|
currentCanvasWidth.value = canvasWidth;
|
||||||
|
currentCanvasHeight.value = 16;
|
||||||
|
|
||||||
|
// 重置画布尺寸
|
||||||
|
if (canvasRef.value) {
|
||||||
|
canvasRef.value.width = canvasWidth;
|
||||||
|
canvasRef.value.height = 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清空画布
|
||||||
|
clearCanvas();
|
||||||
|
|
||||||
|
// 绘制字符
|
||||||
|
ctx.fillStyle = props.color;
|
||||||
|
ctx.font = `${props.fontSize}px ${props.fontFamily}`;
|
||||||
|
ctx.textBaseline = 'middle';
|
||||||
|
ctx.fillText(char, 0, 8);
|
||||||
|
|
||||||
|
// 获取像素数据
|
||||||
|
const imageData = ctx.getImageData(0, 0, canvasWidth, 16);
|
||||||
|
|
||||||
|
resolve({
|
||||||
|
char: char,
|
||||||
|
pixelData: imageData,
|
||||||
|
width: canvasWidth,
|
||||||
|
height: 16
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 绘制文本行并获取所有字符的矩阵数据
|
||||||
|
const drawLine = async (textLine) => {
|
||||||
|
const charMatrices = [];
|
||||||
|
|
||||||
|
for (let i = 0; i < textLine.length; i++) {
|
||||||
|
const char = textLine[i];
|
||||||
|
const result = await drawChar(char);
|
||||||
|
const matrix = convertCharToMatrix(result.pixelData, result.width, result.height);
|
||||||
|
charMatrices.push(matrix);
|
||||||
|
}
|
||||||
|
|
||||||
|
return charMatrices;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 主方法:处理所有文本并返回十六进制矩阵数组
|
||||||
|
const drawAndGetPixels = async () => {
|
||||||
|
// 确保画布已预热
|
||||||
|
await warmupCanvas();
|
||||||
|
|
||||||
|
const result = [];
|
||||||
|
|
||||||
|
for (let i = 0; i < validTxts.value.length; i++) {
|
||||||
|
const line = validTxts.value[i];
|
||||||
|
const lineMatrices = await drawLine(line);
|
||||||
|
result.push(lineMatrices);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 获取单个字符的十六进制矩阵(便捷方法)
|
||||||
|
const getCharHexMatrix = async (char) => {
|
||||||
|
await warmupCanvas();
|
||||||
|
const result = await drawChar(char);
|
||||||
|
return convertCharToMatrix(result.pixelData, result.width, result.height);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 获取文本行的十六进制矩阵(便捷方法)
|
||||||
|
const getTextLineHexMatrix = async (textLine) => {
|
||||||
|
await warmupCanvas();
|
||||||
|
return await drawLine(textLine);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 暴露方法给父组件
|
||||||
|
defineExpose({
|
||||||
|
drawAndGetPixels,
|
||||||
|
getCharHexMatrix,
|
||||||
|
getTextLineHexMatrix
|
||||||
|
});
|
||||||
|
|
||||||
|
// 生命周期
|
||||||
|
onMounted(() => {
|
||||||
|
if (canvasRef.value) {
|
||||||
|
ctx = canvasRef.value.getContext('2d');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.text-to-hex {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.offscreen-canvas {
|
||||||
|
position: fixed;
|
||||||
|
left: -9999px;
|
||||||
|
top: -9999px;
|
||||||
|
visibility: hidden;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
1594
src/views/controlCenter/6075J/index.vue
Normal file
@ -481,7 +481,11 @@ const { queryParams, form, rules } = toRefs<PageData<deviceForm, deviceQuery>>(d
|
|||||||
/** 查询设备列表 */
|
/** 查询设备列表 */
|
||||||
const getList = async () => {
|
const getList = async () => {
|
||||||
loading.value = true;
|
loading.value = true;
|
||||||
const res = await api.deviceList(proxy?.addDateRange(queryParams.value, dateRange.value));
|
let paras=Object.assign({},queryParams.value);
|
||||||
|
|
||||||
|
paras.deviceMac=paras.deviceMac.replace(/:/g,'').replace(/:/g,'').replace(/(.{2})/g, '$1:').slice(0, -1);
|
||||||
|
|
||||||
|
const res = await api.deviceList(proxy?.addDateRange(paras, dateRange.value));
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
deviceDist.value = res.rows;
|
deviceDist.value = res.rows;
|
||||||
total.value = res.total;
|
total.value = res.total;
|
||||||
@ -501,6 +505,7 @@ const resetQuery = () => {
|
|||||||
|
|
||||||
/** 删除按钮操作 */
|
/** 删除按钮操作 */
|
||||||
const handleDelete = async (row?: deviceVO) => {
|
const handleDelete = async (row?: deviceVO) => {
|
||||||
|
debugger;
|
||||||
// 批量删除逻辑
|
// 批量删除逻辑
|
||||||
let arrey = ids.value.map((item) => item.id);
|
let arrey = ids.value.map((item) => item.id);
|
||||||
if (!row) {
|
if (!row) {
|
||||||
|
|||||||