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