This commit is contained in:
snltty
2023-09-14 22:23:25 +08:00
parent 72b57c4920
commit a239926ec0
22 changed files with 82 additions and 39 deletions

View File

@@ -43,7 +43,7 @@
##### 1、公共参数
- [x] **【--mode】** 运行模式 **client,server**
##### 1、客户端
##### 2、客户端
- [x] **【--server】** 服务器ip **192.168.1.18**
- [x] **【--name】** 机器名 **Dns.GetHostName()**
- [ ] **【--username-key】** 用户名内存共享key谁在用此设备 **cmonitor/username**
@@ -53,7 +53,7 @@
- [ ] **【--share-key】** 自定义其它数据共享 **cmonitor/share**
- [ ] **【--share-len】** 长度 **255**
##### 2、服务端
##### 3、服务端
- [x] **【--web】** 管理UI端口 **1800**
- [x] **【--api】** 管理接口端口 **1801**
- [x] **【--service】** 服务端口 **1802**

View File

@@ -67,6 +67,7 @@ export default {
const handleConnect = () => {
initWebsocket(`ws://${window.location.hostname}:${state.port}`);
//initWebsocket(`ws://192.168.1.18:${state.port}`);
localStorage.setItem('port', state.port);
}
const handleUsername = () => {

View File

@@ -119,7 +119,7 @@ export default {
.btn {
a {
font-size: 1.6rem;
color: #fff;
color: #adbfcc;
margin-left: 0.6rem;
position: relative;
@@ -128,6 +128,7 @@ export default {
position: absolute;
right: 110%;
top: -20%;
color: #7c95a7;
}
}
}

View File

@@ -31,12 +31,11 @@ a {
span.value {
position: absolute;
left: 100%;
left: 110%;
top: 50%;
transform: translateY(-50%);
color: #fff;
color: #7c95a7;
font-size: 1.4rem;
text-shadow: 1px 1px 2px #000;
}
}
</style>

View File

@@ -40,11 +40,10 @@ a {
}
.light-value {
color: #fff;
color: #7c95a7;
font-size: 1.4rem;
text-shadow: 1px 1px 2px #000;
position: absolute;
right: 100%;
right: 110%;
top: 50%;
transform: translateY(-50%);
}

View File

@@ -10,7 +10,9 @@ export default {
img: null,
LastInput: 0,
UserName: '',
KeyBoard: ''
KeyBoard: '',
KeyBoardOld: '',
KeyBoardLength: 0,
}
};
},
@@ -24,6 +26,7 @@ export default {
this.fpsInterval();
this.draw();
},
draw() {
const devices = this.globalData.value.devices.filter(c => this.globalData.value.reportNames.indexOf(c.MachineName) >= 0);
@@ -40,22 +43,8 @@ export default {
if (img) {
item.ctx.clearRect(0, 0, item.canvas.width, item.canvas.height);
item.ctx.drawImage(img, 0, 0, img.width, img.height, 0, 0, item.canvas.width, item.canvas.height);
item.ctx.lineWidth = 3;
item.ctx.font = 'bold 50px Arial';
item.ctx.fillStyle = '#000';
item.ctx.fillText(`FPS : ${item.Screen.fps} 、LT : ${item.Screen.LastInput}ms`, 50, 70);
item.ctx.strokeStyle = '#0f0';
item.ctx.strokeText(`FPS : ${item.Screen.fps} 、LT : ${item.Screen.LastInput}ms`, 50, 70);
item.ctx.lineWidth = 10;
let top = (item.canvas.height - 100) / 2;
let left = (item.canvas.width - 50 * item.Screen.KeyBoard.length) / 2;
item.ctx.font = 'bold 100px Arial';
item.ctx.fillStyle = 'rgba(255,255,255,0.5)';
item.ctx.fillText(`${item.Screen.KeyBoard}`, left, top);
item.ctx.lineWidth = 2;
item.ctx.strokeStyle = '#000';
item.ctx.strokeText(`${item.Screen.KeyBoard}`, left, top);
this.drawFps(item);
this.drawKeyboard(item);
}
for (let j in item) {
try {
@@ -63,17 +52,39 @@ export default {
item[j].draw(item.canvas, item.ctx);
}
} catch (e) {
console.log(item);
console.log(e);
}
}
}
//item.Screen.img = null;
}
requestAnimationFrame(() => {
this.draw();
});
},
drawKeyboard(item) {
if (item.Screen.KeyBoard && item.Screen.KeyBoardLength < 60) {
item.Screen.KeyBoardLength++;
item.ctx.lineWidth = 10;
let top = (item.canvas.height - 100) / 2;
let left = (item.canvas.width - 50 * item.Screen.KeyBoard.length) / 2;
item.ctx.font = 'bold 100px Arial';
item.ctx.fillStyle = 'rgba(0,0,0,0.5)';
item.ctx.fillText(`${item.Screen.KeyBoard}`, left, top);
item.ctx.lineWidth = 5;
item.ctx.strokeStyle = 'rgba(255,255,255,0.7)';
item.ctx.strokeText(`${item.Screen.KeyBoard}`, left, top);
}
},
drawFps(item) {
item.ctx.lineWidth = 5;
item.ctx.font = 'bold 60px Arial';
item.ctx.fillStyle = 'rgba(0,0,0,0.5)';
item.ctx.fillText(`FPS : ${item.Screen.fps} 、LT : ${item.Screen.LastInput}ms`, 50, 70);
item.ctx.lineWidth = 2;
item.ctx.strokeStyle = '#fff';
item.ctx.strokeText(`FPS : ${item.Screen.fps} 、LT : ${item.Screen.LastInput}ms`, 50, 70);
},
subMessage() {
subNotifyMsg('/notify/report/screen', (res, param) => {
if (this.globalData.value.reportNames.indexOf(res.Name) == -1) return;
@@ -99,6 +110,7 @@ export default {
}
});
},
fpsInterval() {
this.globalData.value.devices.forEach(item => {
item.Screen.fps = item.Screen.fpsTimes;
@@ -108,6 +120,7 @@ export default {
this.fpsInterval();
}, 1000)
},
reported: true,
reportInterval() {
if (this.reported) {
@@ -129,11 +142,15 @@ export default {
}, 30);
}
},
update(item, report) {
if (report.Screen) {
item.Screen.LastInput = report.Screen.LastInput || '0';
item.Screen.UserName = report.Screen.UserName || '';
if (report.Screen.KeyBoard != item.Screen.KeyBoard) {
item.Screen.KeyBoard = report.Screen.KeyBoard || '';
item.Screen.KeyBoardLength = 0;
}
}
}
}

