Commit 6167f4bb authored by 胡占生's avatar 胡占生 🇨🇳

fix: 算法解析增加loading框

parent 7ac8f091
......@@ -25,7 +25,7 @@ import elementIcons from '@/components/SvgIcon/svgicon'
import './permission' // permission control
import { useDict } from '@/utils/dict'
import { parseTime, resetForm, addDateRange, handleTree, selectDictLabel, selectDictLabels, isNotEmpty} from '@/utils/ruoyi'
import { parseTime, resetForm, addDateRange, handleTree, selectDictLabel, selectDictLabels, isNotEmpty,getFileType} from '@/utils/ruoyi'
// 分页组件
import Pagination from '@/components/Pagination'
......@@ -60,6 +60,7 @@ app.config.globalProperties.addDateRange = addDateRange
app.config.globalProperties.selectDictLabel = selectDictLabel
app.config.globalProperties.selectDictLabels = selectDictLabels
app.config.globalProperties.isNotEmpty = isNotEmpty
app.config.globalProperties.getFileType = getFileType
// 全局组件挂载
app.component('DictTag', DictTag)
......
......@@ -248,4 +248,18 @@ export function blobValidate(data) {
// 非空校验
export function isNotEmpty(value) {
return value !== null && value !== undefined && value !== '';
}
\ No newline at end of file
}
// 图片视频校验
export function getFileType(fileName) {
const videoType =['mp4','avi','mov','wmv','flv','mkv','rmvb','3gp','mpg','mpeg','webm']
const ImgType = ['jpg','jpeg','png','gif','bmp','tiff','webp',]
let fileType = fileName.split(".").pop();
if (videoType.includes(fileType)) {
return "1";
}
if (ImgType.includes(fileType)) {
return "0";
}
}
// mixins.js
import { ref } from 'vue';
import {WebSocketManager} from '@/utils/webscoket'
import { getFileType } from '@/utils/ruoyi'
export function useWebSockets() {
//定义初始值为0的变量,要使用ref方法赋值,直接赋值的话变量改变不会更新 UI
......@@ -23,18 +24,20 @@ export function useWebSockets() {
const result = e && JSON.parse(e)
console.log("🚀 ~ websocketMessage ~ result:", result)
if (result.type == 0) { //获取sessionId
proxy.$modal.loading("正在检测中请稍后");
client.value.sendMessage({
sessionId: e,
algorithmType: roleId,
algorithmId: roleId,
fileType:uploadData.value.fileType,
type: 0, //0 图片 1视频
type: getFileType(uploadData.value.fileName), //0 图片 1视频
filePath:uploadData.value.url,
fileName:uploadData.value.fileName
})
} else if (result.type == 2) {
const queue = result.data.queue.indexOf('[') == -1 ? result.data.queue : JSON.parse(result.data.queue);
outFilePath.value = result.data.outFilePath;
proxy.$modal.closeLoading();
if (!queue.length) {
proxy.$modal.msgWarning("未检测到预警");
resultStr.value = '未检测到预警';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment