Authored by 陈峰

Merge branch 'release/3.0' into 'gray'

yas



See merge request !32
  1 +import yoho from 'yoho';
  2 +
1 export default () => { 3 export default () => {
2 return { 4 return {
3 REC_ID: '', 5 REC_ID: '',
@@ -6,15 +8,13 @@ export default () => { @@ -6,15 +8,13 @@ export default () => {
6 '_' + Math.floor(Math.random() * 1000000 + 1000000)); 8 '_' + Math.floor(Math.random() * 1000000 + 1000000));
7 }, 9 },
8 event(op, param) { 10 event(op, param) {
9 - if (window._yas && window._yas.sendCustomInfo) {  
10 - setTimeout(() => {  
11 - window._yas.sendCustomInfo({  
12 - op: op,  
13 - param: JSON.stringify(Object.assign(param, {  
14 - REC_ID: this.REC_ID  
15 - }))  
16 - }, true);  
17 - }, 0); 11 + if (window._yas && window._yas.sendAppLogs) {
  12 + window._yas.sendAppLogs({
  13 + appop: op,
  14 + param: JSON.stringify(Object.assign(param, {
  15 + REC_ID: this.REC_ID
  16 + }))
  17 + }, true);
18 } 18 }
19 }, 19 },
20 eventData(op, param) { 20 eventData(op, param) {
@@ -50,6 +50,11 @@ directive(Vue); @@ -50,6 +50,11 @@ directive(Vue);
50 filter(Vue); 50 filter(Vue);
51 Vue.use(VueTouch); 51 Vue.use(VueTouch);
52 52
  53 +Vue.prototype.$isApp = yoho.isApp;
  54 +Vue.prototype.$isiOS = yoho.isiOS;
  55 +Vue.prototype.$isAndroid = yoho.isAndroid;
  56 +Vue.prototype.$isYohoBuy = yoho.isYohoBuy;
  57 +
53 $(() => { 58 $(() => {
54 const $body = $('body'); 59 const $body = $('body');
55 60
@@ -65,13 +65,15 @@ @@ -65,13 +65,15 @@
65 }, 65 },
66 methods: { 66 methods: {
67 clickProduct(item, index) { 67 clickProduct(item, index) {
68 - this.$yas.event('YB_GOODS_LIST_DT', {  
69 - TYPE_ID: 13,  
70 - ENT_ID: this.query,  
71 - I_INDEX: index + 1,  
72 - PRD_ID: item.product_id,  
73 - SORT_TYPE: this.orderType  
74 - }); 68 + if (this.$isYohoBuy) {
  69 + this.$yas.event('YB_GOODS_LIST_DT', {
  70 + TYPE_ID: 13,
  71 + ENT_ID: this.query,
  72 + I_INDEX: index + 1,
  73 + PRD_ID: item.product_id,
  74 + SORT_TYPE: this.orderType
  75 + });
  76 + }
75 }, 77 },
76 search: function() { 78 search: function() {
77 const nextPage = this.page + 1; 79 const nextPage = this.page + 1;
@@ -102,15 +104,19 @@ @@ -102,15 +104,19 @@
102 if (!this.filterConfig) { 104 if (!this.filterConfig) {
103 this.filterConfig = res.data.filter; 105 this.filterConfig = res.data.filter;
104 } 106 }
105 - this.$yas.eventData('YB_GOODS_LIST', {  
106 - TYPE_ID: 13,  
107 - ENT_ID: this.query,  
108 - TOTAL: this.productList.length,  
109 - PRD_LIST: this.productList.map(product => {  
110 - return product.product_id;  
111 - }).join(','),  
112 - SORT_TYPE: this.orderType,  
113 - }); 107 + if (this.$isYohoBuy) {
  108 + setTimeout(() => {
  109 + this.$yas.eventData('YB_GOODS_LIST', {
  110 + TYPE_ID: 13,
  111 + ENT_ID: this.query,
  112 + TOTAL: this.productList.length,
  113 + PRD_LIST: this.productList.map(product => {
  114 + return product.product_id;
  115 + }).join(','),
  116 + SORT_TYPE: this.orderType,
  117 + });
  118 + }, 500);
  119 + }
114 } 120 }
115 }) 121 })
116 .fail(() => { 122 .fail(() => {
@@ -142,7 +148,6 @@ @@ -142,7 +148,6 @@
142 created: function() { 148 created: function() {
143 const self = this; 149 const self = this;
144 150
145 -  
146 bus.$on('list.paging', function() { 151 bus.$on('list.paging', function() {
147 self.search(); 152 self.search();
148 }); 153 });