mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 17:53:25 +08:00
uniapp【新增】: 新增页面分享和修复状态栏高度
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<uv-navbar :bgColor="props.bgColor">
|
||||
<uv-navbar :bgColor="props.bgColor" placeholder :height="menuButtonHeight+'px'">
|
||||
<template #left>
|
||||
<view class="page-back">
|
||||
<image v-if="props.isBack" @click="hanlderBack" class="back"
|
||||
@@ -15,7 +15,9 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useSystemInfo } from '@/core/hooks';
|
||||
import { handleStaticResources } from '@/core/utils';
|
||||
const { menuButtonHeight } = useSystemInfo();
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
isBack : boolean,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<coreshop-navbar :isBack="props.isBack" :bgColor="props.bgColor" :mode="props.mode" :title="props.title"
|
||||
:titleColor="props.titleColor" :handleCustomRouteJump="props.handleCustomRouteJump"></coreshop-navbar>
|
||||
<view class="layout-page-content"
|
||||
:style="{ 'padding-top': `${props.isShowStatusBarHeight ? statusBarHeight : 0}px`, ...props.contentStyle }">
|
||||
:style="{ ...props.contentStyle }">
|
||||
<slot></slot>
|
||||
</view>
|
||||
<template v-if="props.showLoginModalDom">
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
skeletonLoading : boolean;
|
||||
}>(), {
|
||||
isBack: true,
|
||||
bgColor: '#EEF3F7',
|
||||
bgColor: '#D33123',
|
||||
titleColor: '#000',
|
||||
mode: 'center',
|
||||
title: '',
|
||||
|
||||
@@ -4,16 +4,20 @@ export const useSystemInfo = () => {
|
||||
const state = reactive<{
|
||||
systemInfo : any;
|
||||
statusBarHeight : number;
|
||||
menuButtonHeight : number;
|
||||
}>({
|
||||
systemInfo: {},
|
||||
statusBarHeight: 0,
|
||||
menuButtonHeight: 44
|
||||
});
|
||||
|
||||
|
||||
onMounted(async () => {
|
||||
const menuButton = uni.getMenuButtonBoundingClientRect();
|
||||
const systemInfo = await uni.getSystemInfo();
|
||||
state.systemInfo = systemInfo;
|
||||
state.statusBarHeight = systemInfo.statusBarHeight + systemInfo.safeArea.top;
|
||||
state.menuButtonHeight = menuButton.height + (menuButton.top - systemInfo.statusBarHeight) * 2;
|
||||
state.statusBarHeight = systemInfo.statusBarHeight + state.menuButtonHeight;
|
||||
})
|
||||
|
||||
return toRefs(state);
|
||||
|
||||
41
CoreCms.Net.Uni-App/CoreShop/core/utils/handle-share.ts
Normal file
41
CoreCms.Net.Uni-App/CoreShop/core/utils/handle-share.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { ShareClientEnum, ShareModelEnum, ShareEnum } from '@/core/enum';
|
||||
import { UserToken } from '@/core/consts';
|
||||
import { queryShare } from '@/core/api';
|
||||
import { handleShowToast } from '@/core/utils';
|
||||
import { useShopConfigStore } from '@/core/store';
|
||||
|
||||
interface RequestParam {
|
||||
client : ShareClientEnum,
|
||||
url : string,
|
||||
type : ShareModelEnum,
|
||||
page : ShareEnum,
|
||||
params ?: any,
|
||||
token ?: string
|
||||
}
|
||||
|
||||
const getDefaultShareData = () => {
|
||||
const shopConfigStore = useShopConfigStore();
|
||||
return {
|
||||
title: shopConfigStore.config?.shopName,
|
||||
imageUrl: shopConfigStore.config?.shopLogo,
|
||||
path: "/pages/home/home"
|
||||
}
|
||||
}
|
||||
|
||||
const getShareUrl = async (requestParam : RequestParam) => {
|
||||
let data : RequestParam = requestParam;
|
||||
if (uni.getStorageSync(UserToken)) {
|
||||
data['token'] = uni.getStorageSync(UserToken)
|
||||
}
|
||||
const share = await queryShare(data);
|
||||
if (share.status) {
|
||||
return share.data;
|
||||
} else {
|
||||
handleShowToast(share.msg);
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
getShareUrl,
|
||||
getDefaultShareData,
|
||||
}
|
||||
@@ -24,3 +24,7 @@ export * from './handle-advertise-detail';
|
||||
|
||||
export * from './uni-promise';
|
||||
export * from './time-format';
|
||||
|
||||
|
||||
/** 处理分享 */
|
||||
export * from './handle-share';
|
||||
@@ -38,7 +38,7 @@
|
||||
}
|
||||
|
||||
.data-box {
|
||||
padding-top: 100rpx;
|
||||
padding-top: 60rpx;
|
||||
|
||||
.item-box {
|
||||
margin-bottom: 30rpx;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<coreshop-navbar :isBack="false" mode="left" title="购物车"> </coreshop-navbar>
|
||||
|
||||
<view class="content-box p-25 page-bg" :style="{ 'padding-top': `${statusBarHeight}px` }">
|
||||
<view class="content-box p-25 page-bg">
|
||||
<view class="cart-box" v-if="state.cartList.length > 0">
|
||||
<view class="all-select" :style="{ 'top': `${statusBarHeight}px` }">
|
||||
<view class="icon-box" @click="hanldeChangeAllSelect">
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</template>
|
||||
</uv-navbar>
|
||||
|
||||
<view class="content-box" :style="{ 'padding-top': `${statusBarHeight}px`, 'height': `${state.height}px` }">
|
||||
<view class="content-box" :style="{'height': `${state.height}px` }">
|
||||
<classifyOne v-if="shopConfigStore.config.cateStyle == GoodsListEnum.one" :data="state.categoriesList">
|
||||
</classifyOne>
|
||||
<classifyTwo v-else-if="shopConfigStore.config.cateStyle == GoodsListEnum.two"
|
||||
|
||||
@@ -51,6 +51,8 @@
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 25rpx;
|
||||
max-height: 500rpx;
|
||||
overflow-y: scroll;
|
||||
.tag {
|
||||
position: relative;
|
||||
font-size: 27rpx;
|
||||
@@ -58,6 +60,7 @@
|
||||
border: 1rpx solid #6e737d;
|
||||
border-radius: 15rpx;
|
||||
text-align: center;
|
||||
height: max-content;
|
||||
.icon-select {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<coreshop-page bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom>
|
||||
<view class=" goods-detail">
|
||||
<view class=" goods-detail" :style="{ 'margin-top': `-${statusBarHeight}px` }">
|
||||
<!-- 商品详情 -->
|
||||
<GoodsDetail :goodsId="state.goodsDetailData?.id" :goodsDetailData="state.goodsDetailData"
|
||||
:swiperBanner="state.swiperBanner" :goodsDetailContent="state.goodsDetailContent"
|
||||
@@ -27,17 +27,18 @@
|
||||
<script setup lang="ts">
|
||||
import { reactive } from 'vue';
|
||||
import { onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
|
||||
import { queryGoodsDetail, queryCartNum, queryShare, queryGoodsDetailByToken, queryPromotionList, queryAddCart, queryUserInfo } from '@/core/api';
|
||||
import { queryGoodsDetail, queryCartNum, queryGoodsDetailByToken, queryPromotionList, queryAddCart } from '@/core/api';
|
||||
import type { Response, GoodsAgentListType, GoodsPromotionType, GoodsSkuListType } from "@/core/models";
|
||||
import { PromotionEnum, AddCartEnum, PaymentTypeEnum, ShareClientEnum, ShareModelEnum, ShareEnum } from '@/core/enum';
|
||||
import { UserToken, shareUrl } from '@/core/consts'
|
||||
import { useCartStore } from '@/core/store';
|
||||
import { handleRouteNavigateTo, handleShowToast } from '@/core/utils';
|
||||
import { handleRouteNavigateTo, handleShowToast, getShareUrl } from '@/core/utils';
|
||||
import GoodsDetail from '@/pages/components/goods-detail/index.vue';
|
||||
import GoodsDetailBottomTabbar from '@/pages/components/goods-detail/components/goods-detail-bottom-tabbar/goods-detail-bottom-tabbar.vue';
|
||||
import GoodsDetailSkuPopup from '@/pages/components/goods-detail/components/goods-detail-sku/goods-detail-sku.vue';
|
||||
import GoodsDetailRecommend from '@/pages/components/goods-detail/components/goods-detail-recommend/goods-detail-recommend.vue';
|
||||
import { useLoginStore } from '@/core/store';
|
||||
import { useSystemInfo } from '@/core/hooks';
|
||||
|
||||
interface QueryParams {
|
||||
id : number;
|
||||
@@ -49,6 +50,8 @@
|
||||
/** 购物车store */
|
||||
const _useCartStore = useCartStore();
|
||||
|
||||
const { statusBarHeight } = useSystemInfo();
|
||||
|
||||
const state = reactive<{
|
||||
goodsDetailData : any;
|
||||
swiperBanner : Array<string>;
|
||||
@@ -122,7 +125,13 @@
|
||||
}
|
||||
|
||||
/** 获取分享url */
|
||||
getShareUrl(goodsDetail.data.id);
|
||||
state.shareUrl = await getShareUrl({
|
||||
client: ShareClientEnum.wxMiNiProgram,
|
||||
url: shareUrl,
|
||||
type: ShareModelEnum.url,
|
||||
page: ShareEnum.goods,
|
||||
params: { goodsId: goodsDetail.data.id, }
|
||||
})
|
||||
|
||||
/** 如果用户登录,获取购物车数量 */
|
||||
if (uni.getStorageSync(UserToken)) {
|
||||
@@ -196,26 +205,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取分享url */
|
||||
const getShareUrl = async (goodsId : number) => {
|
||||
let data = {
|
||||
client: ShareClientEnum.wxMiNiProgram,
|
||||
url: shareUrl,
|
||||
type: ShareModelEnum.url,
|
||||
page: ShareEnum.goods,
|
||||
params: { goodsId, }
|
||||
}
|
||||
if (uni.getStorageSync(UserToken)) {
|
||||
data['token'] = uni.getStorageSync(UserToken)
|
||||
}
|
||||
const share = await queryShare(data);
|
||||
if (share.status) {
|
||||
state.shareUrl = share.data
|
||||
} else {
|
||||
handleShowToast(share.msg);
|
||||
}
|
||||
}
|
||||
|
||||
/** 分享 */
|
||||
onShareAppMessage(() => {
|
||||
return {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</template>
|
||||
</uv-navbar>
|
||||
|
||||
<view class="content-box p-25" :style="{ 'padding-top': `${statusBarHeight + 10}px` }">
|
||||
<view class="content-box p-25">
|
||||
<CustomPage ref="homePage" :coreshopData="state.coreshopData"></CustomPage>
|
||||
</view>
|
||||
|
||||
@@ -25,15 +25,16 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, reactive, ref } from 'vue';
|
||||
import { onPageScroll, onShow } from '@dcloudio/uni-app';
|
||||
import { onPageScroll, onShow, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
|
||||
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, handleRouteNavigateTo } from '@/core/utils';
|
||||
import { handleStaticResources, handleRouteNavigateTo, getShareUrl, getDefaultShareData } from '@/core/utils';
|
||||
import { useSystemInfo, useLoadingFn } from '@/core/hooks';
|
||||
import { UserToken, onHomePageShow } from '@/core/consts';
|
||||
import { UserToken, onHomePageShow, shareUrl } from '@/core/consts';
|
||||
import { useUserInfoStore, useShopConfigStore } from '@/core/store';
|
||||
import { ShareClientEnum, ShareModelEnum, ShareEnum } from '@/core/enum';
|
||||
|
||||
/** 获取项目配置 */
|
||||
const shopConfigStore = useShopConfigStore();
|
||||
@@ -52,10 +53,12 @@
|
||||
coreshopData : Array<PageConfigItemsType>;
|
||||
isScrollTop : boolean;
|
||||
showPage : boolean;
|
||||
shareUrl : string;
|
||||
}>({
|
||||
coreshopData: [],
|
||||
isScrollTop: false,
|
||||
showPage: false,
|
||||
shareUrl: "",
|
||||
})
|
||||
|
||||
onShow(() => {
|
||||
@@ -63,11 +66,18 @@
|
||||
uni.$emit(onHomePageShow);
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
onMounted(async () => {
|
||||
handleuQueryPageConfig()
|
||||
if (uni.getStorageSync(UserToken)) {
|
||||
getUserInfo();
|
||||
}
|
||||
|
||||
state.shareUrl = await getShareUrl({
|
||||
client: ShareClientEnum.wxMiNiProgram,
|
||||
url: shareUrl,
|
||||
type: ShareModelEnum.url,
|
||||
page: ShareEnum.index,
|
||||
})
|
||||
})
|
||||
|
||||
async function getPageConfig() {
|
||||
@@ -91,6 +101,22 @@
|
||||
const handleSearch = () => {
|
||||
handleRouteNavigateTo('/pages/search/search')
|
||||
}
|
||||
|
||||
/** 分享 */
|
||||
onShareAppMessage(() => {
|
||||
return {
|
||||
title: getDefaultShareData().title,
|
||||
imageUrl: getDefaultShareData().imageUrl,
|
||||
path: state.shareUrl
|
||||
}
|
||||
});
|
||||
onShareTimeline(() => {
|
||||
return {
|
||||
title: getDefaultShareData().title,
|
||||
imageUrl: getDefaultShareData().imageUrl,
|
||||
path: state.shareUrl
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
position: relative;
|
||||
.memeber-bg{
|
||||
display: block;
|
||||
width: 750rpx;
|
||||
height: 600rpx;
|
||||
width: 100%;
|
||||
height: 400rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.head-box {
|
||||
position: absolute;
|
||||
bottom: 13rpx;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
.user-info {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<coreshop-page :title="state.isScrollToTop ? '' : userInfoStore.userInfo?.nickName || ''" titleColor="#fff"
|
||||
mode="left" :bgColor=" state.isScrollToTop ? 'rgba(0,0,0,0)':'#d33123'" :isShowStatusBarHeight="false"
|
||||
<coreshop-page :title=" userInfoStore.userInfo?.nickName || ''" titleColor="#fff"
|
||||
mode="left" bgColor="#d33123" :isShowStatusBarHeight="false"
|
||||
:isBack="false" showLoginModalDom>
|
||||
<view class="layout-member-page">
|
||||
<view class="member-head">
|
||||
@@ -164,8 +164,8 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive } from 'vue';
|
||||
import { onPageScroll, onShow } from '@dcloudio/uni-app';
|
||||
import { handleStaticResources, handleRouteNavigateTo, handleShowToast, handleRouteSwitchTab, hanldeShowModal } 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';
|
||||
@@ -336,8 +336,23 @@
|
||||
handleRouteSwitchTab(RouteSwitchTabEnum.home)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
/** 分享 */
|
||||
onShareAppMessage(() => {
|
||||
return {
|
||||
title: getDefaultShareData().title,
|
||||
imageUrl: getDefaultShareData().imageUrl,
|
||||
path: 'pages/member/member'
|
||||
}
|
||||
});
|
||||
onShareTimeline(() => {
|
||||
return {
|
||||
title: getDefaultShareData().title,
|
||||
imageUrl: getDefaultShareData().imageUrl,
|
||||
path: 'pages/member/member'
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -449,7 +449,7 @@
|
||||
}
|
||||
|
||||
.btn {
|
||||
width: 200rpx;
|
||||
width: 240rpx;
|
||||
text-align: center;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { handleRouteSwitchTab, handleRouteNavigateTo, handleShowToast } from '@/core/utils';
|
||||
import { handleRouteSwitchTab, handleRouteRedirectTo, handleShowToast } from '@/core/utils';
|
||||
import { queryDeshare } from '@/core/api';
|
||||
import type { Response } from '@/core/models';
|
||||
import { Invitecode } from '@/core/consts';
|
||||
@@ -22,9 +22,11 @@
|
||||
|
||||
const handleShare = async (code : string | number) => {
|
||||
const shareData : Response<any> = await queryDeshare({ code, });
|
||||
console.log('123',shareData)
|
||||
|
||||
if (shareData.status) {
|
||||
uni.setStorageSync(Invitecode, shareData.data?.userShareCode);
|
||||
switch (shareData.data?.page) {
|
||||
switch (Number(shareData.data?.page)) {
|
||||
/** 首页*/
|
||||
case ShareEnum.index:
|
||||
handleRouteSwitchTab();
|
||||
@@ -32,7 +34,7 @@
|
||||
/** 商品详情页*/
|
||||
case ShareEnum.goods:
|
||||
if (shareData.data?.params?.goodsId) {
|
||||
handleRouteNavigateTo(`/pages/goods/detail?id=${shareData.data?.params?.goodsId}`)
|
||||
handleRouteRedirectTo(`/pages/goods/detail?id=${shareData.data?.params?.goodsId}`)
|
||||
} else {
|
||||
handleRouteSwitchTab();
|
||||
}
|
||||
@@ -40,7 +42,7 @@
|
||||
/** 拼团详情页*/
|
||||
case ShareEnum.pinTuan:
|
||||
if (shareData.data?.params?.groupId && shareData.data?.params?.teamId) {
|
||||
handleRouteNavigateTo(`/pages/subpackage/activity/pinTuan/detail/detail?id=${shareData.data?.params?.groupId}&teamId=${shareData.data?.params?.teamId}`)
|
||||
handleRouteRedirectTo(`/pages/subpackage/activity/pinTuan/detail/detail?id=${shareData.data?.params?.groupId}&teamId=${shareData.data?.params?.teamId}`)
|
||||
} else {
|
||||
handleRouteSwitchTab();
|
||||
}
|
||||
@@ -52,7 +54,7 @@
|
||||
/** 文章页面 */
|
||||
case ShareEnum.article:
|
||||
if (shareData.data?.params?.articleId) {
|
||||
handleRouteNavigateTo(`/pages/subpackage/article/category/category?id=${shareData.data?.params?.articleId}&idType=${shareData.data?.params?.articleType}`)
|
||||
handleRouteRedirectTo(`/pages/subpackage/article/category/category?id=${shareData.data?.params?.articleId}&idType=${shareData.data?.params?.articleType}`)
|
||||
} else {
|
||||
handleRouteSwitchTab();
|
||||
}
|
||||
@@ -60,7 +62,7 @@
|
||||
/** 参团页面 */
|
||||
case ShareEnum.addPinTuan:
|
||||
if (shareData.data?.params?.groupId && shareData.data?.params?.teamId) {
|
||||
handleRouteNavigateTo(`/pages/subpackage/activity/pinTuan/detail/detail?id=${shareData.data?.params?.groupId}&teamId=${shareData.data?.params?.teamId}`)
|
||||
handleRouteRedirectTo(`/pages/subpackage/activity/pinTuan/detail/detail?id=${shareData.data?.params?.groupId}&teamId=${shareData.data?.params?.teamId}`)
|
||||
} else {
|
||||
handleRouteSwitchTab();
|
||||
}
|
||||
@@ -68,7 +70,7 @@
|
||||
/** 自定义页面 */
|
||||
case ShareEnum.page:
|
||||
if (shareData.data?.params?.pageCode) {
|
||||
handleRouteNavigateTo(`/pages/subpackage/custom/custom?code=${shareData.data?.params?.pageCode}`)
|
||||
handleRouteRedirectTo(`/pages/subpackage/custom/custom?code=${shareData.data?.params?.pageCode}`)
|
||||
} else {
|
||||
handleRouteSwitchTab();
|
||||
}
|
||||
@@ -76,7 +78,7 @@
|
||||
/** 智能表单 */
|
||||
case ShareEnum.form:
|
||||
if (shareData.data?.params?.id) {
|
||||
handleRouteNavigateTo(`/pages/subpackage/form/detail/detail?id=${shareData.data?.params?.id}`)
|
||||
handleRouteRedirectTo(`/pages/subpackage/form/detail/detail?id=${shareData.data?.params?.id}`)
|
||||
} else {
|
||||
handleRouteSwitchTab();
|
||||
}
|
||||
@@ -84,7 +86,7 @@
|
||||
/** 团购 */
|
||||
case ShareEnum.group:
|
||||
if (shareData.data?.params?.groupId) {
|
||||
handleRouteNavigateTo(`/pages/subpackage/activity/groupBuying/detail/detail?id=${shareData.data?.params?.groupId}`)
|
||||
handleRouteRedirectTo(`/pages/subpackage/activity/groupBuying/detail/detail?id=${shareData.data?.params?.groupId}`)
|
||||
} else {
|
||||
handleRouteSwitchTab();
|
||||
}
|
||||
@@ -92,7 +94,7 @@
|
||||
/** 秒杀 */
|
||||
case ShareEnum.seckill:
|
||||
if (shareData.data?.params?.groupId) {
|
||||
handleRouteNavigateTo(`/pages/subpackage/activity/seckill/detail/detail?id=${shareData.data?.params?.groupId}`)
|
||||
handleRouteRedirectTo(`/pages/subpackage/activity/seckill/detail/detail?id=${shareData.data?.params?.groupId}`)
|
||||
} else {
|
||||
handleRouteSwitchTab();
|
||||
}
|
||||
@@ -104,7 +106,7 @@
|
||||
/** 接龙*/
|
||||
case ShareEnum.solitaire:
|
||||
if (shareData.data?.params?.id) {
|
||||
handleRouteNavigateTo(`/pages/subpackage/activity/solitaire/detail/detail?id=${shareData.data?.params?.id}`)
|
||||
handleRouteRedirectTo(`/pages/subpackage/activity/solitaire/detail/detail?id=${shareData.data?.params?.id}`)
|
||||
} else {
|
||||
handleRouteSwitchTab();
|
||||
}
|
||||
@@ -112,7 +114,7 @@
|
||||
/** 服务商品*/
|
||||
case ShareEnum.serviceGoods:
|
||||
if (shareData.data?.params?.serviceGoodsId) {
|
||||
handleRouteNavigateTo(`/pages/subpackage/serviceGoods/detail/detail?id=${shareData.data?.params?.serviceGoodsId}`)
|
||||
handleRouteRedirectTo(`/pages/subpackage/serviceGoods/detail/detail?id=${shareData.data?.params?.serviceGoodsId}`)
|
||||
} else {
|
||||
handleRouteSwitchTab();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<coreshop-page bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom>
|
||||
<view class="goods-detail">
|
||||
<view class="goods-detail" :style="{ 'margin-top': `-${statusBarHeight}px` }">
|
||||
<!-- 商品详情 -->
|
||||
<GoodsDetail :goodsId="state.goodsDetailData?.id" :goodsDetailData="state.goodsDetailData"
|
||||
:swiperBanner="state.swiperBanner" :spesDesc="state.spesDesc"
|
||||
@@ -63,17 +63,17 @@
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref } from 'vue';
|
||||
import { onLoad, onShareAppMessage, onShareTimeline } 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'
|
||||
import { useCartStore, useLoginStore } from '@/core/store';
|
||||
import { handleShowToast, handleRouteNavigateTo } from '@/core/utils';
|
||||
import { handleShowToast, handleRouteNavigateTo, getShareUrl } from '@/core/utils';
|
||||
import GoodsDetail from '@/pages/components/goods-detail/index.vue';
|
||||
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 } from '@/core/hooks';
|
||||
import { useLoadingFn, useSystemInfo } from '@/core/hooks';
|
||||
interface QueryParams {
|
||||
id : number;
|
||||
}
|
||||
@@ -84,6 +84,8 @@
|
||||
/** 购物车store */
|
||||
const cartStore = useCartStore();
|
||||
|
||||
const { statusBarHeight } = useSystemInfo();
|
||||
|
||||
const state = reactive<{
|
||||
goodsDetailData : any,
|
||||
swiperBanner : Array<string>;
|
||||
@@ -152,7 +154,16 @@
|
||||
if (uni.getStorageSync(UserToken)) {
|
||||
getCartNum();
|
||||
}
|
||||
getShareUrl();
|
||||
|
||||
state.shareUrl = await getShareUrl({
|
||||
client: ShareClientEnum.wxMiNiProgram,
|
||||
url: shareUrl,
|
||||
type: ShareModelEnum.url,
|
||||
page: ShareEnum.group,
|
||||
params: {
|
||||
groupId: state.id
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 获取购物车数量 */
|
||||
@@ -196,28 +207,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取分享url */
|
||||
const getShareUrl = async () => {
|
||||
let data = {
|
||||
client: ShareClientEnum.wxMiNiProgram,
|
||||
url: shareUrl,
|
||||
type: ShareModelEnum.url,
|
||||
page: ShareEnum.group,
|
||||
params: {
|
||||
groupId: state.id
|
||||
}
|
||||
}
|
||||
if (uni.getStorageSync(UserToken)) {
|
||||
data['token'] = uni.getStorageSync(UserToken)
|
||||
}
|
||||
const share = await queryShare(data);
|
||||
if (share.status) {
|
||||
state.shareUrl = share.data
|
||||
} else {
|
||||
handleShowToast(share.msg);
|
||||
}
|
||||
}
|
||||
|
||||
/** 分享 */
|
||||
onShareAppMessage(() => {
|
||||
return {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<coreshop-page bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom>
|
||||
<view class="goods-detail">
|
||||
<view class="goods-detail" :style="{ 'margin-top': `-${statusBarHeight}px` }">
|
||||
<!-- 商品详情 -->
|
||||
<GoodsDetail :goodsId="state.goodsDetailData?.id" :goodsDetailData="state.goodsDetailData"
|
||||
:swiperBanner="state.swiperBanner" :shareType="ShareEnum.pinTuan"
|
||||
@@ -70,20 +70,20 @@
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { onLoad ,onShareAppMessage,onShareTimeline} from '@dcloudio/uni-app';
|
||||
import { queryPinTuanGoodsDetail, queryCartNum, queryAddCart, queryOrderPinTuanTeamInfo } from '@/core/api';
|
||||
import type { Response } from '@/core/models';
|
||||
import { UserToken } from '@/core/consts'
|
||||
import { UserToken,shareUrl } from '@/core/consts'
|
||||
import { useCartStore, useLoginStore } from '@/core/store';
|
||||
import { PaymentTypeEnum, ShareEnum } from '@/core/enum';
|
||||
import { handleRouteNavigateTo, handleShowToast } from '@/core/utils';
|
||||
import { PaymentTypeEnum, ShareEnum,ShareClientEnum,ShareModelEnum } from '@/core/enum';
|
||||
import { handleRouteNavigateTo, handleShowToast ,getShareUrl} from '@/core/utils';
|
||||
import { deepClone } from '@/uni_modules/uv-ui-tools/libs/function/index.js';
|
||||
|
||||
import GoodsDetail from '@/pages/components/goods-detail/index.vue';
|
||||
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 } from '@/core/hooks';
|
||||
import { useLoadingFn,useSystemInfo } from '@/core/hooks';
|
||||
|
||||
interface QueryParams {
|
||||
id : number;
|
||||
@@ -96,6 +96,8 @@
|
||||
/** 获取购物车数据 */
|
||||
const cartStore = useCartStore();
|
||||
|
||||
const { statusBarHeight } = useSystemInfo();
|
||||
|
||||
const state = reactive<{
|
||||
id : number;
|
||||
goodsDetailData : any,
|
||||
@@ -109,6 +111,7 @@
|
||||
isSingleBuy : boolean;
|
||||
btnBuyTitlt : string;
|
||||
teamInfo : any;
|
||||
shareUrl:string;
|
||||
}>({
|
||||
id: 0,
|
||||
goodsDetailData: {},
|
||||
@@ -122,6 +125,7 @@
|
||||
isSingleBuy: true,
|
||||
btnBuyTitlt: "发起拼团",
|
||||
teamInfo: {},
|
||||
shareUrl:"",
|
||||
});
|
||||
|
||||
const loading = ref(false);
|
||||
@@ -129,6 +133,7 @@
|
||||
|
||||
onLoad((query : QueryParams) => {
|
||||
if (query?.teamId) {
|
||||
state.teamId = query?.teamId;
|
||||
state.goodsDetailData = {
|
||||
teamId: query?.teamId
|
||||
};
|
||||
@@ -172,6 +177,18 @@
|
||||
if (uni.getStorageSync(UserToken)) {
|
||||
getCartNum();
|
||||
}
|
||||
|
||||
state.shareUrl = await getShareUrl({
|
||||
client: ShareClientEnum.wxMiNiProgram,
|
||||
url: shareUrl,
|
||||
type: ShareModelEnum.url,
|
||||
page: ShareEnum.pinTuan,
|
||||
params: {
|
||||
groupId: state.id,
|
||||
goodsId: state.goodsDetailData.id,
|
||||
teamId: state.teamId
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 获取通过分享进来的拼团数据 */
|
||||
@@ -266,6 +283,22 @@
|
||||
handleShowToast(addCart.msg);
|
||||
}
|
||||
}
|
||||
|
||||
/** 分享 */
|
||||
onShareAppMessage(() => {
|
||||
return {
|
||||
title: state.goodsDetailData.name,
|
||||
imageUrl: state.goodsDetailData.image,
|
||||
path: state.shareUrl
|
||||
}
|
||||
});
|
||||
onShareTimeline(() => {
|
||||
return {
|
||||
title: state.goodsDetailData.name,
|
||||
imageUrl: state.goodsDetailData.image,
|
||||
path: state.shareUrl
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import './detail.scss';
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
.content-box {
|
||||
position: relative;
|
||||
margin: 25rpx;
|
||||
padding-top: 200rpx;
|
||||
|
||||
.title-box {
|
||||
display: flex;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<coreshop-page bgColor="rgba(0,0,0,0)" :isShowStatusBarHeight="false" showLoginModalDom>
|
||||
<view class="goods-detail">
|
||||
<view class="goods-detail" :style="{ 'margin-top': `-${statusBarHeight}px` }">
|
||||
<!-- 商品详情 -->
|
||||
<GoodsDetail :goodsId="state.goodsDetailData?.id" :goodsDetailData="state.goodsDetailData"
|
||||
:swiperBanner="state.swiperBanner" :spesDesc="state.spesDesc"
|
||||
@@ -62,18 +62,18 @@
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref } from 'vue';
|
||||
import { onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
|
||||
import { queryActivityDetial, queryCartNum, queryShare, queryAddCart, queryUserInfo } from '@/core/api';
|
||||
import { queryActivityDetial, queryCartNum, queryShare, queryAddCart } from '@/core/api';
|
||||
import { PaymentTypeEnum, ShareClientEnum, ShareModelEnum, ShareEnum } from '@/core/enum';
|
||||
import type { Response } from '@/core/models';
|
||||
import { UserToken, shareUrl } from '@/core/consts'
|
||||
import { useCartStore, useLoginStore } from '@/core/store';
|
||||
import { handleShowToast, handleRouteNavigateTo } from '@/core/utils';
|
||||
import { handleShowToast, handleRouteNavigateTo, getShareUrl } from '@/core/utils';
|
||||
|
||||
import GoodsDetail from '@/pages/components/goods-detail/index.vue';
|
||||
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 } from '@/core/hooks';
|
||||
import { useLoadingFn, useSystemInfo } from '@/core/hooks';
|
||||
|
||||
interface QueryParams {
|
||||
id : number;
|
||||
@@ -84,6 +84,8 @@
|
||||
|
||||
const cartStore = useCartStore();
|
||||
|
||||
const { statusBarHeight } = useSystemInfo();
|
||||
|
||||
const state = reactive<{
|
||||
goodsDetailData : any,
|
||||
swiperBanner : Array<string>;
|
||||
@@ -152,7 +154,16 @@
|
||||
if (uni.getStorageSync(UserToken)) {
|
||||
getCartNum();
|
||||
}
|
||||
getShareUrl();
|
||||
|
||||
state.shareUrl = await getShareUrl({
|
||||
client: ShareClientEnum.wxMiNiProgram,
|
||||
url: shareUrl,
|
||||
type: ShareModelEnum.url,
|
||||
page: ShareEnum.seckill,
|
||||
params: {
|
||||
groupId: state.id
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 获取购物车数量 */
|
||||
@@ -196,28 +207,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取分享url */
|
||||
const getShareUrl = async () => {
|
||||
let data = {
|
||||
client: ShareClientEnum.wxMiNiProgram,
|
||||
url: shareUrl,
|
||||
type: ShareModelEnum.url,
|
||||
page: ShareEnum.seckill,
|
||||
params: {
|
||||
groupId: state.id
|
||||
}
|
||||
}
|
||||
if (uni.getStorageSync(UserToken)) {
|
||||
data['token'] = uni.getStorageSync(UserToken)
|
||||
}
|
||||
const share = await queryShare(data);
|
||||
if (share.status) {
|
||||
state.shareUrl = share.data
|
||||
} else {
|
||||
handleShowToast(share.msg);
|
||||
}
|
||||
}
|
||||
|
||||
/** 分享 */
|
||||
onShareAppMessage(() => {
|
||||
return {
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
.layout-seckill-box{
|
||||
padding-top: 80rpx;
|
||||
}
|
||||
.navbar-box {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
@@ -31,8 +34,6 @@
|
||||
}
|
||||
|
||||
.seckill-box {
|
||||
padding-top: 100rpx;
|
||||
|
||||
.card-box {
|
||||
margin-bottom: 35rpx;
|
||||
margin: 25rpx;
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
import type { Response } from '@/core/models';
|
||||
import { UserToken, shareUrl } from '@/core/consts'
|
||||
import { useShopConfigStore, useLoginStore } from '@/core/store';
|
||||
import { handleShowToast, handleRouteNavigateTo } from '@/core/utils';
|
||||
import { handleShowToast, handleRouteNavigateTo, getShareUrl } from '@/core/utils';
|
||||
import { timeFormat } from '@/uni_modules/uv-ui-tools/libs/function/index.js';
|
||||
import CoreshopShare from '@/components/coreshop-share/coreshop-share.vue';
|
||||
|
||||
@@ -154,7 +154,16 @@
|
||||
} else {
|
||||
handleShowToast(solitaireData.msg)
|
||||
}
|
||||
getShareUrl();
|
||||
|
||||
state.shareUrl = await getShareUrl({
|
||||
client: ShareClientEnum.wxMiNiProgram,
|
||||
url: shareUrl,
|
||||
type: ShareModelEnum.url,
|
||||
page: ShareEnum.solitaire,
|
||||
params: {
|
||||
id: state.solitaireInfo.id
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 步进器变化 */
|
||||
@@ -232,28 +241,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取分享url */
|
||||
const getShareUrl = async () => {
|
||||
let data = {
|
||||
client: ShareClientEnum.wxMiNiProgram,
|
||||
url: shareUrl,
|
||||
type: ShareModelEnum.url,
|
||||
page: ShareEnum.solitaire,
|
||||
params: {
|
||||
id: state.solitaireInfo.id
|
||||
}
|
||||
}
|
||||
if (uni.getStorageSync(UserToken)) {
|
||||
data['token'] = uni.getStorageSync(UserToken)
|
||||
}
|
||||
const share = await queryShare(data);
|
||||
if (share.status) {
|
||||
state.shareUrl = share.data
|
||||
} else {
|
||||
handleShowToast(share.msg);
|
||||
}
|
||||
}
|
||||
|
||||
/** 分享弹框显示与否 */
|
||||
const handleToggleShowShare = () => {
|
||||
_useLoginStore.checkLogin(() => {
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
<script setup lang="ts">
|
||||
import { reactive } from 'vue';
|
||||
import { onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
|
||||
import { handleStaticResources, handleRouteNavigateTo, handleRouteRedirectTo, handleShowToast } from '@/core/utils';
|
||||
import { handleStaticResources, handleRouteNavigateTo, handleRouteRedirectTo, handleShowToast, getShareUrl } from '@/core/utils';
|
||||
import { useShopConfigStore } from '@/core/store';
|
||||
import type { Response, UserInfoType } from '@/core/models';
|
||||
import { queryAgentInfo, queryUserInfo, queryShare } from '@/core/api';
|
||||
@@ -165,7 +165,16 @@
|
||||
if (info.data?.verifyStatus != AgentApplyStatus.success) {
|
||||
handleRouteRedirectTo('/pages/subpackage/distribution/apply/index');
|
||||
}
|
||||
getShareUrl();
|
||||
|
||||
state.shareUrl = await getShareUrl({
|
||||
client: ShareClientEnum.wxMiNiProgram,
|
||||
url: shareUrl,
|
||||
type: ShareModelEnum.url,
|
||||
page: ShareEnum.inv,
|
||||
params: {
|
||||
store: state.info.store
|
||||
}
|
||||
})
|
||||
} else {
|
||||
handleShowToast(info.msg)
|
||||
}
|
||||
@@ -195,28 +204,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取分享url */
|
||||
const getShareUrl = async () => {
|
||||
let data = {
|
||||
client: ShareClientEnum.wxMiNiProgram,
|
||||
url: shareUrl,
|
||||
type: ShareModelEnum.url,
|
||||
page: ShareEnum.inv,
|
||||
params: {
|
||||
store: state.info.store
|
||||
}
|
||||
}
|
||||
if (uni.getStorageSync(UserToken)) {
|
||||
data['token'] = uni.getStorageSync(UserToken)
|
||||
}
|
||||
const share = await queryShare(data);
|
||||
if (share.status) {
|
||||
state.shareUrl = share.data
|
||||
} else {
|
||||
handleShowToast(share.msg);
|
||||
}
|
||||
}
|
||||
|
||||
/** 分享 */
|
||||
onShareAppMessage(() => {
|
||||
return {
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
import { reactive } from 'vue';
|
||||
import { onLoad, onReachBottom, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
|
||||
import { queryAgentStoreInfot, queryShare, queryAgentGoodsPageList } from '@/core/api';
|
||||
import { handleStaticResources, splitArrayByStep, handleShowToast, handleRouteNavigateTo } from '@/core/utils';
|
||||
import { handleStaticResources, splitArrayByStep, handleShowToast, handleRouteNavigateTo, getShareUrl } from '@/core/utils';
|
||||
import type { Response, GoodsType } from '@/core/models';
|
||||
import { ShareClientEnum, ShareModelEnum, ShareEnum } from '@/core/enum';
|
||||
import { shareUrl, UserToken } from '@/core/consts';
|
||||
@@ -112,11 +112,20 @@
|
||||
bannerList: [],
|
||||
})
|
||||
|
||||
onLoad((query : QueryParams) => {
|
||||
onLoad(async (query : QueryParams) => {
|
||||
state.storeId = query.store;
|
||||
getAgentInfo();
|
||||
getShareUrl();
|
||||
getGoodsPageList();
|
||||
|
||||
state.shareUrl = await getShareUrl({
|
||||
client: ShareClientEnum.wxMiNiProgram,
|
||||
url: shareUrl,
|
||||
type: ShareModelEnum.url,
|
||||
page: ShareEnum.agent,
|
||||
params: {
|
||||
store: state.storeId
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
onReachBottom(() => {
|
||||
@@ -201,40 +210,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取分享url */
|
||||
const getShareUrl = async () => {
|
||||
let data = {
|
||||
client: ShareClientEnum.wxMiNiProgram,
|
||||
url: shareUrl,
|
||||
type: ShareModelEnum.url,
|
||||
page: ShareEnum.agent,
|
||||
params: {
|
||||
store: state.storeId
|
||||
}
|
||||
}
|
||||
if (uni.getStorageSync(UserToken)) {
|
||||
data['token'] = uni.getStorageSync(UserToken)
|
||||
}
|
||||
const share = await queryShare(data);
|
||||
if (share.status) {
|
||||
state.shareUrl = share.data
|
||||
} else {
|
||||
handleShowToast(share.msg);
|
||||
}
|
||||
}
|
||||
|
||||
/** 分享 */
|
||||
onShareAppMessage(() => {
|
||||
return {
|
||||
title: shopConfigStore.config.shareTitle,
|
||||
imageUrl: shopConfigStore.config.shareImage,
|
||||
title: state.storeInfo?.storeName ? state.storeInfo?.storeName : shopConfigStore.config.shareTitle,
|
||||
imageUrl: state.storeInfo?.storeLogo ? state.storeInfo?.storeLogo : shopConfigStore.config.shareImage,
|
||||
path: state.shareUrl
|
||||
}
|
||||
});
|
||||
onShareTimeline(() => {
|
||||
return {
|
||||
title: shopConfigStore.config.shareTitle,
|
||||
imageUrl: shopConfigStore.config.shareImage,
|
||||
title: state.storeInfo?.storeName ? state.storeInfo?.storeName : shopConfigStore.config.shareTitle,
|
||||
imageUrl: state.storeInfo?.storeLogo ? state.storeInfo?.storeLogo : shopConfigStore.config.shareImage,
|
||||
path: state.shareUrl
|
||||
}
|
||||
});
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
import { onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
|
||||
import { queryArticleDetail, queryShare, queryNoticeInfo, queryMessageDetil } from '@/core/api';
|
||||
import type { Response, NoticeType } from '@/core/models';
|
||||
import { handleShowToast, handleRouteSwitchTab } from '@/core/utils';
|
||||
import { handleShowToast, handleRouteSwitchTab ,getShareUrl} from '@/core/utils';
|
||||
import { ShareClientEnum, ShareModelEnum, ShareEnum, ArticleDetailEnum } from '@/core/enum';
|
||||
import { UserToken, shareUrl } from '@/core/consts'
|
||||
|
||||
@@ -30,15 +30,16 @@
|
||||
idType : number;
|
||||
id : number;
|
||||
title : string;
|
||||
shareUrl:string;
|
||||
}>({
|
||||
articleDetail: {},
|
||||
idType: 1,
|
||||
id: 0,
|
||||
title: "文章详情"
|
||||
|
||||
title: "文章详情",
|
||||
shareUrl:"",
|
||||
})
|
||||
|
||||
onLoad((query : QueryParams) => {
|
||||
onLoad(async (query : QueryParams) => {
|
||||
state.idType = query?.idType || 1;
|
||||
state.id = query?.id || 0;
|
||||
|
||||
@@ -60,7 +61,16 @@
|
||||
})
|
||||
}
|
||||
/** 获取分享url */
|
||||
getShareUrl();
|
||||
state.shareUrl = await getShareUrl({
|
||||
client: ShareClientEnum.wxMiNiProgram,
|
||||
url: shareUrl,
|
||||
type: ShareModelEnum.url,
|
||||
page: ShareEnum.article,
|
||||
params: {
|
||||
articleId: state.id,
|
||||
articleType: state.idType
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
/** 获取文章详情 */
|
||||
@@ -105,39 +115,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取分享url */
|
||||
const getShareUrl = async () => {
|
||||
let data = {
|
||||
client: ShareClientEnum.wxMiNiProgram,
|
||||
url: shareUrl,
|
||||
type: ShareModelEnum.url,
|
||||
page: ShareEnum.article,
|
||||
params: {
|
||||
articleId: state.id,
|
||||
articleType: state.idType
|
||||
}
|
||||
}
|
||||
if (uni.getStorageSync(UserToken)) {
|
||||
data['token'] = uni.getStorageSync(UserToken)
|
||||
}
|
||||
const share = await queryShare(data);
|
||||
if (share.status) {
|
||||
state.shareUrl = share.data
|
||||
} else {
|
||||
handleShowToast(share.msg);
|
||||
}
|
||||
}
|
||||
|
||||
/** 分享 */
|
||||
onShareAppMessage(() => {
|
||||
return {
|
||||
title: state.noticeInfo.name,
|
||||
title: state.articleDetail.title,
|
||||
path: state.shareUrl
|
||||
}
|
||||
});
|
||||
onShareTimeline(() => {
|
||||
return {
|
||||
title: state.noticeInfo.name,
|
||||
title: state.articleDetail.title,
|
||||
path: state.shareUrl
|
||||
}
|
||||
});
|
||||
|
||||
@@ -32,16 +32,17 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onPageScroll, onLoad } from '@dcloudio/uni-app';
|
||||
import { 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 } from '@/core/utils';
|
||||
import { handleStaticResources, getDefaultShareData, getShareUrl } from '@/core/utils';
|
||||
import { useSystemInfo } from '@/core/hooks';
|
||||
import { UserToken } from '@/core/consts';
|
||||
import { UserToken, shareUrl } from '@/core/consts';
|
||||
import { useUserInfoStore } from '@/core/store';
|
||||
import { ShareClientEnum, ShareModelEnum, ShareEnum } from '@/core/enum';
|
||||
|
||||
interface QueryParams {
|
||||
code : string;
|
||||
@@ -55,9 +56,11 @@
|
||||
const state = reactive<{
|
||||
coreshopData : Array<PageConfigItemsType>;
|
||||
isScrollTop : boolean;
|
||||
shareUrl : string;
|
||||
}>({
|
||||
coreshopData: [],
|
||||
isScrollTop: false,
|
||||
shareUrl: "",
|
||||
})
|
||||
|
||||
onPageScroll((e : any) => {
|
||||
@@ -68,11 +71,18 @@
|
||||
}
|
||||
})
|
||||
|
||||
onLoad((query : QueryParams) => {
|
||||
onLoad(async (query : QueryParams) => {
|
||||
getPageConfig(query?.code);
|
||||
if (uni.getStorageSync(UserToken)) {
|
||||
getUserInfo();
|
||||
}
|
||||
|
||||
state.shareUrl = await getShareUrl({
|
||||
client: ShareClientEnum.wxMiNiProgram,
|
||||
url: shareUrl,
|
||||
type: ShareModelEnum.url,
|
||||
page: ShareEnum.index,
|
||||
})
|
||||
})
|
||||
|
||||
const getPageConfig = async (code : string) => {
|
||||
@@ -87,6 +97,22 @@
|
||||
userInfoStore.setUserInfo(userInfo?.data);
|
||||
}
|
||||
}
|
||||
|
||||
/** 分享 */
|
||||
onShareAppMessage(() => {
|
||||
return {
|
||||
title: getDefaultShareData().title,
|
||||
imageUrl: getDefaultShareData().imageUrl,
|
||||
path: state.shareUrl
|
||||
}
|
||||
});
|
||||
onShareTimeline(() => {
|
||||
return {
|
||||
title: getDefaultShareData().title,
|
||||
imageUrl: getDefaultShareData().imageUrl,
|
||||
path: state.shareUrl
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
import { reactive } from 'vue';
|
||||
import { onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
|
||||
import { queryDistributionInfo, queryUserInfo, queryShare } from '@/core/api';
|
||||
import { handleShowToast, handleStaticResources, handleRouteNavigateTo, handleRouteRedirectTo } from '@/core/utils';
|
||||
import { handleShowToast, handleStaticResources, handleRouteNavigateTo, handleRouteRedirectTo, getShareUrl } from '@/core/utils';
|
||||
import type { Response, UserInfoType } from '@/core/models';
|
||||
import { DistributionApplyStatus, OpenDistributionEnum, ShareClientEnum, ShareModelEnum, ShareEnum } from '@/core/enum';
|
||||
import { useShopConfigStore } from '@/core/store';
|
||||
@@ -167,7 +167,16 @@
|
||||
if (info.data?.verifyStatus != DistributionApplyStatus.success) {
|
||||
handleRouteRedirectTo('/pages/subpackage/distribution/apply/index');
|
||||
}
|
||||
getShareUrl();
|
||||
|
||||
state.shareUrl = await getShareUrl({
|
||||
client: ShareClientEnum.wxMiNiProgram,
|
||||
url: shareUrl,
|
||||
type: ShareModelEnum.url,
|
||||
page: ShareEnum.inv,
|
||||
params: {
|
||||
store: state.info.store
|
||||
}
|
||||
})
|
||||
} else {
|
||||
handleShowToast(info.msg)
|
||||
}
|
||||
@@ -196,40 +205,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取分享url */
|
||||
const getShareUrl = async () => {
|
||||
let data = {
|
||||
client: ShareClientEnum.wxMiNiProgram,
|
||||
url: shareUrl,
|
||||
type: ShareModelEnum.url,
|
||||
page: ShareEnum.inv,
|
||||
params: {
|
||||
store: state.info.store
|
||||
}
|
||||
}
|
||||
if (uni.getStorageSync(UserToken)) {
|
||||
data['token'] = uni.getStorageSync(UserToken)
|
||||
}
|
||||
const share = await queryShare(data);
|
||||
if (share.status) {
|
||||
state.shareUrl = share.data
|
||||
} else {
|
||||
handleShowToast(share.msg);
|
||||
}
|
||||
}
|
||||
|
||||
/** 分享 */
|
||||
onShareAppMessage(() => {
|
||||
return {
|
||||
title: shopConfigStore.config.shareTitle,
|
||||
imageUrl: shopConfigStore.config.shareImage,
|
||||
title: state.info?.storeName ? state.info?.storeName : shopConfigStore.config.shareTitle,
|
||||
imageUrl: state.info?.storeLogo ? state.info?.storeLogo : shopConfigStore.config.shareImage,
|
||||
path: state.shareUrl
|
||||
}
|
||||
});
|
||||
onShareTimeline(() => {
|
||||
return {
|
||||
title: shopConfigStore.config.shareTitle,
|
||||
imageUrl: shopConfigStore.config.shareImage,
|
||||
title: state.info?.storeName ? state.info?.storeName : shopConfigStore.config.shareTitle,
|
||||
imageUrl: state.info?.storeLogo ? state.info?.storeLogo : shopConfigStore.config.shareImage,
|
||||
path: state.shareUrl
|
||||
}
|
||||
});
|
||||
|
||||
@@ -112,11 +112,20 @@
|
||||
bannerList: [],
|
||||
})
|
||||
|
||||
onLoad((query : QueryParams) => {
|
||||
onLoad(async (query : QueryParams) => {
|
||||
state.storeId = query.store;
|
||||
getDistributionInfo();
|
||||
getShareUrl();
|
||||
getGoodsPageList();
|
||||
|
||||
state.shareUrl = await getShareUrl({
|
||||
client: ShareClientEnum.wxMiNiProgram,
|
||||
url: shareUrl,
|
||||
type: ShareModelEnum.url,
|
||||
page: ShareEnum.inv,
|
||||
params: {
|
||||
store: state.storeId
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
onReachBottom(() => {
|
||||
@@ -201,40 +210,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取分享url */
|
||||
const getShareUrl = async () => {
|
||||
let data = {
|
||||
client: ShareClientEnum.wxMiNiProgram,
|
||||
url: shareUrl,
|
||||
type: ShareModelEnum.url,
|
||||
page: ShareEnum.inv,
|
||||
params: {
|
||||
store: state.storeId
|
||||
}
|
||||
}
|
||||
if (uni.getStorageSync(UserToken)) {
|
||||
data['token'] = uni.getStorageSync(UserToken)
|
||||
}
|
||||
const share = await queryShare(data);
|
||||
if (share.status) {
|
||||
state.shareUrl = share.data
|
||||
} else {
|
||||
handleShowToast(share.msg);
|
||||
}
|
||||
}
|
||||
|
||||
/** 分享 */
|
||||
onShareAppMessage(() => {
|
||||
return {
|
||||
title: shopConfigStore.config.shareTitle,
|
||||
imageUrl: shopConfigStore.config.shareImage,
|
||||
title: state.storeInfo?.storeName ? state.storeInfo?.storeName : shopConfigStore.config.shareTitle,
|
||||
imageUrl: state.storeInfo?.storeLogo ? state.storeInfo?.storeLogo : shopConfigStore.config.shareImage,
|
||||
path: state.shareUrl
|
||||
}
|
||||
});
|
||||
onShareTimeline(() => {
|
||||
return {
|
||||
title: shopConfigStore.config.shareTitle,
|
||||
imageUrl: shopConfigStore.config.shareImage,
|
||||
title: state.storeInfo?.storeName ? state.storeInfo?.storeName : shopConfigStore.config.shareTitle,
|
||||
imageUrl: state.storeInfo?.storeLogo ? state.storeInfo?.storeLogo : shopConfigStore.config.shareImage,
|
||||
path: state.shareUrl
|
||||
}
|
||||
});
|
||||
|
||||
@@ -138,9 +138,9 @@
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref } from 'vue';
|
||||
import { onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
|
||||
import { queryFormDetial, queryUploadImages, queryAddSubmit, queryShare } from '@/core/api';
|
||||
import { queryFormDetial, queryUploadImages, queryAddSubmit } from '@/core/api';
|
||||
import type { Response, CityAddressType } from '@/core/models';
|
||||
import { handleShowToast, handleStaticResources, handleRouteRedirectTo, handleRouteSwitchTab, chooseImage, getSetting } from '@/core/utils';
|
||||
import { handleShowToast, handleStaticResources, handleRouteRedirectTo, handleRouteSwitchTab, chooseImage, getSetting, getShareUrl } from '@/core/utils';
|
||||
import { queryAreas } from '@/core/api';
|
||||
import { useLoginStore } from '@/core/store';
|
||||
import { UserToken, shareUrl } from '@/core/consts';
|
||||
@@ -244,15 +244,7 @@
|
||||
state.swiperList = formInfo.data?.images?.split(',') || [];
|
||||
|
||||
/** 获取分享url */
|
||||
getShareUrl();
|
||||
} else {
|
||||
handleShowToast(formInfo.msg)
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取分享url */
|
||||
const getShareUrl = async () => {
|
||||
let data = {
|
||||
state.shareUrl = await getShareUrl({
|
||||
client: ShareClientEnum.wxMiNiProgram,
|
||||
url: shareUrl,
|
||||
type: ShareModelEnum.url,
|
||||
@@ -260,15 +252,9 @@
|
||||
params: {
|
||||
id: state.id
|
||||
}
|
||||
}
|
||||
if (uni.getStorageSync(UserToken)) {
|
||||
data['token'] = uni.getStorageSync(UserToken)
|
||||
}
|
||||
const share = await queryShare(data);
|
||||
if (share.status) {
|
||||
state.shareUrl = share.data
|
||||
})
|
||||
} else {
|
||||
handleShowToast(share.msg);
|
||||
handleShowToast(formInfo.msg)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,26 +14,36 @@
|
||||
<script setup lang="ts">
|
||||
import { reactive } from 'vue';
|
||||
import { onLoad, onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app';
|
||||
import { queryNoticeInfo, queryShare } from '@/core/api';
|
||||
import { queryNoticeInfo } from '@/core/api';
|
||||
import type { Response, NoticeType } from '@/core/models';
|
||||
import { handleShowToast } from '@/core/utils';
|
||||
import { handleShowToast, getShareUrl } from '@/core/utils';
|
||||
import { ShareClientEnum, ShareModelEnum, ShareEnum } from '@/core/enum';
|
||||
import { UserToken, shareUrl } from '@/core/consts'
|
||||
import { shareUrl } from '@/core/consts'
|
||||
|
||||
interface QueryParams {
|
||||
id : number;
|
||||
}
|
||||
const state = reactive<{
|
||||
noticeInfo : NoticeType;
|
||||
shareUrl : string;
|
||||
}>({
|
||||
noticeInfo: {},
|
||||
shareUrl: "",
|
||||
})
|
||||
|
||||
onLoad((query : QueryParams) => {
|
||||
onLoad(async (query : QueryParams) => {
|
||||
/** 获取文章详情 */
|
||||
getNoticeInfo(Number(query.id));
|
||||
/** 获取分享url */
|
||||
getShareUrl(Number(query.id));
|
||||
state.shareUrl = await getShareUrl({
|
||||
client: ShareClientEnum.wxMiNiProgram,
|
||||
url: shareUrl,
|
||||
type: ShareModelEnum.url,
|
||||
page: ShareEnum.article,
|
||||
params: {
|
||||
noticeId: String(query.id),
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
/** 获取文章详情 */
|
||||
@@ -50,38 +60,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
/** 获取分享url */
|
||||
const getShareUrl = async (noticeId : number) => {
|
||||
let data = {
|
||||
client: ShareClientEnum.wxMiNiProgram,
|
||||
url: shareUrl,
|
||||
type: ShareModelEnum.url,
|
||||
page: ShareEnum.article,
|
||||
params: {
|
||||
noticeId: String(noticeId),
|
||||
}
|
||||
}
|
||||
if (uni.getStorageSync(UserToken)) {
|
||||
data['token'] = uni.getStorageSync(UserToken)
|
||||
}
|
||||
const share = await queryShare(data);
|
||||
if (share.status) {
|
||||
state.shareUrl = share.data
|
||||
} else {
|
||||
handleShowToast(share.msg);
|
||||
}
|
||||
}
|
||||
|
||||
/** 分享 */
|
||||
onShareAppMessage(() => {
|
||||
return {
|
||||
title: state.noticeInfo.name,
|
||||
title: state.noticeInfo.title,
|
||||
path: state.shareUrl
|
||||
}
|
||||
});
|
||||
onShareTimeline(() => {
|
||||
return {
|
||||
title: state.noticeInfo.name,
|
||||
title: state.noticeInfo.title,
|
||||
path: state.shareUrl
|
||||
}
|
||||
});
|
||||
|
||||
@@ -82,12 +82,13 @@
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { reactive } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { onLoad ,onShareAppMessage,onShareTimeline} from '@dcloudio/uni-app';
|
||||
import type { Response, ServiceGoodsType } from '@/core/models';
|
||||
import { queryServiceDetail, queryAddServiceOrder } from '@/core/api';
|
||||
import { ServiceGoodsOpenEnum, ShareEnum, PaymentTypeEnum } from '@/core/enum';
|
||||
import { handleShowToast, handleRouteNavigateTo } from '@/core/utils';
|
||||
import { useUserInfoStore, useLoginStore } from '@/core/store';
|
||||
import { ServiceGoodsOpenEnum, ShareEnum, PaymentTypeEnum, ShareClientEnum, ShareModelEnum, } from '@/core/enum';
|
||||
import { handleShowToast, handleRouteNavigateTo,getShareUrl } from '@/core/utils';
|
||||
import { useLoginStore } from '@/core/store';
|
||||
import { shareUrl } from '@/core/consts';
|
||||
import GoodsDetail from '@/pages/components/goods-detail/index.vue';
|
||||
import GoodsDetailRecommend from '@/pages/components/goods-detail/components/goods-detail-recommend/goods-detail-recommend.vue';
|
||||
import GoodsDetailBottomTabbar from '@/pages/components/goods-detail/components/goods-detail-bottom-tabbar/goods-detail-bottom-tabbar.vue';
|
||||
@@ -104,11 +105,13 @@
|
||||
goodsDetailData : ServiceGoodsType,
|
||||
swiperBanner : Array<string>;
|
||||
goodsDetailContent : string;
|
||||
shareUrl:string;
|
||||
}>({
|
||||
id: 0,
|
||||
goodsDetailData: {},
|
||||
swiperBanner: [],
|
||||
goodsDetailContent: "",
|
||||
shareUrl:"",
|
||||
});
|
||||
|
||||
onLoad((query : QueryParams) => {
|
||||
@@ -138,6 +141,16 @@
|
||||
state.swiperBanner = goodsDetail?.data?.thumbnail?.split(',');
|
||||
/** 商品详情内容 */
|
||||
state.goodsDetailContent = goodsDetail?.data?.contentBody;
|
||||
|
||||
state.shareUrl = await getShareUrl({
|
||||
client: ShareClientEnum.wxMiNiProgram,
|
||||
url: shareUrl,
|
||||
type: ShareModelEnum.url,
|
||||
page: ShareEnum.serviceGoods,
|
||||
params: {
|
||||
serviceGoodsId: state.id,
|
||||
}
|
||||
})
|
||||
} else {
|
||||
handleShowToast(goodsDetail.msg)
|
||||
}
|
||||
@@ -160,6 +173,22 @@
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/** 分享 */
|
||||
onShareAppMessage(() => {
|
||||
return {
|
||||
title: state.goodsDetailData.title,
|
||||
imageUrl: state.goodsDetailData.thumbnail,
|
||||
path: state.shareUrl
|
||||
}
|
||||
});
|
||||
onShareTimeline(() => {
|
||||
return {
|
||||
title: state.goodsDetailData.title,
|
||||
imageUrl: state.goodsDetailData.thumbnail,
|
||||
path: state.shareUrl
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
@import './detail.scss';
|
||||
|
||||
Reference in New Issue
Block a user