Commit 2292d493 by yuzhenWang

Merge branch 'wyz' into 'dev'

增加index.html解析参数

See merge request !114
parents 07acd072 68de31b4
......@@ -3,6 +3,36 @@
<head>
<meta charset="UTF-8" />
<script>
// ============ 新增:解析 URL 参数并设置状态栏占位 ============
//解决项目以h5的方式内嵌到app的webview中,手机状态栏和页面顶部内容重叠的问题
(function() {
function getQueryParam(name) {
// 从 hash 中提取查询参数
const hash = window.location.hash;
const queryIndex = hash.indexOf('?');
console.log('queryIndex', queryIndex);
if (queryIndex === -1) return null;
const queryString = hash.substring(queryIndex + 1);
const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
const r = queryString.match(reg);
console.log('匹配结果', r);
if (r != null) return decodeURIComponent(r[2]);
return null;
}
const statusBarHeight = getQueryParam('statusBarHeight');
console.log('状态栏高度', statusBarHeight);
if (statusBarHeight) {
const height = parseInt(statusBarHeight, 10);
if (!isNaN(height) && height > 0) {
document.write('<style>' +
'html, body { margin:0; padding:0; height:100%; overflow:hidden; }' +
'body { padding-top: ' + height + 'px; box-sizing: border-box; }' +
'#app { height: 100%; overflow-y: auto; }' +
'</style>');
}
}
})();
// ============ 新增结束 ============
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)'))
document.write(
......
......@@ -29,7 +29,8 @@
<!-- 家办商城跳cffp的分享功能 -->
<!-- #ifdef H5 -->
<!-- v-if="!generatedImage" -->
<view class="generateImageBox" ref="captureElement" v-if="!generatedImage">
<!-- 生成海报逻辑暂不需要 -->
<!-- <view class="generateImageBox" ref="captureElement" v-if="!generatedImage">
<view class="imgBox">
<img class="posterImg" @load="handleBgImageLoad" @error="handleBgImageError" style="display: block;"
:src="sharePosterItem.fileFirstImage+'?t='+Math.random()" crossorigin="anonymous" alt="防缓存图片" />
......@@ -53,7 +54,7 @@
识别二维码查看商品
</view>
</view>
<!-- 二维码容器 -->
<view class="qrcode-container">
<canvas canvas-id="qrcode" class="qrcode-canvas"
:style="{width: qrCodeSize + 'px', height: qrCodeSize + 'px'}"></canvas>
......@@ -61,7 +62,7 @@
</view>
</view>
</view>
</view> -->
<!-- #endif -->
<view class="productBox">
<view class="productList" :style="{marginTop}">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment