Authored by 徐炜

Merge remote-tracking branch 'origin/develop' into develop

... ... @@ -116,12 +116,9 @@ if (isProduction) {
Object.assign(module.exports, {
appName: 'm.yohoblk.com for test',
domains: {
// api: 'http://dev-api.yohops.com:9999/',
// service: 'http://dev-service.yohops.com:9999/'
api: 'http://api-test1.yohops.com:9999/',
service: 'http://service-test1.yohops.com:9999/',
singleApi: 'http://api-test1.yohops.com:9999/'
api: process.env.TEST_API || 'http://api-test1.yohops.com:9999/',
service: process.env.TEST_SERVICE || 'http://service-test1.yohops.com:9999/',
singleApi: process.env.TEST_SINGLE || 'http://api-test1.yohops.com:9999/'
},
memcache: {
master: ['127.0.0.1:12111'],
... ...
'use strict';
const os = require('os');
const fs = require('fs');
let devHost = 'localhost';
let devHost;
fs.readFile('.devhost', (err, buf)=> {
if (!err) {
devHost = JSON.parse(buf.toString()).host;
}
});
const getFirstLocalIp = () => {
const ifaces = os.networkInterfaces();
const res = [];
Object.keys(ifaces).forEach(function(ifname) {
ifaces[ifname].forEach(function(iface) {
if ('IPv4' !== iface.family || iface.internal !== false) {
return;
}
res.push(iface.address);
});
});
return res[0] || 'localhost';
};
if (!devHost) {
fs.readFile('.devhost', (err, buf) => {
if (!err) {
devHost = JSON.parse(buf.toString()).host;
} else {
devHost = getFirstLocalIp();
}
});
}
module.exports = () => {
return (req, res, next) => {
... ... @@ -17,4 +39,4 @@ module.exports = () => {
next();
};
};
};
\ No newline at end of file
... ...
... ... @@ -8,7 +8,7 @@
module.exports = (Vue) => {
Vue.directive('lazy-html', function(html) {
// TODO 首屏幕不使用
html = html.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, '<img v-lazy="\'$1\'">');
html = html.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, '<img v-bind:src="\'$1\'">');
this.el.innerHTML = html;
this.vm.$compile(this.el);
});
... ...
... ... @@ -59,6 +59,7 @@ const yoho = {
*/
goTab(args, success, fail) {
if (this.isApp && window.yohoInterface) {
args.showScrollbar = 'no';
window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, {
method: 'go.tab',
arguments: args
... ... @@ -181,6 +182,10 @@ const yoho = {
*/
goNewPage(args, success, fail) {
if (this.isApp && window.yohoInterface) {
if (args.header && args.header.headerid === '-1') {
args.showScrollbar = 'no';
}
window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, {
method: 'go.newPage',
arguments: args
... ...
... ... @@ -6,7 +6,7 @@
<div class="brand-box" v-for="brand in item.brands">
<a href="{{brand.domain | brandUrl}}">
<div class="brand-logo">
<img v-lazy="brand.logo | resize 136 136" alt="{{brand.name}}">
<img v-bind:src="brand.logo | resize 136 136" alt="{{brand.name}}">
</div>
<span class="brand-name">{{brand.name}}</span>
</a>
... ...
<template>
<div v-if="channel.length" class="channel-tab">
<div class="channel ellipsis" v-for="(index, item) in channel" :class="{focus: index === current}" @click="changeChannel(index)" :style="{width: (1 / channel.length) * 100 + '%'}">
<div class="channel ellipsis" v-for="(index, item) in channel" :class="{focus: index === current}"
@click="changeChannel(index)" :style="{width: (1 / channel.length) * 100 + '%'}">
<span class="name">{{item.name | uppercase}}</span>
</div>
</div>
... ... @@ -59,8 +60,12 @@
},
methods: {
changeChannel(index) {
const objY = {};
objY[this.page + '_' + this.channel[this.current].channel] = window.scrollY;
this.current = index;
bus.$emit('channel.change', this.page, this.channel[index].channel);
bus.$emit('channel.change', this.page, this.channel[index].channel, objY);
cookie.set('_Channel', this.channel[index].channel);
cookie.set('_ChannelIndex', index);
}
... ...
... ... @@ -4,7 +4,7 @@
<li class="card" v-for="item in data">
<div class="card-pic">
<a href="{{item | goodsUrl}}">
<img v-lazy="item.defaultImages | resize 372 499" alt="{{item.productName}}">
<img v-bind:src="item.defaultImages | resize 372 499" alt="{{item.productName}}">
</a>
</div>
<div class="card-bd">
... ...
<template>
<div class="focus-left-right">
<a v-for="item in floor" href="{{item.url}}" title="{{item.title}}">
<img v-lazy="item.src | resize 250 250">
<img v-bind:src="item.src | resize 250 250">
</a>
</div>
</template>
... ...
... ... @@ -47,6 +47,8 @@
},
data() {
return {
scroll_y: 0,
objY: {},
resources: []
};
},
... ... @@ -62,6 +64,9 @@
contentCode() {
this.getResourcesData();
bus.$emit('contentCode.change', this.contentCode);
setTimeout(()=> {
window.scrollTo(0, this.scroll_y);
}, 1);
}
},
methods: {
... ... @@ -95,7 +100,11 @@
},
created() {
this.getResourcesData();
bus.$on('channel.change', (page, channel) => {
bus.$on('channel.change', (page, channel, objY) => {
if (objY) {
this.objY = Object.assign(this.objY, objY);
}
this.scroll_y = this.objY[page + '_' + channel] || 0;
this.contentCode = contentCode[page][channel];
});
}
... ...
<template>
<div class="recommend-content-five">
<a v-for="item in floor" href="{{item.url}}" title="{{item.title}}">
<img v-lazy="item.src | resize 375 375">
<img v-bind:src="item.src | resize 375 375">
</a>
</div>
</template>
... ...
... ... @@ -2,7 +2,7 @@
<div class="title-image">
<title-floor :title="{name: floor.title, moreName: floor.moreName, moreUrl: floor.moreUrl}"></title-floor>
<a class="image" :href="floor.image.url">
<img v-lazy="floor.image.src | resize 750 364">
<img v-bind:src="floor.image.src | resize 750 364">
</a>
</div>
</template>
... ...
... ... @@ -7,7 +7,7 @@
<a :href="item.url">
<img :title="item.title"
:alt="item.alt"
v-lazy="item.src | resize 750 469" width="375"/>
v-bind:src="item.src | resize 750 469" width="375"/>
</a>
</div>
</div>
... ...
... ... @@ -4,7 +4,7 @@
<div v-for="editorial in editorialList" class="editorial-box">
<div class="img">
<a href='{{"/editorial/" + editorial.id + ".html"}}'>
<img v-lazy="editorial.src | resize 750 469" alt="" />
<img v-bind:src="editorial.src | resize 750 469" alt="" />
</a>
</div>
<div class="title">
... ...