Merge remote-tracking branch 'origin/develop' into develop
Showing
13 changed files
with
62 additions
and
24 deletions
@@ -116,12 +116,9 @@ if (isProduction) { | @@ -116,12 +116,9 @@ if (isProduction) { | ||
116 | Object.assign(module.exports, { | 116 | Object.assign(module.exports, { |
117 | appName: 'm.yohoblk.com for test', | 117 | appName: 'm.yohoblk.com for test', |
118 | domains: { | 118 | domains: { |
119 | - // api: 'http://dev-api.yohops.com:9999/', | ||
120 | - // service: 'http://dev-service.yohops.com:9999/' | ||
121 | - | ||
122 | - api: 'http://api-test1.yohops.com:9999/', | ||
123 | - service: 'http://service-test1.yohops.com:9999/', | ||
124 | - singleApi: 'http://api-test1.yohops.com:9999/' | 119 | + api: process.env.TEST_API || 'http://api-test1.yohops.com:9999/', |
120 | + service: process.env.TEST_SERVICE || 'http://service-test1.yohops.com:9999/', | ||
121 | + singleApi: process.env.TEST_SINGLE || 'http://api-test1.yohops.com:9999/' | ||
125 | }, | 122 | }, |
126 | memcache: { | 123 | memcache: { |
127 | master: ['127.0.0.1:12111'], | 124 | master: ['127.0.0.1:12111'], |
1 | 'use strict'; | 1 | 'use strict'; |
2 | 2 | ||
3 | +const os = require('os'); | ||
3 | const fs = require('fs'); | 4 | const fs = require('fs'); |
4 | -let devHost = 'localhost'; | 5 | +let devHost; |
5 | 6 | ||
6 | -fs.readFile('.devhost', (err, buf)=> { | ||
7 | - if (!err) { | ||
8 | - devHost = JSON.parse(buf.toString()).host; | ||
9 | - } | ||
10 | -}); | 7 | +const getFirstLocalIp = () => { |
8 | + const ifaces = os.networkInterfaces(); | ||
9 | + const res = []; | ||
10 | + | ||
11 | + Object.keys(ifaces).forEach(function(ifname) { | ||
12 | + ifaces[ifname].forEach(function(iface) { | ||
13 | + if ('IPv4' !== iface.family || iface.internal !== false) { | ||
14 | + return; | ||
15 | + } | ||
16 | + | ||
17 | + res.push(iface.address); | ||
18 | + }); | ||
19 | + }); | ||
20 | + | ||
21 | + return res[0] || 'localhost'; | ||
22 | +}; | ||
23 | + | ||
24 | +if (!devHost) { | ||
25 | + fs.readFile('.devhost', (err, buf) => { | ||
26 | + if (!err) { | ||
27 | + devHost = JSON.parse(buf.toString()).host; | ||
28 | + } else { | ||
29 | + devHost = getFirstLocalIp(); | ||
30 | + } | ||
31 | + }); | ||
32 | +} | ||
11 | 33 | ||
12 | module.exports = () => { | 34 | module.exports = () => { |
13 | return (req, res, next) => { | 35 | return (req, res, next) => { |
@@ -17,4 +39,4 @@ module.exports = () => { | @@ -17,4 +39,4 @@ module.exports = () => { | ||
17 | 39 | ||
18 | next(); | 40 | next(); |
19 | }; | 41 | }; |
20 | -}; | 42 | +}; |
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | module.exports = (Vue) => { | 8 | module.exports = (Vue) => { |
9 | Vue.directive('lazy-html', function(html) { | 9 | Vue.directive('lazy-html', function(html) { |
10 | // TODO 首屏幕不使用 | 10 | // TODO 首屏幕不使用 |
11 | - html = html.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, '<img v-lazy="\'$1\'">'); | 11 | + html = html.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, '<img v-bind:src="\'$1\'">'); |
12 | this.el.innerHTML = html; | 12 | this.el.innerHTML = html; |
13 | this.vm.$compile(this.el); | 13 | this.vm.$compile(this.el); |
14 | }); | 14 | }); |
@@ -59,6 +59,7 @@ const yoho = { | @@ -59,6 +59,7 @@ const yoho = { | ||
59 | */ | 59 | */ |
60 | goTab(args, success, fail) { | 60 | goTab(args, success, fail) { |
61 | if (this.isApp && window.yohoInterface) { | 61 | if (this.isApp && window.yohoInterface) { |
62 | + args.showScrollbar = 'no'; | ||
62 | window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, { | 63 | window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, { |
63 | method: 'go.tab', | 64 | method: 'go.tab', |
64 | arguments: args | 65 | arguments: args |
@@ -181,6 +182,10 @@ const yoho = { | @@ -181,6 +182,10 @@ const yoho = { | ||
181 | */ | 182 | */ |
182 | goNewPage(args, success, fail) { | 183 | goNewPage(args, success, fail) { |
183 | if (this.isApp && window.yohoInterface) { | 184 | if (this.isApp && window.yohoInterface) { |
185 | + if (args.header && args.header.headerid === '-1') { | ||
186 | + args.showScrollbar = 'no'; | ||
187 | + } | ||
188 | + | ||
184 | window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, { | 189 | window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, { |
185 | method: 'go.newPage', | 190 | method: 'go.newPage', |
186 | arguments: args | 191 | arguments: args |
@@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
6 | <div class="brand-box" v-for="brand in item.brands"> | 6 | <div class="brand-box" v-for="brand in item.brands"> |
7 | <a href="{{brand.domain | brandUrl}}"> | 7 | <a href="{{brand.domain | brandUrl}}"> |
8 | <div class="brand-logo"> | 8 | <div class="brand-logo"> |
9 | - <img v-lazy="brand.logo | resize 136 136" alt="{{brand.name}}"> | 9 | + <img v-bind:src="brand.logo | resize 136 136" alt="{{brand.name}}"> |
10 | </div> | 10 | </div> |
11 | <span class="brand-name">{{brand.name}}</span> | 11 | <span class="brand-name">{{brand.name}}</span> |
12 | </a> | 12 | </a> |
1 | <template> | 1 | <template> |
2 | <div v-if="channel.length" class="channel-tab"> | 2 | <div v-if="channel.length" class="channel-tab"> |
3 | - <div class="channel ellipsis" v-for="(index, item) in channel" :class="{focus: index === current}" @click="changeChannel(index)" :style="{width: (1 / channel.length) * 100 + '%'}"> | 3 | + <div class="channel ellipsis" v-for="(index, item) in channel" :class="{focus: index === current}" |
4 | + @click="changeChannel(index)" :style="{width: (1 / channel.length) * 100 + '%'}"> | ||
4 | <span class="name">{{item.name | uppercase}}</span> | 5 | <span class="name">{{item.name | uppercase}}</span> |
5 | </div> | 6 | </div> |
6 | </div> | 7 | </div> |
@@ -59,8 +60,12 @@ | @@ -59,8 +60,12 @@ | ||
59 | }, | 60 | }, |
60 | methods: { | 61 | methods: { |
61 | changeChannel(index) { | 62 | changeChannel(index) { |
63 | + const objY = {}; | ||
64 | + | ||
65 | + objY[this.page + '_' + this.channel[this.current].channel] = window.scrollY; | ||
66 | + | ||
62 | this.current = index; | 67 | this.current = index; |
63 | - bus.$emit('channel.change', this.page, this.channel[index].channel); | 68 | + bus.$emit('channel.change', this.page, this.channel[index].channel, objY); |
64 | cookie.set('_Channel', this.channel[index].channel); | 69 | cookie.set('_Channel', this.channel[index].channel); |
65 | cookie.set('_ChannelIndex', index); | 70 | cookie.set('_ChannelIndex', index); |
66 | } | 71 | } |
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | <li class="card" v-for="item in data"> | 4 | <li class="card" v-for="item in data"> |
5 | <div class="card-pic"> | 5 | <div class="card-pic"> |
6 | <a href="{{item | goodsUrl}}"> | 6 | <a href="{{item | goodsUrl}}"> |
7 | - <img v-lazy="item.defaultImages | resize 372 499" alt="{{item.productName}}"> | 7 | + <img v-bind:src="item.defaultImages | resize 372 499" alt="{{item.productName}}"> |
8 | </a> | 8 | </a> |
9 | </div> | 9 | </div> |
10 | <div class="card-bd"> | 10 | <div class="card-bd"> |
1 | <template> | 1 | <template> |
2 | <div class="focus-left-right"> | 2 | <div class="focus-left-right"> |
3 | <a v-for="item in floor" href="{{item.url}}" title="{{item.title}}"> | 3 | <a v-for="item in floor" href="{{item.url}}" title="{{item.title}}"> |
4 | - <img v-lazy="item.src | resize 250 250"> | 4 | + <img v-bind:src="item.src | resize 250 250"> |
5 | </a> | 5 | </a> |
6 | </div> | 6 | </div> |
7 | </template> | 7 | </template> |
@@ -47,6 +47,8 @@ | @@ -47,6 +47,8 @@ | ||
47 | }, | 47 | }, |
48 | data() { | 48 | data() { |
49 | return { | 49 | return { |
50 | + scroll_y: 0, | ||
51 | + objY: {}, | ||
50 | resources: [] | 52 | resources: [] |
51 | }; | 53 | }; |
52 | }, | 54 | }, |
@@ -62,6 +64,9 @@ | @@ -62,6 +64,9 @@ | ||
62 | contentCode() { | 64 | contentCode() { |
63 | this.getResourcesData(); | 65 | this.getResourcesData(); |
64 | bus.$emit('contentCode.change', this.contentCode); | 66 | bus.$emit('contentCode.change', this.contentCode); |
67 | + setTimeout(()=> { | ||
68 | + window.scrollTo(0, this.scroll_y); | ||
69 | + }, 1); | ||
65 | } | 70 | } |
66 | }, | 71 | }, |
67 | methods: { | 72 | methods: { |
@@ -95,7 +100,11 @@ | @@ -95,7 +100,11 @@ | ||
95 | }, | 100 | }, |
96 | created() { | 101 | created() { |
97 | this.getResourcesData(); | 102 | this.getResourcesData(); |
98 | - bus.$on('channel.change', (page, channel) => { | 103 | + bus.$on('channel.change', (page, channel, objY) => { |
104 | + if (objY) { | ||
105 | + this.objY = Object.assign(this.objY, objY); | ||
106 | + } | ||
107 | + this.scroll_y = this.objY[page + '_' + channel] || 0; | ||
99 | this.contentCode = contentCode[page][channel]; | 108 | this.contentCode = contentCode[page][channel]; |
100 | }); | 109 | }); |
101 | } | 110 | } |
1 | <template> | 1 | <template> |
2 | <div class="recommend-content-five"> | 2 | <div class="recommend-content-five"> |
3 | <a v-for="item in floor" href="{{item.url}}" title="{{item.title}}"> | 3 | <a v-for="item in floor" href="{{item.url}}" title="{{item.title}}"> |
4 | - <img v-lazy="item.src | resize 375 375"> | 4 | + <img v-bind:src="item.src | resize 375 375"> |
5 | </a> | 5 | </a> |
6 | </div> | 6 | </div> |
7 | </template> | 7 | </template> |
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | <div class="title-image"> | 2 | <div class="title-image"> |
3 | <title-floor :title="{name: floor.title, moreName: floor.moreName, moreUrl: floor.moreUrl}"></title-floor> | 3 | <title-floor :title="{name: floor.title, moreName: floor.moreName, moreUrl: floor.moreUrl}"></title-floor> |
4 | <a class="image" :href="floor.image.url"> | 4 | <a class="image" :href="floor.image.url"> |
5 | - <img v-lazy="floor.image.src | resize 750 364"> | 5 | + <img v-bind:src="floor.image.src | resize 750 364"> |
6 | </a> | 6 | </a> |
7 | </div> | 7 | </div> |
8 | </template> | 8 | </template> |
@@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
7 | <a :href="item.url"> | 7 | <a :href="item.url"> |
8 | <img :title="item.title" | 8 | <img :title="item.title" |
9 | :alt="item.alt" | 9 | :alt="item.alt" |
10 | - v-lazy="item.src | resize 750 469" width="375"/> | 10 | + v-bind:src="item.src | resize 750 469" width="375"/> |
11 | </a> | 11 | </a> |
12 | </div> | 12 | </div> |
13 | </div> | 13 | </div> |
@@ -4,7 +4,7 @@ | @@ -4,7 +4,7 @@ | ||
4 | <div v-for="editorial in editorialList" class="editorial-box"> | 4 | <div v-for="editorial in editorialList" class="editorial-box"> |
5 | <div class="img"> | 5 | <div class="img"> |
6 | <a href='{{"/editorial/" + editorial.id + ".html"}}'> | 6 | <a href='{{"/editorial/" + editorial.id + ".html"}}'> |
7 | - <img v-lazy="editorial.src | resize 750 469" alt="" /> | 7 | + <img v-bind:src="editorial.src | resize 750 469" alt="" /> |
8 | </a> | 8 | </a> |
9 | </div> | 9 | </div> |
10 | <div class="title"> | 10 | <div class="title"> |
-
Please register or login to post a comment