Authored by 郭成尧

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

... ... @@ -26,7 +26,7 @@
{{/unless}}
{{/if}}
</head>
<body class="{{#if isApp}}app{{/if}} {{#if isiOS}}ios{{/if}} {{#if isAndroid}}android{{/if}}">
<body class="{{#if isApp}}app{{/if}} {{#if isiOS}}ios{{/if}} {{#if isAndroid}}android{{/if}} {{#if noLocalJS}}no-local-js{{/if}}">
<div class="main-wrap">
{{{body}}}
</div>
... ...
... ... @@ -15,10 +15,26 @@
* 2. 查询字符串读取 请使用 yoho-qs
*/
const $ = require('jquery');
const yoho = require('yoho');
const Vue = require('vue');
const interceptClick = require('common/intercept-click');
// 隐藏 App 默认显示的 loading
Vue.mixin({
ready() {
if (this === this.$root && location.pathname !== '/sidebar') {
yoho.showLoading(false);
}
}
});
$(() => {
$('body').on('click', 'a[href]', function() {
const $body = $('body');
if ($body.hasClass('no-local-js')) {
yoho.showLoading(false); // 隐藏 App 默认显示的 loading
}
$body.on('click', 'a[href]', function() {
// 拦截跳转
if (!$(this).hasClass('no-intercept')) {
interceptClick($(this).attr('href'));
... ...
... ... @@ -8,7 +8,7 @@ if (!yoho.isLogin) {
return false;
});
} else {
// 地址管理
// 地址管理
$('#address').on('click', function() {
yoho.goAddress({
type: '2'
... ... @@ -22,3 +22,7 @@ $('#setting').on('click', function() {
yoho.goSetting();
return false;
});
$(() => {
yoho.showLoading(false);
});
... ...
... ... @@ -294,19 +294,22 @@ const yoho = {
},
/**
* 设置频道
* @param args {"channel": "men"}
* 显示 loading
* @param args Boolen
* @param success
* @param fail
*/
goSetChannel(args, success, fail) {
showLoading(args, success, fail) {
if (this.isApp) {
window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, {
method: 'go.setChannel',
arguments: args
method: 'go.loading',
arguments: {
show: args ? 'yes' : 'no'
}
});
} else {
tip(tipInfo);
// tip(tipInfo);
}
},
... ...
... ... @@ -170,7 +170,7 @@
<button class="button control-button">
<span @click="yoho.goShopingCart()" style="position: relative;">
<i class="icon icon-bag"></i>
<span v-if="cartCount > 0" class="badge badge-tr">{{cartCount}}</span>
<span v-if="isApp && cartCount > 0" class="badge badge-tr">{{cartCount}}</span>
</span>
</button>
<button class="button control-button" @click="toggleFavorite()">
... ... @@ -541,11 +541,13 @@
});
// 读取购物车数量
$.get('/product/cart-count.json').then(result=> {
if (result.code === 200) {
this.cartCount = result.data.cart_goods_count;
}
});
if (this.isApp) {
$.get('/product/cart-count.json').then(result=> {
if (result.code === 200) {
this.cartCount = result.data.cart_goods_count;
}
});
}
}
};
</script>
... ...