Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
yyq
8 years ago
Commit
ac5a2d4a8eaf051fec8eefd7f312209cdb9c26d4
1 parent
d1ca4acc
base shop fav
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
public/js/product/index/brand.js
public/js/product/index/brand.js
View file @
ac5a2d4
...
...
@@ -9,8 +9,7 @@ var $ = require('yoho-jquery');
var
$brandFavor
=
$
(
'#brand-favor'
),
$shopFavor
=
$
(
'#shop-favor'
),
shopId
=
$shopFavor
.
data
(
'id'
),
id
=
$brandFavor
.
data
(
'id'
),
isFavorite
=
$shopFavor
.
find
(
'i'
).
hasClass
(
'coled'
);
id
=
$brandFavor
.
data
(
'id'
);
var
BRAND_FAV
=
{
add
:
'add'
,
...
...
@@ -41,17 +40,18 @@ $brandFavor.on('click', function() {
* 店铺收藏
*/
$shopFavor
.
on
(
'click'
,
function
()
{
var
$dom
=
$shopFavor
.
find
(
'i'
);
$
.
ajax
({
type
:
'post'
,
url
:
'/product/shop/togglecollect'
,
data
:
{
isFavorite
:
isFavorite
?
0
:
1
,
isFavorite
:
$dom
.
hasClass
(
'coled'
)
?
0
:
1
,
shopId
:
shopId
}
}).
then
(
function
(
res
)
{
if
(
res
.
code
===
200
)
{
$shopFavor
.
find
(
'i'
).
toggleClass
(
'coled'
);
isFavorite
=
!
isFavorite
;
$dom
.
toggleClass
(
'coled'
);
}
else
if
(
res
.
code
===
401
)
{
location
.
href
=
'//www.yohobuy.com/signin.html?refer='
+
encodeURIComponent
(
location
.
href
);
}
...
...
Please
register
or
login
to post a comment