commonShareUtils.js
4.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
'use strict';
// union_type CPS 用户都要携带
// miniQrType=4 拼团详情 √
// miniQrType=7 商品详情 √
// miniQrType=9 h5 √
// miniQrType=15 拼团列表 √
// miniQrType=18 逛
// miniQrType=15
let host = 'http://api.yoho.cn';
const shareGroupPurchaseList = (shareInfo) => {
let {
activityId,
shareCodeInfo
} = shareInfo;
let param = {
activityId,
}
let qrCode = host + '/wechat/miniapp/img-check.jpg?param=' + encodeURIComponent(JSON.stringify(param)) + '&miniQrType=24' + '&miniapp_type=60';
let miniProgramPath = `/pages/group/list?activityId=${activityId}`;
let fromPage = 'GroupPurchase';
let businessId = 'collage';
let shareParam = {
title: shareCodeInfo.content ? shareCodeInfo.content : '',
content: shareCodeInfo.content ? shareCodeInfo.content : '',
image: shareCodeInfo.pic,
bigImage: shareCodeInfo.bigImage,
url: shareCodeInfo.url,
miniProgramPath,
miniProgramQCodeUrl: qrCode,
from: fromPage,
businessId
};
return shareParam;
};
// miniQrType=17
const shareGroupPurchaseDetail = (shareInfo) => {
const productSkn = shareInfo.productInfo.productSkn;
let {
activityId,
productInfo,
union_type
} = shareInfo;
let miniProgramPath = `pages/group/detail?productSkn=${productSkn}&activityId=${activityId}&union_type=${union_type}`
let param = {
productSkn,
activityId,
union_type
};
let qrCode = host + '/wechat/miniapp/img-check.jpg?param=' + encodeURIComponent(JSON.stringify(param)) + '&miniQrType=24' + '&miniapp_type=60';
let shareParam = {
title: productInfo.productName ? productInfo.productName : '',
content: productInfo.productName ? productInfo.productName : '',
image: productInfo.colorImage,
url: productInfo.productUrl,
miniProgramPath: miniProgramPath,
miniProgramQCodeUrl: qrCode,
product_name: productInfo.productName ? productInfo.productName : '',
sales_price: `¥${productInfo.marketPrice}`,
original_sales_price: `¥${productInfo.originalSalesPrice}`,
productDefaultImage: productInfo.colorImage,
fromType: 'productDetail',
};
return shareParam;
};
// miniQrType=7
const shareGoodsDetail = (shareInfo) => {
let {
productInfo,
union_type
} = shareInfo;
let qrCode;
let productSkn = productInfo.productSkn;
let params = {
productSkn,
union_type,
}
let paramsString = encodeURIComponent(JSON.stringify(params));
qrCode = host + '/wechat/miniapp/img-check.jpg?param=' + paramsString + '&miniQrType=7';
let shareParam = {
title: productInfo.productName ? productInfo.productName : '',
content: productInfo.productName ? productInfo.productName : '',
image: productInfo.colorImage,
url: productInfo.productUrl,
miniProgramPath: 'pages/goodsDetail/goodsDetail?productSkn=' + productSkn,
miniProgramQCodeUrl: qrCode,
product_name: productInfo.productName ? productInfo.productName : '',
sales_price: `¥${productInfo.originalSalesPrice}`,
productDefaultImage: productInfo.colorImage,
product_skn: productSkn + '',
fromType: 'productDetail',
};
return shareParam;
};
// miniQrType=18
const shareStrollDetail = (shareInfo) => {
let {
url,
title,
content,
pic,
minSortName,
wechatShareImgUrl,
union_type
} = shareInfo;
let params = {
id: shareInfo.someKey,
union_type
}
let paramsString = encodeURIComponent(JSON.stringify(params));
let qrCode = host + '/wechat/miniapp/img-check.jpg?param=' + paramsString + '&miniQrType=18';
let miniProgramPath = `page/subPackage/pages/guang/detail?id=${shareInfo.someKey}`;
let shareParam = {
title: title ? title : '',
content: content ? content : '',
pic: pic,
image: pic,
bigImage: wechatShareImgUrl,
url: url,
minSortName,
miniProgramQCodeUrl: qrCode,
miniProgramPath,
};
return shareParam;
}
// miniQrType=9
const shareH5 = (shareInfo) => {
// 请求web数据
let { someKey, url, data, isCatch } = shareInfo;
let param = {
shareId: someKey,
url: data.shareUrl
}
let qrCode = host + '/wechat/miniapp/img-check.jpg?param=' + encodeURIComponent(JSON.stringify(param)) + '&miniQrType=9';
let miniProgramPath = `pages/webview/webview?url=${url}&title=${data.content}`;
let shareParam = {
title: data.content ? data.content : '',
content: data.content ? data.content : '',
image: data.pic,
bigImage: data.bigImage,
url: url,
miniProgramPath,
miniProgramQCodeUrl: qrCode,
from: 'h5',
isCatch,
};
return shareParam;
}
export {
shareGroupPurchaseList,
shareGroupPurchaseDetail,
shareGoodsDetail,
shareStrollDetail,
shareH5,
};