提交 afb99301 作者: 王进

客服切支付增加返回值2

上级 3178ff6b
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @time: 2018-09-19 * @time: 2018-09-19
*/ */
class WechatSDK { class WechatSDK {
private sdkVersion: string = '2.0' private sdkVersion: string = '2.1'
public constructor() { public constructor() {
this.sdkInit() this.sdkInit()
this.timerInit(); this.timerInit();
...@@ -36,7 +36,7 @@ class WechatSDK { ...@@ -36,7 +36,7 @@ class WechatSDK {
const options = _selt.getOptionsInfo(); // 返回参数对象 const options = _selt.getOptionsInfo(); // 返回参数对象
_selt.ReportParams.from = options.from || 0; _selt.ReportParams.from = options.from || 0;
_selt.ReportParams.tag = options.tag || 0; _selt.ReportParams.tag = options.tag || 0;
_selt.ReportParams.passthroughParams = options.tag || ''; _selt.ReportParams.passthroughParams = options.passthroughParams || '';
_selt.ReportParams.fromOpenId = options.fromOpenId || ''; _selt.ReportParams.fromOpenId = options.fromOpenId || '';
_selt.actId = options.actId || ''; _selt.actId = options.actId || '';
await _selt.getNetworkType(); await _selt.getNetworkType();
...@@ -176,6 +176,7 @@ class WechatSDK { ...@@ -176,6 +176,7 @@ class WechatSDK {
} }
} }
_selt.showModal(params); _selt.showModal(params);
return 2;
} else { } else {
// 根据返回的用户订单状态判断是新订单还是未完成订单 // 根据返回的用户订单状态判断是新订单还是未完成订单
if (res.data.order_type == 1) { // 新订单 if (res.data.order_type == 1) { // 新订单
...@@ -820,8 +821,9 @@ class WechatSDK { ...@@ -820,8 +821,9 @@ class WechatSDK {
}, },
success: function (res) { success: function (res) {
let ShareParams = { let ShareParams = {
title: shareInfo.share_title ? shareInfo.share_title : SDKConfig.shareTitle, title: shareInfo.title ? shareInfo.title : SDKConfig.shareTitle,
imageUrl: shareInfo.share_image ? shareInfo.share_image : SDKConfig.shareImageUrl, imageUrl: shareInfo.image ? shareInfo.image : SDKConfig.shareImageUrl,
imageId: shareInfo.imageId ? shareInfo.imageId : SDKConfig.shareImageId,
query: 'fromOpenId=' + _self.ReportParams.openId + '&from=share&tag=0&actId=' + actId query: 'fromOpenId=' + _self.ReportParams.openId + '&from=share&tag=0&actId=' + actId
} }
console.log("^^SDK::ShareParams", ShareParams); console.log("^^SDK::ShareParams", ShareParams);
...@@ -835,7 +837,7 @@ class WechatSDK { ...@@ -835,7 +837,7 @@ class WechatSDK {
} }
private shareInit() { private shareInit() {
(wx as any).showShareMenu({ (wx as any).showShareMenu({
withShareTicket: 'true', withShareTicket: true,
success: () => { }, success: () => { },
fail: () => { }, fail: () => { },
complete: () => { } complete: () => { }
...@@ -849,6 +851,7 @@ class WechatSDK { ...@@ -849,6 +851,7 @@ class WechatSDK {
const ShareParams = { const ShareParams = {
title: shareInfo.title ? shareInfo.title : SDKConfig.shareTitle, title: shareInfo.title ? shareInfo.title : SDKConfig.shareTitle,
imageUrl: shareInfo.image ? shareInfo.image : SDKConfig.shareImageUrl, imageUrl: shareInfo.image ? shareInfo.image : SDKConfig.shareImageUrl,
imageUrlId: shareInfo.imageId ? shareInfo.imageId : SDKConfig.shareImageId,
query: 'fromOpenId=' + that.ReportParams.openId + '&from=share&tag=0&' + (shareInfo.query ? shareInfo.query : ''), query: 'fromOpenId=' + that.ReportParams.openId + '&from=share&tag=0&' + (shareInfo.query ? shareInfo.query : ''),
withShareTicket: true, withShareTicket: true,
success: shareInfo.success, success: shareInfo.success,
...@@ -865,17 +868,19 @@ class WechatSDK { ...@@ -865,17 +868,19 @@ class WechatSDK {
const ShareParams = { const ShareParams = {
title: SDKConfig.shareTitle, title: SDKConfig.shareTitle,
imageUrl: SDKConfig.shareImageUrl, imageUrl: SDKConfig.shareImageUrl,
imageId: SDKConfig.shareImageId,
query: 'fromOpenId=' + that.ReportParams.openId + '&from=share&tag=0&' + (params ? params : '') query: 'fromOpenId=' + that.ReportParams.openId + '&from=share&tag=0&' + (params ? params : '')
} }
return this.share(ShareParams) return this.share(ShareParams)
} }
public ShareGameInfo(shareObj?) { public ShareGameInfo(shareInfo?) {
const that = this const that = this
// 参数,记录分享的用户openid // 参数,记录分享的用户openid
const ShareParams = { const ShareParams = {
title: shareObj && shareObj.title ? shareObj.title : SDKConfig.shareTitle, title: shareInfo && shareInfo.title ? shareInfo.title : SDKConfig.shareTitle,
imageUrl: shareObj && shareObj.image ? shareObj.image : SDKConfig.shareImageUrl, imageUrl: shareInfo && shareInfo.image ? shareInfo.image : SDKConfig.shareImageUrl,
query: 'fromOpenId=' + that.ReportParams.openId + '&from=share&tag=0&' + (shareObj.extraData ? shareObj.extraData : '') imageId: shareInfo && shareInfo.imageId ? shareInfo.imageId : SDKConfig.shareImageId,
query: 'fromOpenId=' + that.ReportParams.openId + '&from=share&tag=0&' + (shareInfo.extraData ? shareInfo.extraData : '')
} }
return this.share(ShareParams) return this.share(ShareParams)
} }
...@@ -943,6 +948,7 @@ const Links = { ...@@ -943,6 +948,7 @@ const Links = {
class shareInfo { class shareInfo {
title?: string title?: string
image?: string image?: string
imageId? : string
query?: string query?: string
success: any success: any
fail: any fail: any
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论