Commit cc244d52 authored by Xuguangxing's avatar Xuguangxing

feat: 增加详情页分享

parent 2bae2a86
...@@ -73,10 +73,12 @@ export default { ...@@ -73,10 +73,12 @@ export default {
if (this.$refs.buttonArea) { if (this.$refs.buttonArea) {
this.observer = new IntersectionObserver(entries => { this.observer = new IntersectionObserver(entries => {
entries.forEach(item => { entries.forEach(item => {
if (item.intersectionRatio == 0) { if (this.groupInfo.groupBuyStatus == 1) {
this.$emit('changeButtonVisible', true); if (item.intersectionRatio == 0) {
} else { this.$emit('changeButtonVisible', true);
this.$emit('changeButtonVisible', false); } else {
this.$emit('changeButtonVisible', false);
}
} }
}); });
}); });
......
...@@ -125,6 +125,7 @@ export default { ...@@ -125,6 +125,7 @@ export default {
countDownText: '', countDownText: '',
stockPercentage: 0, stockPercentage: 0,
sharePicData: {}, sharePicData: {},
picUrl: '', // 海报url
// 以下是原有的data // 以下是原有的data
detailParam: { detailParam: {
skuNo: '', skuNo: '',
...@@ -138,6 +139,19 @@ export default { ...@@ -138,6 +139,19 @@ export default {
showButtonNav: false // 是否显示底部按钮 showButtonNav: false // 是否显示底部按钮
}; };
}, },
computed: {
goodsShareInfo() {
return this.$store.state.pay.goodsShareInfo;
}
},
watch: {
goodsShareInfo: {
immediate: false,
handler(val) {
this.onShareEventChange(val);
}
}
},
created() { created() {
this.detailParam = { ...this.$route.query }; this.detailParam = { ...this.$route.query };
localStorage.set('activityId', this.detailParam.templateId); // 设置活动模板id,用于下单 localStorage.set('activityId', this.detailParam.templateId); // 设置活动模板id,用于下单
...@@ -162,7 +176,17 @@ export default { ...@@ -162,7 +176,17 @@ export default {
}, 5000); }, 5000);
}, },
methods: { 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) { outputPicUrl(res) {
this.picUrl = res || '';
const shareInfo = { const shareInfo = {
title: this.detailInfo.goodsName, title: this.detailInfo.goodsName,
desc: '', 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