Authored by 沈志敏

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

... ... @@ -65,7 +65,7 @@ module.exports = {
shopId: req.body.shopId,
favId: req.body.favId,
uid: req.user.uid,
type: 'shop',
type: 'brand',
isFav: req.body.isFav
}).then(result => {
res.json(result);
... ...
... ... @@ -9,7 +9,7 @@ const Vue = require('vue');
const lazyload = require('vue-lazyload');
const brandListBox = require('channel/brand-list-box.vue');
require('common/vue-filter');
require('common/vue-filter')(Vue);
Vue.use(lazyload);
... ...
... ... @@ -2,7 +2,7 @@ const Vue = require('vue');
const lazyload = require('vue-lazyload');
const cateRes = require('channel/cate-resource-box.vue');
require('common/vue-filter');
require('common/vue-filter')(Vue);
Vue.use(lazyload);
... ...
... ... @@ -4,7 +4,7 @@ const infinitScroll = require('vue-infinite-scroll');
const channel = require('channel/index.vue');
require('common/vue-filter');
require('common/vue-filter')(Vue);
Vue.use(lazyload);
Vue.use(infinitScroll);
... ...
... ... @@ -3,7 +3,7 @@ const lazyload = require('vue-lazyload');
const sidebar = require('channel/sidebar.vue');
require('common/vue-filter');
require('common/vue-filter')(Vue);
Vue.use(lazyload);
... ...
let Vue = require('vue');
/**
* 替换参数
*
* @example
* value = /{width}/{height}/{mode}
*
* {value | resize 100 200 2} ==> /100/200/2
*/
Vue.filter('resize', (value, width, height, mode) => {
return value ? value.replace(/(\{width}|\{height}|\{mode})/g, function($0) {
const dict = {
'{width}': width,
'{height}': height,
'{mode}': mode || 2
};
return dict[$0];
}) : '';
});
/**
* 性别款式
*
* @example
*
* {value | gender}
*/
Vue.filter('clothingGenderIdentity', (value) => {
let ret = null;
switch (value) {
case 1:
ret = '男款';
break;
case 2:
ret = '女款';
break;
default:
ret = '通用';
}
return ret;
});
/**
* 品牌URL
*
* @param value brand domain
*/
Vue.filter('brandUrl', (value) => {
return `/product/shop/${value}`;
});
/**
* 产品 URL
*/
Vue.filter('goodsUrl', (product, kind)=> {
let productId, goodsId, cnAlphabet;
switch (kind) {
case 'collection':
productId = product.productId;
goodsId = product.goodsId;
cnAlphabet = product.cnAlphabet;
break;
default:
productId = product.productId;
goodsId = product.goodsList[0].goodsId;
cnAlphabet = product.cnAlphabet;
}
return `/product/pro_${productId}_${goodsId}/${cnAlphabet}.html`;
});
/**
* 订单状态
* @example
* {value | order}
* 状态 0:待付款,1-3:待发货,4-5:待收货(0:未付款,1:已付款,2:备货中,3:配货中,4:已发货,5:运输中,6:已完成)
*/
Vue.filter('convertOrderState', (value) => {
let stateTxt = '';
if (typeof value !== 'undefined') {
value = parseInt(value, 10);
}
switch (value) {
case 0:
stateTxt = '待付款';
break;
case 1:
stateTxt = '待发货';
break;
case 2:
stateTxt = '待发货';
break;
case 3:
stateTxt = '待发货';
break;
case 4:
stateTxt = '待收货';
break;
case 5:
stateTxt = '待收货';
break;
case 6:
stateTxt = '已完成';
break;
default:
stateTxt = '';
break;
}
return stateTxt;
});
Vue.filter('toFixed', (value, num) => {
if (typeof value === 'undefined') {
return;
}
return Number(value).toFixed(num || 2);
});
/**
* 转换时间
* yyyy-MM-dd hh:mm:ss
*/
Vue.filter('convertTime', (value) => {
if (typeof value === 'undefined') {
return;
}
let date = new Date(parseFloat(value) * 1000);
let Y = date.getFullYear() + '-';
let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
let D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';
let h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
let m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
let s = date.getSeconds();
return Y + M + D + h + m + s;
});
/**
* 格式化时间
*/
Vue.filter('formatUnixTime', (value) => {
// return moment.unix(value).format(format || 'YYYY-MM-DD HH:mm:ss');
if (typeof value === 'undefined') {
return;
}
let date = new Date(parseFloat(value) * 1000);
// let Y = date.getFullYear() + '-';
let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1);
let D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
let h = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
let m = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
// let s = date.getSeconds();
// return M + '.' + D + ' ' + h + ' ' + ' ' + m + ' ' + s;
return `${M}.${D} ${h}:${m}`;
});
const zhDict = {
color: '颜色',
gender: '性别',
size: '尺寸',
brand: '品牌',
priceRange: '价格',
groupSort: '品类',
discount: '折扣',
style: '风格',
ageLevel: '年龄'
module.exports = (Vue) => {
/**
* 替换参数
*
* @example
* value = /{width}/{height}/{mode}
*
* {value | resize 100 200 2} ==> /100/200/2
*/
Vue.filter('resize', (value, width, height, mode) => {
return value ? value.replace(/(\{width}|\{height}|\{mode})/g, function($0) {
const dict = {
'{width}': width,
'{height}': height,
'{mode}': mode || 2
};
return dict[$0];
}) : '';
});
/**
* 性别款式
*
* @example
*
* {value | gender}
*/
Vue.filter('clothingGenderIdentity', (value) => {
let ret = null;
switch (value) {
case 1:
ret = '男款';
break;
case 2:
ret = '女款';
break;
default:
ret = '通用';
}
return ret;
});
/**
* 品牌URL
*
* @param value brand domain
*/
Vue.filter('brandUrl', (value) => {
return `/product/shop/${value}`;
});
/**
* 产品 URL
*/
Vue.filter('goodsUrl', (product, kind)=> {
let productId, goodsId, cnAlphabet;
switch (kind) {
case 'collection':
productId = product.productId;
goodsId = product.goodsId;
cnAlphabet = product.cnAlphabet;
break;
default:
productId = product.productId;
goodsId = product.goodsList[0].goodsId;
cnAlphabet = product.cnAlphabet;
}
return `/product/pro_${productId}_${goodsId}/${cnAlphabet}.html`;
});
/**
* 订单状态
* @example
* {value | order}
* 状态 0:待付款,1-3:待发货,4-5:待收货(0:未付款,1:已付款,2:备货中,3:配货中,4:已发货,5:运输中,6:已完成)
*/
Vue.filter('convertOrderState', (value) => {
let stateTxt = '';
if (typeof value !== 'undefined') {
value = parseInt(value, 10);
}
switch (value) {
case 0:
stateTxt = '待付款';
break;
case 1:
stateTxt = '待发货';
break;
case 2:
stateTxt = '待发货';
break;
case 3:
stateTxt = '待发货';
break;
case 4:
stateTxt = '待收货';
break;
case 5:
stateTxt = '待收货';
break;
case 6:
stateTxt = '已完成';
break;
default:
stateTxt = '';
break;
}
return stateTxt;
});
Vue.filter('toFixed', (value, num) => {
if (typeof value === 'undefined') {
return;
}
return Number(value).toFixed(num || 2);
});
/**
* 转换时间
* yyyy-MM-dd hh:mm:ss
*/
Vue.filter('convertTime', (value) => {
if (typeof value === 'undefined') {
return;
}
let date = new Date(parseFloat(value) * 1000);
let Y = date.getFullYear() + '-';
let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
let D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';
let h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
let m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
let s = date.getSeconds();
return Y + M + D + h + m + s;
});
/**
* 格式化时间
*/
Vue.filter('formatUnixTime', (value) => {
// return moment.unix(value).format(format || 'YYYY-MM-DD HH:mm:ss');
if (typeof value === 'undefined') {
return;
}
let date = new Date(parseFloat(value) * 1000);
// let Y = date.getFullYear() + '-';
let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1);
let D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
let h = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
let m = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
// let s = date.getSeconds();
// return M + '.' + D + ' ' + h + ' ' + ' ' + m + ' ' + s;
return `${M}.${D} ${h}:${m}`;
});
const zhDict = {
color: '颜色',
gender: '性别',
size: '尺寸',
brand: '品牌',
priceRange: '价格',
groupSort: '品类',
discount: '折扣',
style: '风格',
ageLevel: '年龄'
};
const enDict = {
color: 'Color',
gender: 'Gender',
size: 'Size',
brand: 'Brand',
priceRange: 'Price',
groupSort: 'Category',
discount: 'Sale',
style: 'Style',
ageLevel: 'Age'
};
Vue.filter('filter-cn', (value, prefix) => {
prefix = prefix || '';
value = zhDict[value] || '';
return prefix + value || '';
});
Vue.filter('filter-en-cn', value => {
const cn = zhDict[value] || '';
const en = enDict[value] || '';
return en + cn;
});
};
const enDict = {
color: 'Color',
gender: 'Gender',
size: 'Size',
brand: 'Brand',
priceRange: 'Price',
groupSort: 'Category',
discount: 'Sale',
style: 'Style',
ageLevel: 'Age'
};
Vue.filter('filter-cn', (value, prefix) => {
prefix = prefix || '';
value = zhDict[value] || '';
return prefix + value || '';
});
Vue.filter('filter-en-cn', value => {
const cn = zhDict[value] || '';
const en = enDict[value] || '';
return en + cn;
});
... ...
... ... @@ -3,7 +3,7 @@ const lazyload = require('vue-lazyload');
const directive = require('common/vue-directive');
const app = require('editorial/detail.vue');
require('common/vue-filter');
require('common/vue-filter')(Vue);
Vue.use(lazyload);
Vue.use(directive);
... ...
... ... @@ -8,10 +8,11 @@ const Vue = require('vue');
const lazyload = require('vue-lazyload');
const infinitScroll = require('vue-infinite-scroll');
const indexBox = require('editorial/index-box.vue');
Vue.use(lazyload);
Vue.use(infinitScroll);
require('common/vue-filter')(Vue);
const indexBox = require('editorial/index-box.vue');
new Vue({
el: '#index',
... ...
... ... @@ -12,7 +12,7 @@ const infiniteScroll = require('vue-infinite-scroll');
Vue.use(infiniteScroll);
require('common/vue-filter');
require('common/vue-filter')(Vue);
new Vue({
el: '#coin-detail-list',
... ...
... ... @@ -3,7 +3,7 @@ const lazyload = require('vue-lazyload');
const exchange = require('me/exchange.vue');
require('common/vue-filter');
require('common/vue-filter')(Vue);
Vue.use(lazyload);
... ...
... ... @@ -3,7 +3,7 @@ const infiniteScroll = require('vue-infinite-scroll');
const favBrandList = require('me/fav-brand-list.vue');
const VueTouch = require('vue-touch');
require('common/vue-filter');
require('common/vue-filter')(Vue);
Vue.use(VueTouch);
Vue.use(infiniteScroll);
... ...
... ... @@ -3,7 +3,7 @@ const infiniteScroll = require('vue-infinite-scroll');
const favProductList = require('me/fav-product-list.vue');
const VueTouch = require('vue-touch');
require('common/vue-filter');
require('common/vue-filter')(Vue);
Vue.use(VueTouch);
Vue.use(infiniteScroll);
... ...
... ... @@ -8,7 +8,7 @@
const Vue = require('vue');
const OrderDetail = require('me/order-detail.vue');
require('common/vue-filter');
require('common/vue-filter')(Vue);
require('common/count-down');
new Vue({
... ...
... ... @@ -11,7 +11,7 @@ const infiniteScroll = require('vue-infinite-scroll');
Vue.use(infiniteScroll);
require('common/vue-filter');
require('common/vue-filter')(Vue);
require('common/count-down');
new Vue({
... ...
... ... @@ -3,7 +3,7 @@ const lazyload = require('vue-lazyload');
const refund = require('me/refund.vue');
require('common/vue-filter');
require('common/vue-filter')(Vue);
Vue.use(lazyload);
... ...
... ... @@ -11,7 +11,7 @@ const infiniteScroll = require('vue-infinite-scroll');
Vue.use(infiniteScroll);
require('common/vue-filter');
require('common/vue-filter')(Vue);
new Vue({
el: '#refund-order-list',
... ...
const Vue = require('vue');
const Status = require('me/refund-status.vue');
require('common/vue-filter');
require('common/vue-filter')(Vue);
new Vue({
el: '#status',
... ...
... ... @@ -3,7 +3,7 @@ const lazyload = require('vue-lazyload');
const directive = require('common/vue-directive');
const app = require('product/detail/index.vue');
require('common/vue-filter');
require('common/vue-filter')(Vue);
Vue.use(lazyload);
Vue.use(directive);
... ...
... ... @@ -9,7 +9,7 @@ const Vue = require('vue');
const lazyload = require('vue-lazyload');
const shareBox = require('product/shop/share-box.vue');
require('common/vue-filter');
require('common/vue-filter')(Vue);
Vue.use(lazyload);
... ...
... ... @@ -8,11 +8,12 @@ const Vue = require('vue');
const lazyload = require('vue-lazyload');
const infinitScroll = require('vue-infinite-scroll');
const shopBox = require('product/shop/shop-box.vue');
require('common/vue-filter')(Vue);
Vue.use(lazyload);
Vue.use(infinitScroll);
const shopBox = require('product/shop/shop-box.vue');
new Vue({
el: '#shop',
components: {
... ...
... ... @@ -72,8 +72,6 @@
const tip = require('common/tip');
const yoho = require('yoho');
require('common/vue-filter');
module.exports = {
data() {
return {
... ...
... ... @@ -30,8 +30,6 @@
const yoho = require('yoho');
const tip = require('common/tip');
require('common/vue-filter');
module.exports = {
props: {
id: Number,
... ...
... ... @@ -44,8 +44,6 @@
const swipe = require('vue-swipe');
const yoho = require('yoho');
require('common/vue-filter');
module.exports = {
props: {
goods: [Object]
... ...
... ... @@ -25,7 +25,7 @@
Vue.use(lazyload);
Vue.use(infinitScroll);
require('common/vue-filter');
require('common/vue-filter')(Vue);
module.exports = {
el: '#product-list',
... ... @@ -141,7 +141,6 @@
* 2. 关闭 drawer 组件
*/
bus.$on('filter.change', function({val}) {
console.log(val);
let filter = {};
$.each(val, (type, item) => {
... ...
... ... @@ -25,7 +25,7 @@
Vue.use(lazyload);
Vue.use(infinitScroll);
require('common/vue-filter');
require('common/vue-filter')(Vue);
module.exports = {
el: '#product-new',
... ...
... ... @@ -21,7 +21,7 @@
Vue.use(lazyload);
Vue.use(infinitScroll);
require('common/vue-filter');
require('common/vue-filter')(Vue);
module.exports = {
el: '#product-search',
... ...
... ... @@ -29,8 +29,6 @@
const shareSubTitle = '我在BLK发现了一个不错的品牌,赶快来看看吧!';
let locationQuery = qs(decodeURIComponent(location.search.replace(/^\?/, '')));
require('common/vue-filter');
module.exports = {
data() {
return {
... ... @@ -86,7 +84,7 @@
this.shareData = {
title: result.shopName,
des: shareSubTitle,
url: location.origin + '/product/shop/' + $shop.data('domain')+'/share',
url: location.origin + '/product/shop/' + $shop.data('domain') + '/share',
img: result.shopBg,
isBlkShop: result.isBlkShop,
domain: locationQuery.domain,
... ...