feat: 全局更改tabbar、首页、分享页UI重构

This commit is contained in:
2026-06-01 15:50:19 +08:00
parent aa0a289f27
commit c2388e1396
22 changed files with 852 additions and 461 deletions
+10 -4
View File
@@ -182,10 +182,11 @@
// socket() // socket()
}); });
onLaunch(() => { onLaunch(() => {
// 隐藏原生导航栏 使用自定义底部导航 try {
// uni.hideTabBar({ uni.hideTabBar({
// fail: () => {}, fail: () => {},
// }); });
} catch (e) {}
// globalData.value.statusBarHeight = uni.getSystemInfoSync()?.statusBarHeight; // globalData.value.statusBarHeight = uni.getSystemInfoSync()?.statusBarHeight;
// globalData.value.windowHeight = uni.getSystemInfoSync()?.windowHeight; // globalData.value.windowHeight = uni.getSystemInfoSync()?.windowHeight;
// 获取微信胶囊的位置信息 width,height,top,right,left,bottom // 获取微信胶囊的位置信息 width,height,top,right,left,bottom
@@ -208,6 +209,11 @@
}); });
onShow(() => { onShow(() => {
try {
uni.hideTabBar({
fail: () => {},
});
} catch (e) {}
// #ifdef APP-PLUS // #ifdef APP-PLUS
// 获取urlSchemes参数 // 获取urlSchemes参数
const args = const args =
+2 -2
View File
@@ -1,5 +1,5 @@
<template> <template>
<view class="cardTitle p-x-20 cardBg" :style="{ height: statusBarHeight + 44 + 'px' }"> <view class="cardTitle p-x-20 cardBg" :style="[{ height: statusBarHeight + 44 + 'px' }, { backgroundColor: props.bg }]">
<view :style="{ height: statusBarHeight + 'px' }"></view> <view :style="{ height: statusBarHeight + 'px' }"></view>
<view class="flex-center ju-between h_88"> <view class="flex-center ju-between h_88">
<view class="cardLeft" v-if="props.showLeftButton"> <view class="cardLeft" v-if="props.showLeftButton">
@@ -91,7 +91,7 @@
} }
.cardBg { .cardBg {
// 背景图片顶部显示, 超出部分隐藏, 宽等于100% // 背景图片顶部显示, 超出部分隐藏, 宽等于100%
background-color: #ffffff; background-color: transparent;
} }
:deep(.uniui-left) { :deep(.uniui-left) {
font-size: 44rpx !important; font-size: 44rpx !important;
+228 -38
View File
@@ -1,47 +1,237 @@
<template> <template>
<view class="card_tabber"> <view class="tabbar-wrap">
</view> <view class="tabbar safe-bottom">
<image class="tabbar-bg" :src="bgSrc" mode="scaleToFill" />
<view class="tabbar-inner">
<view
v-for="(item, i) in items"
:key="item.pagePath"
class="tabbar-item flex1 flex-center flex-column"
:class="{ 'tabbar-item--mid': item.isMid }"
@click="onTap(item)"
>
<view :class="{ iconBox: item.isMid }">
<image
class="icon"
:class="{ iconMid: item.isMid, border_f: item.isMid }"
:src="getIconSrc(item)"
mode="aspectFit"
/>
</view>
<view v-if="item.text" class="s_20 text" :class="{ textActive: isActive(item) }">
{{ item.text }}
</view>
</view>
</view>
</view>
<view v-if="props.placeholder" class="tabbar-placeholder safe-bottom"></view>
</view>
</template> </template>
<script setup> <script setup>
import {ref} from 'vue' import { computed, ref, watch } from 'vue';
import { onShow } from '@dcloudio/uni-app';
const tabber = ref({ const props = defineProps({
items: [ path: {
{ type: String,
text: '首页', default: '',
url: '/pages/index/index', },
iconUrl: proxy.$url+'index/1.svg', placeholder: {
activeIconUrl: proxy.$url+'index/1_1.svg', type: Boolean,
default: false,
},
});
const currentPath = ref('');
const normalizePath = (p) => {
if (!p) return '';
return p.startsWith('/') ? p : `/${p}`;
};
const updateCurrentPath = () => {
const pages = getCurrentPages?.() || [];
const current = pages[pages.length - 1];
const route = current?.route || '';
currentPath.value = normalizePath(route);
};
const hideNativeTabBar = () => {
try {
uni.hideTabBar({
fail: () => {},
});
} catch (e) {}
};
onShow(() => {
hideNativeTabBar();
updateCurrentPath();
});
watch(
() => props.path,
(val) => {
if (val) currentPath.value = normalizePath(val);
},
{ immediate: true },
);
const items = computed(() => [
{
pagePath: '/pages/index/index',
text: '首页',
iconPath: '/static/index/1.png',
selectedIconPath: '/static/index/1_1.png',
},
{
pagePath: '/pages/index/aiStore',
text: 'AI店铺',
iconPath: '/static/index/2.png',
selectedIconPath: '/static/index/2_1.png',
},
{
pagePath: '/pages/home/seed',
text: '',
iconPath: '/static/index/jinzhongzi.png',
selectedIconPath: '/static/index/jinzhongzi.png',
isMid: true,
},
{
pagePath: '/pages/cart/cart',
text: '购物车',
iconPath: '/static/index/3.png',
selectedIconPath: '/static/index/3_1.png',
},
{
pagePath: '/pages/index/user',
text: '我的',
iconPath: '/static/index/4.png',
selectedIconPath: '/static/index/4_1.png',
},
]);
const isActive = (item) => {
return normalizePath(item.pagePath) === normalizePath(currentPath.value);
};
const getIconSrc = (item) => {
return isActive(item) ? item.selectedIconPath : item.iconPath;
};
const onTap = (item) => {
if (item.isMid) {
hideNativeTabBar();
uni.navigateTo({ url: item.pagePath });
return;
}
if (isActive(item)) return;
hideNativeTabBar();
uni.switchTab({
url: item.pagePath,
fail: () => {
uni.reLaunch({ url: item.pagePath });
}, },
{ });
text: '分类', };
url: '/pages/index/category',
iconUrl: proxy.$url+'index/2.svg', const bgSrc = computed(() => {
activeIconUrl: proxy.$url+'index/2_1.svg', const svg = `
}, <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 750 150" preserveAspectRatio="none">
{ <path fill="#ffffff" d="M40 0 H295 Q316 0 316 21 A59 109 0 0 0 434 21 Q434 0 455 0 H710 Q750 0 750 40 V150 H0 V40 Q0 0 40 0 Z"/>
text: '', </svg>
url: '/pages/home/seed', `;
iconUrl: proxy.$url+'index/6.svg', return `data:image/svg+xml;utf8,${encodeURIComponent(svg)}`;
activeIconUrl: proxy.$url+'index/6.svg', });
},
{
text: '购物车',
url: '/pages/cart/cart',
iconUrl: proxy.$url+'index/3.svg',
activeIconUrl: proxy.$url+'index/3_1.svg',
},
{
text: '我的',
url: '/pages/index/user',
iconUrl: proxy.$url+'index/4.svg',
activeIconUrl: proxy.$url+'index/4_1.svg',
},
],
})
</script> </script>
<style> <style lang="scss">
.tabbar-wrap {
width: 100%;
}
</style> .tabbar {
position: fixed;
left: 0;
right: 0;
bottom: 0;
z-index: 80;
// background: var(--tabbar-bg, #ffffff);
overflow: visible;
}
.tabbar-bg {
position: absolute;
left: 0;
right: 0;
bottom: env(safe-area-inset-bottom);
width: 100%;
height: 100rpx;
filter: drop-shadow(0 -6rpx 24rpx rgba(0, 0, 0, 0.12));
pointer-events: none;
}
.tabbar-inner {
height: 100rpx;
display: flex;
align-items: flex-end;
padding: 0 12rpx;
position: relative;
z-index: 1;
}
.tabbar-item {
min-width: 0;
padding-bottom: 10rpx;
}
.tabbar-item--mid {
padding-bottom: 0;
transform: translateY(-25rpx);
}
.icon {
width: 44rpx;
height: 44rpx;
}
.iconBox {
height: 150rpx;
display: flex;
align-items: flex-end;
justify-content: center;
}
.iconMid {
width: 100rpx;
height: 100rpx;
border-radius: 50%;
border-radius: 50%;
box-shadow: 0rpx 0rpx 12rpx 0rpx rgba(0, 0, 0, 0.12);
background: transparent;
}
.border_f {
// border: 6rpx solid #fff;
}
.text {
margin-top: 6rpx;
font-size: 22rpx;
line-height: 1;
color: var(--tabbar-text, #979797);
}
.textActive {
color: var(--color32, #fa7e31);
}
.safe-bottom {
padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-placeholder {
height: 100rpx;
}
</style>
+5 -8
View File
@@ -11,7 +11,7 @@
@click="navChange(i)" @click="navChange(i)"
> >
<view class="navText"> {{ v.name }} </view> <view class="navText"> {{ v.name }} </view>
<image src="/static/index/active.png" mode="scaleToFill" /> <!-- <image src="/static/index/active.png" mode="scaleToFill" /> -->
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
@@ -60,16 +60,11 @@
white-space: nowrap; white-space: nowrap;
} }
.navs { .navs {
// padding: 0 32rpx;
box-sizing: border-box; box-sizing: border-box;
height: 120rpx; height: 120rpx;
// padding-bottom: 10rpx;
.navItem { .navItem {
color: #777777; color: #777777;
font-size: 32rpx; font-size: 28rpx;
// width: 20%;
// text-align: center;
// margin-right: 40rpx;
white-space: nowrap; white-space: nowrap;
flex-shrink: 0; // 防止被压缩 flex-shrink: 0; // 防止被压缩
image { image {
@@ -81,8 +76,10 @@
} }
.tabIndex { .tabIndex {
color: #777777; color: #777777;
font-size: 36rpx;
font-weight: 500; font-weight: 500;
background: linear-gradient(135deg, #2C8CFA 0%, #3D5EFB 100%);
color: #ffffff !important;
border-radius: 12rpx;
image { image {
opacity: 1; opacity: 1;
} }
+1 -25
View File
@@ -955,31 +955,7 @@
"height": "50px", "height": "50px",
"backgroundImage": "/static/index/6.png" "backgroundImage": "/static/index/6.png"
}, },
"list": [{ "list": []
"pagePath": "pages/index/index",
"text": "首页",
"iconPath": "static/index/1.png",
"selectedIconPath": "static/index/1_1.png"
},
{
"pagePath": "pages/index/category",
"text": "分类",
"iconPath": "static/index/2.png",
"selectedIconPath": "static/index/2_1.png"
},
{
"pagePath": "pages/cart/cart",
"text": "购物车",
"iconPath": "static/index/3.png",
"selectedIconPath": "static/index/3_1.png"
},
{
"pagePath": "pages/index/user",
"text": "我的",
"iconPath": "static/index/4.png",
"selectedIconPath": "static/index/4_1.png"
}
]
}, },
"condition": { "condition": {
"current": 0, "current": 0,
+7 -2
View File
@@ -333,7 +333,12 @@ onShow(async () => {
await loadPageData(); await loadPageData();
}); });
const onClickLeft = () => { const onClickLeft = () => {
uni.switchTab({ url: '/pages/index/index' }); uni.switchTab({
url: '/pages/index/index',
fail: () => {
uni.reLaunch({ url: '/pages/index/index' });
},
});
}; };
let sysInfo = uni.getSystemInfoSync(); let sysInfo = uni.getSystemInfoSync();
const windowHeight = sysInfo.windowHeight; const windowHeight = sysInfo.windowHeight;
@@ -629,4 +634,4 @@ function getProduct(status) {
font-size: 51rpx; font-size: 51rpx;
line-height: 66rpx; line-height: 66rpx;
} }
</style> </style>
@@ -129,6 +129,9 @@
const onCart = () => { const onCart = () => {
uni.switchTab({ uni.switchTab({
url: '/pages/cart/cart', url: '/pages/cart/cart',
fail: () => {
uni.reLaunch({ url: '/pages/cart/cart' });
},
}); });
}; };
</script> </script>
+78 -90
View File
@@ -2,22 +2,17 @@
<s-layout title="邀请好友"> <s-layout title="邀请好友">
<view class="share_page_bg" id="captureBox"> <view class="share_page_bg" id="captureBox">
<view class="slogan"> <view class="slogan">
<view class="text" v-for="(t, idx) in sloganLines" :key="idx">{{ t }}</view> <image class="slogan_img" src="/static/share_bg.png" mode="widthFix" />
</view> </view>
<view class="share_card"> <view class="share_card">
<view class="con_center"> <view class="con_center">
<view class="center m-b-28">
<view class="con_name">邀好友来购物</view>
<view class="sub_title m-t-16">长按保存二维码或复制邀请码分享</view>
</view>
<view class="flex-center"> <view class="flex-center">
<view class="code flex-center code_wrap"> <view class="code flex-center code_wrap">
<view class="img"> <view class="img">
<Qrcode <Qrcode
ref="qrcodeRef" ref="qrcodeRef"
:size="300" :size="420"
@generated="onQrGenerated" @generated="onQrGenerated"
@longpress="saveServiceQrcode" @longpress="saveServiceQrcode"
/> />
@@ -25,16 +20,17 @@
</view> </view>
</view> </view>
<view class="center m-t-32 m-b-24 label_text">您的推荐码</view> <view class="center m-t-32 m-b-24 label_text">我的邀请码</view>
<view class="invite_code_bar"> <view class="invite_code_bar">
<view class="code_val">{{ inviteinfo?.inviteCode }}</view> <view class="code_val">{{ inviteinfo?.inviteCode }}</view>
<view class="copy_btn" @click="copy(inviteinfo?.inviteCode)"> <view class="copy_btn" @click="copy(inviteinfo?.inviteCode)">
<view class="icon-copy"></view> <view class="icon-copy"></view>
<text class="btn_text">复制</text>
</view> </view>
</view> </view>
<view class="qr_tip">扫描二维码,注册并登录APP</view>
<!-- <view class="btns"> <!-- <view class="btns">
<view class="square-btn-outline" @click="saveImg"> <view class="square-btn-outline" @click="saveImg">
<view class="icon-down"></view> <view class="icon-down"></view>
@@ -51,6 +47,8 @@
</uni-popup> </uni-popup>
</view> </view>
</view> </view>
<view class="save_btn" @click="saveImg">保存到相册</view>
</view> </view>
</s-layout> </s-layout>
</template> </template>
@@ -63,8 +61,6 @@ import * as api from '@/sheep/api/home/index';
const instance = getCurrentInstance(); const instance = getCurrentInstance();
const proxy = instance?.proxy; const proxy = instance?.proxy;
const sloganLines = ref(['优品赢四海', '购福赴新途']);
const inviteinfo = ref({}); const inviteinfo = ref({});
const qrCodeUrl = ref(''); const qrCodeUrl = ref('');
const qrcodeRef = ref(null); const qrcodeRef = ref(null);
@@ -304,16 +300,12 @@ getinviteinfo();
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
:deep(page) {
background: #fff6f7;
}
.share_page_bg { .share_page_bg {
position: relative; position: relative;
min-height: 100vh; min-height: 100vh;
padding: 330rpx 40rpx 0rpx; padding: 520rpx 40rpx 80rpx;
box-sizing: border-box; box-sizing: border-box;
background: #fff6f7; // background: #0b53d8;
} }
.share_page_bg::before { .share_page_bg::before {
@@ -323,50 +315,43 @@ getinviteinfo();
top: 0; top: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
background-image: linear-gradient( background-image: url('/static/home/seedBg.png');
to bottom, background-repeat: no-repeat;
rgba(255, 246, 247, 0) 0%, background-position: center top;
rgba(255, 246, 247, 0) 35%, background-size: cover;
rgba(255, 246, 247, 1) 85%,
rgba(255, 246, 247, 1) 100%
),
url('/static/home/jinzhongzi_bg.png');
background-repeat: no-repeat, no-repeat;
background-position: center top, center -80rpx;
background-size: 100% 100%, 100% auto;
pointer-events: none; pointer-events: none;
z-index: 0; z-index: 0;
} }
.slogan { .slogan {
position: absolute; position: absolute;
top: 140rpx; top: 0rpx;
left: 50rpx; left: 0;
right: 40rpx; right: 0;
text-align: left;
color: #fff;
font-size: 40rpx;
font-weight: 700;
letter-spacing: 2rpx;
z-index: 1; z-index: 1;
// padding: 0 40rpx;
box-sizing: border-box;
overflow: hidden;
border-radius: 0 0 30rpx 30rpx;
}
.text + .text { .slogan_img {
margin-top: 10rpx; width: 100%;
} display: block;
} }
.share_card { .share_card {
position: relative; position: relative;
z-index: 1; z-index: 1;
width: 100%; width: 100%;
border-radius: 32rpx; border-radius: 28rpx;
background: rgba(255, 255, 255, 0.92); background: rgba(255, 255, 255, 0.96);
box-shadow: 0 18rpx 56rpx rgba(0, 0, 0, 0.12); box-shadow: 0 16rpx 40rpx rgba(0, 0, 0, 0.18);
overflow: hidden; overflow: hidden;
} }
.con_center { .con_center {
padding: 60rpx 40rpx 44rpx; padding: 48rpx 40rpx 44rpx;
box-sizing: border-box; box-sizing: border-box;
} }
@@ -384,24 +369,23 @@ getinviteinfo();
.label_text { .label_text {
font-size: 26rpx; font-size: 26rpx;
font-weight: 600; font-weight: 600;
color: #333; color: #1a73ff;
} }
.code { .code {
width: 380rpx; width: 460rpx;
height: 380rpx; height: 460rpx;
border: 4rpx solid rgba(255, 111, 145, 0.28); border-radius: 22rpx;
border-radius: 32rpx; background: #fff;
background: rgba(255, 255, 255, 0.6);
} }
.code_wrap { .code_wrap {
backdrop-filter: blur(10px); box-shadow: 0 10rpx 28rpx rgba(31, 63, 132, 0.14);
} }
.img { .img {
width: 300rpx; width: 420rpx;
height: 300rpx; height: 420rpx;
border-radius: 18rpx; border-radius: 18rpx;
overflow: hidden; overflow: hidden;
background: #fff; background: #fff;
@@ -410,17 +394,16 @@ getinviteinfo();
.invite_code_bar { .invite_code_bar {
display: flex; display: flex;
align-items: center; align-items: center;
background: transparent; background: #f2f3f5;
border-radius: 20rpx; border-radius: 18rpx;
overflow: visible; overflow: hidden;
height: 120rpx; height: 112rpx;
margin: 0; margin: 0;
gap: 12rpx;
} }
.code_val { .code_val {
flex: 1; flex: 1;
color: #fff; color: #111;
font-size: 56rpx; font-size: 56rpx;
font-weight: 700; font-weight: 700;
letter-spacing: 4rpx; letter-spacing: 4rpx;
@@ -429,58 +412,63 @@ getinviteinfo();
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
background: linear-gradient(to right, #ffb4a2, #ff6f91); background: transparent;
border-top-left-radius: 20rpx;
border-bottom-left-radius: 20rpx;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
} }
.copy_btn { .copy_btn {
width: 140rpx; width: 120rpx;
height: 120rpx; height: 112rpx;
background: #ff7a8a; background: transparent;
display: flex; display: flex;
flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
color: #fff; color: #1a73ff;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
border-top-right-radius: 20rpx;
border-bottom-right-radius: 20rpx;
}
.btn_text {
color: #fff;
font-size: 22rpx;
font-weight: 500;
margin-top: 10rpx;
} }
.icon-copy { .icon-copy {
width: 24rpx; width: 28rpx;
height: 24rpx; height: 28rpx;
border: 1.3333rpx solid currentColor; border: 2rpx solid currentColor;
border-radius: 5.3333rpx; border-radius: 6rpx;
position: relative; position: relative;
margin-bottom: 5.3333rpx;
box-sizing: border-box; box-sizing: border-box;
} }
.icon-copy::before { .icon-copy::before {
content: ''; content: '';
position: absolute; position: absolute;
left: -8rpx; left: -10rpx;
top: 8rpx; top: 10rpx;
width: 24rpx; width: 28rpx;
height: 24rpx; height: 28rpx;
border: 1.3333rpx solid currentColor; border: 2rpx solid currentColor;
border-radius: 5.3333rpx; border-radius: 6rpx;
box-sizing: border-box; box-sizing: border-box;
opacity: 0.7; opacity: 0.7;
} }
.qr_tip {
margin-top: 22rpx;
text-align: center;
font-size: 22rpx;
color: #9aa0a6;
}
.save_btn {
margin-top: 32rpx;
width: 100%;
height: 104rpx;
border-radius: 18rpx;
background: #2f7cf6;
color: #fff;
font-size: 34rpx;
font-weight: 600;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 18rpx 40rpx rgba(47, 124, 246, 0.35);
}
.btns { .btns {
margin-top: 32rpx; margin-top: 32rpx;
} }
+1 -1
View File
@@ -1,5 +1,5 @@
<template> <template>
<s-pages title="AI店铺"> <s-pages title="AI店铺" tabbar="/pages/index/aiStore" :showLeftButton="false">
<view class="ai-store-page" style="min-height: 100vh"> <view class="ai-store-page" style="min-height: 100vh">
<view class="search_box flex-between"> <view class="search_box flex-between">
<view class="flex-center flex1 search_input"> <view class="flex-center flex1 search_input">
+1 -1
View File
@@ -1,5 +1,5 @@
<template> <template>
<s-pages tabbar="/pages/index/category" title="分类" :showLeftButton="false" color="#ffffff"> <s-pages title="分类" :showLeftButton="false" color="#ffffff">
<card_search class="search" style="padding-bottom: 32rpx" @search="search"></card_search> <card_search class="search" style="padding-bottom: 32rpx" @search="search"></card_search>
<view class="page_bottom flex-row"> <view class="page_bottom flex-row">
<view class="classify shrink"> <view class="classify shrink">
+396 -277
View File
@@ -1,315 +1,434 @@
<!-- 首页,支持店铺装修 --> <!-- 首页,支持店铺装修 -->
<template> <template>
<s-layout title="首页" :showLeftButton="false"> <s-layout title="首页" :showLeftButton="false" tabbar="/pages/index/index" navPreset="light">
<view class="pagesIndex"> <view class="pagesIndex">
<s-custom-navbarIndex /> <view class="index-notice-btn" @click="goNotice"></view>
<view class="pages"> <view class="pageContent">
<s-banner v-if="template?.components[0]?.property.items?.length" :data="template.components[0].property" <view class="floating-search-wrap">
:styles="template.components[0].property.style" /> <view class="floating-search" @click="goSearch">
<!-- 文字滚动 --> <view class="floating-search-left">
<view class="noticeBar flex-center bg24 m-b-22" v-if="informText"> <image class="floating-search-icon_333" src="/static/icon/search1.png" mode="scaleToFill" />
<view class="floating-search-placeholder">搜索想要的商品</view>
</view>
<view class="floating-search-btn">
<image class="floating-search-icon_fff" src="/static/icon/search1.png" mode="scaleToFill" />
</view>
</view>
</view>
<view class="pages">
<!-- <s-custom-navbarIndex /> -->
<s-banner
v-if="template?.components[0]?.property.items?.length"
:data="template.components[0].property"
:styles="template.components[0].property.style"
/>
<!-- 文字滚动 -->
<!-- <view class="noticeBar flex-center bg24 m-b-22" v-if="informText">
<image class="noticeImg shrink" src="/static/index/notice.png" mode="scaleToFill" /> <image class="noticeImg shrink" src="/static/index/notice.png" mode="scaleToFill" />
<uni-notice-bar class="flex1" scrollable background-color="#ffffff" :text="informText" <uni-notice-bar class="flex1" scrollable background-color="#ffffff" :text="informText"
color="#333333" :speed="100" /> color="#333333" :speed="100" />
</view> </view> -->
<!-- <view class="ai-store-entry bg24" @click="goAiStore">ai店铺</view> --> <!-- <view class="ai-store-entry bg24" @click="goAiStore">ai店铺</view> -->
<!-- <view class="navList flex-center ju-between"> <!-- <view class="navList flex-center ju-between">
<view v-for="(v, i) in nav" :key="i" class="navItem flex-center flex-column" @click="go(v.url)"> <view v-for="(v, i) in nav" :key="i" class="navItem flex-center flex-column" @click="go(v.url)">
<image class="navImg shrink" :src="`/static/index/${v.icon}`" mode="scaleToFill" /> <image class="navImg shrink" :src="`/static/index/${v.icon}`" mode="scaleToFill" />
<view class="size26 f500">{{ v.title }}</view> <view class="size26 f500">{{ v.title }}</view>
</view> </view>
</view> --> </view> -->
<view class="activeList flex-row wrap ju-between" v-if="activeList?.length"> <view class="activeList flex-row wrap ju-between" v-if="activeList?.length">
<view class="activeItem" :style="{ <view
height: 160 + 'rpx', class="activeItem"
width: `${activeList?.length === 1 :style="{
? '100%' height: 160 + 'rpx',
: activeList?.length === 2 width: `${
? 'calc((100% - 16rpx) / 2)' activeList?.length === 1
: i === 0 ? '100%'
? '100%' : activeList?.length === 2
: 'calc((100% - 16rpx) / 2)' ? 'calc((100% - 16rpx) / 2)'
}`, : i === 0
}" v-for="(v, i) in activeList" :key="i" @click="go(v)"> ? '100%'
<image :src="sheep.$url.cdn(v.bannerImage)" mode="scaleToFill" /> : 'calc((100% - 16rpx) / 2)'
</view> }`,
</view> }"
</view> v-for="(v, i) in activeList"
<view class="goodsIndex"> :key="i"
<goods :list="tagList" v-if="tagList?.length" /> @click="go(v)"
</view> >
</view> <image :src="sheep.$url.cdn(v.bannerImage)" mode="scaleToFill" />
</s-layout> </view>
</view>
</view>
<view class="goodsIndex">
<goods :list="tagList" v-if="tagList?.length" />
</view>
</view>
</view>
</s-layout>
</template> </template>
<script setup> <script setup>
import { import { ref, computed } from 'vue';
ref, import { onLoad, onPullDownRefresh } from '@dcloudio/uni-app';
computed import goods from '@/components/goods/goods.vue';
} from 'vue'; import sheep from '@/sheep';
import { import $share from '@/sheep/platform/share';
onLoad, import * as api from '@/sheep/api/index/index';
onPullDownRefresh let template = ref({
} from '@dcloudio/uni-app'; page: {
import goods from '@/components/goods/goods.vue'; backgroundColor: '#F2F4F7',
import sheep from '@/sheep'; padding: '0 32rpx',
import $share from '@/sheep/platform/share'; boxSiziong: 'border-box',
import * as api from '@/sheep/api/index/index'; },
let template = ref({ navigationBar: {},
page: { components: [
backgroundColor: '#F2F4F7', {
padding: '0 32rpx', id: 'Banner',
boxSiziong: 'border-box', property: {
}, autoplay: true,
navigationBar: {}, indicator: 'number',
components: [{ interval: 3000,
id: 'Banner', circular: true,
property: { indicatorDots: false,
autoplay: true, indicatorColor: '#D6D6D6', //点颜色
indicator: 'number', indicatorActiveColor: '#FE4246', //当前点颜色
interval: 3000, items: [],
circular: true, style: {
indicatorDots: false, bgType: 'color',
indicatorColor: '#D6D6D6', //点颜色 bgColor: '#fff',
indicatorActiveColor: '#FE4246', //当前点颜色 margin: '12rpx 0rpx',
items: [], marginBottom: '42rpx',
style: { borderRadius: '24rpx',
bgType: 'color', height: '240rpx',
bgColor: '#fff', },
margin: '12rpx 0rpx', bgColor: '',
marginBottom: '42rpx', bgType: 'color',
borderRadius: '24rpx', marginBottom: 8,
height: '240rpx', type: 'default',
}, },
bgColor: '', },
bgType: 'color', ],
marginBottom: 8, });
type: 'default', let nav = ref([
}, {
},], icon: 'i1.png',
}); title: '大健康',
let nav = ref([ url: '',
{ },
icon: 'i1.png', {
title: '大健康', icon: 'i2.png',
url: '', title: '大农业',
}, url: '',
{ },
icon: 'i2.png', {
title: '大农业', icon: 'i3.png',
url: '', title: '大文旅',
}, url: '',
{ },
icon: 'i3.png', {
title: '大文旅', icon: 'i4.png',
url: '', title: '本地生活',
}, url: '',
{ },
icon: 'i4.png', {
title: '本地生活', icon: 'i5.png',
url: '', title: '数据处理',
}, url: '',
{ },
icon: 'i5.png', {
title: '数据处理', icon: 'i6.png',
url: '', title: '跨境电商',
}, url: '',
{ },
icon: 'i6.png', ]);
title: '跨境电商',
url: '',
},
]);
const getBanner = () => { const getBanner = () => {
api.getbannerlist({ api
position: 1, .getbannerlist({
}).then((res) => { position: 1,
let data = res.data; })
template.value.components[0].property.items = data; .then((res) => {
}); let data = res.data;
}; template.value.components[0].property.items = data;
});
};
// 商品标签列表 // 商品标签列表
let tagList = ref([]); let tagList = ref([]);
const getproducttaglist = () => { const getproducttaglist = () => {
api.getproducttaglist({ api
categoryId: 1, .getproducttaglist({
}).then((res) => { categoryId: 1,
tagList.value = res.data; })
}); .then((res) => {
}; tagList.value = res.data;
// 消息通知 });
let informText = ref(''); };
const getnotification = () => { // 消息通知
api.getnotification({}).then((res) => { let informText = ref('');
if (res?.code === 0) { const getnotification = () => {
let data = res.data; api.getnotification({}).then((res) => {
if (!data?.length) return; if (res?.code === 0) {
// 拼接文案content let data = res.data;
informText.value = data.map((item) => item.content).join(' '); if (!data?.length) return;
} // 拼接文案content
}); informText.value = data.map((item) => item.content).join(' ');
}; }
// 活动banner });
let activeList = ref([]); };
// 列数 // 活动banner
let activeCol = ref(2); let activeList = ref([]);
const getappbanner = () => { // 列数
api.getappbanner({}).then((res) => { let activeCol = ref(2);
if (res.data) { const getappbanner = () => {
activeList.value = res.data.list; api.getappbanner({}).then((res) => {
activeCol.value = res.data.bannerDisplayNum; if (res.data) {
} activeList.value = res.data.list;
}); activeCol.value = res.data.bannerDisplayNum;
}; }
const getData = () => { });
// banner };
getBanner(); const getData = () => {
// 标签列表 // banner
getproducttaglist(); getBanner();
getnotification(); // 标签列表
getappbanner(); getproducttaglist();
}; getnotification();
onLoad((options) => { getappbanner();
getData(); };
// #ifdef MP onLoad((options) => {
// 小程序识别二维码 getData();
if (options.scene) { // #ifdef MP
const sceneParams = decodeURIComponent(options.scene).split('='); // 小程序识别二维码
options[sceneParams[0]] = sceneParams[1]; if (options.scene) {
} const sceneParams = decodeURIComponent(options.scene).split('=');
// #endif options[sceneParams[0]] = sceneParams[1];
}
// #endif
// 预览模板 // 预览模板
// if (options.templateId) { // if (options.templateId) {
// sheep.$store('app').init(options.templateId); // sheep.$store('app').init(options.templateId);
// } // }
// 解析分享信息 // 解析分享信息
if (options.spm) { if (options.spm) {
$share.decryptSpm(options.spm); $share.decryptSpm(options.spm);
} }
// 进入指定页面(完整页面路径) // 进入指定页面(完整页面路径)
if (options.page) { if (options.page) {
sheep.$router.go(decodeURIComponent(options.page)); sheep.$router.go(decodeURIComponent(options.page));
} }
}); });
//跳转浏览器 //跳转浏览器
const openExternal = (url) => { const openExternal = (url) => {
if (!url) return; if (!url) return;
if (typeof plus !== 'undefined' && plus.runtime && typeof plus.runtime.openURL === 'function') { if (typeof plus !== 'undefined' && plus.runtime && typeof plus.runtime.openURL === 'function') {
plus.runtime.openURL(url); plus.runtime.openURL(url);
return; return;
} }
if (typeof window !== 'undefined' && typeof window.open === 'function') { if (typeof window !== 'undefined' && typeof window.open === 'function') {
window.open(url, '_blank'); window.open(url, '_blank');
return; return;
} }
}; };
const go = (e) => { const go = (e) => {
// console.log(e); // console.log(e);
if (!e.linkUrl) { if (!e.linkUrl) {
uni.showToast({ uni.showToast({
title: '功能开发中, 敬请期待', title: '功能开发中, 敬请期待',
icon: 'none', icon: 'none',
}); });
return; return;
} else if (e.title === '华贸专区') { } else if (e.title === '华贸专区') {
openExternal(e.linkUrl); openExternal(e.linkUrl);
} else { } else {
uni.navigateTo({ uni.navigateTo({
url: e.linkUrl, url: e.linkUrl,
}); });
} }
}; };
const goAiStore = () => { const goAiStore = () => {
uni.navigateTo({ uni.navigateTo({
url: '/pages/index/aiStore', url: '/pages/index/aiStore',
}); });
}; };
// 下拉刷新 const goSearch = () => {
onPullDownRefresh(() => { sheep.$router.go('/pages/public/search');
// sheep.$store('app').init(); };
getData(); const goNotice = () => {
setTimeout(function () { uni.showToast({
uni.stopPullDownRefresh(); title: '功能开发中, 敬请期待',
}, 1000); icon: 'none',
}); });
};
// 下拉刷新
onPullDownRefresh(() => {
// sheep.$store('app').init();
getData();
setTimeout(function () {
uni.stopPullDownRefresh();
}, 1000);
});
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.pages { .pages {
padding: 0 32rpx; padding: 0 32rpx;
box-sizing: border-box; box-sizing: border-box;
} }
.noticeBar { .noticeBar {
background-color: #fff; background-color: #fff;
border-radius: 12rpx; border-radius: 12rpx;
overflow: hidden; overflow: hidden;
padding-left: 12rpx; padding-left: 12rpx;
box-sizing: border-box; box-sizing: border-box;
} }
.noticeImg { .noticeImg {
width: 52rpx; width: 52rpx;
height: 52rpx; height: 52rpx;
} }
.ai-store-entry { .ai-store-entry {
padding: 24rpx 28rpx; padding: 24rpx 28rpx;
margin-bottom: 22rpx; margin-bottom: 22rpx;
border-radius: 24rpx; border-radius: 24rpx;
font-size: 28rpx; font-size: 28rpx;
font-weight: 600; font-weight: 600;
color: #333333; color: #333333;
} }
:deep(.uni-noticebar) { :deep(.uni-noticebar) {
height: 92rpx; height: 92rpx;
border-radius: 12rpx; border-radius: 12rpx;
overflow: hidden; overflow: hidden;
margin: 0; margin: 0;
font-weight: 500; font-weight: 500;
} }
.navList { .navList {
margin-top: 40rpx; margin-top: 40rpx;
margin-bottom: 52rpx; margin-bottom: 52rpx;
.navItem { .navItem {
width: 120rpx; width: 120rpx;
} }
.navImg { .navImg {
width: 84rpx; width: 84rpx;
height: 84rpx; height: 84rpx;
margin-bottom: 12rpx; margin-bottom: 12rpx;
} }
} }
/* .noticeBar{ /* .noticeBar{
border-radius: 12rpx; border-radius: 12rpx;
overflow: hidden; overflow: hidden;
} */ } */
.activeList { .activeList {
.activeItem { .activeItem {
// width: calc((100% - 10rpx) / 2 - 10rpx); // width: calc((100% - 10rpx) / 2 - 10rpx);
margin-bottom: 16rpx; margin-bottom: 16rpx;
image { image {
width: 100%; width: 100%;
height: 100%; height: 100%;
}
}
}
.pagesIndex {
position: relative;
padding-top: 470rpx;
// background: linear-gradient(135deg, #2c8cfa 0%, #3d5efb 100%);
background-image: url("../../static/index/index_bg.png");
background-size: 100% auto;
background-repeat: no-repeat;
background-position: top center;
.pageContent{
border-radius: 20rpx 20rpx 0 0;
position: relative;
padding-top: 50rpx;
background: #fff;
} }
} }
} .index-notice-btn {
position: absolute;
.pagesIndex { top: 60rpx;
position: relative; right: 52rpx;
} width: 44rpx;
height: 44rpx;
background-image: url('/static/icon/ notice.png');
background-size: 100% 100%;
background-repeat: no-repeat;
background-position: center;
z-index: 20;
}
.floating-search-wrap {
position: absolute;
top: -50rpx;
left: 0;
width: 100%;
padding: 0 32rpx;
box-sizing: border-box;
z-index: 10;
}
.floating-search {
height: 88rpx;
width: 100%;
background: #ffffff;
border-radius: 88rpx;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 14rpx 0 22rpx;
box-sizing: border-box;
box-shadow: 0 8rpx 22rpx rgba(38, 107, 246, 0.55);
}
.floating-search-left {
display: flex;
align-items: center;
min-width: 0;
}
.floating-search-dot {
width: 28rpx;
height: 28rpx;
border-radius: 28rpx;
border: 4rpx solid #ffffff;
background: #ffffff;
box-sizing: border-box;
flex-shrink: 0;
}
.floating-search-placeholder {
margin-left: 16rpx;
color: #b8bcc6;
font-size: 28rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.floating-search-btn {
width: 64rpx;
height: 64rpx;
border-radius: 64rpx;
padding: 0 20rpx;
background: linear-gradient(135deg, #2c8cfa 0%, #3d5efb 100%);
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.floating-search-icon_fff {
width: 42rpx;
height: 42rpx;
filter: brightness(0) invert(1);
}
.floating-search-icon_333 {
width: 32rpx;
height: 32rpx;
}
</style> </style>
+3 -2
View File
@@ -104,10 +104,11 @@
</view> </view>
</view> </view>
<view class="h_150" style="background-color: #f2f4f7;"/> <cardTabber path="/pages/index/user" placeholder />
</template> </template>
<script setup lang="ts"> <script setup>
import sheep from '@/sheep'; import sheep from '@/sheep';
import cardTabber from '@/components/card_tabber/card_tabber.vue';
import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue'; import { ref, reactive, onMounted, onUnmounted, getCurrentInstance, watch, nextTick } from 'vue';
import { onShow } from '@dcloudio/uni-app'; import { onShow } from '@dcloudio/uni-app';
import { getWallet } from '@/sheep/api/home/pay'; import { getWallet } from '@/sheep/api/home/pay';
+87 -5
View File
@@ -7,6 +7,8 @@
v-if="navbar === 'normal'" v-if="navbar === 'normal'"
:title="title" :title="title"
:showLeftButton="showLeftButton" :showLeftButton="showLeftButton"
:bg="navBarColors.bg"
:color="navBarColors.color"
@clickLeft="onClickLeft" @clickLeft="onClickLeft"
:index="props.index" :index="props.index"
/> />
@@ -14,6 +16,10 @@
v-if="navbar === 'inner'" v-if="navbar === 'inner'"
:title="title" :title="title"
:showLeftButton="showLeftButton" :showLeftButton="showLeftButton"
:bg="navBarColors.bg"
:color="navBarColors.color"
:scrollbg="navBarColors.scrollbg"
:scrollColor="navBarColors.scrollColor"
@clickLeft="onClickLeft" @clickLeft="onClickLeft"
:index="props.index" :index="props.index"
/> />
@@ -21,13 +27,17 @@
v-if="navbar === 'transparent'" v-if="navbar === 'transparent'"
:title="title" :title="title"
:showLeftButton="showLeftButton" :showLeftButton="showLeftButton"
:bg="navBarColors.bg"
:color="navBarColors.color"
:scrollbg="navBarColors.scrollbg"
:scrollColor="navBarColors.scrollColor"
@clickLeft="onClickLeft" @clickLeft="onClickLeft"
:index="props.index" :index="props.index"
/> />
<!-- 页面内容插槽 --> <!-- 页面内容插槽 -->
<!-- :style="{ paddingTop: paddingTop + 'px' }" --> <!-- :style="{ paddingTop: paddingTop + 'px' }" -->
<view class="pageCon" :style="{ paddingTop: paddingTop + 'px' }"> <view class="pageCon" :style="pageConStyle">
<!-- <view class="transparent_bg" style="z-index: 100;"> <!-- <view class="transparent_bg" style="z-index: 100;">
<image src="/static/transparent_bg.png" /> <image src="/static/transparent_bg.png" />
</view> --> </view> -->
@@ -40,16 +50,21 @@
<!-- 全局快捷入口 --> <!-- 全局快捷入口 -->
<s-menu-tools /> <s-menu-tools />
</view> </view>
<cardTabber v-if="props.tabbar" :path="tabbarPath" />
</view> </view>
</template> </template>
<script setup lang="ts"> <script setup>
import { getCurrentInstance, ref, computed } from 'vue'; import { getCurrentInstance, ref, computed, watch } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import innerNavbar from '@/components/card_navbar/inner-navbar'; import innerNavbar from '@/components/card_navbar/inner-navbar';
import cardNavbar from '@/components/card_navbar/card_navbar'; import cardNavbar from '@/components/card_navbar/card_navbar';
import transparentNavbar from '@/components/card_navbar/transparent_navbar'; import transparentNavbar from '@/components/card_navbar/transparent_navbar';
import cardTabber from '@/components/card_tabber/card_tabber.vue';
import sheep from '@/sheep'; import sheep from '@/sheep';
const { proxy } = getCurrentInstance() as any; const emits = defineEmits(['onClickLeft']);
const instance = getCurrentInstance();
const proxy = instance?.proxy;
const props = defineProps({ const props = defineProps({
title: { title: {
type: String, type: String,
@@ -126,6 +141,10 @@
type: String, type: String,
default: '2', default: '2',
}, },
navPreset: {
type: String,
default: '',
},
index: { index: {
type: Number, type: Number,
default: 0, default: 0,
@@ -140,6 +159,36 @@
let paddingTop = ref(); let paddingTop = ref();
paddingTop.value = statusBarHeight + 44; paddingTop.value = statusBarHeight + 44;
const tabbarPath = ref('');
const normalizePath = (p) => {
if (!p) return '';
return p.startsWith('/') ? p : `/${p}`;
};
const updateTabbarPath = () => {
if (typeof props.tabbar === 'string' && props.tabbar) {
tabbarPath.value = normalizePath(props.tabbar);
return;
}
const pages = getCurrentPages?.() || [];
const current = pages[pages.length - 1];
tabbarPath.value = normalizePath(current?.route || '');
};
onShow(() => updateTabbarPath());
watch(() => props.tabbar, () => updateTabbarPath(), { immediate: true });
const pageConStyle = computed(() => {
const style = {
paddingTop: paddingTop.value + 'px',
};
if (props.tabbar) {
style.paddingBottom = `calc(${uni.upx2px(100)}px + env(safe-area-inset-bottom))`;
}
return style;
});
const bgMain = computed(() => { const bgMain = computed(() => {
return { return {
background: `${props.bgStyle.backgroundColor || props.bgStyle.color} url(${sheep.$url.cdn( background: `${props.bgStyle.backgroundColor || props.bgStyle.color} url(${sheep.$url.cdn(
@@ -147,9 +196,42 @@
)}) no-repeat top center / 100% auto`, )}) no-repeat top center / 100% auto`,
}; };
}); });
const navBarColors = computed(() => {
if (props.navPreset === 'light') {
return {
bg: '#ffffff',
color: '#333333',
scrollbg: '#ffffff',
scrollColor: '#333333',
};
}
if (props.navPreset === 'transparent') {
return {
bg: 'transparent',
color: '#333333',
scrollbg: '#ffffff',
scrollColor: '#333333',
};
}
if (props.navPreset === 'dark') {
return {
bg: '#000000',
color: '#ffffff',
scrollbg: '#000000',
scrollColor: '#ffffff',
};
}
return {
bg: undefined,
color: undefined,
scrollbg: undefined,
scrollColor: undefined,
};
});
const onClickLeft = () => { const onClickLeft = () => {
console.log('返回2'); console.log('返回2');
proxy.$emit('onClickLeft'); emits('onClickLeft');
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
+9 -2
View File
@@ -6,6 +6,7 @@
:bgStyle="{ color: props.color }" :bgStyle="{ color: props.color }"
:showLeftButton="props.showLeftButton" :showLeftButton="props.showLeftButton"
:goLeft="props.goLeft" :goLeft="props.goLeft"
:tabbar="props.tabbar"
@onClickLeft="onClickLeft" @onClickLeft="onClickLeft"
> >
<!-- <Agreement /> --> <!-- <Agreement /> -->
@@ -24,7 +25,7 @@
</view> </view>
</s-layout> </s-layout>
</template> </template>
<script setup lang="ts"> <script setup>
// import Agreement from '@/components/agreement.vue'; // import Agreement from '@/components/agreement.vue';
import { import {
ref, ref,
@@ -71,16 +72,22 @@
type: String, type: String,
default: 'inner', default: 'inner',
}, },
tabbar: {
type: [String, Boolean],
default: '',
},
}); });
let height = ref(0); let height = ref(0);
let sysInfo = uni.getSystemInfoSync(); let sysInfo = uni.getSystemInfoSync();
const windowHeight = sysInfo.windowHeight; const windowHeight = sysInfo.windowHeight;
const safeBottom = sysInfo.safeAreaInsets?.bottom || 0;
watch( watch(
() => [props.height, props.heightShow], () => [props.height, props.heightShow],
(val) => { (val) => {
if (!props.height) { if (!props.height) {
if (!props.heightShow) { if (!props.heightShow) {
height.value = windowHeight - sysInfo.statusBarHeight - uni.upx2px(88); const tabbarHeight = props.tabbar ? uni.upx2px(100) + safeBottom : 0;
height.value = windowHeight - sysInfo.statusBarHeight - uni.upx2px(88) - tabbarHeight;
} }
} else { } else {
height.value = props.height; height.value = props.height;
+3
View File
@@ -72,6 +72,9 @@ const _go = (
if (TABBAR.includes(page)) { if (TABBAR.includes(page)) {
uni.switchTab({ uni.switchTab({
url, url,
fail: () => {
uni.reLaunch({ url });
},
}); });
return; return;
} }
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 542 KiB

@@ -440,7 +440,12 @@ export default {
url: href, url: href,
fail () { fail () {
uni.switchTab({ uni.switchTab({
url: href url: href,
fail () {
uni.reLaunch({
url: href
})
}
}) })
} }
}) })
@@ -365,7 +365,12 @@ export default {
fail () { fail () {
uni.switchTab({ uni.switchTab({
url: href, url: href,
fail () { } fail () {
uni.reLaunch({
url: href,
fail () { }
})
}
}) })
} }
}) })
@@ -584,4 +589,4 @@ export default {
height: 225px; height: 225px;
} }
/* #endif */ /* #endif */
</style> </style>
@@ -271,7 +271,11 @@ export default {
uni.reLaunch(callback); uni.reLaunch(callback);
break; break;
case 'switchTab': case 'switchTab':
uni.switchTab(callback); uni.switchTab(Object.assign({}, callback, {
fail: () => {
uni.reLaunch(callback);
}
}));
break; break;
default: default:
uni.navigateTo(callback); uni.navigateTo(callback);