Commit 1f872198 authored by lei's avatar lei

删除log

parent f787c894
......@@ -74,10 +74,14 @@ VITE_STORAGE_PREFIX=SOY_
# ============================================ old
# 开发环境 - 视频流地址
VITE_VIDEO_URL=ws://10.0.20.81:9999
VITE_VIDEO_URL=ws://192.168.3.248:9999
# 开发环境 - 所有服务接口地址
VITE_SERVICE_URL=http://10.0.20.81:9996
VITE_SERVICE_URL=http://192.168.3.248:9996
# 开发环境 - WebSocket 全局地址
VITE_WEBSOCKET_URL=ws://10.0.20.81:9996
VITE_WEBSOCKET_URL=ws://192.168.3.248:9999
VITE_OTHER_SERVICE_BASE_URL= `{
"demo": "http://192.168.3.248:9999"
}`
\ No newline at end of file
# backend service base url, prod environment
# VITE_SERVICE_BASE_URL=https://192.168.5.223:
# VITE_SERVICE_BASE_URL=http://192.168.5.223:9999
VITE_VIDEO_URL=ws://192.168.5.223:9999
VITE_SERVICE_URL=https://192.168.5.223:9996
VITE_SERVICE_URL=http://192.168.5.223:9996
VITE_WEBSOCKET_URL=ws://192.168.5.223:9999
# other backend service base url, prod environment
VITE_OTHER_SERVICE_BASE_URL= `{
"demo": "http://192.168.5.223:9999"
}`
# VITE_OTHER_SERVICE_BASE_URL= `{
# "demo": "http://192.168.5.223:9999"
# }`
This diff is collapsed.
......@@ -4,8 +4,6 @@
* @param env The current env
*/
export function createServiceConfig(env: Env.ImportMeta) {
const { VITE_SERVICE_BASE_URL, VITE_OTHER_SERVICE_BASE_URL } = env;
......@@ -14,28 +12,31 @@ export function createServiceConfig(env: Env.ImportMeta) {
other = JSON.parse(VITE_OTHER_SERVICE_BASE_URL);
} catch (error) {
// eslint-disable-next-line no-console
} console.error('VITE_OTHER_SERVICE_BASE_URL is not a valid JSON string');
}
const httpConfig: App.Service.SimpleServiceConfig = {
baseURL: VITE_SERVICE_BASE_URL,
other
other,
};
const otherHttpKeys = Object.keys(httpConfig.other) as App.Service.OtherBaseURLKey[];
const otherHttpKeys = Object.keys(
httpConfig.other,
) as App.Service.OtherBaseURLKey[];
const otherConfig: App.Service.OtherServiceConfigItem[] = otherHttpKeys.map(key => {
return {
key,
baseURL: httpConfig.other[key],
proxyPattern: createProxyPattern(key)
};
});
const otherConfig: App.Service.OtherServiceConfigItem[] = otherHttpKeys.map(
(key) => {
return {
key,
baseURL: httpConfig.other[key],
proxyPattern: createProxyPattern(key),
};
},
);
const config: App.Service.ServiceConfig = {
baseURL: httpConfig.baseURL,
proxyPattern: createProxyPattern(),
other: otherConfig
other: otherConfig,
};
return config;
......@@ -52,13 +53,13 @@ export function getServiceBaseURL(env: Env.ImportMeta, isProxy: boolean) {
const otherBaseURL = {} as Record<App.Service.OtherBaseURLKey, string>;
other.forEach(item => {
other.forEach((item) => {
otherBaseURL[item.key] = isProxy ? item.proxyPattern : item.baseURL;
});
return {
baseURL: isProxy ? createProxyPattern() : baseURL,
otherBaseURL
otherBaseURL,
};
}
......@@ -69,7 +70,7 @@ export function getServiceBaseURL(env: Env.ImportMeta, isProxy: boolean) {
*/
function createProxyPattern(key?: App.Service.OtherBaseURLKey) {
if (!key) {
return '/proxy-default';
return "/proxy-default";
}
return `/proxy-${key}`;
......
......@@ -494,9 +494,9 @@ onMounted(() => {
<!-- ======================= 状态 | E -->
</NFlex>
<NButton @click.stop="() => {
<!-- <NButton @click.stop="() => {
isDefaultPreview = false;
}" strong secondary type="info" size="small">回放</NButton>
}" strong secondary type="info" size="small">回放</NButton> -->
</NFlex>
</template>
<!-- 图片区域 -->
......
......@@ -21,6 +21,7 @@ import fullScreen from '@/utils/full'
const serviceUrl = import.meta.env.VITE_VIDEO_URL;
const apiUrl = import.meta.env.VITE_SERVICE_URL;
const webSocketUrl = import.meta.env.VITE_WEBSOCKET_URL;
......@@ -86,6 +87,7 @@ const audioId = ref('');
const playAudio = async (id: string) => {
// 创建新的音频元素并播放
const audio = new Audio(`${apiUrl}/v1/play/${id}`);
audio.play();
// 保留原始逻辑备用
......@@ -101,7 +103,6 @@ const switchVideoPalyer = (id: string) => {
cId.value = id;
let camera = cameraList.value.filter(item => item?.id === id)[0];
console.log("======================================= id", id, camera?.cameraAddress);
// if (!camera?.cameraAddress?.includes('rtsp://')) {
// return message.error('摄像头流地址格式有误!');
......@@ -125,7 +126,6 @@ const switchVideoPalyer = (id: string) => {
}
);
} catch (e) {
console.log("======================================= error", e);
}
});
};
......@@ -163,7 +163,6 @@ const options = [
}
];
const handleSelect = (key: string) => {
console.log(key);
};
// 变更状态
......@@ -205,7 +204,6 @@ let cLogInfo = reactive({});
// 切换视频播放源头
const switchVideoPlayer = () => {
console.log("switchVideoPlayer ==============", "rtsp://admin:gemho10-7@192.168.0.56:554/h264/ch1/main/av_stream`")
// nextTick(() => {
// try {
// // 临时测试
......@@ -284,14 +282,13 @@ onMounted(() => {
try {
let ws = new WebSocket(`${webSocketUrl}/ws/${localStg.get('id')}`);
// 应改为(测试用临时方案):
// let ws = new WebSocket(`ws://localhost:9999/ws/${localStg.get('id')}`);
ws.onopen = function () {
console.log('WebSocket connected --------------------------------------------------------------------------');
ws.send('Hello, Server! ------------------------- ');
};
ws.onmessage = function (event) {
console.log('---------------------- WebSocket received message:', JSON.parse(event.data));
let data = JSON.parse(event.data);
data.algorithmId && playAudio(data.algorithmId);
......@@ -359,15 +356,14 @@ onMounted(() => {
};
ws.onclose = function () {
console.log('WebSocket closed');
};
ws.onerror = function (error) {
console.error('WebSocket error:', error);
console.error('WebSocket error:', error); // 检查控制台是否有连接错误
};
} catch (e) {
console.log("error", e)
console.log(e,'error')
}
......
<script setup lang="ts">
import { watch, onMounted, defineProps } from 'vue';
import { $t } from '@/locales';
import { useAppStore } from '@/store/modules/app';
import { useEcharts } from '@/hooks/common/echarts';
import { watch, onMounted, defineProps } from "vue";
import { $t } from "@/locales";
import { useAppStore } from "@/store/modules/app";
import { useEcharts } from "@/hooks/common/echarts";
import { api_logCount } from "@/api/index.ts";
defineOptions({
name: 'LineChart'
name: "LineChart",
});
const props = defineProps({
date: {
type: Array,
default: () => []
}
default: () => [],
},
});
watch(props, () => {
getLogCount();
})
});
// 获取日志报警的数据
const getLogCount = async () => {
await api_logCount(props.date).then(res => {
await api_logCount(props.date).then((res) => {
if (res.data.code === 200) {
console.log("================= res", res.data.data);
let data = res.data.data;
console.log("=================== data", data);
updateOptions(opts => {
console.log("========================= opts", opts)
updateOptions((opts) => {
// opts.series[1].data = [2208, 2016, 2916, 4512, 8281, 2008, 1963, 2367, 2956, 678];
opts.xAxis.data = data.dateLabel;
opts.legend.data = data.result;
opts.series.forEach((item, index) => {
opts.series[index].data = [];
})
opts.series[index].data = [];
});
const service = (name = (Math.random() * 100).toFixed(0)) => {
return {
color: '#1872F0',
color: "#1872F0",
name,
type: 'line',
type: "line",
smooth: true,
stack: 'Total',
stack: "Total",
areaStyle: {
color: {
type: 'linear',
type: "linear",
x: 0,
y: 0,
x2: 0,
......@@ -58,33 +51,32 @@ const getLogCount = async () => {
colorStops: [
{
offset: 0.25,
color: '#1872F0'
color: "#1872F0",
},
{
offset: 1,
color: '#fff'
}
]
}
color: "#fff",
},
],
},
},
emphasis: {
focus: 'series'
focus: "series",
},
data: new Array(data[0].countList.length).fill(100)
data: new Array(data[0].countList.length).fill(100),
};
}
};
data.countLabel.forEach((item, index) => {
opts.series.push({
color: '#1872F0',
color: "#1872F0",
name: data.result[index],
type: 'line',
type: "line",
smooth: true,
stack: 'Total',
stack: "Total",
areaStyle: {
color: {
type: 'linear',
type: "linear",
x: 0,
y: 0,
x2: 0,
......@@ -92,21 +84,21 @@ const getLogCount = async () => {
colorStops: [
{
offset: 0.25,
color: '#1872F0'
color: "#1872F0",
},
{
offset: 1,
color: '#fff'
}
]
}
color: "#fff",
},
],
},
},
emphasis: {
focus: 'series'
focus: "series",
},
data: item
})
})
data: item,
});
});
// opts.series = new Array(data[0].countList.length).fill(
// series
......@@ -115,69 +107,64 @@ const getLogCount = async () => {
// countList 17
// opts.series[0].data = [0xxx]
// data.forEach(wrapItem => {
// wrapItem.countList.forEach((item, index) => {
// opts.series[index].name = item.algorithmName;
// })
// });
// data[0].countList((item, index) => {
// series.data[index] = item.count;
// })
console.log("========================= opts", opts.xAxis.data, opts.legend.data)
return opts;
})
});
}
})
}
});
};
onMounted(() => {
getLogCount()
})
getLogCount();
});
const appStore = useAppStore();
const { domRef, updateOptions } = useEcharts(() => ({
tooltip: {
trigger: 'axis',
trigger: "axis",
axisPointer: {
type: 'cross',
type: "cross",
label: {
backgroundColor: '#6a7985'
}
}
backgroundColor: "#6a7985",
},
},
},
legend: {
data: [$t('page.home.downloadCount'), $t('page.home.registerCount')]
data: [$t("page.home.downloadCount"), $t("page.home.registerCount")],
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
left: "3%",
right: "4%",
bottom: "3%",
containLabel: true,
},
xAxis: {
type: 'category',
type: "category",
boundaryGap: false,
data: [] as string[]
data: [] as string[],
},
yAxis: {
type: 'value'
type: "value",
},
series: [
{
color: '#1872F0',
name: $t('page.home.downloadCount'),
type: 'line',
color: "#1872F0",
name: $t("page.home.downloadCount"),
type: "line",
smooth: true,
stack: 'Total',
stack: "Total",
areaStyle: {
color: {
type: 'linear',
type: "linear",
x: 0,
y: 0,
x2: 0,
......@@ -185,29 +172,29 @@ const { domRef, updateOptions } = useEcharts(() => ({
colorStops: [
{
offset: 0.25,
color: '#1872F0'
color: "#1872F0",
},
{
offset: 1,
color: '#fff'
}
]
}
color: "#fff",
},
],
},
},
emphasis: {
focus: 'series'
focus: "series",
},
data: [] as number[]
data: [] as number[],
},
{
color: '#26deca',
name: $t('page.home.registerCount'),
type: 'line',
color: "#26deca",
name: $t("page.home.registerCount"),
type: "line",
smooth: true,
stack: 'Total',
stack: "Total",
areaStyle: {
color: {
type: 'linear',
type: "linear",
x: 0,
y: 0,
x2: 0,
......@@ -215,36 +202,36 @@ const { domRef, updateOptions } = useEcharts(() => ({
colorStops: [
{
offset: 0.25,
color: '#26deca'
color: "#26deca",
},
{
offset: 1,
color: '#fff'
}
]
}
color: "#fff",
},
],
},
},
emphasis: {
focus: 'series'
focus: "series",
},
data: []
}
]
data: [],
},
],
}));
async function mockData() {
await new Promise(resolve => {
await new Promise((resolve) => {
setTimeout(resolve, 1000);
});
updateOptions(opts => {
updateOptions((opts) => {
[
{
label: "10/15",
num: 502
num: 502,
},
// ?cvxccxvxcv
]
];
// opts.xAxis.data = ['06:00', '08:00', '10:00', '12:00', '14:00', '16:00', '18:00', '20:00', '22:00', '24:00'];
// opts.series[0].data = [4623, 6145, 6268, 6411, 1890, 4251, 2978, 3880, 3606, 4311];
// opts.series[1].data = [2208, 2016, 2916, 4512, 8281, 2008, 1963, 2367, 2956, 678];
......
......@@ -15,12 +15,12 @@ const getCardData = async () => {
updateOptions((opts) => {
opts.series[0].data = [
{
name: `已启动 ${res.data.data[1].count} 个`,
value: res.data.data[1].count,
name: `已启动 ${res.data.data[0].count} 个`,
value: res.data.data[0].count,
},
{
name: `已停用 ${res.data.data[0].count} 个`,
value: res.data.data[0].count,
name: `已停用 ${res.data.data[1].count} 个`,
value: res.data.data[1].count,
},
];
return opts;
......
......@@ -113,8 +113,8 @@ const getCardData = async () => {
if (res.data.code === 200) {
updateOptions((opts) => {
opts.series[0].data = [
{ name: `已启动`, value: res.data.data[1].count },
{ name: `已停用`, value: res.data.data[0].count },
{ name: `已启动`, value: res.data.data[0].count },
{ name: `已停用`, value: res.data.data[1].count },
];
return opts;
});
......
import process from 'node:process';
import { URL, fileURLToPath } from 'node:url';
import { defineConfig, loadEnv } from 'vite';
import { setupVitePlugins } from './build/plugins';
import { createViteProxy, getBuildTime } from './build/config';
import process from "node:process";
import { URL, fileURLToPath } from "node:url";
import { defineConfig, loadEnv } from "vite";
import { setupVitePlugins } from "./build/plugins";
import { createViteProxy, getBuildTime } from "./build/config";
// export const proxyTarget = 'http://192.168.3.248:9996';
export const proxyTarget = 'http://10.0.20.81:9996';
export const proxyTarget = "http://192.168.3.248:9996";
// export const proxyTarget = "http://192.168.3.248:9996";
// export const proxyTarget = 'http://192.168.1.119:9996';
// export const proxyTarget = 'http://192.168.1.119:9996';
// export const proxyTarget = "http://192.168.2.188:9527";
// 视频地址
export const videdUrl = 'ws://10.0.20.81:9999';
export const videdUrl = "ws://192.168.3.248:9999";
// 固定接口地址
export const apiUrl = 'http://10.0.20.81:9996';
export const apiUrl = "http://192.168.3.248:9996";
// WS 地址
export const wsUrl = 'ws://10.0.20.81:9999';
export const wsUrl = "ws://192.168.3.248:9996";
export default defineConfig(configEnv => {
const viteEnv = loadEnv(configEnv.mode, process.cwd()) as unknown as Env.ImportMeta;
export default defineConfig((configEnv) => {
const viteEnv = loadEnv(
configEnv.mode,
process.cwd(),
) as unknown as Env.ImportMeta;
const buildTime = getBuildTime();
......@@ -30,49 +30,49 @@ export default defineConfig(configEnv => {
base: viteEnv.VITE_BASE_URL,
resolve: {
alias: {
'~': fileURLToPath(new URL('./', import.meta.url)),
'@': fileURLToPath(new URL('./src', import.meta.url))
}
"~": fileURLToPath(new URL("./", import.meta.url)),
"@": fileURLToPath(new URL("./src", import.meta.url)),
},
},
css: {
preprocessorOptions: {
scss: {
additionalData: `@use "./src/styles/scss/global.scss" as *;`
}
}
additionalData: `@use "./src/styles/scss/global.scss" as *;`,
},
},
},
plugins: setupVitePlugins(viteEnv, buildTime),
define: {
BUILD_TIME: JSON.stringify(buildTime)
BUILD_TIME: JSON.stringify(buildTime),
},
server: {
host: '0.0.0.0',
host: "0.0.0.0",
port: 9527,
open: true,
// 集成别人封装的代理项 & 晶合项目的代理项
proxy: {
...createViteProxy(viteEnv, configEnv.command === 'serve'),
...createViteProxy(viteEnv, configEnv.command === "serve"),
// '/menus': 'http://192.168.1.102:9995/menus',
// '/menus': 'http://192.168.1.173:10000/menus'
'/v1': {
"/v1": {
target: proxyTarget,
changeOrigin: true
}
changeOrigin: true,
},
},
fs: {
cachedChecks: false
}
cachedChecks: false,
},
},
preview: {
port: 9725
port: 9725,
},
build: {
reportCompressedSize: false,
sourcemap: viteEnv.VITE_SOURCE_MAP === 'Y',
sourcemap: viteEnv.VITE_SOURCE_MAP === "Y",
commonjsOptions: {
ignoreTryCatch: false
}
}
ignoreTryCatch: false,
},
},
};
});
......
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