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
陈峰
6 years ago
Commit
f63bb5bc3b89784829f0de2bb0c9f42c05836162
2 parents
8b0d0639
311fb18d
Merge branch 'hotfix/fix-shop-links' into 'master'
修改活动模板中店铺链接 See merge request
!1703
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
72 additions
and
3 deletions
apps/activity/controllers/individuation.js
apps/activity/models/feature.js
apps/activity/models/individuation.js
apps/activity/router.js
apps/activity/views/action/feature/index.hbs
public/js/activity/feature.page.js
public/scss/feature/anchor.scss
apps/activity/controllers/individuation.js
View file @
f63bb5b
...
...
@@ -146,3 +146,11 @@ exports.shop = function(req, res, next) {
res
.
jsonp
(
result
);
}).
catch
(
next
);
};
exports
.
getShopByIds
=
function
(
req
,
res
,
next
)
{
let
shopIds
=
req
.
query
.
shopIds
||
'0'
;
req
.
ctx
(
model
).
getShopByIds
(
shopIds
).
then
(
result
=>
{
res
.
jsonp
(
result
);
}).
catch
(
next
);
};
...
...
apps/activity/models/feature.js
View file @
f63bb5b
...
...
@@ -369,9 +369,9 @@ class featureModel extends global.yoho.BaseModel {
if
(
componentType
===
'shopAndProduct'
)
{
let
shop
=
f
.
component
[
0
];
shop
.
jumpUrl
=
`
//m.yohobuy.com/product/shop?shop_id=${shop.shopId}&openby:yohobuy=
{
"action"
:
"go.shop"
,
"params"
:{
"shop_id"
:
"${shop.shopId}"
,
"shop_template_type"
:
"2"
}}
`
;
shop
.
jumpUrl
=
`
//m.yohobuy.com/product/index/brand?shop_id=${shop.shopId}&openby:yohobuy={"action":"go.shop","params":{"shop_id":"${shop.shopId}","shop_template_type":"2"}}`;// eslint-disable-line
shop
.
numOfOneRow
=
'3'
;
if
(
shop
.
searchCondition
)
{
shop
.
searchCondition
.
limit
=
'3'
;
// 强制把数量限制为3个
if
(
shop
.
favourite_prds_enable
===
'1'
)
{
...
...
@@ -382,6 +382,7 @@ class featureModel extends global.yoho.BaseModel {
shop
.
newStyle
=
_
.
get
(
f
,
'component[0].newStyle'
)
===
'1'
;
}
}
else
if
(
shop
.
defaultSkn
)
{
componentArr
.
push
(
shop
);
}
...
...
apps/activity/models/individuation.js
View file @
f63bb5b
...
...
@@ -113,6 +113,16 @@ class individuationModel extends global.yoho.BaseModel {
});
}
getShopByIds
(
shopIds
)
{
return
this
.
get
({
data
:
{
method
:
'app.shops.batchGetShops'
,
shop_ids
:
shopIds
},
param
:
{
cache
:
true
}
});
}
}
module
.
exports
=
individuationModel
;
...
...
apps/activity/router.js
View file @
f63bb5b
...
...
@@ -271,6 +271,7 @@ router.get('/redbag/2017', redbag.index);
router
.
get
(
'/individuation'
,
individuation
.
productLst
);
router
.
get
(
'/individuation/coupon'
,
individuation
.
coupon
);
router
.
get
(
'/individuation/shop'
,
individuation
.
shop
);
router
.
get
(
'/individuation/getShopByIds'
,
individuation
.
getShopByIds
);
// 通过ID获取店铺基本信息
// 活动页模版
router
.
get
(
'/feature/:code.html'
,
feature
.
index
);
...
...
apps/activity/views/action/feature/index.hbs
View file @
f63bb5b
...
...
@@ -111,7 +111,7 @@
{{#
isEqualOr
type
'shopAndProduct'
}}
<!--一个店铺带两个商品-->
<div
class=
"shop-product-container
{{#
isEqualOr
position
'1'
}}
right
{{^}}
left
{{/
isEqualOr
}}
"
>
<div
class=
"shop-product-container
{{#
isEqualOr
position
'1'
}}
right
{{^}}
left
{{/
isEqualOr
}}
"
id=
"s_p_
{{
shopId
}}
"
data-shopId=
"
{{
shopId
}}
"
>
<div
class=
"product-container single-item3
{{#
isEqualOr
position
'1'
}}
right
{{^}}
left
{{/
isEqualOr
}}
shop-wrapper"
>
<a
class=
"shop-container"
href=
"
{{
jumpUrl
}}
"
target=
"_blank"
>
<div
class=
"feature-shop-info"
>
...
...
public/js/activity/feature.page.js
View file @
f63bb5b
...
...
@@ -316,6 +316,51 @@ function shopGroupInit() {
});
}
/**
* 获取店铺+商品组中的店铺信息,并更换店铺链接为新店铺链接
*/
function
getShopProductLinks
()
{
let
shopArr
=
{
ids
:
[],
shopIds
:
[]
};
$
(
'.shop-product-container'
).
each
(
function
()
{
let
shopId
=
$
(
this
).
data
(
'shopid'
);
let
id
=
$
(
this
)[
0
].
id
;
console
.
log
(
id
,
shopId
);
if
(
shopId
&&
id
)
{
shopArr
.
ids
.
push
(
id
);
shopArr
.
shopIds
.
push
(
shopId
);
}
});
if
(
shopArr
.
ids
.
length
>
0
&&
shopArr
.
shopIds
.
length
>
0
&&
(
shopArr
.
ids
.
length
===
shopArr
.
shopIds
.
length
))
{
$
.
ajax
({
url
:
'//m.yohobuy.com/activity/individuation/getShopByIds'
,
data
:
{
shopIds
:
shopArr
.
shopIds
.
join
(
','
)},
dataType
:
'jsonp'
}).
then
(
res
=>
{
if
(
res
.
data
&&
res
.
data
.
length
>
0
)
{
for
(
let
i
=
0
;
i
<
res
.
data
.
length
;
i
++
)
{
let
shopInfo
=
res
.
data
[
i
];
let
index
=
shopArr
.
shopIds
.
indexOf
(
shopInfo
.
shops_id
);
let
is_red_shop
=
shopInfo
.
is_red_shop
?
',"is_red_shop":"1"'
:
''
;
if
(
index
>=
0
)
{
let
divId
=
shopArr
.
ids
[
index
];
let
shopUrl
=
`
//m.yohobuy.com/product/index/brand?shop_id=${shopInfo.shops_id}&openby:yohobuy={"action":"go.shop","params":{"shop_id":"${shopInfo.shops_id}","shop_template_type":"${shopInfo.shop_template_type}","shop_name":"${shopInfo.shop_name}"${is_red_shop}}}`;// eslint-disable-line
console
.
log
(
shopUrl
);
$
(
'#'
+
divId
).
find
(
'.shop-wrapper a'
).
attr
(
'href'
,
shopUrl
);
}
}
}
});
}
}
function
convertTime
(
time
)
{
var
anHour
=
3600
,
aMinute
=
60
,
...
...
@@ -881,6 +926,7 @@ function activityPlan() {
}
}
// 单独改变未完成的楼层的高度
function
changeShopAndProductHeightSingle
(
parent
,
className
)
{
let
img
=
$
(
parent
).
find
(
'.'
+
className
);
...
...
@@ -997,6 +1043,8 @@ $(function() {
changeShopAndProductHeight
();
getShopProductLinks
();
// 小程序相关处理
if
(
!
window
.
WeixinJSBridge
||
!
window
.
WeixinJSBridge
.
invoke
)
{
document
.
addEventListener
(
'WeixinJSBridgeReady'
,
miniProgramHandleInit
,
false
);
...
...
public/scss/feature/anchor.scss
View file @
f63bb5b
...
...
@@ -99,6 +99,7 @@ li {
.feature-page
.floor
{
width
:
100%
;
position
:
relative
;
background-size
:
cover
;
img
{
display
:
block
;
...
...
Please
register
or
login
to post a comment