Commit 6b9b32e0 authored by beisir's avatar beisir

feat

parent bc7fbac9
import { isAndroid, isIOS, isXyqb } from './validation.service';
import { isAndroid, isIOS, isXyqb, isWxMp } from './validation.service';
import Bridge from '@qg/js-bridge';
import MpBridge from '@/service/mp';
const jsBridge = new Bridge();
import Vue from 'vue';
import config from '@/config';
......@@ -373,3 +374,53 @@ export function paramsParentheses(pointer) {
const paramsString = qs.stringify(params);
return `${config.localHost}${path}?` + paramsString;
}
export function firstGroupShare(shareInfo, type) {
if (!isWxMp) {
return;
}
// eslint-disable-next-line no-unused-vars
let linkPath = '';
let detailData = {
skuNo: shareInfo.skuNo,
goodsSpecialId: shareInfo.goodsSpecialId,
activityId: shareInfo.activityId,
templateId: shareInfo.templateId,
templateDetailId: shareInfo.templateDetailId,
vccToken: encodeURIComponent('{token}')
};
switch (type) {
case 0:
linkPath = `${config.localHost}/groupBuy/list?activityId=${
shareInfo.activityId
}&vccToken=${encodeURIComponent('{token}')}`;
break;
case 1:
linkPath = `${config.localHost}/orderList/0`;
break;
case 2:
case 3:
if (shareInfo.groupBuyGroupId) {
detailData.groupBuyGroupId = shareInfo.groupBuyGroupId;
}
linkPath = qs.stringify(detailData);
linkPath = `${config.localHost}/groupBuy/skuInfo?${linkPath}`;
break;
}
shareInfo.linkPath = `/pages/groupbuy/webview?url=${encodeURIComponent(
JSON.stringify(linkPath)
)}`;
const tagName = type ? '[0元购] ' : '';
let shareDic = {
title: `${tagName}${shareInfo.skuName}`,
link: shareInfo.linkPath, // 页面地址
imgUrl: shareInfo.skuImg // 图片地
};
console.log(shareDic);
new MpBridge().run({
event: 'showShareView',
data: {
shareDic
}
});
}
......@@ -74,7 +74,7 @@ import groupSwiper from '@/components/groupSwiper';
import { handleRemainTime, handleDateFormat } from './components/utils';
import localStorage from '@/service/localStorage.service';
import goodsCheckMixin from '@/mixins/goodsCheck.mixin';
import { setAppTitleColor, EventBus } from '@/service/utils.service';
import { setAppTitleColor, EventBus, firstGroupShare } from '@/service/utils.service';
import { saTrackEvent } from '@/service/sa.service';
// import { isNull } from '@/service/validation.service';
// let topicIndex;
......@@ -167,6 +167,12 @@ export default {
}
},
methods: {
// 第一次进来页面分享事件
async firstShareTemplate() {
const shareInfo = await this.getShareData();
firstGroupShare(shareInfo, 0);
},
animationEventStart() {
this.showSwipe = false;
},
......@@ -350,6 +356,7 @@ async function getActivityList(urlQuery, next) {
vm.pageNo = 1;
vm.getGoodsList(true);
vm.reload = false;
vm.firstShareTemplate(t);
});
} else {
nextFns(vm => {
......
......@@ -24,7 +24,8 @@
<script>
import groupBuyApi from '@/api/groupBuy';
import List from './components/List';
import { EventBus } from '@/service/utils.service';
import { EventBus, firstGroupShare } from '@/service/utils.service';
const commonParams = {
loading: false,
finished: false,
......@@ -79,6 +80,13 @@ export default {
getstatusQuery() {
const { status } = this.$route.params || {};
status && (this.currentTab = Number(status));
firstGroupShare(
{
skuName: '我的拼团',
skuImg: 'https://img.lkbang.net/activity/share/default/shareDefault.png'
},
1
);
},
handleTabChange(name) {
this.currentTab = name;
......
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