Commit cc244d52 authored by Xuguangxing's avatar Xuguangxing

feat: 增加详情页分享

parent 2bae2a86
......@@ -73,11 +73,13 @@ export default {
if (this.$refs.buttonArea) {
this.observer = new IntersectionObserver(entries => {
entries.forEach(item => {
if (this.groupInfo.groupBuyStatus == 1) {
if (item.intersectionRatio == 0) {
this.$emit('changeButtonVisible', true);
} else {
this.$emit('changeButtonVisible', false);
}
}
});
});
this.observer.USE_MUTATION_OBSERVER = false;
......
......@@ -125,6 +125,7 @@ export default {
countDownText: '',
stockPercentage: 0,
sharePicData: {},
picUrl: '', // 海报url
// 以下是原有的data
detailParam: {
skuNo: '',
......@@ -138,6 +139,19 @@ export default {
showButtonNav: false // 是否显示底部按钮
};
},
computed: {
goodsShareInfo() {
return this.$store.state.pay.goodsShareInfo;
}
},
watch: {
goodsShareInfo: {
immediate: false,
handler(val) {
this.onShareEventChange(val);
}
}
},
created() {
this.detailParam = { ...this.$route.query };
localStorage.set('activityId', this.detailParam.templateId); // 设置活动模板id,用于下单
......@@ -162,7 +176,17 @@ export default {
}, 5000);
},
methods: {
async onShareEventChange({ ev, nativeBridge }) {
if (ev === 'pic') {
// 处理图片url
nativeBridge.openNewUrl({
newUrl: `/pages/goodshare/index?url=${encodeURIComponent(JSON.stringify(this.picUrl))}`
});
this.$store.dispatch('goods_share_close');
}
},
outputPicUrl(res) {
this.picUrl = res || '';
const shareInfo = {
title: this.detailInfo.goodsName,
desc: '',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment