Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-blk
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
1
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
石坚
2016-09-22 05:37:55 +0200
Commit
f5ed89c78381f5046f96ea5b1f27b251ee69b301
1 parent
43424d53
blk camelcase
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
184 additions
and
179 deletions
apps/brand/models/brand.js
apps/brand/views/partial/list.hbs
apps/channel/models/index.js
apps/editorial/controllers/editorial.js
apps/editorial/models/editorial.js
apps/editorial/views/partial/msg.hbs
package.json
apps/brand/models/brand.js
View file @
f5ed89c
...
...
@@ -7,7 +7,6 @@
'use strict'
;
const
api
=
global
.
yoho
.
API
;
const
camelCase
=
global
.
yoho
.
camelCase
;
const
_
=
require
(
'lodash'
);
const
logger
=
global
.
yoho
.
logger
;
const
serviceAPI
=
global
.
yoho
.
ServiceAPI
;
...
...
@@ -22,16 +21,17 @@ const _processListData = (list) => {
let
listData
=
[];
list
=
list
||
[];
list
=
camelCase
(
list
);
// list = camelCase(list);
let
listKey
=
[];
// console.log(list)
_
.
forEach
(
list
.
data
.
all
L
ist
,
function
(
value
,
index
)
{
_
.
forEach
(
list
.
data
.
all
_l
ist
,
function
(
value
,
index
)
{
_
.
forEach
(
value
,
function
(
data
)
{
data
.
brand
Domain
=
`
$
{
config
.
siteUrl
}
/product/
shop
/
$
{
data
.
brandD
omain
}
`
;
data
.
brand
_domain
=
`
$
{
config
.
siteUrl
}
/product/
shop
/
$
{
data
.
brand_d
omain
}
`
;
});
if
(
index
!==
'0~9'
)
{
...
...
@@ -52,7 +52,7 @@ const _processListData = (list) => {
listData
.
push
({
key
:
keyName
,
brands
:
list
.
data
.
all
L
ist
[
key
]
brands
:
list
.
data
.
all
_l
ist
[
key
]
});
});
...
...
@@ -67,7 +67,8 @@ const _processTabData = (list) => {
let
tabData
=
[];
list
=
list
||
[];
list
=
camelCase
(
list
);
// list = camelCase(list);
_
.
forEach
(
list
,
function
(
value
)
{
...
...
apps/brand/views/partial/list.hbs
View file @
f5ed89c
...
...
@@ -5,9 +5,9 @@
<ul
class=
"clearfix"
>
{{#
each
brands
}}
<li>
<a
data-key=
"
{{
key
}}
"
href=
"
{{
brandDomain
}}
?gender=
{{
@root
.
brand
.
gender
}}
"
target=
"_blank"
>
<img
class=
"lazy"
data-original=
"
{{
image
brandIco
270
190
}}
"
>
<span>
{{#if
brandName
}}{{
brandName
}}{{else}}{{
brandNameEn
}}{{/if}}
</span>
<a
data-key=
"
{{
key
}}
"
href=
"
{{
brand_domain
}}
?gender=
{{
@root
.
brand
.
gender
}}
"
target=
"_blank"
>
<img
class=
"lazy"
data-original=
"
{{
image
brand_ico
270
190
}}
"
>
<span>
{{#if
brand_name
}}{{
brand_name
}}{{else}}{{
brand_name_en
}}{{/if}}
</span>
</a>
</li>
{{/
each
}}
...
...
apps/channel/models/index.js
View file @
f5ed89c
...
...
@@ -7,7 +7,6 @@
const
channelApi
=
require
(
'./channel-api'
);
const
floorDataHandler
=
require
(
'./floor-data-handler'
);
const
camelCase
=
global
.
yoho
.
camelCase
;
const
_
=
require
(
'lodash'
);
...
...
@@ -106,8 +105,8 @@ const _processFloorData = d => {
return
false
;
}
if
(
templateMap
[
data
.
templateName
])
{
floorData
=
templateMap
[
data
.
templateName
](
data
.
data
);
if
(
templateMap
[
data
.
template_name
])
{
floorData
=
templateMap
[
data
.
template_name
](
data
.
data
);
}
floorList
.
push
(
floorData
);
...
...
@@ -124,7 +123,7 @@ const _processFloorData = d => {
const
getContent
=
type
=>
{
return
channelApi
.
getChannelDataAsync
(
type
).
then
(
result
=>
{
if
(
result
.
data
&&
result
.
data
.
list
)
{
const
l
=
camelCase
(
result
.
data
.
list
);
const
l
=
result
.
data
.
list
;
//
camelCase(result.data.list);
const
floor
=
{
content
:
_processFloorData
(
l
)
};
...
...
apps/editorial/controllers/editorial.js
View file @
f5ed89c
...
...
@@ -184,42 +184,45 @@ const detail = (req, res, next) => {
}
editorialModel
.
getDetailData
(
id
,
appType
,
gender
,
tag
,
uid
,
udid
).
then
((
result
)
=>
{
let
editorialDetail
=
{
nav
:
[
{
link
:
link
,
pathTitle
:
'首页'
,
name
:
name
},
{
link
:
'//www.yohoblk.com/editorial'
,
pathTitle
:
'资讯'
,
name
:
'Editorial资讯'
},
{
pathTitle
:
'资讯'
,
name
:
result
.
head
.
title
}
],
id
:
id
,
header
:
result
.
head
,
content
:
result
.
content
.
contents
,
tags
:
result
.
tags
,
userInfo
:
result
.
head
,
comment
:
result
.
comment
,
brands
:
result
.
brands
,
nextArticle
:
result
.
nextArticle
,
perArticle
:
result
.
perArticle
,
share
:
{
shareImg
:
result
.
content
.
shareImg
,
shareDesc
:
result
.
head
.
title
,
weixinUrl
:
result
.
head
.
weixinUrl
}
};
res
.
display
(
'detail'
,
{
module
:
'editorial'
,
page
:
'detail'
,
title
:
result
.
head
.
title
,
editorialDetail
:
{
nav
:
[
{
link
:
link
,
pathTitle
:
'首页'
,
name
:
name
},
{
link
:
'//www.yohoblk.com/editorial'
,
pathTitle
:
'资讯'
,
name
:
'Editorial资讯'
},
{
pathTitle
:
'资讯'
,
name
:
result
.
head
.
title
}
],
id
:
id
,
header
:
result
.
head
,
content
:
result
.
content
.
contents
,
tags
:
result
.
tags
,
userInfo
:
result
.
head
,
comment
:
result
.
comment
,
brands
:
result
.
brands
,
nextArticle
:
result
.
nextArticle
,
perArticle
:
result
.
perArticle
,
share
:
{
shareImg
:
result
.
content
.
shareImg
,
shareDesc
:
result
.
head
.
title
,
weixinUrl
:
result
.
head
.
weixinUrl
}
},
editorialDetail
:
editorialDetail
,
helpers
:
{
// import component, path depends on your project
pagination
:
require
(
'../../../doraemon/components/pagination/pagination'
).
createPagination
...
...
apps/editorial/models/editorial.js
View file @
f5ed89c
...
...
@@ -6,7 +6,6 @@
'use strict'
;
const
serviceAPI
=
global
.
yoho
.
ServiceAPI
;
const
api
=
global
.
yoho
.
API
;
const
camelCase
=
global
.
yoho
.
camelCase
;
const
_
=
require
(
'lodash'
);
const
Promise
=
require
(
'bluebird'
);
const
co
=
Promise
.
coroutine
;
...
...
@@ -25,7 +24,8 @@ const logger = global.yoho.logger;
const
_processListData
=
(
list
)
=>
{
list
=
list
||
[];
list
=
camelCase
(
list
);
// list = camelCase(list);
let
listData
=
{
tabs
:
[]
...
...
@@ -43,8 +43,8 @@ const _processListData = (list) => {
});
}
data
.
publishTime
=
data
.
publishTime
.
replace
(
/年|月/g
,
'/'
);
data
.
publishTime
=
data
.
publishTime
.
replace
(
/日/g
,
''
);
data
.
publish_time
=
data
.
publish_time
.
replace
(
/年|月/g
,
'/'
);
data
.
publish_time
=
data
.
publish_time
.
replace
(
/日/g
,
''
);
data
.
isPraise
=
data
.
isPraise
===
'Y'
;
});
...
...
@@ -140,7 +140,8 @@ const _processHeadData = (list) => {
return
co
(
function
*
()
{
list
=
list
||
[];
list
=
camelCase
(
list
);
// list = camelCase(list);
let
newData
=
{
headData
:
{},
...
...
@@ -155,11 +156,11 @@ const _processHeadData = (list) => {
newData
.
headData
=
{
title
:
data
.
title
,
click
:
data
.
viewNum
,
time
:
data
.
publishTime
,
click
:
data
.
view_num
,
time
:
data
.
publish_time
,
isLike
:
data
.
isPraise
,
isCollected
:
data
.
isFavor
,
likeNum
:
data
.
praise
N
um
,
likeNum
:
data
.
praise
_n
um
,
weixinUrl
:
`
http
:
//m.yohoblk.com/${data.id}.html`
};
...
...
@@ -167,8 +168,8 @@ const _processHeadData = (list) => {
if
(
index
===
1
)
{
newData
.
headData
=
_
.
assign
(
newData
.
headData
,
{
authorId
:
data
.
authorId
,
authorUrl
:
`
/
editorial
/
list
/
?
authorId
=
$
{
data
.
authorId
}
`
authorId
:
data
.
author_id
,
authorUrl
:
`
/
editorial
/
list
/
?
authorId
=
$
{
data
.
author_id
}
`
});
_
.
forEach
(
data
.
tags
,
function
(
value
)
{
...
...
@@ -245,7 +246,8 @@ const _getRelatedData = (idList) => {
*/
const
_processContentData
=
(
list
)
=>
{
list
=
list
||
[];
list
=
camelCase
(
list
);
// list = camelCase(list);
// console.log(list)
...
...
@@ -462,7 +464,7 @@ const _getCommentsData = (id, appType) => {
data
.
create_time
=
data
.
create_time
.
replace
(
/月/g
,
'/'
);
data
.
create_time
=
data
.
create_time
.
replace
(
/日/g
,
''
);
});
return
camelCase
(
result
.
data
);
return
result
.
data
;
//
camelCase(result.data);
}
else
{
logger
.
error
(
'Review data return code is not 200'
);
return
{};
...
...
@@ -488,7 +490,7 @@ const _getRelateBrand = (id, appType) => {
domain
=
domain
.
substring
(
domain
.
indexOf
(
'/'
)
+
2
,
domain
.
indexOf
(
'.'
));
data
.
url
=
`
$
{
config
.
siteUrl
}
/product/
shop
/
$
{
domain
}
`
;
});
return
camelCase
(
result
.
data
);
return
result
.
data
;
//
camelCase(result.data);
}
else
{
logger
.
error
(
'Related brand return code is not 200'
);
return
{};
...
...
@@ -663,7 +665,7 @@ const addComment = (id, uid, comment) => {
const
shareData
=
()
=>
{
return
serviceAPI
.
get
(
'guang/api/*/share/guang'
,
{}).
then
((
result
)
=>
{
if
(
result
&&
result
.
code
===
200
)
{
return
camelCase
(
result
.
data
);
return
result
.
data
;
//
camelCase(result.data);
}
else
{
logger
.
error
(
'Related brand return code is not 200'
);
return
{};
...
...
apps/editorial/views/partial/msg.hbs
View file @
f5ed89c
<div
class=
"content-msg clearfix"
data-id=
"
{{
id
}}
"
>
<div
class=
"msg-left"
><i
class=
"iconfont"
>

</i>
<span
class=
"time-word font brown-light"
>
{{
publish
T
ime
}}
</span></div>
<div
class=
"msg-left"
><i
class=
"iconfont"
>

</i>
<span
class=
"time-word font brown-light"
>
{{
publish
_t
ime
}}
</span></div>
<div
class=
"msg-right"
>
<a
class=
"msg-title"
href=
"/editorial/
{{
id
}}
.html"
target=
"_blank"
>
{{
title
}}
</a>
<a
href=
"/editorial/
{{
id
}}
.html"
target=
"_blank"
>
...
...
@@ -9,8 +9,8 @@
<div
class=
"msg-app"
>
<span
class=
"like-comment"
>
<i
class=
"iconfont like-icon
{{#if
isPraise
}}
liked
{{/if}}
"
>

</i>
<b
class=
"like-num brown-light font"
>
{{
praise
N
um
}}
</b>
<b
class=
"like-num brown-light font"
>
{{
praise
_n
um
}}
</b>
</span>
</div>
</div>
</div>
\ No newline at end of file
</div>
...
...
package.json
View file @
f5ed89c
{
"name"
:
"yoho-blk"
,
"version"
:
"0.0.1"
,
"private"
:
true
,
"description"
:
"A New Yohoblk Project With Express"
,
"repository"
:
{
"type"
:
"git"
,
"url"
:
"http://git.yoho.cn/fe/yoho-blk.git"
},
"scripts"
:
{
"start"
:
"node app.js"
,
"dev"
:
"nodemon -e js,hbs -i public/ app.js"
,
"online"
:
"NODE_ENV=\"production\" node app.js"
,
"debug"
:
"DEBUG=\"express:*\" nodemon -e js,hbs -i public/ app.js"
,
"lint-js"
:
"eslint -c .eslintrc --cache --fix ."
,
"lint-css"
:
"stylelint --config .stylelintrc public/scss/**/*.css"
,
"precommit"
:
"node lint.js"
,
"test"
:
"NODE_ENV=test nyc ./node_modules/.bin/ava"
,
"posttest"
:
"nyc report --reporter=html"
},
"ava"
:
{
"tap"
:
true
,
"require"
:
[
"babel-register"
],
"babel"
:
{
"presets"
:
[
"es2015"
]
}
},
"license"
:
"MIT"
,
"dependencies"
:
{
"bluebird"
:
"^3.4.0"
,
"body-parser"
:
"^1.15.0"
,
"captchapng"
:
"0.0.1"
,
"connect-memcached"
:
"^0.2.0"
,
"connect-multiparty"
:
"^2.0.0"
,
"cookie-parser"
:
"^1.4.3"
,
"csurf"
:
"^1.9.0"
,
"express"
:
"^4.13.1"
,
"express-handlebars"
:
"^3.0.0"
,
"express-session"
:
"^1.13.0"
,
"influxdb-winston"
:
"^1.0.1"
,
"lodash"
:
"^4.13.1"
,
"md5"
:
"^2.1.0"
,
"memcached"
:
"^2.2.2"
,
"moment"
:
"^2.13.0"
,
"morgan"
:
"^1.7.0"
,
"oneapm"
:
"^1.2.20"
,
"passport"
:
"^0.3.2"
,
"passport-douban"
:
"0.0.1"
,
"passport-local"
:
"^1.0.0"
,
"passport-qq"
:
"0.0.3"
,
"passport-renren"
:
"^0.1.3"
,
"passport-sina"
:
"^0.1.0"
,
"passport-strategy"
:
"1.x.x"
,
"passport-weixin"
:
"^0.1.0"
,
"request"
:
"^2.73.0"
,
"request-promise"
:
"^3.0.0"
,
"serve-favicon"
:
"^2.3.0"
,
"uuid"
:
"^2.0.2"
,
"winston"
:
"^2.2.0"
,
"winston-daily-rotate-file"
:
"^1.1.4"
,
"xss"
:
"^0.2.13"
,
"yoho-node-lib"
:
"0.0.45"
},
"devDependencies"
:
{
"autoprefixer"
:
"^6.3.6"
,
"ava"
:
"^0.15.2"
,
"babel-preset-es2015"
:
"^6.9.0"
,
"babel-register"
:
"^6.9.0"
,
"eslint"
:
"^2.12.0"
,
"eslint-config-yoho"
:
"^1.0.1"
,
"gulp"
:
"^3.9.1"
,
"gulp-cssnano"
:
"^2.1.2"
,
"gulp-ftp"
:
"^1.1.0"
,
"gulp-postcss"
:
"^6.1.0"
,
"gulp-sourcemaps"
:
"^2.0.0-alpha"
,
"gulp-util"
:
"^3.0.7"
,
"handlebars-loader"
:
"^1.3.0"
,
"husky"
:
"^0.11.4"
,
"nodemon"
:
"1.9.2"
,
"nyc"
:
"^6.6.1"
,
"postcss-assets"
:
"^4.0.1"
,
"postcss-cachebuster"
:
"^0.1.3"
,
"postcss-calc"
:
"^5.2.1"
,
"postcss-center"
:
"^1.0.0"
,
"postcss-clearfix"
:
"^1.0.0"
,
"postcss-crip"
:
"^2.0.0"
,
"postcss-opacity"
:
"^3.0.0"
,
"postcss-position"
:
"^0.5.0"
,
"postcss-pxtorem"
:
"^3.3.1"
,
"postcss-short"
:
"^1.4.0"
,
"postcss-sprites"
:
"^3.1.2"
,
"postcss-use"
:
"^2.0.2"
,
"precss"
:
"^1.4.0"
,
"rewire"
:
"^2.5.1"
,
"shelljs"
:
"^0.7.0"
,
"stylelint"
:
"^7.1.0"
,
"stylelint-config-yoho"
:
"^1.2.7"
,
"webpack"
:
"^1.13.1"
,
"webpack-dev-server"
:
"^1.14.1"
,
"webpack-stream"
:
"^3.1.0"
,
"yoho-eventproxy"
:
"^0.3.6"
,
"yoho-handlebars"
:
"^4.0.5"
,
"yoho-jquery"
:
"^1.12.4"
,
"yoho-jquery-accordion"
:
"0.0.2"
,
"yoho-jquery-dotdotdot"
:
"0.0.1"
,
"yoho-jquery-lazyload"
:
"^1.9.7"
,
"yoho-jquery-nanoscroller"
:
"0.0.1"
,
"yoho-jquery-placeholder"
:
"^2.3.1"
,
"yoho-jquery-qrcode"
:
"0.0.3"
,
"yoho-json2"
:
"^1.0.0"
,
"yoho-slider"
:
"0.0.2"
}
}
{
"name"
:
"yoho-blk"
,
"version"
:
"0.0.1"
,
"private"
:
true
,
"description"
:
"A New Yohoblk Project With Express"
,
"repository"
:
{
"type"
:
"git"
,
"url"
:
"http://git.yoho.cn/fe/yoho-blk.git"
},
"scripts"
:
{
"start"
:
"node app.js"
,
"dev"
:
"nodemon -e js,hbs -i public/ app.js"
,
"online"
:
"NODE_ENV=\"production\" node app.js"
,
"debug"
:
"DEBUG=\"express:*\" nodemon -e js,hbs -i public/ app.js"
,
"lint-js"
:
"eslint -c .eslintrc --cache --fix ."
,
"lint-css"
:
"stylelint --config .stylelintrc public/scss/**/*.css"
,
"precommit"
:
"node lint.js"
,
"test"
:
"NODE_ENV=test nyc ./node_modules/.bin/ava"
,
"posttest"
:
"nyc report --reporter=html"
},
"ava"
:
{
"tap"
:
true
,
"require"
:
[
"babel-register"
],
"babel"
:
{
"presets"
:
[
"es2015"
]
}
},
"license"
:
"MIT"
,
"dependencies"
:
{
"bluebird"
:
"^3.4.0"
,
"body-parser"
:
"^1.15.0"
,
"captchapng"
:
"0.0.1"
,
"connect-memcached"
:
"^0.2.0"
,
"connect-multiparty"
:
"^2.0.0"
,
"cookie-parser"
:
"^1.4.3"
,
"csurf"
:
"^1.9.0"
,
"express"
:
"^4.13.1"
,
"express-handlebars"
:
"^3.0.0"
,
"express-session"
:
"^1.13.0"
,
"influxdb-winston"
:
"^1.0.1"
,
"lodash"
:
"^4.13.1"
,
"md5"
:
"^2.1.0"
,
"memcached"
:
"^2.2.2"
,
"moment"
:
"^2.13.0"
,
"morgan"
:
"^1.7.0"
,
"oneapm"
:
"^1.2.20"
,
"passport"
:
"^0.3.2"
,
"passport-douban"
:
"0.0.1"
,
"passport-local"
:
"^1.0.0"
,
"passport-qq"
:
"0.0.3"
,
"passport-renren"
:
"^0.1.3"
,
"passport-sina"
:
"^0.1.0"
,
"passport-strategy"
:
"1.x.x"
,
"passport-weixin"
:
"^0.1.0"
,
"request"
:
"^2.73.0"
,
"request-promise"
:
"^3.0.0"
,
"serve-favicon"
:
"^2.3.0"
,
"uuid"
:
"^2.0.2"
,
"winston"
:
"^2.2.0"
,
"winston-daily-rotate-file"
:
"^1.1.4"
,
"xss"
:
"^0.2.13"
,
"yoho-node-lib"
:
"0.0.50"
},
"devDependencies"
:
{
"autoprefixer"
:
"^6.3.6"
,
"ava"
:
"^0.15.2"
,
"babel-preset-es2015"
:
"^6.9.0"
,
"babel-register"
:
"^6.9.0"
,
"eslint"
:
"^2.12.0"
,
"eslint-config-yoho"
:
"^1.0.1"
,
"gulp"
:
"^3.9.1"
,
"gulp-cssnano"
:
"^2.1.2"
,
"gulp-ftp"
:
"^1.1.0"
,
"gulp-postcss"
:
"^6.1.0"
,
"gulp-sourcemaps"
:
"^2.0.0-alpha"
,
"gulp-util"
:
"^3.0.7"
,
"handlebars-loader"
:
"^1.3.0"
,
"husky"
:
"^0.11.4"
,
"nodemon"
:
"1.9.2"
,
"nyc"
:
"^6.6.1"
,
"postcss-assets"
:
"^4.0.1"
,
"postcss-cachebuster"
:
"^0.1.3"
,
"postcss-calc"
:
"^5.2.1"
,
"postcss-center"
:
"^1.0.0"
,
"postcss-clearfix"
:
"^1.0.0"
,
"postcss-crip"
:
"^2.0.0"
,
"postcss-opacity"
:
"^3.0.0"
,
"postcss-position"
:
"^0.5.0"
,
"postcss-pxtorem"
:
"^3.3.1"
,
"postcss-short"
:
"^1.4.0"
,
"postcss-sprites"
:
"^3.1.2"
,
"postcss-use"
:
"^2.0.2"
,
"precss"
:
"^1.4.0"
,
"rewire"
:
"^2.5.1"
,
"shelljs"
:
"^0.7.0"
,
"stylelint"
:
"^7.1.0"
,
"stylelint-config-yoho"
:
"^1.2.7"
,
"webpack"
:
"^1.13.1"
,
"webpack-dev-server"
:
"^1.14.1"
,
"webpack-stream"
:
"^3.1.0"
,
"yoho-eventproxy"
:
"^0.3.6"
,
"yoho-handlebars"
:
"^4.0.5"
,
"yoho-jquery"
:
"^1.12.4"
,
"yoho-jquery-accordion"
:
"0.0.2"
,
"yoho-jquery-dotdotdot"
:
"0.0.1"
,
"yoho-jquery-lazyload"
:
"^1.9.7"
,
"yoho-jquery-nanoscroller"
:
"0.0.1"
,
"yoho-jquery-placeholder"
:
"^2.3.1"
,
"yoho-jquery-qrcode"
:
"0.0.3"
,
"yoho-json2"
:
"^1.0.0"
,
"yoho-slider"
:
"0.0.2"
}
}
...
...
Please
register
or
login
to post a comment