fix: H5本地运行白屏及登录获取验证码去除安全验证弹窗

- manifest.json: H5 devServer 关闭 https,修复本地开发 WDS 断连问题
- App.vue: 大屏跳转 pc.html 时动态推导路径前缀,兼容本地(/)和部署(/h5/)两种场景
- static/html/pc.html: iframe src 根据当前页面路径动态计算,修复本地白屏问题
- login/index.vue: 获取验证码直接调用接口,跳过前端安全验证弹窗(后端已注释校验)

Made-with: Cursor
This commit is contained in:
apple
2026-03-21 08:57:13 +08:00
parent ae8b866319
commit 788ee0c0c0
4 changed files with 71 additions and 59 deletions

View File

@@ -35,21 +35,30 @@
}
}
</style>
<script type="text/javascript">
window.isPC = true;
window.onload = function(){
/* 监听电脑浏览器窗口尺寸改变 */
window.onresize = function(){
/* 窗口宽度 小于或等于420px 时跳转回H5页面 */
if(window.innerWidth <= 420){
window.location.pathname = '/h5/';
}
}
}
</script>
</head>
<body>
<iframe src="/h5/?type=1"></iframe>
<iframe id="app-frame"></iframe>
<script type="text/javascript">
window.isPC = true;
/* 根据当前地址推导 H5 根路径:本地 dev 多为 /,线上部署多为 /h5/ */
function h5AppRootPathname() {
var path = (window.location.pathname || '/').replace(/\/$/, '') || '/';
var marker = '/static/html/pc.html';
if (path.endsWith(marker)) {
var root = path.slice(0, -marker.length);
if (!root) root = '/';
return root === '/' ? '/' : (root + '/');
}
return '/';
}
var H5_ROOT = h5AppRootPathname();
document.getElementById('app-frame').src = H5_ROOT + '?type=1';
window.onresize = function(){
if (window.innerWidth <= 420) {
var target = H5_ROOT.replace(/\/$/, '');
window.location.pathname = target || '/';
}
};
</script>
</body>
</html>