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
Plain Diff
Browse Files
Authored by
ccbikai(👎🏻🍜)
8 years ago
Commit
ec700ab215ac4e747d2b674194b8b833f7472e10
2 parents
03c97b38
8e04a789
Merge branch 'release/5.1' of git.yoho.cn:fe/yohobuywap-node into release/5.1
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
76 additions
and
47 deletions
apps/activity/models/shopCollect.js
apps/cart/index.js
apps/guang/controllers/opt.js
apps/guang/controllers/plustar.js
apps/guang/models/plustar.js
apps/guang/views/action/plustar/detail.hbs
apps/product/controllers/seckill.js
config/common.js
public/hbs/product/seckill/product.hbs
public/js/activity/register.page.js
public/js/activity/shop-collect.page.js
public/js/guang/plustar-detail.page.js
public/js/product/seckill.page.js
public/scss/activity/shop-collect/_shop-collect.css
public/scss/product/seckill/_nav.css
utils/html-process.js
apps/activity/models/shopCollect.js
View file @
ec700ab
...
...
@@ -18,11 +18,10 @@ const shopList = (uid, tabName) => {
code
:
200
,
cache
:
true
}).
then
((
result
)
=>
{
// console.log(result)
if
(
result
&&
result
.
code
===
200
)
{
_
.
forEach
(
result
.
data
,
function
(
data
)
{
let
href
=
'https://m.yohobuy.com/product/index/brand?shop_id='
+
data
.
shopsId
+
'&openby: yohobuy={"action":"go.shop","params":{"shop_id":"'
+
data
.
shopsId
+
'","shop_template_type":"'
+
2
+
'","shop_name":"'
+
data
.
shopName
+
'"}}'
;
let
href
=
'//m.yohobuy.com/product/index/brand?shop_id='
+
data
.
shopsId
+
'&openby: yohobuy={"action":"go.shop","params":{"shop_id":"'
+
data
.
shopsId
+
'","shop_template_type":"'
+
data
.
shopTemplateType
+
'","shop_name":"'
+
data
.
shopName
+
'"}}'
;
data
.
isFavorite
=
data
.
isFavorite
===
'Y'
;
...
...
@@ -51,7 +50,8 @@ const shopNav = () => {
const
banner
=
()
=>
{
return
service
.
get
(
'operations/api/v5/resource/get'
,
{
content_code
:
'ec9eb72eae121fcd6c1b7d1de75caff1'
content_code
:
'ec9eb72eae121fcd6c1b7d1de75caff1'
,
platform
:
'iphone'
},
{
cache
:
true
,
code
:
200
...
...
apps/cart/index.js
View file @
ec700ab
...
...
@@ -4,15 +4,28 @@
* @date: 2016/09/26
*/
var
express
=
require
(
'express'
);
var
express
=
require
(
'express'
),
path
=
require
(
'path'
);
var
app
=
express
();
// set view engin
var
doraemon
=
path
.
join
(
__dirname
,
'../../doraemon/views'
);
// parent view root
app
.
on
(
'mount'
,
function
(
parent
)
{
delete
parent
.
locals
.
settings
;
// 不继承父 App 的设置
Object
.
assign
(
app
.
locals
,
parent
.
locals
);
});
app
.
use
(
global
.
yoho
.
hbs
({
extname
:
'.hbs'
,
defaultLayout
:
'layout'
,
layoutsDir
:
doraemon
,
partialsDir
:
path
.
join
(
__dirname
,
'views/partial'
),
views
:
path
.
join
(
__dirname
,
'views/action'
),
helpers
:
global
.
yoho
.
helpers
}));
// for zookeeper, inject locals
app
.
use
((
req
,
res
,
next
)
=>
{
req
.
app
.
locals
.
wap
=
app
.
locals
.
wap
;
...
...
@@ -24,3 +37,4 @@ app.use((req, res, next) => {
app
.
use
(
require
(
'./router'
));
module
.
exports
=
app
;
...
...
apps/guang/controllers/opt.js
View file @
ec700ab
...
...
@@ -10,7 +10,8 @@ const optModel = require(`${mRoot}/opt`);
const
brandModel
=
require
(
`
$
{
mRoot
}
/brand`
)
;
const
helpers
=
global
.
yoho
.
helpers
;
const
stringProcess
=
require
(
`
$
{
global
.
utils
}
/string-process`
)
;
const
crypto
=
global
.
yoho
.
crypto
;
const
_
=
require
(
'lodash'
);
/**
* [资讯文章点赞 (H5里显示点赞)]
...
...
@@ -105,9 +106,10 @@ const favoriteBrand = (req, res, next) => {
/* 判断参数是否有效 */
let
id
=
req
.
body
.
id
,
opt
=
req
.
body
.
opt
||
'ok'
,
uid
=
req
.
user
.
uid
;
uid
=
req
.
user
.
uid
||
(
req
.
body
.
uid
&&
crypto
.
decrypt
(
null
,
req
.
body
.
uid
))
||
req
.
cookies
.
appUid
;
if
(
!
stringProcess
.
isNumeric
(
id
)
||
!
stringProcess
.
isNumeric
(
uid
))
{
res
.
json
(
result
);
return
;
}
...
...
apps/guang/controllers/plustar.js
View file @
ec700ab
...
...
@@ -11,6 +11,7 @@ const app = express();
const
plustarModel
=
require
(
`
$
{
mRoot
}
/plustar`
)
;
const
htmlProcess
=
require
(
`
$
{
global
.
utils
}
/html-process`
)
;
const
headerModel
=
require
(
'../../../doraemon/models/header'
);
// 头部model
const
crypto
=
global
.
yoho
.
crypto
;
let
channels
=
{
boys
:
'1,3'
,
girl
:
'2,3'
,
...
...
@@ -65,7 +66,7 @@ const getListData = (req, res, next) => {
const
getDetailData
=
(
req
,
res
,
next
)
=>
{
let
id
=
req
.
query
.
id
;
let
uid
=
req
.
user
.
uid
;
let
uid
=
''
;
let
udid
=
req
.
sessionID
||
'yoho'
;
let
gender
=
req
.
query
.
gender
||
req
.
cookies
.
_Channel
&&
channels
[
req
.
cookies
.
_Channel
]
||
'1,3'
;
let
isApp
=
req
.
query
.
app_version
||
req
.
query
.
appVersion
||
false
;
...
...
@@ -74,6 +75,12 @@ const getDetailData = (req, res, next) => {
let
userAgent
=
req
.
get
(
'User-Agent'
);
let
isWeixin
=
userAgent
.
includes
(
'MicroMessenger'
);
// 标识是否是微信访问
if
(
req
.
yoho
.
isApp
)
{
uid
=
crypto
.
encryption
(
''
,
req
.
query
.
uid
+
''
);
}
else
{
uid
=
req
.
user
.
uid
;
}
if
(
clientType
.
toLowerCase
()
===
'ios'
&&
version
)
{
clientType
=
'iphone'
;
}
else
if
(
clientType
.
toLowerCase
()
===
'android'
&&
version
)
{
...
...
@@ -82,7 +89,7 @@ const getDetailData = (req, res, next) => {
clientType
=
'h5'
;
}
plustarModel
.
getDetailData
(
id
,
uid
,
udid
,
gender
,
isApp
,
clientType
).
then
((
result
)
=>
{
result
.
brand
Intro
=
htmlProcess
.
removeHtml
(
result
.
brandI
ntro
);
result
.
brand
_intro
=
htmlProcess
.
removeHtml
(
result
.
brand_i
ntro
);
if
(
!
isApp
&
!
isWeixin
)
{
res
.
render
(
'plustar/detail'
,
{
...
...
@@ -99,7 +106,8 @@ const getDetailData = (req, res, next) => {
module
:
'guang'
,
page
:
'plustar-detail'
,
title
:
result
.
brandName
,
ps
:
result
ps
:
result
,
uid
:
uid
});
}
...
...
apps/guang/models/plustar.js
View file @
ec700ab
...
...
@@ -182,7 +182,6 @@ const getNewProduct = (brandId, gender, url, isApp) => {
list
.
goods_list
[
0
].
goods_id
+
'/'
+
list
.
cn_alphabet
+
'.html'
;
if
(
isApp
)
{
console
.
log
(
productUrl
);
productUrl
+=
`
?
openby
:
yohobuy
=
{
"action"
:
"go.productDetail"
,
"params"
:{
"product_skn"
:
"${list.product_skn}"
}}
`
;
}
...
...
@@ -309,25 +308,25 @@ const getDetailData = (id, uid, udid, gender, isApp, clientType) => {
url
=
'//'
+
brandDomain
+
'.m.yohobuy.com'
;
}
if
(
isApp
&
!
uid
)
{
if
(
isApp
&
&
!
uid
)
{
jumpToApp
=
1
;
}
let
likeUrl
=
helpers
.
urlFormat
(
'/plustar/brandinfo'
,
{
id
:
brandI
d
id
:
list
.
i
d
},
'guang'
);
if
(
isApp
)
{
let
$url
=
likeUrl
;
$url
+=
'&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"http:\/\/guang.m.yohobuy.com\/plustar\/brandinfo","param":{"id":'
+
brandId
+
'}},"requesturl":{"url":"\/guang\/api\/v1\/favorite\/togglebrand","param":{"brand_id":"'
+
brandId
+
'"}},"priority":"Y"}}'
;
likeUrl
+=
'&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"http:\/\/guang.m.yohobuy.com\/plustar\/brandinfo","param":{"id":'
+
list
.
id
+
'}},"requesturl":{"url":"\/guang\/api\/v1\/favorite\/togglebrand","param":{"brand_id":"'
+
brandId
+
'"}},"priority":"Y"}}'
;
}
else
{
l
et
$u
rl
=
helpers
.
urlFormat
(
'/signin.html'
,
{
refer
:
likeUrl
});
l
ikeU
rl
=
helpers
.
urlFormat
(
'/signin.html'
,
{
refer
:
likeUrl
});
}
return
Promise
.
all
([
isCollection
(
uid
,
brandId
,
clientType
),
getRelatedEditorial
(
brandId
,
uid
,
udid
,
clientType
,
isApp
),
getNewProduct
(
brandId
,
gender
,
url
,
isApp
)]).
then
((
result
)
=>
{
list
=
_
.
assign
(
list
,
{
likeUrl
:
likeUrl
,
isLike
:
result
[
0
],
infos
:
result
[
1
],
newArrival
:
result
[
2
],
...
...
apps/guang/views/action/plustar/detail.hbs
View file @
ec700ab
...
...
@@ -107,4 +107,6 @@
<input
id=
"shareTitle"
type=
"hidden"
value=
"
{{
shareTitle
}}
"
>
<input
id=
"shareDesc"
type=
"hidden"
value=
"
{{
shareDesc
}}
"
>
{{/
ps
}}
<input
type=
"hidden"
name=
"uid"
value=
"
{{
uid
}}
"
>
</div>
\ No newline at end of file
...
...
apps/product/controllers/seckill.js
View file @
ec700ab
...
...
@@ -64,9 +64,6 @@ function _productAddFlag(productList, remindList) {
}
}
else
if
(
product
.
secKillStatus
===
0
||
(
now
>
endTime
))
{
// 确实已抢光, 过了秒杀时间
product
.
over
=
true
;
product
.
isSeckill
=
false
;
}
else
{
product
.
isSeckill
=
true
;
}
});
...
...
config/common.js
View file @
ec700ab
...
...
@@ -16,15 +16,16 @@ module.exports = {
siteUrl
:
'//m.yohobuy.com'
,
assetUrl
:
'//localhost:5001'
,
domains
:
{
// api: 'http://api.yoho.yohoops.org/',
// service: 'http://service.yoho.yohoops.org/',
// liveApi: 'http://api.live.yoho.cn/',
// singleApi: 'http://single.yoho.cn/'
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/'
},
subDomains
:
{
host
:
'.m.yohobuy.com'
,
...
...
public/hbs/product/seckill/product.hbs
View file @
ec700ab
...
...
@@ -41,9 +41,5 @@
</div>
</div>
{{#if
isSeckill
}}
<a
class=
"item-link"
href=
'/product/seckill/show_
{{{
productSkn
}}}{{#if
@root
.
isApp
}}
?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"
{{
productSkn
}}
", "is_seckill": "Y"}}
{{/if}}
'
></a>
{{else}}
<a
class=
"item-link"
href=
'/product/show_
{{{
productSkn
}}}{{#if
@root
.
isApp
}}
?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":"
{{
productSkn
}}
"}}
{{/if}}
'
></a>
{{/if}}
</div>
\ No newline at end of file
...
...
public/js/activity/register.page.js
View file @
ec700ab
...
...
@@ -389,6 +389,10 @@ $(function() {
}
});
$
(
document
).
on
(
'input'
,
'#tb_name, #tb_cert_no'
,
function
()
{
changeSuccess
();
});
// data-aslider-in="education|fade"
$
(
document
).
on
(
'click'
,
'#s-education .s-item'
,
function
()
{
$
(
'#s-education-tb'
).
val
(
$
.
trim
(
$
(
this
).
html
()));
...
...
public/js/activity/shop-collect.page.js
View file @
ec700ab
...
...
@@ -43,16 +43,13 @@ function shopFav(shopIds) {
if
(
it
&&
it
.
id
)
{
$it
=
$
(
'.shop-info[data-id='
+
it
.
id
+
']'
,
$
(
'.shop-list'
));
if
(
it
.
favorite
===
'Y'
)
{
if
(
it
.
favorite
===
true
)
{
$it
.
find
(
'.collect-btn'
).
addClass
(
'already-collect'
);
}
else
{
$it
.
find
(
'.collect-btn'
).
removeClass
(
'already-collect'
);
}
}
}
},
error
:
function
()
{
tip
.
show
(
'网络断开连接了~'
);
}
});
}
...
...
public/js/guang/plustar-detail.page.js
View file @
ec700ab
...
...
@@ -11,7 +11,8 @@ var $ = require('yoho-jquery'),
var
$intro
=
$
(
'#intro'
),
$imt
=
$
(
'#intro-more-txt'
),
$infosContainer
=
$
(
'#related-infos-container'
);
$infosContainer
=
$
(
'#related-infos-container'
),
uid
=
$
(
'input[name="uid"]'
).
val
();
var
info
=
require
(
'./info'
);
...
...
@@ -92,10 +93,9 @@ likeHammer.on('tap', function(e) {
var
opt
=
'ok'
,
$this
=
$
(
e
.
target
);
// jumpToApp = 1表示APP未登录的情况,此时不发送ajax请求而由a链接直接跳转APP
if
(
jumpToApp
===
'1'
)
{
return
;
return
false
;
}
e
.
preventDefault
();
...
...
@@ -109,9 +109,11 @@ likeHammer.on('tap', function(e) {
url
:
'/guang/opt/favoriteBrand'
,
data
:
{
id
:
brandId
,
opt
:
opt
opt
:
opt
,
uid
:
uid
},
success
:
function
(
data
)
{
console
.
log
(
data
);
if
(
data
.
code
===
200
)
{
$this
.
toggleClass
(
'like'
);
tip
.
show
(
data
.
message
);
...
...
public/js/product/seckill.page.js
View file @
ec700ab
...
...
@@ -280,8 +280,7 @@ seckillObj = {
second
=
offsetTime
%
60
;
if
(
offsetTime
<=
0
)
{
// 结束倒计时刷新状态
// that.refreshList(elem);
location
.
reload
();
that
.
refreshList
(
elem
);
}
else
{
$
(
elem
).
find
(
'.tick.hour'
).
text
(
hour
<
0
?
'00'
:
(
hour
<
10
?
(
'0'
+
hour
)
:
hour
));
$
(
elem
).
find
(
'.tick.minute'
).
text
(
minute
<
0
?
'00'
:
(
minute
<
10
?
(
'0'
+
minute
)
:
minute
));
...
...
@@ -290,7 +289,7 @@ seckillObj = {
$el
.
currentTick
=
setTimeout
(
function
()
{
var
curSec
=
Math
.
floor
(
Date
.
now
()
/
1000
);
offsetTime
=
offsetTime
-
(
curSec
-
nowTime
)
-
that
.
diff
;
offsetTime
=
offsetTime
-
(
curSec
-
nowTime
);
that
.
startTick
(
elem
,
offsetTime
,
curSec
);
},
1000
);
}
...
...
@@ -391,9 +390,10 @@ seckillObj = {
isApp
:
yoho
.
isApp
}))
);
if
(
result
&&
result
.
currentTime
)
{
self
.
diff
=
Math
.
round
((
Date
.
now
()
-
result
.
currentTime
)
/
1000
);
}
// if (result && result.currentTime) {
// self.diff = Math.round((Date.now() - result.currentTime) / 1000);
// }
lazyload
(
'img.lazy'
);
window
.
rePosFooter
();
...
...
public/scss/activity/shop-collect/_shop-collect.css
View file @
ec700ab
...
...
@@ -49,17 +49,21 @@
.collect
{
float
:
right
;
margin-right
:
30
px
;
margin-right
:
15
px
;
line-height
:
70px
;
height
:
70px
;
.fans
{
margin-right
:
3
0px
;
margin-right
:
1
0px
;
color
:
#666
;
}
.collect-btn
{
color
:
#b0b0b0
;
display
:
inline-block
;
width
:
50px
;
font-size
:
24px
;
text-align
:
center
;
}
.already-collect
{
...
...
public/scss/product/seckill/_nav.css
View file @
ec700ab
...
...
@@ -62,15 +62,18 @@
color
:
#d0021b
!important
;
font-weight
:
bold
;
height
:
79px
;
line-height
:
40px
;
}
.normal
{
display
:
block
;
height
:
79px
;
line-height
:
40px
;
}
.time
{
font-size
:
30px
;
span
{
margin-right
:
5px
;
font-size
:
30px
;
}
}
.tick
{
...
...
utils/html-process.js
View file @
ec700ab
...
...
@@ -11,7 +11,7 @@ const _EscapeMap = {lt: '<', gt: '>', nbsp: ' ', amp: '&', quot: '"'};
* [移除html标签]
*/
const
removeHtml
=
(
str
)
=>
{
return
str
.
replace
(
/<
[^
>
]
+>/g
,
''
);
return
(
str
||
''
)
.
replace
(
/<
[^
>
]
+>/g
,
''
);
};
/**
...
...
Please
register
or
login
to post a comment