Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuywap-node
·
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
陈峰
8 years ago
Commit
d87344797d6bcb9612eac45c129b0b3614091add
1 parent
0d46f7c7
降级开发完成
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
161 additions
and
126 deletions
app.js
apps/guang/models/plustar.js
apps/guang/views/action/plustar/detail.hbs
apps/home/views/action/home.hbs
apps/product/controllers/recommend-for-you.js
apps/product/controllers/search.js
apps/product/views/action/detail/detail.hbs
config/common.js
doraemon/views/partial/common/suspend-cart.hbs
public/js/common/suspend-cart.js
public/js/guang/plustar-detail-render.js
public/js/guang/plustar-detail.page.js
public/js/home/index.page.js
public/js/product/detail.page.js
public/js/product/seckill-detail.page.js
public/js/product/suspend-cart.js
app.js
View file @
d873447
...
...
@@ -72,7 +72,7 @@ app.use(session({
app
.
use
((
req
,
res
,
next
)
=>
{
req
.
user
=
{};
// 全局的用户数据
req
.
yoho
=
{};
// req和res绑定yoho对象,用于传递全局数据, 如req.yoho.channel等
req
.
app
.
locals
.
wap
=
app
.
locals
.
wap
;
//zookeper对象赋值
if
(
!
req
.
session
.
id
)
{
req
.
session
.
id
=
uuid
.
v4
();
}
...
...
apps/guang/models/plustar.js
View file @
d873447
...
...
@@ -334,8 +334,8 @@ const getDetailData = (id, uid, udid, gender, isApp, clientType) => {
shareLink
:
'//guang.m.yohobuy.com/plustar/brandinfo?id='
+
id
,
shareTitle
:
list
.
brandName
,
shareImg
:
list
.
brandIco
,
shareDesc
:
htmlProcess
.
removeHtml
(
list
.
brandIntro
)
shareDesc
:
htmlProcess
.
removeHtml
(
list
.
brandIntro
),
clientType
:
clientType
});
return
list
;
...
...
apps/guang/views/action/plustar/detail.hbs
View file @
d873447
...
...
@@ -6,9 +6,11 @@
<div
class=
"header-content clearfix"
>
<p
class=
"name-islike-container"
>
<span
class=
"name"
>
{{
brand_name
}}
</span>
{{#
unless
@root
.
wap
.
plustar
.
removeCollect
}}
<a
id=
"brand-like"
class=
"brand-islike iconfont"
href=
"
{{
likeUrl
}}
"
>

</a>
{{/
unless
}}
</p>
<div
id=
"more-intro-click-range"
class=
"clearfix"
>
<div
id=
"intro"
class=
"intro"
>
...
...
@@ -98,9 +100,11 @@
</div>
<input
id=
"jump-to-app"
type=
"hidden"
value=
"
{{
jumpToApp
}}
"
>
<input
id=
"brandId"
type=
"hidden"
value=
"
{{
brand
I
d
}}
"
>
<input
id=
"brandId"
type=
"hidden"
value=
"
{{
brand
_i
d
}}
"
>
<input
id=
"clientType"
type=
"hidden"
value=
"
{{
clientType
}}
"
>
{{#
unless
@root
.
wap
.
plustar
.
removeRelatedPost
}}
<input
id=
"related-infos-demote"
type=
"hidden"
value=
"1"
>
{{/
unless
}}
{{!-- wx-share --}}
<input
id=
"shareLink"
type=
"hidden"
value=
"
{{
shareLink
}}
"
>
<input
id=
"shareImg"
type=
"hidden"
value=
"
{{
shareImg
}}
"
>
...
...
apps/home/views/action/home.hbs
View file @
d873447
...
...
@@ -127,8 +127,9 @@
<span
class=
"iconfont num"
>

</span>
</a>
</div>
{{>
common
/
recommend-for-you
}}
{{#
unless
@root
.
wap
.
ucenter
.
removePrefer
}}
{{>
common
/
recommend-for-you
}}
{{/
unless
}}
{{>
common
/
suspend-cart
}}
</div>
...
...
apps/product/controllers/recommend-for-you.js
View file @
d873447
...
...
@@ -33,7 +33,9 @@ exports.cart = (req, res, next) => {
uid
=
req
.
user
.
uid
||
0
,
yhChannel
=
req
.
query
.
yh_channel
||
'1'
,
limit
=
30
;
if
(
req
.
app
.
locals
.
wap
.
cart
.
removePrefer
)
{
return
res
.
send
(
''
);
}
recommendForYouModel
.
getPreference
({
yh_channel
:
yhChannel
,
udid
:
udid
,
...
...
@@ -52,4 +54,5 @@ exports.cart = (req, res, next) => {
page
:
'recommend'
});
}).
catch
(
next
);
};
...
...
apps/product/controllers/search.js
View file @
d873447
...
...
@@ -132,8 +132,16 @@ const list = (req, res, next) => {
*/
const
index
=
(
req
,
res
,
next
)
=>
{
let
title
=
'搜索'
;
searchModel
.
getSearchIndex
().
then
((
result
)
=>
{
((
render
)
=>
{
if
(
req
.
app
.
locals
.
wap
.
search
.
removeHotSearch
)
{
render
([]);
}
else
{
searchModel
.
getSearchIndex
().
then
((
result
)
=>
{
render
(
result
);
}).
catch
(
next
);
}
})((
result
)
=>
{
res
.
render
(
'search/index'
,
{
module
:
'product'
,
page
:
'search-index'
,
...
...
@@ -142,13 +150,14 @@ const index = (req, res, next) => {
}),
pageFooter
:
true
,
search
:
{
defaultTerms
:
result
[
0
].
content
||
''
,
defaultTerms
:
result
.
length
&&
result
[
0
].
content
||
''
,
url
:
helpers
.
urlFormat
(
''
,
null
,
'search'
),
hotTerms
:
result
}
});
}).
catch
(
next
);
})
};
/**
...
...
apps/product/views/action/detail/detail.hbs
View file @
d873447
...
...
@@ -125,6 +125,9 @@
<div
class=
"chose-panel"
></div>
<div
class=
"cart-bar data-bind"
>
{{#
unless
@root
.
wap
.
common
.
removeCartCount
}}
<input
type=
"hidden"
id=
"remove-cart-count"
value=
"1"
>
{{/
unless
}}
<a
href=
""
class=
"num-incart iconfont"
><span
class=
"num-tag hide"
></span>

</a>
<a
id=
"addtoCart"
href=
"javascript:;"
class=
"addto-cart add-to-cart-url data-bind"
></a>
<a
id=
"soldOut"
href=
"javascript:;"
class=
"sold-out data-bind"
>
已售罄
</a>
...
...
config/common.js
View file @
d873447
...
...
@@ -16,15 +16,15 @@ module.exports = {
siteUrl
:
'//m.yohobuy.com'
,
assetUrl
:
'//localhost:5001'
,
domains
:
{
api
:
'http://api-test3.yohops.com:9999/'
,
service
:
'http://service-test3.yohops.com:9999/'
,
liveApi
:
'http://testapi.live.yohops.com:9999/'
,
singleApi
:
'http://api-test3.yohops.com:9999/'
// api: 'http://api-test3.yohops.com:9999/',
// service: 'http://service-test3.yohops.com:9999/',
// liveApi: 'http://testapi.live.yohops.com:9999/',
// singleApi: 'http://api-test3.yohops.com:9999/'
// api: 'http://api.yoho.cn/',
// service: 'http://service.yoho.cn/',
// liveApi: 'http://api.live.yoho.cn/',
// singleApi: 'http://single.yoho.cn/'
api
:
'http://api.yoho.cn/'
,
service
:
'http://service.yoho.cn/'
,
liveApi
:
'http://api.live.yoho.cn/'
,
singleApi
:
'http://single.yoho.cn/'
},
subDomains
:
{
...
...
@@ -79,7 +79,7 @@ module.exports = {
appSecret
:
'ce21ae4a3f93852279175a167e54509b'
}
},
zookeeperServer
:
false
// '10.66.1.97:2181
'
zookeeperServer
:
'192.168.102.168:2188
'
};
if
(
isProduction
)
{
...
...
@@ -104,7 +104,8 @@ if (isProduction) {
interfaceShunt
:
{
open
:
false
,
url
:
'http://123.206.2.55/strategy'
}
},
zookeeperServer
:
'10.66.1.97:2181'
});
}
else
if
(
isTest
)
{
Object
.
assign
(
module
.
exports
,
{
...
...
doraemon/views/partial/common/suspend-cart.hbs
View file @
d873447
...
...
@@ -4,5 +4,6 @@
</a>
{{#
unless
@root
.
wap
.
common
.
removeCartCount
}}
<span
class=
"cart-count hide"
>
0
</span>
<input
type=
"hidden"
id=
"remove-cart-count"
value=
"1"
>
{{/
unless
}}
</div>
...
...
public/js/common/suspend-cart.js
View file @
d873447
...
...
@@ -7,22 +7,24 @@
var
$
=
require
(
'yoho-jquery'
);
var
$cart
=
$
(
'#suspend-cart'
);
if
(
$
(
'#remove-cart-count'
).
length
)
{
$
.
ajax
({
type
:
'GET'
,
url
:
'/cart/index/count'
,
success
:
function
(
data
)
{
var
count
;
$
.
ajax
({
type
:
'GET'
,
url
:
'/cart/index/count'
,
success
:
function
(
data
)
{
var
count
;
if
(
data
.
code
===
200
)
{
count
=
data
.
data
.
cart_goods_count
;
if
(
count
>
99
)
{
count
=
'99+'
;
}
if
(
count
===
0
)
{
$
(
'.cart-count'
).
remove
();
if
(
data
.
code
===
200
)
{
count
=
data
.
data
.
cart_goods_count
;
if
(
count
>
99
)
{
count
=
'99+'
;
}
if
(
count
===
0
)
{
$
(
'.cart-count'
).
remove
();
}
$cart
.
find
(
'.cart-count'
).
html
(
count
).
removeClass
(
'hide'
);
}
$cart
.
find
(
'.cart-count'
).
html
(
count
).
removeClass
(
'hide'
);
}
}
});
});
}
...
...
public/js/guang/plustar-detail-render.js
View file @
d873447
...
...
@@ -5,7 +5,7 @@ var $ = require('yoho-jquery'),
module
.
exports
=
function
(
callback
)
{
var
brandId
=
$
(
'#brandId'
).
val
();
var
clientType
=
$
(
'#clientType'
).
val
();
if
(
brandId
)
{
if
(
brandId
&&
$
(
'#related-infos-demote'
).
length
)
{
$
.
ajax
({
type
:
'POST'
,
url
:
'/guang/plustar/brandinfoAsync'
,
...
...
public/js/guang/plustar-detail.page.js
View file @
d873447
...
...
@@ -87,46 +87,49 @@ moreHammer.on('tap', function(e) {
e
.
preventDefault
();
// 防止收缩后误点到商品产生跳转
});
// 品牌收藏
likeHammer
=
new
Hammer
(
document
.
getElementById
(
'brand-like'
));
likeHammer
.
on
(
'tap'
,
function
(
e
)
{
var
opt
=
'ok'
,
$this
=
$
(
e
.
target
);
// jumpToApp = 1表示APP未登录的情况,此时不发送ajax请求而由a链接直接跳转APP
if
(
jumpToApp
===
'1'
)
{
return
false
;
}
if
(
$
(
'#brand-like'
).
length
)
{
// 品牌收藏
likeHammer
=
new
Hammer
(
document
.
getElementById
(
'brand-like'
));
likeHammer
.
on
(
'tap'
,
function
(
e
)
{
var
opt
=
'ok'
,
$this
=
$
(
e
.
target
);
// jumpToApp = 1表示APP未登录的情况,此时不发送ajax请求而由a链接直接跳转APP
if
(
jumpToApp
===
'1'
)
{
return
false
;
}
e
.
preventDefault
();
e
.
preventDefault
();
if
(
$this
.
hasClass
(
'like'
))
{
opt
=
'cancel'
;
}
if
(
$this
.
hasClass
(
'like'
))
{
opt
=
'cancel'
;
}
$
.
ajax
({
type
:
'POST'
,
url
:
'/guang/opt/favoriteBrand'
,
data
:
{
id
:
brandId
,
opt
:
opt
,
uid
:
uid
},
success
:
function
(
data
)
{
console
.
log
(
data
);
if
(
data
.
code
===
200
)
{
$this
.
toggleClass
(
'like'
);
tip
.
show
(
data
.
message
);
}
else
if
(
data
.
code
===
400
||
data
.
code
===
412
)
{
location
.
href
=
data
.
data
;
// 未登录跳转登录页面
}
else
{
tip
.
show
(
data
.
message
);
$
.
ajax
({
type
:
'POST'
,
url
:
'/guang/opt/favoriteBrand'
,
data
:
{
id
:
brandId
,
opt
:
opt
,
uid
:
uid
},
success
:
function
(
data
)
{
console
.
log
(
data
);
if
(
data
.
code
===
200
)
{
$this
.
toggleClass
(
'like'
);
tip
.
show
(
data
.
message
);
}
else
if
(
data
.
code
===
400
||
data
.
code
===
412
)
{
location
.
href
=
data
.
data
;
// 未登录跳转登录页面
}
else
{
tip
.
show
(
data
.
message
);
}
},
error
:
function
()
{
tip
.
show
(
'网络断开连接了~'
);
}
},
error
:
function
()
{
tip
.
show
(
'网络断开连接了~'
);
}
});
});
});
}
// console.log($('.logo').attr('src'))
...
...
public/js/home/index.page.js
View file @
d873447
...
...
@@ -13,8 +13,10 @@ var myImage = new Image(),
avatar
;
require
(
'../common'
);
require
(
'./recommend-for-you-user-center'
);
require
(
'../product/suspend-cart.js'
);
if
(
$
(
'.recommend-for-you'
).
length
)
{
require
(
'./recommend-for-you-user-center'
);
}
require
(
'../common/suspend-cart'
);
require
(
'../common/footer'
);
// 部分老用户没有头像,显示默认头像
...
...
public/js/product/detail.page.js
View file @
d873447
...
...
@@ -126,25 +126,27 @@ require('./detail/page-render')(function() {
require
(
'./detail/consultform'
);
require
(
'./detail/recommend-for-you-product-desc'
);
// 购物车商品数量
$
.
ajax
({
type
:
'GET'
,
url
:
'/cart/index/count'
,
success
:
function
(
data
)
{
var
count
;
if
(
data
.
code
===
200
)
{
count
=
data
.
data
.
cart_goods_count
||
0
;
if
(
count
===
0
)
{
return
false
;
}
if
(
count
>
99
)
{
count
=
'99+'
;
if
(
$
(
'#remove-cart-count'
).
length
)
{
// 购物车商品数量
$
.
ajax
({
type
:
'GET'
,
url
:
'/cart/index/count'
,
success
:
function
(
data
)
{
var
count
;
if
(
data
.
code
===
200
)
{
count
=
data
.
data
.
cart_goods_count
||
0
;
if
(
count
===
0
)
{
return
false
;
}
if
(
count
>
99
)
{
count
=
'99+'
;
}
$cart
.
find
(
'.num-tag'
).
html
(
count
).
removeClass
(
'hide'
);
}
$cart
.
find
(
'.num-tag'
).
html
(
count
).
removeClass
(
'hide'
);
}
}
});
});
}
if
(
$
(
'.good-detail-page'
).
length
>
0
)
{
$
(
'#yoho-footer'
).
css
(
'border-top'
,
'1px solid #e0e0e0'
);
...
...
public/js/product/seckill-detail.page.js
View file @
d873447
...
...
@@ -128,25 +128,27 @@ require('./detail/page-render')(function() {
require
(
'./detail/consultform'
);
require
(
'./detail/recommend-for-you-product-desc'
);
// 购物车商品数量
$
.
ajax
({
type
:
'GET'
,
url
:
'/cart/index/count'
,
success
:
function
(
data
)
{
var
count
;
if
(
data
.
code
===
200
)
{
count
=
data
.
data
.
cart_goods_count
||
0
;
if
(
count
===
0
)
{
return
false
;
}
if
(
count
>
99
)
{
count
=
'99+'
;
if
(
$
(
'#remove-cart-count'
).
length
)
{
// 购物车商品数量
$
.
ajax
({
type
:
'GET'
,
url
:
'/cart/index/count'
,
success
:
function
(
data
)
{
var
count
;
if
(
data
.
code
===
200
)
{
count
=
data
.
data
.
cart_goods_count
||
0
;
if
(
count
===
0
)
{
return
false
;
}
if
(
count
>
99
)
{
count
=
'99+'
;
}
$cart
.
find
(
'.num-tag'
).
html
(
count
).
removeClass
(
'hide'
);
}
$cart
.
find
(
'.num-tag'
).
html
(
count
).
removeClass
(
'hide'
);
}
}
});
});
}
if
(
$
(
'.good-detail-page'
).
length
>
0
)
{
$
(
'#yoho-footer'
).
css
(
'border-top'
,
'1px solid #e0e0e0'
);
...
...
public/js/product/suspend-cart.js
View file @
d873447
...
...
@@ -8,21 +8,23 @@ var $ = require('yoho-jquery');
var
$cart
=
$
(
'#suspend-cart'
);
$
.
ajax
({
type
:
'GET'
,
url
:
'/cart/index/count'
,
success
:
function
(
data
)
{
var
count
;
if
(
$
(
'#remove-cart-count'
).
length
)
{
$
.
ajax
({
type
:
'GET'
,
url
:
'/cart/index/count'
,
success
:
function
(
data
)
{
var
count
;
if
(
data
.
code
===
200
)
{
count
=
data
.
data
.
cart_goods_count
;
if
(
count
>
99
)
{
count
=
'99+'
;
if
(
data
.
code
===
200
)
{
count
=
data
.
data
.
cart_goods_count
;
if
(
count
>
99
)
{
count
=
'99+'
;
}
if
(
count
===
0
)
{
$
(
'.cart-count'
).
remove
();
}
$cart
.
find
(
'.cart-count'
).
html
(
count
).
removeClass
(
'hide'
);
}
if
(
count
===
0
)
{
$
(
'.cart-count'
).
remove
();
}
$cart
.
find
(
'.cart-count'
).
html
(
count
).
removeClass
(
'hide'
);
}
}
});
});
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment