Commit bc7fbac9 authored by beisir's avatar beisir

feat:增加app版本判断

parent 20b49deb
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -38,7 +38,8 @@ export default {
sharePicData: {},
shareInfo: {},
type: 0,
dataType: false
dataType: false,
isCreatePic: isApp && +appVersion.replace(/\./g, '') < 8260 // 8251
// typeStatus: {
// 0: '入口活动页面',
// 1: '拼团列表页面',
......@@ -78,7 +79,6 @@ export default {
outputPicUrl(posterUrl) {
// 海报创建成功
this.sharePicData.posterUrl = posterUrl;
this.getShareData();
// 弹出分享框
if (isApp) {
// 如果是app环境直接调用app方法
......@@ -86,6 +86,7 @@ export default {
}
if (isWxMp) {
// 如果是小程序则直接跳转海报保存页面
this.getShareData(); // 创建分享数据
this.openTenetPosterUrl();
}
this.$store.dispatch('change_loading', false);
......@@ -95,10 +96,13 @@ export default {
if (this.dataType) {
// 有海报数据时
if (params.posterUrl) {
this.getShareData(); // 创建分享数据
this.appShareEventChange(); // 调用app分享
} else {
this.$refs.sharePic.createAndUploadPic(params);
if (this.isCreatePic) {
this.appShareEventChange(); // 调用app分享
} else {
this.$refs.sharePic.createAndUploadPic(params);
}
}
this.$store.dispatch('change_loading', false);
return;
......@@ -112,33 +116,19 @@ export default {
const [res] = await groupBuyApi.getGroupShareInfo(orderNo);
this.$store.dispatch('change_loading', true);
this.sharePicData = res;
!isNotPic && this.$refs.sharePic.createAndUploadPic(res);
isWxMp && this.sendSaTrackEvent(res, !isNotPic ? 'pic' : 'weixin');
this.$store.dispatch('change_loading', false);
if (this.isCreatePic) {
this.appShareEventChange(); // 调用app分享
} else {
!isNotPic && this.$refs.sharePic.createAndUploadPic(res);
}
} catch (err) {
this.$store.dispatch('change_loading', false);
console.log(err);
}
},
handleShareInfo(shareInfo) {
this.getShareData(); // 获取分享数据
// 如果是小程序则首先弹出分享框
if (isWxMp) {
this.shareOpenWechat();
}
if (isApp) {
if (shareInfo.posterUrl) {
// 如果是App并且有海报地址直接调用app分享方法
this.appShareEventChange();
} else {
// 否则创建海报
this.$refs.sharePic.createAndUploadPic(this.sharePicData);
}
}
this.$store.dispatch('change_loading', false);
},
// 点击微信弹出框按钮
bundleShareClickItem(ev) {
let params = this.sharePicData;
......@@ -198,9 +188,6 @@ export default {
imgUrl: sharePicData.skuImg, // 图片地
posterUrl: sharePicData.posterUrl
};
if (isApp && +appVersion.replace(/\./g, '') < 8260) {
delete shareInfo.posterUrl;
}
this.shareInfo = shareInfo;
},
filterShareInfo() {
......@@ -286,22 +273,22 @@ export default {
});
},
appShareEventChange() {
this.getShareData();
const { title, desc, link, imgUrl, posterUrl } = this.shareInfo;
let shareDic = { title, desc, link, imgUrl };
let platform = ['weChat', 'timeLine', 'QQ', 'CopyLink']; //依次分别是微信、朋友圈、QQ好友、QQ空间、复制链接
if (!this.isCreatePic) {
shareDic.posterUrl = posterUrl;
platform.push('GeneratePoster');
}
// 进行App分享
const data = {
this.nativeBridge.showShareView({
event: 'showShareView',
data: {
platform: ['weChat', 'timeLine', 'QQ', 'CopyLink', 'GeneratePoster'], //依次分别是微信、朋友圈、QQ好友、QQ空间、复制链接
shareDic: {
title,
desc,
link, // 页面地址
imgUrl, // 图片地址
posterUrl
}
platform,
shareDic
}
};
this.nativeBridge.showShareView(data);
});
},
tipDialogMessage() {
this.$dialog({
......
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