Authored by 沈志敏

fix bug

@@ -2,17 +2,7 @@ var yoho = require('yoho'); @@ -2,17 +2,7 @@ var yoho = require('yoho');
2 var $ = require('jquery'); 2 var $ = require('jquery');
3 var util = require('common/util'); 3 var util = require('common/util');
4 4
5 -$(() => {  
6 - window.addEventListener('touchmove', function() {  
7 - var topHeight = document.body.scrollTop;  
8 -  
9 - if (topHeight > 50) {  
10 - $('#header').addClass('top-change');  
11 - } else {  
12 - $('#header').removeClass('top-change');  
13 - }  
14 - });  
15 - 5 +yoho.ready(() => {
16 if (!yoho.isLogin) { 6 if (!yoho.isLogin) {
17 $('.auth').addClass('no-intercept'); 7 $('.auth').addClass('no-intercept');
18 $('.auth').on('click', function() { 8 $('.auth').on('click', function() {
@@ -37,4 +27,20 @@ $(() => { @@ -37,4 +27,20 @@ $(() => {
37 27
38 yoho.showLoading(false); 28 yoho.showLoading(false);
39 util.visibilitychange(); 29 util.visibilitychange();
  30 +
  31 + window.addEventListener('touchmove', function() {
  32 + var topHeight = document.body.scrollTop;
  33 +
  34 + if (topHeight > 50) {
  35 + $('#header').addClass('top-change');
  36 + } else {
  37 + $('#header').removeClass('top-change');
  38 + }
  39 + });
  40 +
  41 + document.addEventListener('visibilitychange', () => {
  42 + if (!document.hidden) {
  43 + location.reload();
  44 + }
  45 + });
40 }); 46 });
@@ -7,16 +7,19 @@ @@ -7,16 +7,19 @@
7 7
8 const Vue = require('vue'); 8 const Vue = require('vue');
9 const OrderDetail = require('me/order-detail.vue'); 9 const OrderDetail = require('me/order-detail.vue');
  10 +const yoho = require('yoho');
10 11
11 require('common/vue-filter')(Vue); 12 require('common/vue-filter')(Vue);
12 require('common/count-down'); 13 require('common/count-down');
13 14
14 -new Vue({  
15 - el: '#order-detail',  
16 - data: {  
17 - orderCode: document.getElementById('order-code').value  
18 - },  
19 - components: {  
20 - OrderDetail  
21 - } 15 +yoho.ready(() => {
  16 + new Vue({
  17 + el: '#order-detail',
  18 + data: {
  19 + orderCode: document.getElementById('order-code').value
  20 + },
  21 + components: {
  22 + OrderDetail
  23 + }
  24 + });
22 }); 25 });
@@ -33,6 +33,14 @@ const yoho = { @@ -33,6 +33,14 @@ const yoho = {
33 */ 33 */
34 data: window.yohoInterfaceData, 34 data: window.yohoInterfaceData,
35 35
  36 + ready(callback) {
  37 + if (this.isApp) {
  38 + document.addEventListener('deviceready', callback);
  39 + } else {
  40 + callback();
  41 + }
  42 + },
  43 +
36 /** 44 /**
37 * 跳转至指定index的tab(从0开始) 45 * 跳转至指定index的tab(从0开始)
38 * @param args 传递给 APP 的参数 {"index":tab_index} 46 * @param args 传递给 APP 的参数 {"index":tab_index}