uniapp【优化】: 分享海报以及头部问题

This commit is contained in:
15093570141
2024-10-24 12:14:04 +08:00
36 changed files with 217 additions and 146 deletions

View File

@@ -28,7 +28,7 @@
mode : string,
title : string,
handleCustomRouteJump : () => void | null,
placeholder:boolean;
placeholder : boolean;
}>(), {
isBack: true,
bgColor: '#eef2f6',
@@ -36,7 +36,7 @@
mode: 'center',
title: '',
handleCustomRouteJump: null,
placeholder:true,
placeholder: true,
});
const hanlderBack = () => {

View File

@@ -79,6 +79,7 @@
}
},
"mp-alipay" : {
"appid" : "2021004107611929",
"usingComponents" : true
},
"mp-baidu" : {

View File

@@ -1,5 +1,6 @@
<template>
<coreshop-page :isBack="false" bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom needLoadingPage :loadingPage="loading">
<coreshop-page :isBack="false" bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom
needLoadingPage :loadingPage="loading">
<view class="layout-classify-page">
<!-- #ifndef MP-ALIPAY -->
<uv-navbar bgColor="#EEF3F7" :height="menuButtonHeight+'px'">

View File

@@ -1,5 +1,6 @@
<template>
<coreshop-page bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" :placeholder="false" showLoginModalDom needLoadingPage :loadingPage="loading">
<coreshop-page bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" :placeholder="false" showLoginModalDom
needLoadingPage :loadingPage="loading">
<view class="goods-detail">
<!-- 商品详情 -->
<GoodsDetail :goodsId="state.goodsDetailData?.id" :goodsDetailData="state.goodsDetailData"
@@ -136,16 +137,16 @@
return item;
});
}
/** 获取分享url */
/** 获取分享url */
state.shareUrl = await getShareUrl({
client: ShareClientEnum.wxMiNiProgram,
url: shareUrl,
type: ShareModelEnum.url,
page: ShareEnum.goods,
params: { goodsId: goodsDetail.data.id, }
})
params: { goodsId: goodsDetail.data.id, }
})
/** 如果用户登录,获取购物车数量 */
if (uni.getStorageSync(UserToken)) {
await getCartNum();

View File

@@ -1,5 +1,6 @@
<template>
<coreshop-page :isBack="false" bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom needLoadingPage :loadingPage="loading">
<coreshop-page :isBack="false" bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom
needLoadingPage :loadingPage="loading">
<view class="layout-home-page page-bg">
<image class="home-bg" :src="handleStaticResources('/static/images/home-bg.jpg')"></image>
<uv-navbar :title="shopConfigStore.config?.shopName"
@@ -64,7 +65,6 @@
/** 触发自定义onshow事件让后代组件监听页面是都进入 */
uni.$emit(onHomePageShow);
})
onPullDownRefresh(async () => {
await queryHomePageConfig();
uni.stopPullDownRefresh();

View File

@@ -2,16 +2,16 @@
position: relative;
.memeber-bg {
display: block;
width: 100%;
height: 600rpx;
width: 100%;
height: 600rpx;
}
}
.head-box {
position: absolute;
position: absolute;
bottom: 12rpx;
left: 0;
width: 100%;
width: 100%;
.user-info {
display: flex;
align-items: center;

View File

@@ -1,7 +1,7 @@
<template>
<coreshop-page :title="state.isScrollToTop ? '' :userInfoStore.userInfo?.nickName" :placeholder="false" titleColor="#fff"
mode="left" bgColor="#d33123" :isShowStatusBarHeight="false"
:isBack="false" showLoginModalDom>
<coreshop-page :title="state.isScrollToTop ? '' :userInfoStore.userInfo?.nickName" :placeholder="false"
titleColor="#fff" mode="left" bgColor="#d33123" :isShowStatusBarHeight="false" :isBack="false"
showLoginModalDom>
<view class="layout-member-page">
<view class="member-head">
<image class="memeber-bg" src="/static/images/member/bg.png"></image>
@@ -164,8 +164,8 @@
<script setup lang="ts">
import { reactive } from 'vue';
import { onPageScroll, onShow ,onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
import { handleStaticResources, handleRouteNavigateTo, handleShowToast, handleRouteSwitchTab, hanldeShowModal ,getDefaultShareData} from '@/core/utils';
import { onPageScroll, onShow, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
import { handleStaticResources, handleRouteNavigateTo, handleShowToast, handleRouteSwitchTab, hanldeShowModal, getDefaultShareData } from '@/core/utils';
import { queryUserInfo, queryOrderStatusNum, queryUserIsClerk, queryDistributionInfo, queryAgentInfo, queryShopConfigV2 } from '@/core/api';
import type { Response, MemberOrderType, UserInfoType, UserIsClerkType, MemberServiceType, ShopConfigType } from '@/core/models';
import { useShopConfigStore, useUserInfoStore, useLoginStore } from '@/core/store';
@@ -322,7 +322,7 @@
handleRouteSwitchTab(RouteSwitchTabEnum.home)
}, 1000)
})
}
}
}
/** 注销登录 */
@@ -335,9 +335,9 @@
userInfoStore.setUserInfo({});
handleRouteSwitchTab(RouteSwitchTabEnum.home)
}
})
})
}
/** 分享 */
onShareAppMessage(() => {
return {

View File

@@ -74,7 +74,7 @@
import GoodsDetailRecommend from '@/pages/components/goods-detail/components/goods-detail-recommend/goods-detail-recommend.vue';
import GoodsDetailSkuPopup from '@/pages/components/goods-detail/components/goods-detail-sku/goods-detail-sku.vue';
import GoodsDetailBottomTabbar from '@/pages/components/goods-detail/components/goods-detail-bottom-tabbar/goods-detail-bottom-tabbar.vue';
import { useLoadingFn, useSystemInfo } from '@/core/hooks';
import { useLoadingFn } from '@/core/hooks';
interface QueryParams {
id : number;
}
@@ -85,8 +85,6 @@
/** 购物车store */
const cartStore = useCartStore();
const { statusBarHeight } = useSystemInfo();
const state = reactive<{
goodsDetailData : any,
swiperBanner : Array<string>;

View File

@@ -84,7 +84,7 @@
import GoodsDetailRecommend from '@/pages/components/goods-detail/components/goods-detail-recommend/goods-detail-recommend.vue';
import GoodsDetailSkuPopup from '@/pages/components/goods-detail/components/goods-detail-sku/goods-detail-sku.vue';
import GoodsDetailBottomTabbar from '@/pages/components/goods-detail/components/goods-detail-bottom-tabbar/goods-detail-bottom-tabbar.vue';
import { useLoadingFn, useSystemInfo } from '@/core/hooks';
import { useLoadingFn } from '@/core/hooks';
interface QueryParams {
id : number;
@@ -97,8 +97,6 @@
/** 获取购物车数据 */
const cartStore = useCartStore();
const { statusBarHeight } = useSystemInfo();
const state = reactive<{
id : number;
goodsDetailData : any,
@@ -185,7 +183,6 @@
if (uni.getStorageSync(UserToken)) {
getCartNum();
}
state.shareUrl = await getShareUrl({
client: ShareClientEnum.wxMiNiProgram,
url: shareUrl,
@@ -291,7 +288,7 @@
handleShowToast(addCart.msg);
}
}
/** 分享 */
onShareAppMessage(() => {
return {

View File

@@ -63,7 +63,7 @@
<script setup lang="ts">
import { reactive, ref } from 'vue';
import { onLoad, onShareAppMessage, onShareTimeline, onPullDownRefresh } from '@dcloudio/uni-app';
import { queryActivityDetial, queryCartNum, queryShare, queryAddCart } from '@/core/api';
import { queryActivityDetial, queryCartNum, queryAddCart } from '@/core/api';
import { PaymentTypeEnum, ShareClientEnum, ShareModelEnum, ShareEnum } from '@/core/enum';
import type { Response } from '@/core/models';
import { UserToken, shareUrl } from '@/core/consts'
@@ -74,7 +74,7 @@
import GoodsDetailRecommend from '@/pages/components/goods-detail/components/goods-detail-recommend/goods-detail-recommend.vue';
import GoodsDetailSkuPopup from '@/pages/components/goods-detail/components/goods-detail-sku/goods-detail-sku.vue';
import GoodsDetailBottomTabbar from '@/pages/components/goods-detail/components/goods-detail-bottom-tabbar/goods-detail-bottom-tabbar.vue';
import { useLoadingFn, useSystemInfo } from '@/core/hooks';
import { useLoadingFn } from '@/core/hooks';
interface QueryParams {
id : number;
@@ -85,8 +85,6 @@
const cartStore = useCartStore();
const { statusBarHeight } = useSystemInfo();
const state = reactive<{
goodsDetailData : any,
swiperBanner : Array<string>;

View File

@@ -33,24 +33,24 @@
</template>
<script setup lang="ts">
import { onShow,onPageScroll, onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
import { onShow, onPageScroll, onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
import { reactive } from 'vue';
import { queryPageConfig, queryUserInfo } from '@/core/api';
import type { Response, PageConfigType, PageConfigItemsType, UserInfoType } from '@/core/models';
import CustomPage from '@/pages/components/custom-page/index.vue';
import HomeAdpop from '@/pages/components/custom-page/components/home-adpop/home-adpop.vue';
import { handleStaticResources, getDefaultShareData, getShareUrl } from '@/core/utils';
import { UserToken, shareUrl,onHomePageShow } from '@/core/consts';
import { handleStaticResources, getDefaultShareData, getShareUrl } from '@/core/utils';
import { UserToken, shareUrl, onHomePageShow } from '@/core/consts';
import { useUserInfoStore } from '@/core/store';
import { ShareClientEnum, ShareModelEnum, ShareEnum } from '@/core/enum';
interface QueryParams {
code : string;
}
/** 获取 用户数据 */
const userInfoStore = useUserInfoStore();
const state = reactive<{
coreshopData : Array<PageConfigItemsType>;
isScrollTop : boolean;
@@ -60,12 +60,12 @@
isScrollTop: false,
shareUrl: "",
})
onShow(() => {
/** 触发自定义onshow事件让后代组件监听页面是都进入 */
uni.$emit(onHomePageShow);
})
onPageScroll((e : any) => {
state.isScrollTop = e.scrollTop > 10;
})