Merge branch 'develop' of git.yoho.cn:fe/yohoblk-wap into develop
Showing
24 changed files
with
229 additions
and
182 deletions
1 | - | ||
2 | -# Created by https://www.gitignore.io/api/node,webstorm,netbeans,sublimetext,vim | ||
3 | - | ||
4 | -### Node ### | ||
5 | -# Logs | ||
6 | -logs | ||
7 | -*.log | ||
8 | -npm-debug.log* | ||
9 | - | ||
10 | -# Runtime data | ||
11 | -pids | ||
12 | -*.pid | ||
13 | -*.seed | ||
14 | - | ||
15 | -# Directory for instrumented libs generated by jscoverage/JSCover | ||
16 | -lib-cov | ||
17 | - | ||
18 | -# Coverage directory used by tools like istanbul | ||
19 | -coverage | ||
20 | - | ||
21 | -# nyc test coverage | ||
22 | -.nyc_output | ||
23 | - | ||
24 | -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
25 | -.grunt | ||
26 | - | ||
27 | -# node-waf configuration | ||
28 | -.lock-wscript | ||
29 | - | ||
30 | -# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
31 | -build/Release | ||
32 | - | ||
33 | -# Dependency directories | ||
34 | -node_modules | ||
35 | -jspm_packages | ||
36 | - | ||
37 | -# Optional npm cache directory | ||
38 | -.npm | ||
39 | - | ||
40 | -# Optional REPL history | ||
41 | -.node_repl_history | ||
42 | - | ||
43 | - | ||
44 | -### WebStorm ### | ||
45 | -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm | ||
46 | -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | ||
47 | -.idea/ | ||
48 | -# User-specific stuff: | ||
49 | -.idea/workspace.xml | ||
50 | -.idea/tasks.xml | ||
51 | -.idea/dictionaries | ||
52 | -.idea/vcs.xml | ||
53 | -.idea/jsLibraryMappings.xml | ||
54 | - | ||
55 | -# Sensitive or high-churn files: | ||
56 | -.idea/dataSources.ids | ||
57 | -.idea/dataSources.xml | ||
58 | -.idea/dataSources.local.xml | ||
59 | -.idea/sqlDataSources.xml | ||
60 | -.idea/dynamic.xml | ||
61 | -.idea/uiDesigner.xml | ||
62 | - | ||
63 | -# Gradle: | ||
64 | -.idea/gradle.xml | ||
65 | -.idea/libraries | ||
66 | - | ||
67 | -# Mongo Explorer plugin: | ||
68 | -.idea/mongoSettings.xml | ||
69 | - | ||
70 | -## File-based project format: | ||
71 | -*.iws | ||
72 | - | ||
73 | -## Plugin-specific files: | ||
74 | - | ||
75 | -# IntelliJ | ||
76 | -/out/ | ||
77 | - | ||
78 | -# mpeltonen/sbt-idea plugin | ||
79 | -.idea_modules/ | ||
80 | - | ||
81 | -# JIRA plugin | ||
82 | -atlassian-ide-plugin.xml | ||
83 | - | ||
84 | -# Crashlytics plugin (for Android Studio and IntelliJ) | ||
85 | -com_crashlytics_export_strings.xml | ||
86 | -crashlytics.properties | ||
87 | -crashlytics-build.properties | ||
88 | -fabric.properties | ||
89 | - | ||
90 | -### WebStorm Patch ### | ||
91 | -# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 | ||
92 | - | ||
93 | -# *.iml | ||
94 | -# modules.xml | ||
95 | - | ||
96 | - | ||
97 | -### NetBeans ### | ||
98 | -nbproject/private/ | ||
99 | -build/ | ||
100 | -nbbuild/ | ||
101 | -dist/ | ||
102 | -nbdist/ | ||
103 | -nbactions.xml | ||
104 | -.nb-gradle/ | ||
105 | - | ||
106 | - | ||
107 | -### SublimeText ### | ||
108 | -# cache files for sublime text | ||
109 | -*.tmlanguage.cache | ||
110 | -*.tmPreferences.cache | ||
111 | -*.stTheme.cache | ||
112 | - | ||
113 | -# workspace files are user-specific | ||
114 | -*.sublime-workspace | ||
115 | - | ||
116 | -# project files should be checked into the repository, unless a significant | ||
117 | -# proportion of contributors will probably not be using SublimeText | ||
118 | -# *.sublime-project | ||
119 | - | ||
120 | -# sftp configuration file | ||
121 | -sftp-config.json | ||
122 | - | ||
123 | - | ||
124 | -### Vim ### | ||
125 | -# swap | ||
126 | -[._]*.s[a-w][a-z] | ||
127 | -[._]s[a-w][a-z] | ||
128 | -# session | ||
129 | -Session.vim | ||
130 | -# temporary | ||
131 | -.netrwhist | ||
132 | -*~ | ||
133 | -# auto-generated tag files | ||
134 | -tags | ||
135 | - | ||
136 | -### VS Code ### | ||
137 | -.vscode/ | ||
138 | - | ||
139 | -### YOHO ### | ||
140 | -public/dist/ | ||
141 | -public/css/* | ||
142 | -public/bundle/* | ||
143 | -.eslintcache | ||
144 | -*.log.* | ||
145 | -nbproject/* | ||
146 | -.DS_Store | 1 | + |
2 | +# Created by https://www.gitignore.io/api/node,webstorm,netbeans,sublimetext,vim | ||
3 | + | ||
4 | +### Node ### | ||
5 | +# Logs | ||
6 | +logs | ||
7 | +*.log | ||
8 | +npm-debug.log* | ||
9 | + | ||
10 | +# Runtime data | ||
11 | +pids | ||
12 | +*.pid | ||
13 | +*.seed | ||
14 | + | ||
15 | +# Directory for instrumented libs generated by jscoverage/JSCover | ||
16 | +lib-cov | ||
17 | + | ||
18 | +# Coverage directory used by tools like istanbul | ||
19 | +coverage | ||
20 | + | ||
21 | +# nyc test coverage | ||
22 | +.nyc_output | ||
23 | + | ||
24 | +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
25 | +.grunt | ||
26 | + | ||
27 | +# node-waf configuration | ||
28 | +.lock-wscript | ||
29 | + | ||
30 | +# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
31 | +build/Release | ||
32 | + | ||
33 | +# Dependency directories | ||
34 | +node_modules | ||
35 | +jspm_packages | ||
36 | + | ||
37 | +# Optional npm cache directory | ||
38 | +.npm | ||
39 | + | ||
40 | +# Optional REPL history | ||
41 | +.node_repl_history | ||
42 | + | ||
43 | + | ||
44 | +### WebStorm ### | ||
45 | +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm | ||
46 | +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 | ||
47 | +.idea/ | ||
48 | +# User-specific stuff: | ||
49 | +.idea/workspace.xml | ||
50 | +.idea/tasks.xml | ||
51 | +.idea/dictionaries | ||
52 | +.idea/vcs.xml | ||
53 | +.idea/jsLibraryMappings.xml | ||
54 | + | ||
55 | +# Sensitive or high-churn files: | ||
56 | +.idea/dataSources.ids | ||
57 | +.idea/dataSources.xml | ||
58 | +.idea/dataSources.local.xml | ||
59 | +.idea/sqlDataSources.xml | ||
60 | +.idea/dynamic.xml | ||
61 | +.idea/uiDesigner.xml | ||
62 | + | ||
63 | +# Gradle: | ||
64 | +.idea/gradle.xml | ||
65 | +.idea/libraries | ||
66 | + | ||
67 | +# Mongo Explorer plugin: | ||
68 | +.idea/mongoSettings.xml | ||
69 | + | ||
70 | +## File-based project format: | ||
71 | +*.iws | ||
72 | + | ||
73 | +## Plugin-specific files: | ||
74 | + | ||
75 | +# IntelliJ | ||
76 | +/out/ | ||
77 | + | ||
78 | +# mpeltonen/sbt-idea plugin | ||
79 | +.idea_modules/ | ||
80 | + | ||
81 | +# JIRA plugin | ||
82 | +atlassian-ide-plugin.xml | ||
83 | + | ||
84 | +# Crashlytics plugin (for Android Studio and IntelliJ) | ||
85 | +com_crashlytics_export_strings.xml | ||
86 | +crashlytics.properties | ||
87 | +crashlytics-build.properties | ||
88 | +fabric.properties | ||
89 | + | ||
90 | +### WebStorm Patch ### | ||
91 | +# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721 | ||
92 | + | ||
93 | +# *.iml | ||
94 | +# modules.xml | ||
95 | + | ||
96 | + | ||
97 | +### NetBeans ### | ||
98 | +nbproject/private/ | ||
99 | +build/ | ||
100 | +nbbuild/ | ||
101 | +dist/ | ||
102 | +nbdist/ | ||
103 | +nbactions.xml | ||
104 | +.nb-gradle/ | ||
105 | + | ||
106 | + | ||
107 | +### SublimeText ### | ||
108 | +# cache files for sublime text | ||
109 | +*.tmlanguage.cache | ||
110 | +*.tmPreferences.cache | ||
111 | +*.stTheme.cache | ||
112 | + | ||
113 | +# workspace files are user-specific | ||
114 | +*.sublime-workspace | ||
115 | + | ||
116 | +# project files should be checked into the repository, unless a significant | ||
117 | +# proportion of contributors will probably not be using SublimeText | ||
118 | +# *.sublime-project | ||
119 | + | ||
120 | +# sftp configuration file | ||
121 | +sftp-config.json | ||
122 | + | ||
123 | + | ||
124 | +### Vim ### | ||
125 | +# swap | ||
126 | +[._]*.s[a-w][a-z] | ||
127 | +[._]s[a-w][a-z] | ||
128 | +# session | ||
129 | +Session.vim | ||
130 | +# temporary | ||
131 | +.netrwhist | ||
132 | +*~ | ||
133 | +# auto-generated tag files | ||
134 | +tags | ||
135 | + | ||
136 | +### VS Code ### | ||
137 | +.vscode/ | ||
138 | + | ||
139 | +### YOHO ### | ||
140 | +public/dist/ | ||
141 | +public/css/* | ||
142 | +public/bundle/* | ||
143 | +.eslintcache | ||
144 | +*.log.* | ||
145 | +nbproject/* | ||
146 | +.DS_Store | ||
147 | +.devhost |
@@ -22,6 +22,7 @@ const session = require('express-session'); | @@ -22,6 +22,7 @@ const session = require('express-session'); | ||
22 | const memcached = require('connect-memcached'); | 22 | const memcached = require('connect-memcached'); |
23 | const hbs = require('express-handlebars'); | 23 | const hbs = require('express-handlebars'); |
24 | const pkg = require('./package.json'); | 24 | const pkg = require('./package.json'); |
25 | +const devtools = require('./doraemon/middleware/devtools'); | ||
25 | 26 | ||
26 | const app = express(); | 27 | const app = express(); |
27 | const MemcachedStore = memcached(session); | 28 | const MemcachedStore = memcached(session); |
@@ -40,6 +41,10 @@ global.doraemon = path.resolve('./doraemon'); | @@ -40,6 +41,10 @@ global.doraemon = path.resolve('./doraemon'); | ||
40 | 41 | ||
41 | const logger = global.yoho.logger; | 42 | const logger = global.yoho.logger; |
42 | 43 | ||
44 | +if (app.locals.devEnv) { | ||
45 | + app.use(devtools()); | ||
46 | +} | ||
47 | + | ||
43 | app.set('view engine', '.hbs'); | 48 | app.set('view engine', '.hbs'); |
44 | app.set('views', './doraemon/views'); | 49 | app.set('views', './doraemon/views'); |
45 | app.engine('.hbs', hbs({ | 50 | app.engine('.hbs', hbs({ |
doraemon/middleware/devtools.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +const fs = require('fs'); | ||
4 | +let devHost = 'localhost'; | ||
5 | + | ||
6 | +fs.readFile('.devhost', (err, buf)=> { | ||
7 | + if (!err) { | ||
8 | + devHost = JSON.parse(buf.toString()).host; | ||
9 | + } | ||
10 | +}); | ||
11 | + | ||
12 | +module.exports = () => { | ||
13 | + return (req, res, next) => { | ||
14 | + Object.assign(res.locals, { | ||
15 | + devHost: devHost | ||
16 | + }); | ||
17 | + | ||
18 | + next(); | ||
19 | + }; | ||
20 | +}; |
@@ -15,9 +15,9 @@ | @@ -15,9 +15,9 @@ | ||
15 | (function(d,c){var e=d.documentElement,a="orientationchange" in window?"orientationchange":"resize",b=function(){var f=e.clientWidth;if(!f){return}if(f>=750){e.style.fontSize="40px"}else{e.style.fontSize=40*(f/750)+"px"}};if(!d.addEventListener){return}b();c.addEventListener(a,b,false);d.addEventListener("DOMContentLoaded",b,false)})(document,window); | 15 | (function(d,c){var e=d.documentElement,a="orientationchange" in window?"orientationchange":"resize",b=function(){var f=e.clientWidth;if(!f){return}if(f>=750){e.style.fontSize="40px"}else{e.style.fontSize=40*(f/750)+"px"}};if(!d.addEventListener){return}b();c.addEventListener(a,b,false);d.addEventListener("DOMContentLoaded",b,false)})(document,window); |
16 | </script> | 16 | </script> |
17 | {{#if devEnv}} | 17 | {{#if devEnv}} |
18 | - <link rel="stylesheet" media="all" href="//localhost:5004/css/index.css"> | 18 | + <link rel="stylesheet" media="all" href="//{{devHost}}:5004/css/index.css"> |
19 | {{#unless noLocalCSS}} | 19 | {{#unless noLocalCSS}} |
20 | - <link rel="stylesheet" media="all" href="//localhost:5004/{{module}}.{{page}}.css"> | 20 | + <link rel="stylesheet" media="all" href="//{{devHost}}:5004/{{module}}.{{page}}.css"> |
21 | {{/unless}} | 21 | {{/unless}} |
22 | {{^}} | 22 | {{^}} |
23 | <link rel="stylesheet" href="//cdn.yoho.cn/yohoblk-wap/{{version}}/index.css"> | 23 | <link rel="stylesheet" href="//cdn.yoho.cn/yohoblk-wap/{{version}}/index.css"> |
@@ -32,9 +32,9 @@ | @@ -32,9 +32,9 @@ | ||
32 | </div> | 32 | </div> |
33 | 33 | ||
34 | {{#if devEnv}} | 34 | {{#if devEnv}} |
35 | - <script src="//localhost:5004/libs.js"></script> | 35 | + <script src="//{{devHost}}:5004/libs.js"></script> |
36 | {{#unless noLocalJS}} | 36 | {{#unless noLocalJS}} |
37 | - <script src="//localhost:5004/{{module}}.{{page}}.js"></script> | 37 | + <script src="//{{devHost}}:5004/{{module}}.{{page}}.js"></script> |
38 | {{/unless}} | 38 | {{/unless}} |
39 | {{^}} | 39 | {{^}} |
40 | <script src="//cdn.yoho.cn/yohoblk-wap/{{version}}/libs.js"></script> | 40 | <script src="//cdn.yoho.cn/yohoblk-wap/{{version}}/libs.js"></script> |
@@ -11,7 +11,7 @@ const brandListBox = require('channel/brand-list-box.vue'); | @@ -11,7 +11,7 @@ const brandListBox = require('channel/brand-list-box.vue'); | ||
11 | 11 | ||
12 | require('common/vue-filter')(Vue); | 12 | require('common/vue-filter')(Vue); |
13 | 13 | ||
14 | -Vue.use(lazyload); | 14 | +Vue.use(lazyload, { preLoad: 3 }); |
15 | 15 | ||
16 | new Vue({ | 16 | new Vue({ |
17 | el: '#brand-list', | 17 | el: '#brand-list', |
@@ -4,7 +4,7 @@ const cateRes = require('channel/cate-resource-box.vue'); | @@ -4,7 +4,7 @@ const cateRes = require('channel/cate-resource-box.vue'); | ||
4 | 4 | ||
5 | require('common/vue-filter')(Vue); | 5 | require('common/vue-filter')(Vue); |
6 | 6 | ||
7 | -Vue.use(lazyload); | 7 | +Vue.use(lazyload, { preLoad: 3 }); |
8 | 8 | ||
9 | new Vue({ | 9 | new Vue({ |
10 | el: '#cate-resource', | 10 | el: '#cate-resource', |
@@ -6,7 +6,7 @@ const channel = require('channel/index.vue'); | @@ -6,7 +6,7 @@ const channel = require('channel/index.vue'); | ||
6 | 6 | ||
7 | require('common/vue-filter')(Vue); | 7 | require('common/vue-filter')(Vue); |
8 | 8 | ||
9 | -Vue.use(lazyload); | 9 | +Vue.use(lazyload, { preLoad: 3 }); |
10 | Vue.use(infinitScroll); | 10 | Vue.use(infinitScroll); |
11 | 11 | ||
12 | new Vue({ | 12 | new Vue({ |
@@ -5,7 +5,7 @@ const sidebar = require('channel/sidebar.vue'); | @@ -5,7 +5,7 @@ const sidebar = require('channel/sidebar.vue'); | ||
5 | 5 | ||
6 | require('common/vue-filter')(Vue); | 6 | require('common/vue-filter')(Vue); |
7 | 7 | ||
8 | -Vue.use(lazyload); | 8 | +Vue.use(lazyload, { preLoad: 3 }); |
9 | 9 | ||
10 | new Vue({ | 10 | new Vue({ |
11 | el: '#sidebar', | 11 | el: '#sidebar', |
@@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
7 | 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 | html = html.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, '<img v-lazy="\'$1\'">'); | 11 | html = html.replace(/<img [^>]*src=['"]([^'"]+)[^>]*>/gi, '<img v-lazy="\'$1\'">'); |
11 | this.el.innerHTML = html; | 12 | this.el.innerHTML = html; |
12 | this.vm.$compile(this.el); | 13 | this.vm.$compile(this.el); |
@@ -4,7 +4,7 @@ const directive = require('common/vue-directive'); | @@ -4,7 +4,7 @@ const directive = require('common/vue-directive'); | ||
4 | const app = require('editorial/detail.vue'); | 4 | const app = require('editorial/detail.vue'); |
5 | 5 | ||
6 | require('common/vue-filter')(Vue); | 6 | require('common/vue-filter')(Vue); |
7 | -Vue.use(lazyload); | 7 | +Vue.use(lazyload, { preLoad: 3 }); |
8 | Vue.use(directive); | 8 | Vue.use(directive); |
9 | 9 | ||
10 | new Vue({ | 10 | new Vue({ |
@@ -8,7 +8,7 @@ const Vue = require('vue'); | @@ -8,7 +8,7 @@ const Vue = require('vue'); | ||
8 | const lazyload = require('vue-lazyload'); | 8 | const lazyload = require('vue-lazyload'); |
9 | const infinitScroll = require('vue-infinite-scroll'); | 9 | const infinitScroll = require('vue-infinite-scroll'); |
10 | 10 | ||
11 | -Vue.use(lazyload); | 11 | +Vue.use(lazyload, { preLoad: 3 }); |
12 | Vue.use(infinitScroll); | 12 | Vue.use(infinitScroll); |
13 | require('common/vue-filter')(Vue); | 13 | require('common/vue-filter')(Vue); |
14 | 14 |
@@ -5,6 +5,6 @@ const exchange = require('me/exchange.vue'); | @@ -5,6 +5,6 @@ const exchange = require('me/exchange.vue'); | ||
5 | 5 | ||
6 | require('common/vue-filter')(Vue); | 6 | require('common/vue-filter')(Vue); |
7 | 7 | ||
8 | -Vue.use(lazyload); | 8 | +Vue.use(lazyload, { preLoad: 3 }); |
9 | 9 | ||
10 | new Vue(exchange); | 10 | new Vue(exchange); |
@@ -5,7 +5,7 @@ const refund = require('me/refund.vue'); | @@ -5,7 +5,7 @@ const refund = require('me/refund.vue'); | ||
5 | 5 | ||
6 | require('common/vue-filter')(Vue); | 6 | require('common/vue-filter')(Vue); |
7 | 7 | ||
8 | -Vue.use(lazyload); | 8 | +Vue.use(lazyload, { preLoad: 3 }); |
9 | 9 | ||
10 | new Vue({ | 10 | new Vue({ |
11 | el: '#refund', | 11 | el: '#refund', |
@@ -4,7 +4,7 @@ const directive = require('common/vue-directive'); | @@ -4,7 +4,7 @@ const directive = require('common/vue-directive'); | ||
4 | const app = require('product/detail/index.vue'); | 4 | const app = require('product/detail/index.vue'); |
5 | 5 | ||
6 | require('common/vue-filter')(Vue); | 6 | require('common/vue-filter')(Vue); |
7 | -Vue.use(lazyload); | 7 | +Vue.use(lazyload, { preLoad: 3 }); |
8 | Vue.use(directive); | 8 | Vue.use(directive); |
9 | 9 | ||
10 | new Vue({ | 10 | new Vue({ |
@@ -10,8 +10,9 @@ const lazyload = require('vue-lazyload'); | @@ -10,8 +10,9 @@ const lazyload = require('vue-lazyload'); | ||
10 | const shareBox = require('product/shop/share-box.vue'); | 10 | const shareBox = require('product/shop/share-box.vue'); |
11 | 11 | ||
12 | require('common/vue-filter')(Vue); | 12 | require('common/vue-filter')(Vue); |
13 | - | ||
14 | -Vue.use(lazyload); | 13 | +Vue.use(lazyload, { |
14 | + preLoad: 3 | ||
15 | +}); | ||
15 | 16 | ||
16 | new Vue({ | 17 | new Vue({ |
17 | el: '#share', | 18 | el: '#share', |
@@ -9,7 +9,9 @@ const lazyload = require('vue-lazyload'); | @@ -9,7 +9,9 @@ const lazyload = require('vue-lazyload'); | ||
9 | const infinitScroll = require('vue-infinite-scroll'); | 9 | const infinitScroll = require('vue-infinite-scroll'); |
10 | 10 | ||
11 | require('common/vue-filter')(Vue); | 11 | require('common/vue-filter')(Vue); |
12 | -Vue.use(lazyload); | 12 | +Vue.use(lazyload, { |
13 | + preLoad: 3 | ||
14 | +}); | ||
13 | Vue.use(infinitScroll); | 15 | Vue.use(infinitScroll); |
14 | 16 | ||
15 | const shopBox = require('product/shop/shop-box.vue'); | 17 | const shopBox = require('product/shop/shop-box.vue'); |
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | <div class="blk-header"> | 3 | <div class="blk-header"> |
4 | <div class="blk-header-left"> | 4 | <div class="blk-header-left"> |
5 | <slot name="left"> | 5 | <slot name="left"> |
6 | - <i class="icon icon-left" @click="goBack"></i> | 6 | + <i class="icon icon-left go-back-btn" @click="goBack"></i> |
7 | </slot> | 7 | </slot> |
8 | </div> | 8 | </div> |
9 | <div class="blk-header-right"> | 9 | <div class="blk-header-right"> |
@@ -92,6 +92,13 @@ | @@ -92,6 +92,13 @@ | ||
92 | .blk-header-title { | 92 | .blk-header-title { |
93 | vertical-align: middle; | 93 | vertical-align: middle; |
94 | } | 94 | } |
95 | + | ||
96 | + .go-back-btn { | ||
97 | + width: 128px; | ||
98 | + text-indent: 32px; | ||
99 | + margin-left: -32px; | ||
100 | + display: inline-block; | ||
101 | + } | ||
95 | } | 102 | } |
96 | 103 | ||
97 | .blk-header-main { | 104 | .blk-header-main { |
@@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
18 | </ul> | 18 | </ul> |
19 | <p class="cardlist--loading text-center" v-show="inLoading">正在加载...</p> | 19 | <p class="cardlist--loading text-center" v-show="inLoading">正在加载...</p> |
20 | <p class="cardlist--end text-center" v-show="atEnd ">--End--</p> | 20 | <p class="cardlist--end text-center" v-show="atEnd ">--End--</p> |
21 | - | 21 | + |
22 | <div class="empty-tip" v-show="empty"> | 22 | <div class="empty-tip" v-show="empty"> |
23 | <i class="icon icon-search"></i> | 23 | <i class="icon icon-search"></i> |
24 | <p class="empty-tip-cn">未找到相关商品</p> | 24 | <p class="empty-tip-cn">未找到相关商品</p> |
@@ -31,7 +31,7 @@ | @@ -31,7 +31,7 @@ | ||
31 | const lazyload = require('vue-lazyload'); | 31 | const lazyload = require('vue-lazyload'); |
32 | const infinitScroll = require('vue-infinite-scroll'); | 32 | const infinitScroll = require('vue-infinite-scroll'); |
33 | 33 | ||
34 | - Vue.use(lazyload); | 34 | + Vue.use(lazyload, { preLoad: 3 }); |
35 | Vue.use(infinitScroll); | 35 | Vue.use(infinitScroll); |
36 | 36 | ||
37 | let bus = require('common/vue-bus'); | 37 | let bus = require('common/vue-bus'); |
@@ -23,7 +23,7 @@ | @@ -23,7 +23,7 @@ | ||
23 | 23 | ||
24 | let locationQuery = qs(decodeURIComponent(location.search.replace(/^\?/, ''))); | 24 | let locationQuery = qs(decodeURIComponent(location.search.replace(/^\?/, ''))); |
25 | 25 | ||
26 | - Vue.use(lazyload); | 26 | + Vue.use(lazyload, { preLoad: 3 }); |
27 | Vue.use(infinitScroll); | 27 | Vue.use(infinitScroll); |
28 | require('common/vue-filter')(Vue); | 28 | require('common/vue-filter')(Vue); |
29 | 29 |
@@ -21,7 +21,7 @@ | @@ -21,7 +21,7 @@ | ||
21 | 21 | ||
22 | let locationQuery = qs(decodeURIComponent(location.search.replace(/^\?/, ''))); | 22 | let locationQuery = qs(decodeURIComponent(location.search.replace(/^\?/, ''))); |
23 | 23 | ||
24 | - Vue.use(lazyload); | 24 | + Vue.use(lazyload, { preLoad: 3 }); |
25 | Vue.use(infinitScroll); | 25 | Vue.use(infinitScroll); |
26 | require('common/vue-filter')(Vue); | 26 | require('common/vue-filter')(Vue); |
27 | 27 |
@@ -18,7 +18,7 @@ | @@ -18,7 +18,7 @@ | ||
18 | const order = require('component/product/order.vue'); | 18 | const order = require('component/product/order.vue'); |
19 | const list = require('component/product/list.vue'); | 19 | const list = require('component/product/list.vue'); |
20 | 20 | ||
21 | - Vue.use(lazyload); | 21 | + Vue.use(lazyload, { preLoad: 3 }); |
22 | Vue.use(infinitScroll); | 22 | Vue.use(infinitScroll); |
23 | 23 | ||
24 | require('common/vue-filter')(Vue); | 24 | require('common/vue-filter')(Vue); |
1 | <template> | 1 | <template> |
2 | - <top-bar :share-data="shareData"></top-bar> | 2 | + <top-bar :share-data="shareData" :show-top-bar="showTopBar"></top-bar> |
3 | + | ||
3 | <shop-top :shop-info="shopInfo"></shop-top> | 4 | <shop-top :shop-info="shopInfo"></shop-top> |
4 | <div :class='{"shop-goods-top": !shopInfo.isBlkShop}'> | 5 | <div :class='{"shop-goods-top": !shopInfo.isBlkShop}'> |
5 | <goods-list :data="productList" :empty="empty"></goods-list> | 6 | <goods-list :data="productList" :empty="empty"></goods-list> |
@@ -34,9 +35,9 @@ | @@ -34,9 +35,9 @@ | ||
34 | return { | 35 | return { |
35 | shareData: {}, // 分享相关数据 | 36 | shareData: {}, // 分享相关数据 |
36 | shopInfo: {}, // 店铺介绍相关数据 | 37 | shopInfo: {}, // 店铺介绍相关数据 |
37 | - | ||
38 | sortConfig: {}, | 38 | sortConfig: {}, |
39 | filterConfig: {}, | 39 | filterConfig: {}, |
40 | + showTopBar: false, | ||
40 | 41 | ||
41 | // query | 42 | // query |
42 | url: '/product/shop/goods.json', | 43 | url: '/product/shop/goods.json', |
@@ -73,7 +74,7 @@ | @@ -73,7 +74,7 @@ | ||
73 | /* 获取店铺简介相关数据 */ | 74 | /* 获取店铺简介相关数据 */ |
74 | getShopInfo() { | 75 | getShopInfo() { |
75 | $.get({ | 76 | $.get({ |
76 | - async: false, | 77 | + // async: false, |
77 | url: '/product/shop/info.json', | 78 | url: '/product/shop/info.json', |
78 | data: { | 79 | data: { |
79 | domain: $shop.data('domain'), | 80 | domain: $shop.data('domain'), |
@@ -83,6 +84,7 @@ | @@ -83,6 +84,7 @@ | ||
83 | if (result) { | 84 | if (result) { |
84 | this.shopInfo = result; | 85 | this.shopInfo = result; |
85 | this.shopInfo.showBrandInfo = true; | 86 | this.shopInfo.showBrandInfo = true; |
87 | + | ||
86 | let shareUrl = locationQuery.id ? | 88 | let shareUrl = locationQuery.id ? |
87 | location.origin + '/product/shop/favorite/share?id=' + locationQuery.id : | 89 | location.origin + '/product/shop/favorite/share?id=' + locationQuery.id : |
88 | location.origin + '/product/shop/' + $shop.data('domain') + '/share'; | 90 | location.origin + '/product/shop/' + $shop.data('domain') + '/share'; |
@@ -103,6 +105,8 @@ | @@ -103,6 +105,8 @@ | ||
103 | } else { | 105 | } else { |
104 | this.shopInfo.showBrandInfo = false; | 106 | this.shopInfo.showBrandInfo = false; |
105 | } | 107 | } |
108 | + | ||
109 | + this.showTopBar = true; | ||
106 | }).fail(() => { | 110 | }).fail(() => { |
107 | tip('网络出错~'); | 111 | tip('网络出错~'); |
108 | }); | 112 | }); |
1 | <template> | 1 | <template> |
2 | - <cheader :title="title" :class="{ghost: shareData.isBlkShop}" :fixed="shareData.isBlkShop" v-ref:header> | ||
3 | - <template slot="right" v-on:scroll=""> | ||
4 | - <span v-if="shareData.isBlkShop" v-show="shareData.isFav" class="icon" @click="collectShop()"></span> | ||
5 | - <span v-if="shareData.isBlkShop" v-show="!shareData.isFav" class="icon" @click="collectShop()"></span> | ||
6 | - <span v-if="shareData.isBlkShop" class="icon" @click="goShare()"></span> | ||
7 | - <span class="icon" @click="showFilter()"></span> | ||
8 | - </template> | ||
9 | - </cheader> | 2 | + <div :style="{display: topBarDisplay}"> |
3 | + <cheader :title="title" :class="{ghost: shareData.isBlkShop}" :fixed="shareData.isBlkShop" v-ref:header> | ||
4 | + <template slot="right" v-on:scroll=""> | ||
5 | + <span v-if="shareData.isBlkShop" v-show="shareData.isFav" class="icon" @click="collectShop()"></span> | ||
6 | + <span v-if="shareData.isBlkShop" v-show="!shareData.isFav" class="icon" @click="collectShop()"></span> | ||
7 | + <span v-if="shareData.isBlkShop" class="icon" @click="goShare()"></span> | ||
8 | + <span class="icon" @click="showFilter()"></span> | ||
9 | + </template> | ||
10 | + </cheader> | ||
11 | + </div> | ||
10 | </template> | 12 | </template> |
11 | 13 | ||
12 | <style> | 14 | <style> |
@@ -31,8 +33,9 @@ | @@ -31,8 +33,9 @@ | ||
31 | }, | 33 | }, |
32 | props: { | 34 | props: { |
33 | shareData: { | 35 | shareData: { |
34 | - type: Object | ||
35 | - } | 36 | + type: Object, |
37 | + }, | ||
38 | + showTopBar: false | ||
36 | }, | 39 | }, |
37 | computed: { | 40 | computed: { |
38 | title() { | 41 | title() { |
@@ -43,6 +46,9 @@ | @@ -43,6 +46,9 @@ | ||
43 | } | 46 | } |
44 | 47 | ||
45 | return result; | 48 | return result; |
49 | + }, | ||
50 | + topBarDisplay() { | ||
51 | + return this.showTopBar ? 'block' : 'none'; | ||
46 | } | 52 | } |
47 | }, | 53 | }, |
48 | components: { | 54 | components: { |
-
Please register or login to post a comment