Commit 7bdf6a64 authored by beisir's avatar beisir

feat:update shareGroup

parent bfa869a1
......@@ -52,5 +52,8 @@ export default {
return http.get(`${talosHost}/api/kdsp/group-order/list`, {
params
});
},
getGroupShareInfo(orderNo) {
return http.get(`${talosHost}/api/kdsp/groupShareInfo?orderNo=${orderNo}`);
}
};
......@@ -34,7 +34,6 @@ export default {
}),
showShare: {
get() {
console.log(this.$store.state.pay);
return this.$store.state.pay.showShare;
},
set() {
......@@ -50,24 +49,11 @@ export default {
methods: {
shareCloseChange() {},
bundleShareClickItem(ev) {
if (ev === 'wexin') {
if (ev === 'weixin') {
this.shareDialogConfirm();
}
EventBus.$emit('shareClickItem', ev);
// if (ev === 'pic') {
// const { posterUrl } = this.shareInfo;
// this.nativeBridge.openNewUrl({
// newUrl: `/pages/goodshare/index?url=${encodeURIComponent(JSON.stringify(posterUrl))}`
// });
// }
// if (ev === 'weixin') {
// this.nativeBridge.run({
// event: 'showShareView',
// data: {
// shareDic: this.shareInfo
// }
// });
// }
const nativeBridge = this.nativeBridge;
EventBus.$emit('shareClickItem', { ev, nativeBridge });
registeredEvents('H5_GroupZeroYuanPurchaseActivityPageSharePopupWindowBtnClick', {
sku_no: '',
buttons_name: '', // 按钮名称
......
This diff is collapsed.
......@@ -89,7 +89,8 @@ import { isWxMp, isApp } from '@/service/validation.service';
import Bridge from '@qg/js-bridge';
import MpBridge from '@/service/mp';
import { registeredEvents } from '@/service/sa.service';
import { EventBus } from '@/service/utils.service';
import groupBuyApi from '@/api/groupBuy';
export default {
name: 'OrderSkuList',
components: {
......@@ -106,6 +107,8 @@ export default {
},
data() {
return {
shareInfo: null,
nativeBridge: null,
gpCountDown: new Date('2021-09-12 00:00:00').getTime(),
......@@ -148,6 +151,9 @@ export default {
if (isApp) this.nativeBridge = new Bridge();
else if (isWxMp) this.nativeBridge = new MpBridge();
},
mounted() {
this.onShareEventChange();
},
methods: {
goGroupDetails(skuInfo) {
this.nativeBridge.openNewUrl({
......@@ -157,33 +163,29 @@ export default {
goGroupPayPages(skuInfo) {
this.$router.push(`/pay?orderNo=${skuInfo.orderNo}`);
},
async getGroupShareInfo(order) {
const res = await groupBuyApi.getGroupShareInfo(order);
console.log(res);
},
async openShareEvent(skuInfo) {
let options = await this.getShareData(skuInfo);
this.$store.dispatch('goods_share_open', options);
// this.getGroupShareInfo('1440970158226214912');
this.shareInfo = skuInfo;
this.$store.dispatch('goods_share_open');
registeredEvents('H5_MyPuzzlePageGroupOrderBtnClick', {
sku_no: '',
leader_user_id: ''
});
},
async getShareData(skuInfo) {
return Promise.resolve({
title: skuInfo.skuName,
desc: '我正在免费拿商品,请你帮帮我',
link: `${window.location.origin}/activity/zeroBuy`, // 页面地址
imgUrl: skuInfo.imageUrl // 图片地
});
// await
},
toDetail(goodsItem) {
const { skuNo, skuList, activityInfoId, activityHundredGroupId } = goodsItem;
const { skuList, activityInfoId, activityHundredGroupId } = goodsItem;
this.$router.push({
path: '/groupBuy/skuInfoSmallPic',
query: {
h: 0,
skuNo,
activityHundredGroupId,
skuNo: skuList[0].skuNo,
groupBuyGroupId: activityHundredGroupId,
goodsSpecialId: skuList[0].goodsSpecialId,
activityId: activityInfoId,
templateId: skuList[0].activityTemplateInfoId,
......@@ -197,8 +199,37 @@ export default {
onOptionClick(orderInfo, eventType) {
this.$emit(EVENT_CLICK, { orderInfo, eventType });
},
toHome() {
this.$router.replace({ path: '/home' });
async getShareData(shareInfo) {
return {
title: shareInfo.skuName,
link: `${window.location.origin}/activity/zeroBuy`, // 页面地址
imgUrl: shareInfo.skuImg // 图片地
};
},
onShareEventChange() {
EventBus.$on('shareClickItem', async function({ ev, nativeBridge }) {
if (ev === 'pic') {
// 分享海报跳转小程序海报分享页面
// nativeBridge.openNewUrl({
// newUrl: `/pages/goodshare/index?url=${encodeURIComponent(
// JSON.stringify(shareDic.posterUrl)
// )}`
// });
}
if (ev === 'weixin') {
// const res = await groupBuyApi.getGroupShareInfo(this.shareInfo.order);
const [res] = await groupBuyApi.getGroupShareInfo('1440884214932389888');
console.log(res);
const shareDic = await this.getShareData(res);
// 分享朋友派发微信postMessage事件
nativeBridge.run({
event: 'showShareView',
data: {
shareDic
}
});
}
});
}
}
};
......
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