Authored by 郭成尧

Merge branch 'develop' of git.yoho.cn:fe/yohoblk-wap into develop

... ... @@ -34,19 +34,21 @@ Vue.mixin({
$(() => {
const $body = $('body');
// 页面内无 JS 时, 自动隐藏 App 显示的 Loading
if ($body.hasClass('no-local-js')) {
yoho.showLoading(false); // 隐藏 App 默认显示的 loading
util.visibilitychange();
}
// 拦截页面内所有 a 标签的跳转
$body.on('click', 'a[href]', function() {
// 拦截跳转
if (!$(this).hasClass('no-intercept')) {
interceptClick.intercept($(this).attr('href'));
return false;
}
});
// App 发送给 H5 的事件,统一转为 Vue-bus 的事件
yoho.addNativeMethod('triggerH5Event', (eventName) => {
alert(eventName);
bus.$emit(eventName);
... ...
... ... @@ -233,7 +233,7 @@ const yoho = {
*/
goSearch(args, success, fail) {
if (this.isApp && window.yohoInterface) {
window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, {
window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, {
method: 'go.search',
arguments: args
});
... ... @@ -250,7 +250,7 @@ const yoho = {
*/
goSetting(args, success, fail) {
if (this.isApp && window.yohoInterface) {
window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, {
window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, {
method: 'go.setting',
arguments: args
});
... ... @@ -267,7 +267,7 @@ const yoho = {
*/
goSetAvatar(args, success, fail) {
if (this.isApp && window.yohoInterface) {
window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, {
window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, {
method: 'go.setAvatar',
arguments: args
});
... ... @@ -284,7 +284,7 @@ const yoho = {
*/
goPageView(args, success, fail) {
if (this.isApp && window.yohoInterface) {
window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, {
window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, {
method: 'go.pageView',
arguments: args
});
... ... @@ -294,6 +294,23 @@ const yoho = {
},
/**
* 更新头部信息
* @param args {""}
* @param success
* @param fail
*/
updateNavigationBar(args, success, fail) {
if (this.isApp) {
window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, {
method: 'update.navigationBarStyle',
arguments: args
});
} else {
tip(tipInfo);
}
},
/**
* 显示 loading
* @param args Boolen
* @param success
... ... @@ -301,7 +318,7 @@ const yoho = {
*/
showLoading(args, success, fail) {
if (this.isApp && window.yohoInterface) {
window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, {
window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, {
method: 'go.loading',
arguments: {
show: args ? 'yes' : 'no'
... ...
... ... @@ -23,7 +23,7 @@
};
},
methods: {
selectItem(item) {
selectItem() {
this.hide();
return true;
},
... ... @@ -49,7 +49,6 @@
z-index: 2010;
overflow: auto;
&.filter-sub-open {
transform: translate3d(0, 0, 0);
}
... ... @@ -85,6 +84,10 @@
padding: 0 $w;
height: 100px;
line-height: 100px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
</style>
\ No newline at end of file
... ...
... ... @@ -210,7 +210,7 @@
header.defaultSelectedIndex = '1';
header.right.des = this.editmodel ? '完成' : '编辑';
return yoho.goPageView({
return yoho.updateNavigationBar({
header: header
});
});
... ...
... ... @@ -228,7 +228,7 @@
header.defaultSelectedIndex = '0';
header.right.des = this.editmodel ? '完成' : '编辑';
return yoho.goPageView({
return yoho.updateNavigationBar({
header: header
});
});
... ...
... ... @@ -409,6 +409,7 @@
const tip = require('common/tip');
const yoho = require('yoho');
const share = require('common/share');
const bus = require('common/vue-bus');
require('vue-swipe/dist/vue-swipe.css');
... ... @@ -498,6 +499,17 @@
});
}
});
},
/*
刷新购物车
*/
refreshCart: function() {
$.get('/product/cart-count.json').then(result=> {
if (result.code === 200) {
this.cartCount = result.data.cart_goods_count;
}
});
}
},
created() {
... ... @@ -555,11 +567,8 @@
// 读取购物车数量
if (this.isApp) {
$.get('/product/cart-count.json').then(result=> {
if (result.code === 200) {
this.cartCount = result.data.cart_goods_count;
}
});
this.refreshCart();
bus.on('app.shoppingcart,refresh', () => this.refreshCart);
}
}
};
... ...