View File

@@ -47,11 +47,10 @@ a {
}
.volume-value {
color: #fff;
color: #7c95a7;
font-size: 1.4rem;
text-shadow: 1px 1px 2px #000;
position: absolute;
right: 100%;
right: 110%;
top: 50%;
transform: translateY(-50%);
}

View File

@@ -12,6 +12,7 @@
import Item from './Item.vue'
import { computed, watch } from 'vue'
import { getList } from '../../../apis/signin.js'
import { websocketState } from '../../../apis/request'
import { nextTick, onMounted, onUnmounted } from 'vue'
import { injectGlobalData } from '@/views/provide'
import { subNotifyMsg } from '@/apis/request'
@@ -117,11 +118,31 @@ export default {
console.log(e);
}
}
const updateListInterver = () => {
if (websocketState.connected) {
getList().then((res) => {
globalData.value.allDevices.forEach(c => {
let item = res.filter(d => d.MachineName == c.MachineName)[0];
if (item) {
c.Connected = item.Connected;
}
});
}).catch(() => {
});
}
setTimeout(() => {
updateListInterver();
}, 1000);
}
onMounted(() => {
getData();
listWrapScrollListener();
updateVisibleItems();
subMessage();
updateListInterver();
});
onUnmounted(() => {
listWrapRemoveScrollListener();

View File

@@ -1,4 +1,6 @@
using common.libs.database;
using common.libs;
using common.libs.database;
using common.libs.extends;
using System;
using System.ComponentModel.DataAnnotations.Schema;

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>cmonitor.web</title><script defer="defer" src="/js/chunk-vendors.d3224db2.js"></script><script defer="defer" src="/js/app.1e5ef610.js"></script><link href="/css/chunk-vendors.faad7142.css" rel="stylesheet"><link href="/css/app.97eae421.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but cmonitor.web doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>
<!doctype html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>cmonitor.web</title><script defer="defer" src="/js/chunk-vendors.d3224db2.js"></script><script defer="defer" src="/js/app.3d96c181.js"></script><link href="/css/chunk-vendors.faad7142.css" rel="stylesheet"><link href="/css/app.97eae421.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but cmonitor.web doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -51,6 +51,8 @@ namespace common.libs.database
if (File.Exists(fileName))
{
string str = (await File.ReadAllTextAsync(fileName).ConfigureAwait(false));
//Logger.Instance.Error($"read:{fileName}");
// Logger.Instance.Error(str);
return str.DeJson<T>();
}
else
@@ -79,6 +81,10 @@ namespace common.libs.database
try
{
string fileName = GetTableName(typeof(T));
//Logger.Instance.Error($"save:{fileName}");
//Logger.Instance.Error(model.ToJsonIndented());
await File.WriteAllTextAsync(fileName, model.ToJsonIndented(), Encoding.UTF8).ConfigureAwait(false);
}
catch (Exception)

View File

@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Windows.Forms;