增加公共分享组件

This commit is contained in:
2026-01-21 10:26:05 +08:00
parent 67ae138033
commit 654ed39854
6 changed files with 57 additions and 18 deletions

View File

@@ -44,6 +44,9 @@ page,
image {
display: block;
}
.relative{
position: relative;
}
.absolute{
position: absolute;
}

View File

@@ -0,0 +1,28 @@
<template>
<view class="relative">
<slot v-if="$slots.default" name="default"></slot>
<up-icon v-else name="share-square" bold color="#333" size="36rpx"></up-icon>
<view class="absolute share-box">
<button open-type="share" @click="shareClick">分享</button>
</view>
</view>
</template>
<script setup>
const emits = defineEmits(['shareClick'])
function shareClick() {
emits('shareClick')
}
</script>
<style lang="scss">
.share-box {
left: 0;
right: 0;
bottom: 0;
top: 0;
opacity: 0;
overflow: hidden;
}
</style>

View File

@@ -2,6 +2,7 @@
"easycom": {
"autoscan": true,
"custom": {
"^my-(.*)": "@/components/ymf-components/ymf-$1.vue",
"^u--(.*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue",
"^up-(.*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue",
"^u-([^-].*)": "@/uni_modules/uview-plus/components/u-$1/u-$1.vue"

View File

@@ -13,8 +13,10 @@
<up-swiper :list="goods.images" @change="swiperChange" :current="swiperCurrent" radius="6px"
height="250" @click="prveImgs(goods.images, goods.images[swiperCurrent])">
</up-swiper>
<view class="shop_sku_name">{{ goods.name }}</view>
<view class="shop_sku_name u-flex u-row-between">
<view class="u-line-1" style="max-width: 600rpx;">{{ goods.name }}</view>
<ymfShare />
</view>
<view class="shop_sku_description" v-if="isSkuGoods">
{{ goods.shortTitle ? goods.shortTitle : '' }}
</view>
@@ -308,6 +310,7 @@
import {
useNavbarStore
} from '@/stores/navbarStore';
import ymfShare from '@/components/ymf-components/ymf-share.vue'
const store = useNavbarStore();
const {
showBack,
@@ -479,11 +482,11 @@
const swiperCurrent = ref(0);
function returnFirstSku(product) {
console.log('returnFirstSku', product.skuList[0]);
console.log('returnFirstSku', product);
return {
...product.skuList[0],
sku_id: product.skuList[0].id,
id: product.id,
...product.skuList[0]||'',
sku_id: product.skuList[0].id||'',
id: product.id||'',
}
}
//返回是否是多规格商品
@@ -831,7 +834,7 @@
padding: 0 28rpx;
margin-top: 20rpx;
font-weight: bold;
font-size: 32upx;
font-size: 32rpx;
margin-bottom: 16rpx;
}

View File

@@ -1445,7 +1445,11 @@
// showShopsku.value = true;
goodsModalList.value.push({
show:true,
goods:specifications.item
goods:{
...specifications.item,
/*过滤掉只有一个规格且下架的商品或者skuList为空的商品*/
relatedRecommendJson:(specifications.item.relatedRecommendJson||[]).filter(v=>v.skuList&&v.skuList.length)
}
})
};
// 判断商品是否在可售时间内

View File

@@ -63,8 +63,8 @@ export function wxShare(par) {
}
export async function returnQuery(query) {
const shopId = uni.cache.get('shopId')
const shopUserInfo = uni.cache.get('shopUserInfo')
const shopInfo = uni.cache.get('shopInfo')
@@ -72,13 +72,13 @@ export async function returnQuery(query) {
shopId: shopId,
shopUserId: shopUserInfo.id
})
const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
const currentPath = currentPage.route;
const currentOptions = currentPage.options;
let sharePath = `/${currentPath}`;
const queryJson = {
inviteCode: (inviteCode && inviteCode !== true) ? inviteCode : null,
@@ -94,7 +94,7 @@ export async function returnQuery(query) {
queryJson.shopId = shopId
queryJson.inviteCode = (inviteCode && inviteCode !== true) ? inviteCode : null
queryJson.shopUserId = shopUserInfo.id
let result = ''
for (let key in queryJson) {
if (queryJson[key]) {
@@ -240,10 +240,10 @@ export const shareMixin = {
...defaultShareConfig,
...pageShareConfig
})
return {
return wxShare({
...defaultShareConfig,
...pageShareConfig
};
});
},
@@ -289,9 +289,9 @@ export const shareMixin = {
};
const pageTimelineConfig = this.$options.shareTimelineConfig || {};
return {
return wxShare({
...defaultTimelineConfig,
...pageTimelineConfig
};
});
}
};