Authored by shuaiguo

Merge branch 'refs/heads/hotfix/close-loading'

{
"name": "yohobuywap-node-activity",
"version": "6.9.22",
"version": "6.9.23",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -12,7 +12,7 @@ const shopTmpl = require('hbs/activity/feature/shop-group.hbs');
const seckillTabTpl = require('hbs/activity/feature/seckill-tab.hbs');
const seckillProductTpl = require('hbs/activity/feature/seckill-product.hbs');
const yo_sdk = require('./feature/yo-sdk');
const { XianyuJSBridge } = require('./xianyu');
let XianyuJSBridge = null;
require('scss/feature.scss');
... ... @@ -1223,9 +1223,37 @@ function miniProgramHandleInit() {
}
}
// 1、判断闲鱼环境,加载相关jssdk资源(layout.hbs 已做)
// 2、打开闲鱼导航栏右侧···按钮,并配置分享参数
// 3、绑定相关触发函数
// /* eslint-disable */
function setXianyuShareInfo() {
// var VConsole = require('vconsole');
// var vConsole = new VConsole();
// const webShareData = {
// title: $('#shareTitle').val(),
// desc: $('#shareImg').val(),
// imgUrl: $('#shareDesc').val(),
// link: $('#shareLink').val()
// };
// const parames = {
// shareType: 'activity', // 类型,默认activity
// image: webShareData.imgUrl,
// url: `${webShareData.link}?isNeedRefresh=false`, // 分享链接
// link: `${webShareData.link}?isNeedRefresh=false`, // 和url保持
// title: `淘口令#${webShareData.title}`, // 分享标题
// text: '' // 分享描述
// };
// XianyuJSBridge.hideLoadingBox().setNavRightItem(parames);
XianyuJSBridge.hideLoadingBox();
}
function xianyuAppHandleInit() {
if (/AliApp/i.test(navigator.userAgent)) {
require('./xianyu');
XianyuJSBridge = require('./xianyu/js-bridge');
setXianyuShareInfo();
}
}
... ... @@ -1602,29 +1630,3 @@ $(function() {
couponSendFinished();
}
});
// 1、判断闲鱼环境,加载相关jssdk资源(layout.hbs 已做)
// 2、打开闲鱼导航栏右侧···按钮,并配置分享参数
// 3、绑定相关触发函数
// /* eslint-disable */
$(function() {
// var VConsole = require('vconsole');
// var vConsole = new VConsole();
// const webShareData = {
// title: $('#shareTitle').val(),
// desc: $('#shareImg').val(),
// imgUrl: $('#shareDesc').val(),
// link: $('#shareLink').val()
// };
// const parames = {
// shareType: 'activity', // 类型,默认activity
// image: webShareData.imgUrl,
// url: `${webShareData.link}?isNeedRefresh=false`, // 分享链接
// link: `${webShareData.link}?isNeedRefresh=false`, // 和url保持
// title: `淘口令#${webShareData.title}`, // 分享标题
// text: '' // 分享描述
// };
// XianyuJSBridge.hideLoadingBox().setNavRightItem(parames);
XianyuJSBridge.hideLoadingBox();
});
... ...
... ... @@ -8,6 +8,7 @@ function XianyuLinkHandle() {
let currentTarget = $(event.currentTarget);
let href = currentTarget.attr('href') ?
currentTarget.attr('href').replace(/[?|&]openby:yohobuy=.*/, '') : 'javascript:void(0)';
let tag = href.indexOf('?') >= 0 ? '&' : '?';
href = href + tag + 'isNeedRefresh=false';
... ... @@ -35,86 +36,3 @@ function XianyuLinkHandle() {
}
export default new XianyuLinkHandle();
/* eslint-disable */
/*
* @ description: js调用闲鱼相关API方法封装
* @ author: huzhiming
* @ date: 2019-12-03 09:45:05
* @ version: v1.0.0
*
*/
export const XianyuJSBridge = {
// 判断是否在闲鱼环境内
get isAliApp () {
return /AliApp/i.test(navigator.userAgent || '');
},
/*
* @ description: 导航栏右侧自定义按钮 设为关闭
* @ author: huzhiming
* @ date: 2019-11-14 16:15:07
* @ version: v1.0.0
*/
closeNavRightItem () {
if (this.isAliApp && window.WindVane) {
window.WindVane.call('WVIdleFishApi', 'setHideNavigatorRightItem', {}, () => { }, () => { })
}
return this;
},
// 导航栏右侧自定义按钮 设为可见
setNavRightItem (shareParam = null) {
window._xianyuShare = () => {
this.setXianyuShare(shareParam);
}
if (this.isAliApp && window.WindVane) {
window.WindVane.call('WVIdleFishApi', 'setNavigatorRightItem', {
title: '∙∙∙', // 按钮名称
func: '_xianyuShare' // func: 'test' //点击调用函数 注意调用的函数必须挂载在window上
}, function(data) {
console.log('setNavigatorRightItem success:', data);
}, function(e) {
console.log('setNavigatorRightItem error:', e);
});
}
return this;
},
/*
* @ description: 配置分享参数进行分享操作
* @ author: huzhiming
* @ date: 2019-11-05 10:38:24
* @ version: v1.0.0
*/
setXianyuShare (param = {
shareType: 'activity', // 类型,默认activity
image: '//img11.static.yhbimg.com/goodsimg/2018/12/24/17/01070adae9791c70ed02593550437cf30e.jpg?imageMogr2/thumbnail/600x600/background/d2hpdGU=/position/center/quality/80',
url: '//xianyu.yohobuy.com/xianyu/index/channel?wxIsAvailable', // 分享链接
link: '//xianyu.yohobuy.com/xianyu/index/channel?wxIsAvailable', // 和url保持
title: '闲鱼潮品首页', // 分享标题
text: '' // 分享描述
}) {
if (this.isAliApp && window.WindVane) {
window.WindVane.call('WVIdleFishApi', 'showShareMenu', param, (data) => {
console.log('success:', JSON.stringify(data), typeof data.isCancel);
// if (data.isCancel === 'false') {}
}, function(e) {
console.log('fail:', JSON.stringify(e));
});
}
return this;
},
// 隐藏 webview loadingBox
hideLoadingBox () {
if (this.isAliApp && window.WindVane) {
window.WindVane.call('WVUI', 'hideLoadingBox', {}, function(e) {
console.log('success: ' + JSON.stringify(e));
}, function(e) {
console.log('failure: ' + JSON.stringify(e));
});
}
return this;
}
};
... ...
/* eslint-disable */
/*
* @ description: js调用闲鱼相关API方法封装
* @ author: huzhiming
* @ date: 2019-12-03 09:45:05
* @ version: v1.0.0
*
*/
const XianyuJSBridge = {
// 判断是否在闲鱼环境内
get isAliApp () {
return /AliApp/i.test(navigator.userAgent || '');
},
/*
* @ description: 导航栏右侧自定义按钮 设为关闭
* @ author: huzhiming
* @ date: 2019-11-14 16:15:07
* @ version: v1.0.0
*/
closeNavRightItem () {
if (this.isAliApp && window.WindVane) {
window.WindVane.call('WVIdleFishApi', 'setHideNavigatorRightItem', {}, () => { }, () => { })
}
return this;
},
// 导航栏右侧自定义按钮 设为可见
setNavRightItem (shareParam = null) {
window._xianyuShare = () => {
this.setXianyuShare(shareParam);
}
if (this.isAliApp && window.WindVane) {
window.WindVane.call('WVIdleFishApi', 'setNavigatorRightItem', {
title: '∙∙∙', // 按钮名称
func: '_xianyuShare' // func: 'test' //点击调用函数 注意调用的函数必须挂载在window上
}, function(data) {
console.log('setNavigatorRightItem success:', data);
}, function(e) {
console.log('setNavigatorRightItem error:', e);
});
}
return this;
},
/*
* @ description: 配置分享参数进行分享操作
* @ author: huzhiming
* @ date: 2019-11-05 10:38:24
* @ version: v1.0.0
*/
setXianyuShare (param = {
shareType: 'activity', // 类型,默认activity
image: '//img11.static.yhbimg.com/goodsimg/2018/12/24/17/01070adae9791c70ed02593550437cf30e.jpg?imageMogr2/thumbnail/600x600/background/d2hpdGU=/position/center/quality/80',
url: '//xianyu.yohobuy.com/xianyu/index/channel?wxIsAvailable', // 分享链接
link: '//xianyu.yohobuy.com/xianyu/index/channel?wxIsAvailable', // 和url保持
title: '闲鱼潮品首页', // 分享标题
text: '' // 分享描述
}) {
if (this.isAliApp && window.WindVane) {
window.WindVane.call('WVIdleFishApi', 'showShareMenu', param, (data) => {
console.log('success:', JSON.stringify(data), typeof data.isCancel);
// if (data.isCancel === 'false') {}
}, function(e) {
console.log('fail:', JSON.stringify(e));
});
}
return this;
},
// 隐藏 webview loadingBox
hideLoadingBox () {
if (this.isAliApp && window.WindVane) {
window.WindVane.call('WVUI', 'hideLoadingBox', {}, function(e) {
console.log('success: ' + JSON.stringify(e));
}, function(e) {
console.log('failure: ' + JSON.stringify(e));
});
}
return this;
}
};
module.exports = XianyuJSBridge;
... ...