Merge branch 'master' into feature/coupon-capthca
# Conflicts: # package.json # public/js/activity/feature.page.js
Showing
4 changed files
with
117 additions
and
113 deletions
1 | { | 1 | { |
2 | "name": "yohobuywap-node-activity", | 2 | "name": "yohobuywap-node-activity", |
3 | - "version": "6.9.23", | 3 | + "version": "6.9.24", |
4 | "private": true, | 4 | "private": true, |
5 | "description": "A New Yohobuy Project With Express", | 5 | "description": "A New Yohobuy Project With Express", |
6 | "repository": { | 6 | "repository": { |
@@ -12,7 +12,7 @@ const shopTmpl = require('hbs/activity/feature/shop-group.hbs'); | @@ -12,7 +12,7 @@ const shopTmpl = require('hbs/activity/feature/shop-group.hbs'); | ||
12 | const seckillTabTpl = require('hbs/activity/feature/seckill-tab.hbs'); | 12 | const seckillTabTpl = require('hbs/activity/feature/seckill-tab.hbs'); |
13 | const seckillProductTpl = require('hbs/activity/feature/seckill-product.hbs'); | 13 | const seckillProductTpl = require('hbs/activity/feature/seckill-product.hbs'); |
14 | const yo_sdk = require('./feature/yo-sdk'); | 14 | const yo_sdk = require('./feature/yo-sdk'); |
15 | -const { XianyuJSBridge } = require('./xianyu'); | 15 | +let XianyuJSBridge = null; |
16 | 16 | ||
17 | require('scss/feature.scss'); | 17 | require('scss/feature.scss'); |
18 | 18 | ||
@@ -1223,9 +1223,37 @@ function miniProgramHandleInit() { | @@ -1223,9 +1223,37 @@ function miniProgramHandleInit() { | ||
1223 | } | 1223 | } |
1224 | } | 1224 | } |
1225 | 1225 | ||
1226 | +// 1、判断闲鱼环境,加载相关jssdk资源(layout.hbs 已做) | ||
1227 | +// 2、打开闲鱼导航栏右侧···按钮,并配置分享参数 | ||
1228 | +// 3、绑定相关触发函数 | ||
1229 | +// /* eslint-disable */ | ||
1230 | +function setXianyuShareInfo() { | ||
1231 | + // var VConsole = require('vconsole'); | ||
1232 | + // var vConsole = new VConsole(); | ||
1233 | + // const webShareData = { | ||
1234 | + // title: $('#shareTitle').val(), | ||
1235 | + // desc: $('#shareImg').val(), | ||
1236 | + // imgUrl: $('#shareDesc').val(), | ||
1237 | + // link: $('#shareLink').val() | ||
1238 | + // }; | ||
1239 | + // const parames = { | ||
1240 | + // shareType: 'activity', // 类型,默认activity | ||
1241 | + // image: webShareData.imgUrl, | ||
1242 | + // url: `${webShareData.link}?isNeedRefresh=false`, // 分享链接 | ||
1243 | + // link: `${webShareData.link}?isNeedRefresh=false`, // 和url保持 | ||
1244 | + // title: `淘口令#${webShareData.title}`, // 分享标题 | ||
1245 | + // text: '' // 分享描述 | ||
1246 | + // }; | ||
1247 | + | ||
1248 | + // XianyuJSBridge.hideLoadingBox().setNavRightItem(parames); | ||
1249 | + XianyuJSBridge.hideLoadingBox(); | ||
1250 | +} | ||
1251 | + | ||
1226 | function xianyuAppHandleInit() { | 1252 | function xianyuAppHandleInit() { |
1227 | if (/AliApp/i.test(navigator.userAgent)) { | 1253 | if (/AliApp/i.test(navigator.userAgent)) { |
1228 | require('./xianyu'); | 1254 | require('./xianyu'); |
1255 | + XianyuJSBridge = require('./xianyu/js-bridge'); | ||
1256 | + setXianyuShareInfo(); | ||
1229 | } | 1257 | } |
1230 | } | 1258 | } |
1231 | 1259 | ||
@@ -1602,30 +1630,3 @@ $(function() { | @@ -1602,30 +1630,3 @@ $(function() { | ||
1602 | couponSendFinished(); | 1630 | couponSendFinished(); |
1603 | } | 1631 | } |
1604 | }); | 1632 | }); |
1605 | - | ||
1606 | -// 1、判断闲鱼环境,加载相关jssdk资源(layout.hbs 已做) | ||
1607 | -// 2、打开闲鱼导航栏右侧···按钮,并配置分享参数 | ||
1608 | -// 3、绑定相关触发函数 | ||
1609 | -// /* eslint-disable */ | ||
1610 | -$(function() { | ||
1611 | - // var VConsole = require('vconsole'); | ||
1612 | - // var vConsole = new VConsole(); | ||
1613 | - | ||
1614 | - // const webShareData = { | ||
1615 | - // title: $('#shareTitle').val(), | ||
1616 | - // desc: $('#shareImg').val(), | ||
1617 | - // imgUrl: $('#shareDesc').val(), | ||
1618 | - // link: $('#shareLink').val() | ||
1619 | - // }; | ||
1620 | - // const parames = { | ||
1621 | - // shareType: 'activity', // 类型,默认activity | ||
1622 | - // image: webShareData.imgUrl, | ||
1623 | - // url: `${webShareData.link}?isNeedRefresh=false`, // 分享链接 | ||
1624 | - // link: `${webShareData.link}?isNeedRefresh=false`, // 和url保持 | ||
1625 | - // title: `淘口令#${webShareData.title}`, // 分享标题 | ||
1626 | - // text: '' // 分享描述 | ||
1627 | - // }; | ||
1628 | - | ||
1629 | - // XianyuJSBridge.hideLoadingBox().setNavRightItem(parames); | ||
1630 | - XianyuJSBridge.hideLoadingBox(); | ||
1631 | -}); |
@@ -7,7 +7,10 @@ function XianyuLinkHandle() { | @@ -7,7 +7,10 @@ function XianyuLinkHandle() { | ||
7 | event => { | 7 | event => { |
8 | let currentTarget = $(event.currentTarget); | 8 | let currentTarget = $(event.currentTarget); |
9 | let href = currentTarget.attr('href') ? | 9 | let href = currentTarget.attr('href') ? |
10 | - currentTarget.attr('href').replace(/[?|&]openby:yohobuy=.*/, '') : 'javascript:void(0)'; | 10 | + currentTarget.attr('href').replace(/[?|&]openby:yohobuy=.*/, '').repalce(/\n/, '') : |
11 | + // eslint-disable-next-line no-script-url | ||
12 | + 'javascript:void(0)'; | ||
13 | + | ||
11 | let tag = href.indexOf('?') >= 0 ? '&' : '?'; | 14 | let tag = href.indexOf('?') >= 0 ? '&' : '?'; |
12 | 15 | ||
13 | href = href + tag + 'isNeedRefresh=false'; | 16 | href = href + tag + 'isNeedRefresh=false'; |
@@ -35,86 +38,3 @@ function XianyuLinkHandle() { | @@ -35,86 +38,3 @@ function XianyuLinkHandle() { | ||
35 | } | 38 | } |
36 | 39 | ||
37 | export default new XianyuLinkHandle(); | 40 | export default new XianyuLinkHandle(); |
38 | - | ||
39 | -/* eslint-disable */ | ||
40 | -/* | ||
41 | - * @ description: js调用闲鱼相关API方法封装 | ||
42 | - * @ author: huzhiming | ||
43 | - * @ date: 2019-12-03 09:45:05 | ||
44 | - * @ version: v1.0.0 | ||
45 | - * | ||
46 | -*/ | ||
47 | -export const XianyuJSBridge = { | ||
48 | - // 判断是否在闲鱼环境内 | ||
49 | - get isAliApp () { | ||
50 | - return /AliApp/i.test(navigator.userAgent || ''); | ||
51 | - }, | ||
52 | - /* | ||
53 | - * @ description: 导航栏右侧自定义按钮 设为关闭 | ||
54 | - * @ author: huzhiming | ||
55 | - * @ date: 2019-11-14 16:15:07 | ||
56 | - * @ version: v1.0.0 | ||
57 | - */ | ||
58 | - closeNavRightItem () { | ||
59 | - if (this.isAliApp && window.WindVane) { | ||
60 | - window.WindVane.call('WVIdleFishApi', 'setHideNavigatorRightItem', {}, () => { }, () => { }) | ||
61 | - } | ||
62 | - return this; | ||
63 | - }, | ||
64 | - | ||
65 | - // 导航栏右侧自定义按钮 设为可见 | ||
66 | - setNavRightItem (shareParam = null) { | ||
67 | - window._xianyuShare = () => { | ||
68 | - this.setXianyuShare(shareParam); | ||
69 | - } | ||
70 | - if (this.isAliApp && window.WindVane) { | ||
71 | - window.WindVane.call('WVIdleFishApi', 'setNavigatorRightItem', { | ||
72 | - title: '∙∙∙', // 按钮名称 | ||
73 | - func: '_xianyuShare' // func: 'test' //点击调用函数 注意调用的函数必须挂载在window上 | ||
74 | - }, function(data) { | ||
75 | - console.log('setNavigatorRightItem success:', data); | ||
76 | - }, function(e) { | ||
77 | - console.log('setNavigatorRightItem error:', e); | ||
78 | - }); | ||
79 | - } | ||
80 | - return this; | ||
81 | - }, | ||
82 | - | ||
83 | - /* | ||
84 | - * @ description: 配置分享参数进行分享操作 | ||
85 | - * @ author: huzhiming | ||
86 | - * @ date: 2019-11-05 10:38:24 | ||
87 | - * @ version: v1.0.0 | ||
88 | - */ | ||
89 | - setXianyuShare (param = { | ||
90 | - shareType: 'activity', // 类型,默认activity | ||
91 | - image: '//img11.static.yhbimg.com/goodsimg/2018/12/24/17/01070adae9791c70ed02593550437cf30e.jpg?imageMogr2/thumbnail/600x600/background/d2hpdGU=/position/center/quality/80', | ||
92 | - url: '//xianyu.yohobuy.com/xianyu/index/channel?wxIsAvailable', // 分享链接 | ||
93 | - link: '//xianyu.yohobuy.com/xianyu/index/channel?wxIsAvailable', // 和url保持 | ||
94 | - title: '闲鱼潮品首页', // 分享标题 | ||
95 | - text: '' // 分享描述 | ||
96 | - }) { | ||
97 | - if (this.isAliApp && window.WindVane) { | ||
98 | - window.WindVane.call('WVIdleFishApi', 'showShareMenu', param, (data) => { | ||
99 | - console.log('success:', JSON.stringify(data), typeof data.isCancel); | ||
100 | - // if (data.isCancel === 'false') {} | ||
101 | - }, function(e) { | ||
102 | - console.log('fail:', JSON.stringify(e)); | ||
103 | - }); | ||
104 | - } | ||
105 | - return this; | ||
106 | - }, | ||
107 | - | ||
108 | - // 隐藏 webview loadingBox | ||
109 | - hideLoadingBox () { | ||
110 | - if (this.isAliApp && window.WindVane) { | ||
111 | - window.WindVane.call('WVUI', 'hideLoadingBox', {}, function(e) { | ||
112 | - console.log('success: ' + JSON.stringify(e)); | ||
113 | - }, function(e) { | ||
114 | - console.log('failure: ' + JSON.stringify(e)); | ||
115 | - }); | ||
116 | - } | ||
117 | - return this; | ||
118 | - } | ||
119 | -}; | ||
120 | - |
public/js/activity/xianyu/js-bridge.js
0 → 100644
1 | +/* eslint-disable */ | ||
2 | +/* | ||
3 | + * @ description: js调用闲鱼相关API方法封装 | ||
4 | + * @ author: huzhiming | ||
5 | + * @ date: 2019-12-03 09:45:05 | ||
6 | + * @ version: v1.0.0 | ||
7 | + * | ||
8 | +*/ | ||
9 | + const XianyuJSBridge = { | ||
10 | + // 判断是否在闲鱼环境内 | ||
11 | + get isAliApp () { | ||
12 | + return /AliApp/i.test(navigator.userAgent || ''); | ||
13 | + }, | ||
14 | + /* | ||
15 | + * @ description: 导航栏右侧自定义按钮 设为关闭 | ||
16 | + * @ author: huzhiming | ||
17 | + * @ date: 2019-11-14 16:15:07 | ||
18 | + * @ version: v1.0.0 | ||
19 | + */ | ||
20 | + closeNavRightItem () { | ||
21 | + if (this.isAliApp && window.WindVane) { | ||
22 | + window.WindVane.call('WVIdleFishApi', 'setHideNavigatorRightItem', {}, () => { }, () => { }) | ||
23 | + } | ||
24 | + return this; | ||
25 | + }, | ||
26 | + | ||
27 | + // 导航栏右侧自定义按钮 设为可见 | ||
28 | + setNavRightItem (shareParam = null) { | ||
29 | + window._xianyuShare = () => { | ||
30 | + this.setXianyuShare(shareParam); | ||
31 | + } | ||
32 | + if (this.isAliApp && window.WindVane) { | ||
33 | + window.WindVane.call('WVIdleFishApi', 'setNavigatorRightItem', { | ||
34 | + title: '∙∙∙', // 按钮名称 | ||
35 | + func: '_xianyuShare' // func: 'test' //点击调用函数 注意调用的函数必须挂载在window上 | ||
36 | + }, function(data) { | ||
37 | + console.log('setNavigatorRightItem success:', data); | ||
38 | + }, function(e) { | ||
39 | + console.log('setNavigatorRightItem error:', e); | ||
40 | + }); | ||
41 | + } | ||
42 | + return this; | ||
43 | + }, | ||
44 | + | ||
45 | + /* | ||
46 | + * @ description: 配置分享参数进行分享操作 | ||
47 | + * @ author: huzhiming | ||
48 | + * @ date: 2019-11-05 10:38:24 | ||
49 | + * @ version: v1.0.0 | ||
50 | + */ | ||
51 | + setXianyuShare (param = { | ||
52 | + shareType: 'activity', // 类型,默认activity | ||
53 | + image: '//img11.static.yhbimg.com/goodsimg/2018/12/24/17/01070adae9791c70ed02593550437cf30e.jpg?imageMogr2/thumbnail/600x600/background/d2hpdGU=/position/center/quality/80', | ||
54 | + url: '//xianyu.yohobuy.com/xianyu/index/channel?wxIsAvailable', // 分享链接 | ||
55 | + link: '//xianyu.yohobuy.com/xianyu/index/channel?wxIsAvailable', // 和url保持 | ||
56 | + title: '闲鱼潮品首页', // 分享标题 | ||
57 | + text: '' // 分享描述 | ||
58 | + }) { | ||
59 | + if (this.isAliApp && window.WindVane) { | ||
60 | + window.WindVane.call('WVIdleFishApi', 'showShareMenu', param, (data) => { | ||
61 | + console.log('success:', JSON.stringify(data), typeof data.isCancel); | ||
62 | + // if (data.isCancel === 'false') {} | ||
63 | + }, function(e) { | ||
64 | + console.log('fail:', JSON.stringify(e)); | ||
65 | + }); | ||
66 | + } | ||
67 | + return this; | ||
68 | + }, | ||
69 | + | ||
70 | + // 隐藏 webview loadingBox | ||
71 | + hideLoadingBox () { | ||
72 | + if (this.isAliApp && window.WindVane) { | ||
73 | + window.WindVane.call('WVUI', 'hideLoadingBox', {}, function(e) { | ||
74 | + console.log('success: ' + JSON.stringify(e)); | ||
75 | + }, function(e) { | ||
76 | + console.log('failure: ' + JSON.stringify(e)); | ||
77 | + }); | ||
78 | + } | ||
79 | + return this; | ||
80 | + } | ||
81 | +}; | ||
82 | + | ||
83 | +module.exports = XianyuJSBridge; |
-
Please register or login to post a comment