style: 调整ai店铺商品布局、tabbar中心icon白边处理

This commit is contained in:
2026-06-02 15:26:19 +08:00
parent 3f01c33bfb
commit fe1ca06827
9 changed files with 129 additions and 45 deletions
+52 -10
View File
@@ -1,6 +1,6 @@
<template>
<s-layout title="邀请好友">
<view class="share_page_bg" id="captureBox">
<s-layout :navbar="navBar" title="邀请好友" navPreset="float">
<view class="share_page_bg" id="captureBox" :style="{ marginTop: `-${navHeight}px` }">
<view class="slogan">
<image class="slogan_img" src="/static/share_bg.png" mode="widthFix" />
</view>
@@ -55,10 +55,22 @@
import Qrcode from './components/Qrcode';
import { getCurrentInstance, nextTick, ref } from 'vue';
import * as api from '@/sheep/api/home/index';
import { onPageScroll } from '@dcloudio/uni-app';
const instance = getCurrentInstance();
const proxy = instance?.proxy;
const sysInfoForNav = uni.getSystemInfoSync();
const navHeight = ref((sysInfoForNav?.statusBarHeight || 0) + 44);
const navBar = ref('inner');
onPageScroll((e) => {
if ((e?.scrollTop || 0) > 20) {
navBar.value = 'normal';
} else {
navBar.value = 'inner';
}
});
const inviteinfo = ref({});
const qrCodeUrl = ref('');
const qrcodeRef = ref(null);
@@ -168,6 +180,7 @@
const rect = await getCaptureBoxRect();
const sysInfo = uni.getSystemInfoSync();
const excludeTopPx = (sysInfo?.statusBarHeight || 0) + 44;
const ratioX =
typeof plus !== 'undefined' && plus.screen && plus.screen.resolutionWidth
? plus.screen.resolutionWidth / sysInfo.windowWidth
@@ -180,20 +193,18 @@
const maxHeight = Math.max(1, Math.floor(sysInfo.windowHeight * ratioY));
const clip = {
top: Math.max(0, Math.floor((rect.top || 0) * ratioY)),
top: Math.max(0, Math.floor(((rect.top || 0) + excludeTopPx) * ratioY)),
left: Math.max(0, Math.floor((rect.left || 0) * ratioX)),
width: Math.max(1, Math.floor((rect.width || 1) * ratioX)),
height: Math.max(1, Math.floor((rect.height || 1) * ratioY)),
height: Math.max(1, Math.floor(Math.max(1, (rect.height || 1) - excludeTopPx) * ratioY)),
};
const sideExpand = Math.max(0, Math.floor(30 * ratioX));
const topExpand = Math.max(0, Math.floor(60 * ratioY));
const bottomExpand = Math.max(0, Math.floor(20 * ratioY));
clip.top = Math.max(0, clip.top - topExpand);
clip.left = Math.max(0, clip.left - sideExpand);
clip.width = clip.width + sideExpand * 2;
clip.height = clip.height + topExpand + bottomExpand;
clip.height = clip.height + bottomExpand;
if (clip.left >= maxWidth) clip.left = maxWidth - 1;
if (clip.top >= maxHeight) clip.top = maxHeight - 1;
@@ -282,9 +293,40 @@
try {
uni.showLoading({ title: '生成分享图片...' });
await nextTick();
await sleep(450);
for (let i = 0; i < 8; i++) {
if (qrCodeUrl.value) break;
await sleep(200);
}
const rect = await getCaptureBoxRect();
const sysInfo = uni.getSystemInfoSync();
const excludeTopPx = (sysInfo?.statusBarHeight || 0) + 44;
const ratioX =
typeof plus !== 'undefined' && plus.screen && plus.screen.resolutionWidth
? plus.screen.resolutionWidth / sysInfo.windowWidth
: sysInfo.pixelRatio || 1;
const ratioY =
typeof plus !== 'undefined' && plus.screen && plus.screen.resolutionHeight
? plus.screen.resolutionHeight / sysInfo.windowHeight
: sysInfo.pixelRatio || 1;
const maxWidth = Math.max(1, Math.floor(sysInfo.windowWidth * ratioX));
const maxHeight = Math.max(1, Math.floor(sysInfo.windowHeight * ratioY));
const clip = {
top: Math.max(0, Math.floor(((rect.top || 0) + excludeTopPx) * ratioY)),
left: Math.max(0, Math.floor((rect.left || 0) * ratioX)),
width: Math.max(1, Math.floor((rect.width || 1) * ratioX)),
height: Math.max(1, Math.floor(Math.max(1, (rect.height || 1) - excludeTopPx) * ratioY)),
};
const sideExpand = Math.max(0, Math.floor(30 * ratioX));
const bottomExpand = Math.max(0, Math.floor(20 * ratioY));
clip.left = Math.max(0, clip.left - sideExpand);
clip.width = clip.width + sideExpand * 2;
clip.height = clip.height + bottomExpand;
if (clip.left >= maxWidth) clip.left = maxWidth - 1;
if (clip.top >= maxHeight) clip.top = maxHeight - 1;
if (clip.left + clip.width > maxWidth) clip.width = maxWidth - clip.left;
if (clip.top + clip.height > maxHeight) clip.height = maxHeight - clip.top;
uni.hideLoading();
const { localPath: shareImage } = await drawCurrentWebviewToFile();
const { localPath: shareImage } = await drawCurrentWebviewToFile({ clip });
uni.share({
provider,
type: 1,
@@ -306,7 +348,7 @@
.share_page_bg {
position: relative;
min-height: 100vh;
padding: 520rpx 40rpx 80rpx;
padding: 570rpx 40rpx 80rpx;
box-sizing: border-box;
// background: #0b53d8;
}