fix(layout): IPv6按钮顶栏内正常排版不遮挡 + 窄屏收缩;relay/my-ip/用户菜单等本次改动入库
This commit is contained in:
1 parent
ea4e3deb50
commit
7b22e53d1a
8 files changed
+1050
-106
No files matched your search
@@ -99,6 +99,7 @@ async function loadIps() {
|
||||
v4Geo.value = g4;
|
||||
v6Geo.value = g6;
|
||||
ipLoading.value = false;
|
||||
ensureIspNode(); // 归属运营商已知 → 插入「本省运营商门户」延迟节点并补测
|
||||
// 拿到地址后并行做代理/VPN 检测(不阻塞主卡片)
|
||||
runProxyCheck();
|
||||
rtcProbe();
|
||||
@@ -237,10 +238,11 @@ async function copyIp(text: string, key: string) {
|
||||
}
|
||||
|
||||
// ---------- 热门地点延迟(你的浏览器到各地点的实测延迟) ----------
|
||||
type LatNode = { name: string; url: string; ms: number | null; st: 'wait' | 'run' | 'ok' | 'fail' };
|
||||
type LatNode = { name: string; url: string; ms: number | null; st: 'wait' | 'run' | 'ok' | 'fail'; note?: string };
|
||||
const latTesting = ref(false);
|
||||
const nodes = ref<LatNode[]>([
|
||||
{ name: '本站服务器', url: `${location.origin}/favicon.ico`, ms: null, st: 'wait' },
|
||||
{ name: '百度', url: 'https://www.baidu.com/favicon.ico', ms: null, st: 'wait' },
|
||||
{ name: '清华 TUNA(北京)', url: 'https://mirrors.tuna.tsinghua.edu.cn/', ms: null, st: 'wait' },
|
||||
{ name: '阿里云镜像(杭州)', url: 'https://mirrors.aliyun.com/', ms: null, st: 'wait' },
|
||||
{ name: '腾讯云镜像(广州)', url: 'https://mirrors.cloud.tencent.com/', ms: null, st: 'wait' },
|
||||
@@ -251,6 +253,33 @@ const nodes = ref<LatNode[]>([
|
||||
{ name: 'Cloudflare(海外)', url: 'https://speed.cloudflare.com/__down?bytes=0', ms: null, st: 'wait' },
|
||||
]);
|
||||
|
||||
// 按用户 IPv4 归属运营商动态插入「本省运营商门户」节点(三大运营商+广电,无匹配则不插)
|
||||
function ensureIspNode() {
|
||||
if (nodes.value.some((n) => n.name.startsWith('本省'))) return;
|
||||
const g = v4Geo.value;
|
||||
const isp = `${g?.isp || ''} ${g?.as || ''}`;
|
||||
const province = g?.regionName || '';
|
||||
let portal = '';
|
||||
let short = '';
|
||||
if (/联通|Unicom/i.test(isp)) {
|
||||
portal = 'https://www.10010.com/favicon.ico'; // favicon 直链无 302;首页会被风控挂到超时
|
||||
short = '联通';
|
||||
} else if (/电信|Telecom/i.test(isp)) {
|
||||
portal = 'https://www.189.cn/favicon.ico';
|
||||
short = '电信';
|
||||
} else if (/移动|Mobile|铁通|Tietong/i.test(isp)) {
|
||||
portal = 'https://www.10086.cn/'; // 移动 favicon 不可达,用首页(200 稳定)
|
||||
short = '移动';
|
||||
} else if (/广电|Broadnet/i.test(isp)) {
|
||||
portal = 'https://www.10099.com.cn/favicon.ico';
|
||||
short = '广电';
|
||||
}
|
||||
if (!portal) return; // 未知运营商(教育网/长城等)不插行
|
||||
const node: LatNode = { name: `本省·${short}`, url: portal, ms: null, st: 'wait', note: province ? `${g?.isp || short} · ${province}` : (g?.isp || '') };
|
||||
nodes.value.splice(1, 0, node);
|
||||
ping(node); // 其余节点已在测,单独补测这一项
|
||||
}
|
||||
|
||||
const latSummary = computed(() => {
|
||||
const ok = nodes.value.filter((n) => n.st === 'ok' && n.ms != null);
|
||||
if (!ok.length) return '';
|
||||
@@ -422,6 +451,7 @@ interface SpeedRec {
|
||||
ms: number; // 到本站延迟
|
||||
route: 'IPv6 直连' | '公网中转'; // 测试时所走线路
|
||||
host: string; // 测试时的访问域名
|
||||
lat?: string; // 测速时点的热门地点延迟快照:"百度5 本省联通6 清华12 …"(空串=当时未测完)
|
||||
}
|
||||
const speedHistory = ref<SpeedRec[]>([]);
|
||||
|
||||
@@ -444,6 +474,14 @@ function saveSpeedHistory() {
|
||||
}
|
||||
}
|
||||
|
||||
// 把当前热门地点延迟压成短串快照(写入历史记录):"百度5 本省联通6 清华12 …"
|
||||
function latSnapshot(): string {
|
||||
return nodes.value
|
||||
.filter((n) => n.st === 'ok' && n.ms != null)
|
||||
.map((n) => `${n.name.replace(/([^)]*)/g, '').replace(/[\s·]/g, '')}${n.ms}`)
|
||||
.join(' ');
|
||||
}
|
||||
|
||||
function pushSpeedRec() {
|
||||
speedHistory.value.unshift({
|
||||
t: Date.now(),
|
||||
@@ -452,6 +490,7 @@ function pushSpeedRec() {
|
||||
ms: serverMs.value ?? 0,
|
||||
route: onV6Host ? 'IPv6 直连' : '公网中转',
|
||||
host: location.host,
|
||||
lat: latSnapshot(),
|
||||
});
|
||||
speedHistory.value = speedHistory.value.slice(0, 20);
|
||||
saveSpeedHistory();
|
||||
@@ -606,6 +645,7 @@ onMounted(() => {
|
||||
<span>下载 Mbps</span>
|
||||
<span>上传 Mbps</span>
|
||||
<span>延迟 ms</span>
|
||||
<span>热门地点延迟快照</span>
|
||||
</div>
|
||||
<div v-for="r in speedHistory" :key="r.t" class="sp-hrow">
|
||||
<span>{{ fmtTime(r.t) }}</span>
|
||||
@@ -613,9 +653,10 @@ onMounted(() => {
|
||||
<span class="c-down">{{ r.down }}</span>
|
||||
<span class="c-up">{{ r.up }}</span>
|
||||
<span class="c-ms">{{ r.ms }}</span>
|
||||
<span class="c-lat">{{ r.lat || '—' }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sp-hist-tip">对比方法:在当前线路测一次 → 点横幅「切换 IPv6 直连」再测一次,两条线路的下载/上传/延迟直接在表里对照。</div>
|
||||
<div class="sp-hist-tip">对比方法:在当前线路测一次 → 点横幅「切换 IPv6 直连」再测一次,下载/上传/延迟与各地点(百度/本省运营商/镜像站等)延迟直接在表里对照。</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -676,7 +717,7 @@ onMounted(() => {
|
||||
</div>
|
||||
<div class="lat-grid">
|
||||
<div v-for="n in nodes" :key="n.name" class="lat-card" :class="latCls(n)">
|
||||
<span class="lat-name">{{ n.name }}</span>
|
||||
<span class="lat-name" :title="n.note || ''">{{ n.name }}</span>
|
||||
<span class="lat-ms">
|
||||
{{ n.st === 'run' ? '测速中…' : n.st === 'fail' ? '超时' : n.st === 'ok' ? `${n.ms} ms` : '待测' }}
|
||||
</span>
|
||||
@@ -1140,7 +1181,7 @@ onMounted(() => {
|
||||
|
||||
.sp-hrow {
|
||||
display: grid;
|
||||
grid-template-columns: 1.1fr 1.1fr 1fr 1fr 0.9fr;
|
||||
grid-template-columns: 1.1fr 1.1fr 1fr 1fr 0.9fr 2.4fr;
|
||||
gap: 6px;
|
||||
padding: 6px 4px;
|
||||
align-items: center;
|
||||
@@ -1208,8 +1249,16 @@ onMounted(() => {
|
||||
}
|
||||
}
|
||||
.sp-hist-table .sp-hrow {
|
||||
grid-template-columns: 1fr 1fr 1fr 1fr 0.8fr;
|
||||
grid-template-columns: 0.9fr 1fr 0.8fr 0.8fr 0.7fr 2.6fr;
|
||||
font-size: 12.5px;
|
||||
}
|
||||
|
||||
.sp-hist-table .c-lat {
|
||||
font-family: monospace;
|
||||
font-size: 11.5px;
|
||||
opacity: 0.85;
|
||||
line-height: 1.6;
|
||||
word-break: break-all;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user