Authored by 陈峰

Merge branch 'release/3.0' into 'gray'

yas



See merge request !31
... ... @@ -31,6 +31,9 @@
{{{body}}}
</div>
{{#unless devEnv}}
{{> analysis}}
{{/unless}}
{{#if devEnv}}
<script src="//{{devHost}}:5004/libs.js"></script>
{{#unless noLocalJS}}
... ... @@ -42,8 +45,5 @@
<script src="//cdn.yoho.cn/yohoblk-wap/{{version}}/{{module}}.{{page}}.js"></script>
{{/unless}}
{{/if}}
{{#unless devEnv}}
{{> analysis}}
{{/unless}}
</body>
</html>
... ...
<script>
{{!--(function(w, d, s, j, f) {
(function(w, d, s, j, f) {
var a = d.createElement(s);
var m = d.getElementsByTagName(s)[0];
w.YohoAcquisitionObject = f;
w[f] = function() {
w[f].p = arguments;
};
a.async = 1;
a.src = j;
m.parentNode.insertBefore(a, m);
}(window, document, 'script', (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//cdn.yoho.cn/yas-jssdk/2.1.2/yas.js', '_yas'));
}(window, document, 'script', (document.location.protocol === 'https:' ? 'https:' : 'http:') + '//cdn.yoho.cn/yas-jssdk/2.4.2/yas.js', '_yas'));
(function() {
function getUid() {
... ... @@ -18,12 +20,12 @@
name = '_UID',
cookies = (document.cookie && document.cookie.split(';')) || [];
cookies.forEach(function(c) {
if (c.indexOf(name) > -1) {
uid = decodeURIComponent(c.replace(name + '=', '').trim());
return;
for (var i = 0; i < cookies.length; i++) {
if (cookies[i].indexOf(name) > -1) {
uid = decodeURIComponent(cookies[i].replace(name + '=', '').trim());
break;
}
});
}
if (!uid) return 0;
... ... @@ -48,13 +50,26 @@
}
var uid = getUid() || queryString().uid;
var isYohoBuy = /YohoBuy/i.test(navigator.userAgent || '');
var isIos = /\(i[^;]+;( U;)? CPU.+Mac OS X/i.test(navigator.userAgent || '');
var isAndroid = /Android/i.test(navigator.userAgent || '');
uid = uid === 0 ? '' : uid;
window._ozuid = uid; // 暴露ozuid
if (window._yas) {
window._yas(1 * new Date(), '2.1.2', 'yohoblk_m', uid, '', '');
let ak = 'yohoblk_m';
if (isYohoBuy) {
if (isIos) {
ak = 'yohobuy_ios';
} else if (isAndroid) {
ak = 'yohobuy_android';
}
}
window._yas(1 * new Date(), '2.4.2', ak, uid, '', '');
}
}());--}}
}());
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
... ...
export default () => {
return {
REC_ID: '',
generateREC_ID() {
return (new Date().getTime() + '_H5_YOHOBLK_' + Math.floor(Math.random() * 1000000 + 1000000) +
'_' + Math.floor(Math.random() * 1000000 + 1000000));
},
event(op, param) {
if (window._yas && window._yas.sendCustomInfo) {
setTimeout(() => {
window._yas.sendCustomInfo({
op: op,
param: JSON.stringify(Object.assign(param, {
REC_ID: this.REC_ID
}))
}, true);
}, 0);
}
},
eventData(op, param) {
this.REC_ID = this.generateREC_ID();
this.event(op, param);
}
};
};
... ...
... ... @@ -25,6 +25,7 @@ import FastClick from 'fastclick';
import directive from 'common/vue-directive';
import filter from 'common/vue-filter';
import VueTouch from 'vue-touch';
import yas from 'common/yas';
/**
* iOS 7 不支持 Promise, vue-lazyload 有用到,所以全局申明
... ... @@ -40,6 +41,9 @@ Vue.mixin({
yoho.showLoading(false);
util.visibilitychange();
}
},
created() {
this.$yas = yas();
}
});
directive(Vue);
... ...
... ... @@ -77,16 +77,20 @@ export default {
recItems: [
{
text: '推荐',
val: ''
val: '',
type: 0
}, {
text: '新品',
val: 's_t_desc'
val: 's_t_desc',
type: 2
}, {
text: '价格从高到低',
val: 's_p_desc'
val: 's_p_desc',
type: 3
}, {
text: '价格从低到高',
val: 's_p_asc'
val: 's_p_asc',
type: 3
}
],
filterItems: [
... ... @@ -174,7 +178,8 @@ export default {
this.activeSort = item;
bus.$emit('order.change', {
val: item.val,
ref: this._uid
ref: this._uid,
type: item.type
});
this.recDown = true;
this.hideLay();
... ...
<template>
<div class="goods-box" v-infinite-scroll="fetch" infinite-scroll-disable="disableFetch" infinite-scroll-distance="1200">
<ul class="cardlist card-large clearfix">
<li class="card" v-for="(item, index) in data" :key="item.product_skn">
<li class="card" v-for="(item, index) in data" :key="item.product_skn" @click="clickProduct(item, index)">
<div class="card-pic">
<a v-good-href="item">
<img v-img-src="{src: item.default_images, width: 330, height: 440}" :alt="item.product_name">
... ... @@ -57,6 +57,9 @@
methods: {
fetch: function() {
bus.$emit('list.paging');
},
clickProduct(item, index) {
this.$emit('click-product', item, index);
}
}
};
... ...
<template>
<div>
<filter-box :val="order" :filter="filterConfig" v-if="enableOrder" :search-page="true"></filter-box>
<product-list :data="productList" :state="listState" class="list-items"></product-list>
<product-list :data="productList" :state="listState" class="list-items" @click-product="clickProduct"></product-list>
</div>
</template>
<script>
... ... @@ -29,7 +29,8 @@
return {
url: '/product/search.json',
order: '',
query: decodeURIComponent(qs.query),
orderType: 0,
query: qs.query ? decodeURIComponent(qs.query) : '',
page: 0, // 未搜索 page=0; 全部加载完 page = totalPage; 无数据: page !=0 && productList.length=0
totalPage: null,
productList: [],
... ... @@ -63,6 +64,15 @@
FilterBox
},
methods: {
clickProduct(item, index) {
this.$yas.event('YB_GOODS_LIST_DT', {
TYPE_ID: 13,
ENT_ID: this.query,
I_INDEX: index + 1,
PRD_ID: item.product_id,
SORT_TYPE: this.orderType
});
},
search: function() {
const nextPage = this.page + 1;
... ... @@ -92,6 +102,15 @@
if (!this.filterConfig) {
this.filterConfig = res.data.filter;
}
this.$yas.eventData('YB_GOODS_LIST', {
TYPE_ID: 13,
ENT_ID: this.query,
TOTAL: this.productList.length,
PRD_LIST: this.productList.map(product => {
return product.product_id;
}).join(','),
SORT_TYPE: this.orderType,
});
}
})
.fail(() => {
... ... @@ -128,10 +147,9 @@
self.search();
});
bus.$on('order.change', function({
val
}) {
bus.$on('order.change', function({val, type}) {
self.order = val;
self.orderType = type;
});
bus.$on('filter.change', function({val}) {
... ...