- manifest.json: H5 devServer 关闭 https,修复本地开发 WDS 断连问题 - App.vue: 大屏跳转 pc.html 时动态推导路径前缀,兼容本地(/)和部署(/h5/)两种场景 - static/html/pc.html: iframe src 根据当前页面路径动态计算,修复本地白屏问题 - login/index.vue: 获取验证码直接调用接口,跳过前端安全验证弹窗(后端已注释校验) Made-with: Cursor
64 lines
1.7 KiB
HTML
64 lines
1.7 KiB
HTML
<!DOCTYPE html>
|
|
<html lang=zh-CN>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1">
|
|
<title>PC端</title>
|
|
<meta name="Copyright" content="helang">
|
|
<link rel="shortcut icon" type="image/png" href="">
|
|
<meta name="keywords" content="">
|
|
<meta name="description" content="">
|
|
<style type="text/css">
|
|
body{
|
|
margin: 0;
|
|
background-color: #f3f3f3;
|
|
}
|
|
iframe{
|
|
width: 375px;
|
|
height: 667px;
|
|
background-color: #fff;
|
|
box-sizing: content-box;
|
|
border: none;
|
|
}
|
|
|
|
@media screen and (min-width: 450px) {
|
|
iframe {
|
|
position: fixed;
|
|
top: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
left: 0;
|
|
margin: auto;
|
|
border: rgba(0,0,0,0.1) solid 1px;
|
|
border-radius: 4px;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<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> |