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