Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohoblk-wap
·
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
Plain Diff
Browse Files
Authored by
陈轩
9 years ago
Commit
542c7d4f85181d21a6f788c9526ddc74d013c7ac
2 parents
a91d5e81
44ec07cd
master
...
feature/blk-miniapp
feature/brand-multi-shops
feature/change
feature/context
feature/context-and-tracking
feature/docker
feature/hotfix
feature/leftScrollMore
feature/listGoodsList
feature/style
feature/tracking
feature/webpack-hash
feature/webpack2
gray
hotfix/moreGoods
hotfix/ssr
release/0725
release/5.8
2017.09.01
fix-cant-loadmore
Merge remote-tracking branch 'origin/develop' into develop
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
77 additions
and
64 deletions
URL.md
apps/channel/models/brand.js
apps/news/controllers/detail.js → apps/editorial/controllers/detail.js
apps/news/controllers/index.js → apps/editorial/controllers/index.js
apps/news/index.js → apps/editorial/index.js
apps/news/models/detail.js → apps/editorial/models/detail.js
apps/news/models/list-api.js → apps/editorial/models/list-api.js
apps/news/models/list.js → apps/editorial/models/list.js
apps/news/router.js → apps/editorial/router.js
apps/news/views/action/detail.hbs → apps/editorial/views/action/detail.hbs
apps/news/views/action/index.hbs → apps/editorial/views/action/index.hbs
apps/product/models/search.js
dispatch.js
public/js/common/intercept-click.js
public/js/content-code.js
public/js/news/detail.page.js → public/js/editorial/detail.page.js
public/js/news/index.page.js → public/js/editorial/index.page.js
public/vue/news/content-block.vue → public/vue/editorial/content-block.vue
public/vue/news/detail.vue → public/vue/editorial/detail.vue
public/vue/news/index-box.vue → public/vue/editorial/index-box.vue
public/vue/news/top-nav.vue → public/vue/editorial/top-nav.vue
URL.md
View file @
542c7d4
Name | Path | Note
-------- | ------------------------------------ | ---------
首页 | / |
...
...
@@ -34,10 +35,10 @@ yoho币 | /me/mycurrency |
退换货物流详情| /me/logistic?order_code=1609827614&type=refund|
--------------------------------------------------------------------------------
----
### order 常亮
Name | Note
--------
-|--
------
--------
|
------
s_t_desc | 默认(最新)
s_p_asc | 价格升序
s_p_desc | 价格降序
...
...
apps/channel/models/brand.js
View file @
542c7d4
...
...
@@ -7,10 +7,14 @@
'use strict'
;
const
api
=
global
.
yoho
.
API
;
const
helpers
=
global
.
yoho
.
helpers
;
const
brandApi
=
require
(
'./brand-api'
);
const
logger
=
global
.
yoho
.
logger
;
const
_
=
require
(
'lodash'
);
const
querystring
=
require
(
'querystring'
);
const
urlFormat
=
(
path
,
qs
)
=>
{
return
path
+
'?'
+
querystring
.
stringify
(
qs
);
};
/**
* 处理品牌一览品牌列表数据
...
...
@@ -101,7 +105,7 @@ const getCateListData = params => {
sub
:
[]
};
if
(
_
.
isEmpty
(
cate
.
sub
))
{
item
.
url
=
helpers
.
urlFormat
(
'/list'
,
{
item
.
url
=
urlFormat
(
'/list'
,
{
sort
:
item
.
sort
,
sort_name
:
item
.
name
,
gender
:
genderArr
[
categorykey
]
...
...
@@ -115,7 +119,7 @@ const getCateListData = params => {
id
:
item
.
id
,
name
:
'全部'
+
item
.
name
,
sort
:
item
.
sort
,
url
:
helpers
.
urlFormat
(
'/list'
,
{
url
:
urlFormat
(
'/list'
,
{
sort
:
item
.
sort
,
sort_name
:
item
.
name
,
gender
:
genderArr
[
categorykey
]
...
...
@@ -130,7 +134,7 @@ const getCateListData = params => {
sort
:
sub
.
relation_parameter
.
sort
,
url
:
''
};
subitem
.
url
=
helpers
.
urlFormat
(
'/list'
,
{
subitem
.
url
=
urlFormat
(
'/list'
,
{
sort
:
subitem
.
sort
,
sort_name
:
subitem
.
name
,
gender
:
genderArr
[
categorykey
]
...
...
apps/
news
/controllers/detail.js → apps/
editorial
/controllers/detail.js
View file @
542c7d4
...
...
@@ -17,12 +17,12 @@ const camelCase = global.yoho.camelCase;
const
component
=
{
index
(
req
,
res
)
{
res
.
render
(
'detail'
,
{
module
:
'
news
'
,
module
:
'
editorial
'
,
page
:
'detail'
,
news
Id
:
req
.
params
[
0
]
editorial
Id
:
req
.
params
[
0
]
});
},
news
(
req
,
res
,
next
)
{
editorial
(
req
,
res
,
next
)
{
const
id
=
req
.
params
[
0
];
let
params
=
{
...
...
apps/
news
/controllers/index.js → apps/
editorial
/controllers/index.js
View file @
542c7d4
...
...
@@ -14,20 +14,20 @@ module.exports = {
/* 资讯首页 */
index
:
(
req
,
res
)
=>
{
res
.
render
(
'index'
,
{
module
:
'
news
'
,
module
:
'
editorial
'
,
page
:
'index'
});
},
/* 获取资讯列表数据 */
get
News
List
:
(
req
,
res
,
next
)
=>
{
get
Editorial
List
:
(
req
,
res
,
next
)
=>
{
let
params
=
{
page
:
req
.
body
.
page
,
channel
:
req
.
body
.
channel
,
uid
:
req
.
user
.
uid
};
listModel
.
news
List
(
params
).
then
(
result
=>
{
listModel
.
editorial
List
(
params
).
then
(
result
=>
{
res
.
json
(
result
);
}).
catch
(
next
);
}
...
...
apps/
news
/index.js → apps/
editorial
/index.js
View file @
542c7d4
apps/
news
/models/detail.js → apps/
editorial
/models/detail.js
View file @
542c7d4
apps/
news
/models/list-api.js → apps/
editorial
/models/list-api.js
View file @
542c7d4
...
...
@@ -23,7 +23,7 @@ const yhChannel = {
module
.
exports
=
{
/* 资讯列表页数据获取 */
get
News
ListData
(
params
)
{
get
Editorial
ListData
(
params
)
{
return
serviceAPI
.
get
(
'guang/api/v2/article/getList'
,
{
sort_id
:
''
,
gender
:
yhChannel
[
params
.
channel
||
'all'
].
channel
,
...
...
apps/
news
/models/list.js → apps/
editorial
/models/list.js
View file @
542c7d4
...
...
@@ -8,7 +8,7 @@
const
logger
=
global
.
yoho
.
logger
;
const
api
=
global
.
yoho
.
API
;
const
news
ListApi
=
require
(
'./list-api'
);
const
editorial
ListApi
=
require
(
'./list-api'
);
const
camelCase
=
global
.
yoho
.
camelCase
;
/**
...
...
@@ -16,11 +16,11 @@ const camelCase = global.yoho.camelCase;
* @param params
* @returns {*|Promise.<TResult>}
*/
const
news
List
=
params
=>
{
const
editorial
List
=
params
=>
{
let
finalResult
=
{};
return
api
.
all
([
newsListApi
.
getNews
ListData
(
params
)
editorialListApi
.
getEditorial
ListData
(
params
)
]).
then
(
result
=>
{
if
(
result
[
0
].
code
===
200
&&
result
[
0
].
data
.
list
)
{
Object
.
assign
(
finalResult
,
{
...
...
@@ -31,7 +31,7 @@ const newsList = params => {
code
:
200
});
}
else
{
logger
.
error
(
'get
News
ListData api code no 200'
);
logger
.
error
(
'get
Eitorial
ListData api code no 200'
);
}
return
camelCase
(
finalResult
);
...
...
@@ -39,5 +39,5 @@ const newsList = params => {
};
module
.
exports
=
{
news
List
editorial
List
};
...
...
apps/
news
/router.js → apps/
editorial
/router.js
View file @
542c7d4
/**
* router of sub app
news
* router of sub app
editorial
* @author: Aiden Xu<aiden.xu@yoho.cn>
* @date: 2016/07/25
*/
...
...
@@ -10,18 +10,18 @@ const expressRouter = require('express').Router;
const
cRoot
=
'./controllers'
;
const
router
=
expressRouter
();
const
editorial
=
require
(
`
$
{
cRoot
}
/index`
)
;
router
.
get
(
'/list'
,
editorial
.
index
);
// 首页
router
.
post
(
'/list.json'
,
editorial
.
getEditorialList
);
// 获取资讯数据
// 详情controller
const
detail
=
require
(
`
$
{
cRoot
}
/detail`
)
;
router
.
get
(
/
\/([\d]
+
)(
.*
)
/
,
detail
.
index
);
// 详情routers
router
.
get
(
/news_
(\d
+
)\.
json/
,
detail
.
news
);
router
.
get
(
/
\/([\d]
+
)
.html/
,
detail
.
index
);
// 详情routers
router
.
get
(
/editorial_
(\d
+
)\.
json/
,
detail
.
editorial
);
router
.
get
(
/like_
(\d
+
)\.
json/
,
detail
.
like
);
router
.
get
(
/favorite_
(\d
+
)\.
json/
,
detail
.
favorite
);
router
.
get
(
/misc_
(\d
+
)\.
json/
,
detail
.
misc
);
const
news
=
require
(
`
$
{
cRoot
}
/index`
)
;
router
.
get
(
''
,
news
.
index
);
// 首页
router
.
post
(
'/list.json'
,
news
.
getNewsList
);
// 获取资讯数据
module
.
exports
=
router
;
...
...
apps/
news
/views/action/detail.hbs → apps/
editorial
/views/action/detail.hbs
View file @
542c7d4
<div
id=
"app"
class=
"
news-page"
data-news-id=
"
{{
news
Id
}}
"
>
<div
id=
"app"
class=
"
editorial-page"
data-editorial-id=
"
{{
editorial
Id
}}
"
>
<app/>
</div>
...
...
apps/
news
/views/action/index.hbs → apps/
editorial
/views/action/index.hbs
View file @
542c7d4
apps/product/models/search.js
View file @
542c7d4
...
...
@@ -10,6 +10,8 @@ const search = {
method
:
'app.search.li'
},
params
);
delete
data
.
client_type
;
delete
data
.
client_secret
;
return
api
.
post
(
''
,
data
,
{
cache
:
true
,
code
:
200
...
...
dispatch.js
View file @
542c7d4
...
...
@@ -10,7 +10,7 @@ module.exports = app => {
app
.
use
(
'/'
,
require
(
'./apps/product'
));
// 商品模块
app
.
use
(
'/'
,
require
(
'./apps/me'
));
// 个人中心
app
.
use
(
'/api'
,
require
(
'./apps/api'
));
// 各模块公有 API
app
.
use
(
'/
news'
,
require
(
'./apps/news
'
));
// 资讯
app
.
use
(
'/
editorial'
,
require
(
'./apps/editorial
'
));
// 资讯
// 组件示例
if
(
!
app
.
locals
.
proEnv
)
{
...
...
public/js/common/intercept-click.js
View file @
542c7d4
...
...
@@ -24,7 +24,7 @@ const titleMap = {
action
:
''
},
title
:
{
des
:
'
BLK
'
,
des
:
''
,
action
:
''
}
},
...
...
@@ -34,7 +34,7 @@ const titleMap = {
action
:
''
},
title
:
{
des
:
'
BLK
'
,
des
:
''
,
action
:
''
},
right
:
{
...
...
@@ -48,7 +48,7 @@ const titleMap = {
action
:
''
},
title
:
{
des
:
'
BLK
'
,
des
:
''
,
action
:
''
},
right
:
{
...
...
@@ -89,7 +89,7 @@ const titleMap = {
6
:
{
headerid
:
'6'
,
title
:
{
des
:
'资讯
6
'
,
des
:
'资讯'
,
action
:
''
}
}
...
...
@@ -97,10 +97,16 @@ const titleMap = {
const
matchHeader
=
(
url
)
=>
{
let
header
=
{
headerid
:
'-1'
// 默认不显示头部
headerid
:
'-1'
};
let
path
=
url
.
split
(
'?'
)[
0
];
if
(
/
\/
cate-all$/
.
test
(
path
))
{
header
=
titleMap
[
1
];
header
.
title
.
des
=
'全部分类'
;
return
header
;
}
if
(
/
\/
me
\/
mydetails$/
.
test
(
path
))
{
header
=
titleMap
[
1
];
header
.
title
.
des
=
'个人信息'
;
...
...
@@ -201,12 +207,12 @@ module.exports = (url) => {
}
// 资讯
if
(
/
\/
news
$/
.
test
(
path
))
{
if
(
/
\/
editorial
\/
list
$/
.
test
(
path
))
{
return
yoho
.
goTab
({
index
:
2
});
}
// 品牌 品类
if
(
/
\/
brand
s
$/
.
test
(
path
)
||
/
\/
cate$/
.
test
(
path
))
{
if
(
/
\/
brand$/
.
test
(
path
)
||
/
\/
cate$/
.
test
(
path
))
{
return
yoho
.
goTab
({
index
:
1
});
}
...
...
public/js/content-code.js
View file @
542c7d4
...
...
@@ -25,7 +25,7 @@ const cate = {
};
/* TODO 资讯列表资源位 */
const
news
=
{
const
editorial
=
{
all
:
'd4fdfcad1ec877d466d9780efaf4d296'
,
men
:
'e1f8dce8cb9de1a0977479c13c4d3dcc'
,
women
:
'5c0b9963d8b75e6fd788a2b49402be14'
...
...
@@ -35,5 +35,5 @@ module.exports = {
channel
,
brand
,
cate
,
news
editorial
};
...
...
public/js/
news
/detail.page.js → public/js/
editorial
/detail.page.js
View file @
542c7d4
const
Vue
=
require
(
'vue'
);
const
lazyload
=
require
(
'vue-lazyload'
);
const
app
=
require
(
'
news
/detail.vue'
);
const
app
=
require
(
'
editorial
/detail.vue'
);
new
Vue
({
el
:
'#app'
,
...
...
public/js/
news
/index.page.js → public/js/
editorial
/index.page.js
View file @
542c7d4
...
...
@@ -8,7 +8,7 @@ const Vue = require('vue');
const
lazyload
=
require
(
'vue-lazyload'
);
const
infinitScroll
=
require
(
'vue-infinite-scroll'
);
const
indexBox
=
require
(
'
news
/index-box.vue'
);
const
indexBox
=
require
(
'
editorial
/index-box.vue'
);
Vue
.
use
(
lazyload
);
Vue
.
use
(
infinitScroll
);
...
...
public/vue/
news
/content-block.vue → public/vue/
editorial
/content-block.vue
View file @
542c7d4
public/vue/
news
/detail.vue → public/vue/
editorial
/detail.vue
View file @
542c7d4
<template>
<top-nav :id="id" :article="article"></top-nav>
<div class="show-box no-padding first-box">
<div class="
news
-box">
<div class="
editorial
-box">
<h1>{{article.articleTitle}}</h1>
<div class="status-bar">
<span class="icon icon-timeshare"></span><span class="label">{{article.publishTime | formatUnixTime 'MM.DD HH:mm'}}</span>
...
...
@@ -52,7 +52,7 @@
<style class="scss" scoped>
$bgcolor: #fff;
.
news
-page {
.
editorial
-page {
background: #f6f6f6;
}
...
...
@@ -78,7 +78,7 @@
margin-bottom: 0;
}
.
news
-box {
.
editorial
-box {
padding: 30px;
background: $bgcolor;
}
...
...
@@ -201,12 +201,12 @@
};
},
init() {
const
newsId = $('#app').data('news
Id');
const
editorialId = $('#app').data('editorial
Id');
this.id =
news
Id;
this.id =
editorial
Id;
let loadDeferred = null;
$.get(`/
news/news_${news
Id}.json`).then(result => {
$.get(`/
editorial/editorial_${editorial
Id}.json`).then(result => {
const article = result[0],
content = result[1],
brands = result[2],
...
...
public/vue/
news
/index-box.vue → public/vue/
editorial
/index-box.vue
View file @
542c7d4
<template>
<resources v-bind:content-code.sync="contentCode"></resources>
<div v-infinite-scroll="getNewsList()" infinite-scroll-disabled="scrollDisabled">
<div v-for="
news in newsList" class="news
-box">
<div v-for="
editorial in editorialList" class="editorial
-box">
<div class="img">
<a href='{{"/news/" + news.id}}'>
<img v-lazy="news.src | resize 750 470" alt="" />
<a href='{{"/editorial/" + editorial.id + ".html"}}'>
<img v-lazy="editorial.src | resize 750 470" alt="" />
</a>
</div>
<div class="title"><a href='{{"/news/" + news.id}}'>{{news.title}}</a></div>
<div class="news-des">
{{news.intro}}
<div class="title"><a href='{{"/editorial/" + editorial.id + ".html"}}'>{{editorial.title}}</a></div>
<div class="editorial-des">
{{editorial.intro}}
</div>
<hr>
<div class="bottom clearfix">
<span class="icon time-icon"></span>
<span class="time">{{news.publishTime}}</span>
<span class="icon icon-share share" @click="share(news.title, news.intro, news.src, news.share.url)"></span>
<span class="time">{{editorial.publishTime}}</span>
<span class="icon icon-share share" @click="share(editorial.title, editorial.intro, editorial.src, editorial.share.url)"></span>
</div>
</div>
</div>
</template>
<style>
.
news
-box {
.
editorial
-box {
background: #f6f6f6;
.img {
...
...
@@ -42,7 +42,7 @@
padding: 10px 20px;
}
.
news
-des {
.
editorial
-des {
background: #fff;
padding: 10px 20px;
color: #939393;
...
...
@@ -77,8 +77,8 @@
module.exports = {
data() {
return {
contentCode: contentCode.news[qs.channel || 'all'],
newsList: [],
contentCode: contentCode.editorial[qs.channel || 'all'],
editorialList: [],
page: 0,
scrollDisabled: false
};
...
...
@@ -93,17 +93,17 @@
/* 获取资讯列表数据 */
getNewsList() {
$.post({
url: '/
news
/list.json',
url: '/
editorial
/list.json',
data: {
page: this.page++,
channel: qs.channel || 'all'
}
}).done(result => {
if (result.code === 200) {
if (this.newsList.length > 0 && result.data.list.length > 0) {
this.$set('newsList', this.newsList.concat(result.data.list));
if (this.editorialList.length > 0 && result.data.list.length > 0) {
this.$set('editorialList', this.editorialList.concat(result.data.list));
} else {
this.
news
List = result.data.list;
this.
editorial
List = result.data.list;
}
} else {
this.scrollDisabled = true;
...
...
public/vue/
news
/top-nav.vue → public/vue/
editorial
/top-nav.vue
View file @
542c7d4
...
...
@@ -55,7 +55,7 @@
},
methods: {
like: function() {
$.get(`/
news
/like_${this.article.id}.json`, {
$.get(`/
editorial
/like_${this.article.id}.json`, {
flag: !this.isLiked
}, (results)=> {
const result = results[0], misc = results[1];
...
...
@@ -70,7 +70,7 @@
});
},
favorite: function() {
$.get(`/
news
/favorite_${this.article.id}.json`, {
$.get(`/
editorial
/favorite_${this.article.id}.json`, {
flag: !this.isFavorite
}, (results)=> {
const result = results[0], misc = results[1];
...
...
@@ -108,7 +108,7 @@
}
},
created() {
$.get(`/
news
/misc_${this.id}.json`).then(result => {
$.get(`/
editorial
/misc_${this.id}.json`).then(result => {
if (result.code === 200) {
this.isFavorite = result.data.isFavor === 'Y';
this.isLiked = result.data.isPraise === 'Y';
...
...
Please
register
or
login
to post a comment