Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-activity-platform
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
yyq
7 years ago
Commit
77cf373d2c7e60c44600671737f5fecad4535742
1 parent
35246bd6
dev info
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
44 additions
and
47 deletions
apps/admin/views/action/login.hbs
build/dev-info.js
build/webpack.base.config.js
config/common.js
doraemon/middleware/devtools.js
doraemon/views/error/403.hbs
doraemon/views/error/404.hbs
doraemon/views/error/500.hbs
doraemon/views/layout.hbs
apps/admin/views/action/login.hbs
View file @
77cf373
...
...
@@ -8,8 +8,8 @@
<title>
YOHO!Activity Admin
</title>
{{#if
devEnv
}}
<link
rel=
"stylesheet"
media=
"all"
href=
"//
{{
devHost
}}
:5002/css/common.css?t=
{{
startTime
}}
"
>
<link
rel=
"stylesheet"
media=
"all"
href=
"//
{{
devHost
}}
:5002/css/
{{
module
}}
.
{{
page
}}
.css?t=
{{
startTime
}}
"
>
<link
rel=
"stylesheet"
media=
"all"
href=
"//
{{
devHost
}}
:
{{
devPort
}}
/css/common.css?t=
{{
startTime
}}
"
>
<link
rel=
"stylesheet"
media=
"all"
href=
"//
{{
devHost
}}
:
{{
devPort
}}
/css/
{{
module
}}
.
{{
page
}}
.css?t=
{{
startTime
}}
"
>
{{^}}
<link
rel=
"stylesheet"
media=
"all"
href=
"/yoho-activity-platform/
{{
version
}}
/css/common.css?t=
{{
startTime
}}
"
>
<link
rel=
"stylesheet"
media=
"all"
href=
"/yoho-activity-platform/
{{
version
}}
/css/
{{
module
}}
.
{{
page
}}
.css?t=
{{
startTime
}}
"
>
...
...
@@ -50,8 +50,8 @@
</div>
</div>
{{#if
devEnv
}}
<script
src=
"//
{{
devHost
}}
:5002/libs.js"
></script>
<script
src=
"//
{{
devHost
}}
:5002/js/
{{
module
}}
.
{{
page
}}
.js"
></script>
<script
src=
"//
{{
devHost
}}
:
{{
devPort
}}
/libs.js"
></script>
<script
src=
"//
{{
devHost
}}
:
{{
devPort
}}
/js/
{{
module
}}
.
{{
page
}}
.js"
></script>
{{^}}
<script
src=
"/yoho-activity-platform/
{{
version
}}
/libs.js?t=
{{
startTime
}}
"
></script>
<script
src=
"/yoho-activity-platform/
{{
version
}}
/js/
{{
module
}}
.
{{
page
}}
.js?t=
{{
startTime
}}
"
></script>
...
...
build/dev-info.js
View file @
77cf373
const
fs
=
require
(
'fs'
);
const
path
=
require
(
'path'
);
const
devTools
=
require
(
'../doraemon/middleware/devtools'
)();
const
info
=
{
host
:
'127.0.0.1'
,
port
:
5002
,
publicPath
:
'http://127.0.0.1:5002/'
};
try
{
let
dev
=
JSON
.
parse
(
fs
.
readFileSync
(
path
.
join
(
__dirname
,
'../.devhost'
)));
let
devInfo
=
{};
info
.
host
=
dev
.
host
;
info
.
publicPath
=
`
http
:
//${info.host}:${info.port}/`;
}
catch
(
e
)
{
if
(
!
process
.
env
.
NODE_ENV
)
{
console
.
error
(
e
);
console
.
warn
(
`
推荐在项目主目录建一个
.
devhost
文件,内容为
{
"host"
:
"127.0.0.1"
}
`
);
}
}
devTools
(
''
,
{
locals
:
devInfo
});
module
.
exports
=
info
;
module
.
exports
=
{
host
:
devInfo
.
devHost
,
port
:
devInfo
.
devPort
,
publicPath
:
`
http
:
//${devInfo.devHost}:${devInfo.devPort}/`
};
...
...
build/webpack.base.config.js
View file @
77cf373
...
...
@@ -53,13 +53,13 @@ const getEntries = () => {
// 构建各模块子页面JS
// 新的生成规则 module/page/index.js
shelljs
.
ls
(
path
.
join
(
__dirname
,
'../public/js/**/index.js'
)).
forEach
((
f
)
=>
{
const
dir
=
_
.
slice
(
f
.
split
(
'/'
),
-
3
);
// [modulename, page, index.js]
// shelljs.ls(path.join(__dirname, '../public/js/**/index.js')).forEach((f) => {
// const dir = _.slice(f.split('/'), -3); // [modulename, page, index.js]
// Important
// 生成规则:module.page: './js/module/page/index.js'
entries
[
`
$
{
dir
[
0
]}.
$
{
dir
[
1
]}
`
]
=
path
.
join
(
__dirname
,
`
..
/
public
/
js
/
$
{
dir
.
join
(
'/'
)}
`
);
});
// // Important
// // 生成规则:module.page: './js/module/page/index.js'
// entries[`${dir[0]}.${dir[1]}`] = path.join(__dirname, `../public/js/${dir.join('/')}`);
// });
// 老的生成规则module.page.js
shelljs
.
ls
(
path
.
join
(
__dirname
,
'../public/js/**/*.page.js'
)).
forEach
((
f
)
=>
{
...
...
config/common.js
View file @
77cf373
...
...
@@ -73,7 +73,7 @@ module.exports = {
host
:
'localhost'
,
port
:
'3306'
,
user
:
'root'
,
password
:
''
password
:
'
123456
'
},
database
:
'yoho_activity_platform'
,
},
...
...
doraemon/middleware/devtools.js
View file @
77cf373
'use strict'
;
const
fs
=
require
(
'fs'
);
const
path
=
require
(
'path'
);
let
devHost
=
'127.0.0.1'
;
let
devPort
=
'5006'
;
fs
.
readFile
(
'.devhost'
,
(
err
,
buf
)
=>
{
fs
.
readFile
(
path
.
join
(
__dirname
,
'../../.devhost'
)
,
(
err
,
buf
)
=>
{
if
(
!
err
)
{
devHost
=
JSON
.
parse
(
buf
.
toString
()).
host
;
let
devConfig
=
JSON
.
parse
(
buf
.
toString
());
devHost
=
devConfig
.
host
||
devHost
;
devPort
=
devConfig
.
port
||
devPort
;
}
else
if
(
!
process
.
env
.
NODE_ENV
)
{
console
.
error
(
err
);
console
.
warn
(
`
推荐在项目主目录建一个
.
devhost
文件,内容为
{
"host"
:
"127.0.0.1"
}
`
);
}
});
console
.
log
(
devHost
);
module
.
exports
=
()
=>
{
return
(
req
,
res
,
next
)
=>
{
Object
.
assign
(
res
.
locals
,
{
devHost
:
devHost
devHost
:
devHost
,
devPort
:
devPort
});
next
();
next
&&
next
();
};
};
...
...
doraemon/views/error/403.hbs
View file @
77cf373
...
...
@@ -8,7 +8,7 @@
<title>
YOHO!活动平台
</title>
{{#if
devEnv
}}
<link
rel=
"stylesheet"
media=
"all"
href=
"//
{{
devHost
}}
:
5002
/css/common.css?t=
{{
startTime
}}
"
>
<link
rel=
"stylesheet"
media=
"all"
href=
"//
{{
devHost
}}
:
{{
devPort
}}
/css/common.css?t=
{{
startTime
}}
"
>
{{^}}
<link
rel=
"stylesheet"
media=
"all"
href=
"/yoho-activity-platform/
{{
version
}}
/css/common.css?t=
{{
startTime
}}
"
>
...
...
doraemon/views/error/404.hbs
View file @
77cf373
...
...
@@ -8,7 +8,7 @@
<title>
YOHO!活动平台
</title>
{{#if
devEnv
}}
<link
rel=
"stylesheet"
media=
"all"
href=
"//
{{
devHost
}}
:
5002
/css/common.css?t=
{{
startTime
}}
"
>
<link
rel=
"stylesheet"
media=
"all"
href=
"//
{{
devHost
}}
:
{{
devPort
}}
/css/common.css?t=
{{
startTime
}}
"
>
{{^}}
<link
rel=
"stylesheet"
media=
"all"
href=
"/yoho-activity-platform/
{{
version
}}
/css/common.css?t=
{{
startTime
}}
"
>
...
...
doraemon/views/error/500.hbs
View file @
77cf373
...
...
@@ -8,7 +8,7 @@
<title>
YOHO!活动平台
</title>
{{#if
devEnv
}}
<link
rel=
"stylesheet"
media=
"all"
href=
"//
{{
devHost
}}
:
5002
/css/common.css?t=
{{
startTime
}}
"
>
<link
rel=
"stylesheet"
media=
"all"
href=
"//
{{
devHost
}}
:
{{
devPort
}}
/css/common.css?t=
{{
startTime
}}
"
>
{{^}}
<link
rel=
"stylesheet"
media=
"all"
href=
"/yoho-activity-platform/
{{
version
}}
/css/common.css?t=
{{
startTime
}}
"
>
...
...
doraemon/views/layout.hbs
View file @
77cf373
...
...
@@ -8,8 +8,8 @@
<title>
YOHO!活动平台
</title>
{{#if
devEnv
}}
<link
rel=
"stylesheet"
media=
"all"
href=
"//
{{
devHost
}}
:5002/css/common.css?t=
{{
startTime
}}
"
>
<link
rel=
"stylesheet"
media=
"all"
href=
"//
{{
devHost
}}
:5002/css/
{{
module
}}
.
{{
page
}}
.css?t=
{{
startTime
}}
"
>
<link
rel=
"stylesheet"
media=
"all"
href=
"//
{{
devHost
}}
:
{{
devPort
}}
/css/common.css?t=
{{
startTime
}}
"
>
<link
rel=
"stylesheet"
media=
"all"
href=
"//
{{
devHost
}}
:
{{
devPort
}}
/css/
{{
module
}}
.
{{
page
}}
.css?t=
{{
startTime
}}
"
>
{{^}}
<link
rel=
"stylesheet"
media=
"all"
href=
"/yoho-activity-platform/
{{
version
}}
/css/common.css?t=
{{
startTime
}}
"
>
<link
rel=
"stylesheet"
media=
"all"
...
...
@@ -112,8 +112,8 @@
</div>
</div>
{{#if
devEnv
}}
<script
src=
"//
{{
devHost
}}
:5002/libs.js"
></script>
<script
src=
"//
{{
devHost
}}
:5002/js/
{{
module
}}
.
{{
page
}}
.js"
></script>
<script
src=
"//
{{
devHost
}}
:
{{
devPort
}}
/libs.js"
></script>
<script
src=
"//
{{
devHost
}}
:
{{
devPort
}}
/js/
{{
module
}}
.
{{
page
}}
.js"
></script>
{{^}}
<script
src=
"/yoho-activity-platform/
{{
version
}}
/libs.js?t=
{{
startTime
}}
"
></script>
<script
src=
"/yoho-activity-platform/
{{
version
}}
/js/
{{
module
}}
.
{{
page
}}
.js?t=
{{
startTime
}}
"
></script>
...
...
Please
register
or
login
to post a comment