阶段2: USB 远程 adb server 打通(220 host 网络 5037 全接口监听,无需改 220)+ 自建远程看屏(MJPEG 流 + u2 触控 tap/swipe/key/text,ws-scrcpy 不在 npm 改自建)

This commit is contained in:
2026-08-17 16:50:12 +08:00
parent 5354fe6379
commit 645938b305
10 changed files with 466 additions and 50 deletions
+37
View File
@@ -482,6 +482,7 @@ select.form-control{cursor:pointer}
<button class="sub-tab" data-sub="appver" onclick="showSubTab('tools','appver')">应用版本管理</button>
<button class="sub-tab" data-sub="devapps" onclick="showSubTab('tools','devapps')">设备已装应用</button>
<button class="sub-tab" data-sub="stfdev" onclick="showSubTab('tools','stfdev')">STF 设备管理</button>
<button class="sub-tab" data-sub="screen" onclick="showSubTab('tools','screen')">远程看屏</button>
</div>
<!-- 子分栏 1:剪贴板注入 -->
@@ -665,6 +666,42 @@ select.form-control{cursor:pointer}
脚本的 cron 每 5 分钟自动补连掉线设备。adb 操作发生在 220(STF provider 侧),不影响本机任务直连。
</div>
</div>
<!-- 子分栏 7:远程看屏(MJPEG 实时流 + 触控) -->
<div class="sub-panel" id="tools-sub-screen">
<div class="toolbar">
<select id="screen-device" class="form-control" style="width:300px;font-family:monospace"></select>
<button class="btn btn-primary" onclick="startScreenView()">开始看屏</button>
<button class="btn" onclick="stopScreenView()">停止</button>
<button class="btn" onclick="loadScreenDevices(true)">刷新设备</button>
<span id="screen-status" class="text-muted"></span>
</div>
<div style="display:flex;gap:16px;align-items:flex-start;flex-wrap:wrap">
<div style="position:relative" id="screen-stage">
<img id="screen-img" alt="远程画面"
style="max-width:420px;border-radius:12px;border:1px solid var(--border);background:#000;cursor:crosshair;user-select:none">
<div id="screen-loading" class="empty" style="position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,.6);color:#fff;border-radius:12px">连接中(首次连接需推送 atx-agent,最长约 30 秒)...</div>
</div>
<div style="display:flex;flex-direction:column;gap:6px;min-width:200px">
<div style="font-size:12px;color:var(--text-light)">操作(鼠标拖拽=滑动,点击=轻触)</div>
<div style="display:flex;gap:6px;flex-wrap:wrap">
<button class="btn btn-xs" onclick="screenKey('back')">◀ 返回</button>
<button class="btn btn-xs" onclick="screenKey('home')">🏠 主页</button>
<button class="btn btn-xs" onclick="screenKey('recent')">📋 最近</button>
<button class="btn btn-xs" onclick="screenKey('menu')">☰ 菜单</button>
<button class="btn btn-xs" onclick="screenKey('power')">⏻ 电源</button>
<button class="btn btn-xs" onclick="screenKey('volume_up')">🔊 音量+</button>
<button class="btn btn-xs" onclick="screenKey('volume_down')">🔉 音量-</button>
</div>
<div style="display:flex;gap:6px;margin-top:4px">
<input type="text" id="screen-text" class="form-control" style="flex:1" placeholder="输入文字(需光标在输入框)"
onkeydown="if(event.key==='Enter')screenSendText()">
<button class="btn btn-xs" onclick="screenSendText()">发送</button>
</div>
<div class="help" style="margin-top:6px">画面为设备原生分辨率 JPEG 流(约 3-6 帧/秒)。设备息屏时画面为黑,可先点电源/亮屏。</div>
</div>
</div>
</div>
</div>
</div><!-- /.content -->