Authored by Aiden Xu

分期订单

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 -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 +dist
  141 +public/css/*
  142 +public/bundle/*
  143 +.eslintcache
  144 +*.log.*
  145 +nbproject/*
  146 +.DS_Store
  147 +.devhost
@@ -86,13 +86,17 @@ try { @@ -86,13 +86,17 @@ try {
86 const setYohoData = require('./doraemon/middleware/set-yoho-data'); 86 const setYohoData = require('./doraemon/middleware/set-yoho-data');
87 const errorHanlder = require('./doraemon/middleware/error-handler'); 87 const errorHanlder = require('./doraemon/middleware/error-handler');
88 const setPageInfo = require('./doraemon/middleware/set-pageinfo'); 88 const setPageInfo = require('./doraemon/middleware/set-pageinfo');
89 - 89 + const devtools = require('./doraemon/middleware/devtools');
90 90
91 // YOHO 前置中间件 91 // YOHO 前置中间件
92 app.use(setYohoData()); 92 app.use(setYohoData());
93 app.use(user()); 93 app.use(user());
94 app.use(setPageInfo()); 94 app.use(setPageInfo());
95 95
  96 + if (app.locals.devEnv) {
  97 + app.use(devtools());
  98 + }
  99 +
96 require('./dispatch')(app); 100 require('./dispatch')(app);
97 101
98 app.all('*', errorHanlder.notFound()); // 404 102 app.all('*', errorHanlder.notFound()); // 404
  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 +};
@@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
18 (function(d,c){var e=d.documentElement,a="orientationchange" in window?"orientationchange":"resize",b=function(){var f=e.clientWidth;if(!f){return}if(f>=640){e.style.fontSize="40px"}else{e.style.fontSize=40*(f/640)+"px"}};if(!d.addEventListener){return}b();c.addEventListener(a,b,false);d.addEventListener("DOMContentLoaded",b,false)})(document,window); 18 (function(d,c){var e=d.documentElement,a="orientationchange" in window?"orientationchange":"resize",b=function(){var f=e.clientWidth;if(!f){return}if(f>=640){e.style.fontSize="40px"}else{e.style.fontSize=40*(f/640)+"px"}};if(!d.addEventListener){return}b();c.addEventListener(a,b,false);d.addEventListener("DOMContentLoaded",b,false)})(document,window);
19 </script> 19 </script>
20 {{#if devEnv}} 20 {{#if devEnv}}
21 - <link rel="stylesheet" href="//172.16.11.32:5001/css/index.css"> 21 + <link rel="stylesheet" href="//{{devHost}}:5001/css/index.css">
22 {{^}} 22 {{^}}
23 <link rel="stylesheet" href="//cdn.yoho.cn/m-yohobuy-node/{{version}}/index.css"> 23 <link rel="stylesheet" href="//cdn.yoho.cn/m-yohobuy-node/{{version}}/index.css">
24 {{/if}} 24 {{/if}}
@@ -41,8 +41,8 @@ @@ -41,8 +41,8 @@
41 <script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.1.0.js"></script> 41 <script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
42 {{/wechatShare}} 42 {{/wechatShare}}
43 {{#if devEnv}} 43 {{#if devEnv}}
44 - <script src="//172.16.11.32:5001/libs.js"></script>  
45 - <script src="//172.16.11.32:5001/{{module}}.{{page}}.js"></script> 44 + <script src="//{{devHost}}:5001/libs.js"></script>
  45 + <script src="//{{devHost}}:5001/{{module}}.{{page}}.js"></script>
46 {{^}} 46 {{^}}
47 <script src="//cdn.yoho.cn/m-yohobuy-node/{{version}}/libs.js"></script> 47 <script src="//cdn.yoho.cn/m-yohobuy-node/{{version}}/libs.js"></script>
48 <script src="//cdn.yoho.cn/m-yohobuy-node/{{version}}/{{module}}.{{page}}.js"></script> 48 <script src="//cdn.yoho.cn/m-yohobuy-node/{{version}}/{{module}}.{{page}}.js"></script>