Authored by 郭成尧

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

@@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
26 {{/unless}} 26 {{/unless}}
27 {{/if}} 27 {{/if}}
28 </head> 28 </head>
29 - <body class="{{#if isApp}}app{{/if}} {{#if isiOS}}ios{{/if}} {{#if isAndroid}}android{{/if}}"> 29 + <body class="{{#if isApp}}app{{/if}} {{#if isiOS}}ios{{/if}} {{#if isAndroid}}android{{/if}} {{#if noLocalJS}}no-local-js{{/if}}">
30 <div class="main-wrap"> 30 <div class="main-wrap">
31 {{{body}}} 31 {{{body}}}
32 </div> 32 </div>
@@ -15,10 +15,26 @@ @@ -15,10 +15,26 @@
15 * 2. 查询字符串读取 请使用 yoho-qs 15 * 2. 查询字符串读取 请使用 yoho-qs
16 */ 16 */
17 const $ = require('jquery'); 17 const $ = require('jquery');
  18 +const yoho = require('yoho');
  19 +const Vue = require('vue');
18 const interceptClick = require('common/intercept-click'); 20 const interceptClick = require('common/intercept-click');
19 21
  22 +// 隐藏 App 默认显示的 loading
  23 +Vue.mixin({
  24 + ready() {
  25 + if (this === this.$root && location.pathname !== '/sidebar') {
  26 + yoho.showLoading(false);
  27 + }
  28 + }
  29 +});
  30 +
20 $(() => { 31 $(() => {
21 - $('body').on('click', 'a[href]', function() { 32 + const $body = $('body');
  33 +
  34 + if ($body.hasClass('no-local-js')) {
  35 + yoho.showLoading(false); // 隐藏 App 默认显示的 loading
  36 + }
  37 + $body.on('click', 'a[href]', function() {
22 // 拦截跳转 38 // 拦截跳转
23 if (!$(this).hasClass('no-intercept')) { 39 if (!$(this).hasClass('no-intercept')) {
24 interceptClick($(this).attr('href')); 40 interceptClick($(this).attr('href'));
@@ -8,7 +8,7 @@ if (!yoho.isLogin) { @@ -8,7 +8,7 @@ if (!yoho.isLogin) {
8 return false; 8 return false;
9 }); 9 });
10 } else { 10 } else {
11 - // 地址管理 11 +// 地址管理
12 $('#address').on('click', function() { 12 $('#address').on('click', function() {
13 yoho.goAddress({ 13 yoho.goAddress({
14 type: '2' 14 type: '2'
@@ -22,3 +22,7 @@ $('#setting').on('click', function() { @@ -22,3 +22,7 @@ $('#setting').on('click', function() {
22 yoho.goSetting(); 22 yoho.goSetting();
23 return false; 23 return false;
24 }); 24 });
  25 +
  26 +$(() => {
  27 + yoho.showLoading(false);
  28 +});
@@ -294,19 +294,22 @@ const yoho = { @@ -294,19 +294,22 @@ const yoho = {
294 }, 294 },
295 295
296 /** 296 /**
297 - * 设置频道  
298 - * @param args {"channel": "men"} 297 + * 显示 loading
  298 + * @param args Boolen
299 * @param success 299 * @param success
300 * @param fail 300 * @param fail
301 */ 301 */
302 - goSetChannel(args, success, fail) { 302 + showLoading(args, success, fail) {
303 if (this.isApp) { 303 if (this.isApp) {
304 window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, { 304 window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, {
305 - method: 'go.setChannel',  
306 - arguments: args 305 + method: 'go.loading',
  306 + arguments: {
  307 + show: args ? 'yes' : 'no'
  308 + }
307 }); 309 });
308 } else { 310 } else {
309 - tip(tipInfo); 311 +
  312 + // tip(tipInfo);
310 } 313 }
311 }, 314 },
312 315
@@ -170,7 +170,7 @@ @@ -170,7 +170,7 @@
170 <button class="button control-button"> 170 <button class="button control-button">
171 <span @click="yoho.goShopingCart()" style="position: relative;"> 171 <span @click="yoho.goShopingCart()" style="position: relative;">
172 <i class="icon icon-bag"></i> 172 <i class="icon icon-bag"></i>
173 - <span v-if="cartCount > 0" class="badge badge-tr">{{cartCount}}</span> 173 + <span v-if="isApp && cartCount > 0" class="badge badge-tr">{{cartCount}}</span>
174 </span> 174 </span>
175 </button> 175 </button>
176 <button class="button control-button" @click="toggleFavorite()"> 176 <button class="button control-button" @click="toggleFavorite()">
@@ -541,11 +541,13 @@ @@ -541,11 +541,13 @@
541 }); 541 });
542 542
543 // 读取购物车数量 543 // 读取购物车数量
544 - $.get('/product/cart-count.json').then(result=> {  
545 - if (result.code === 200) {  
546 - this.cartCount = result.data.cart_goods_count;  
547 - }  
548 - }); 544 + if (this.isApp) {
  545 + $.get('/product/cart-count.json').then(result=> {
  546 + if (result.code === 200) {
  547 + this.cartCount = result.data.cart_goods_count;
  548 + }
  549 + });
  550 + }
549 } 551 }
550 }; 552 };
551 </script> 553 </script>