Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-blk
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
1
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
yyq
9 years ago
Commit
fccddc33471af19c10b18c595a5238cb36847b44
2 parents
724b57b1
276c703e
Merge branch 'release/1.0' of git.yoho.cn:fe/yoho-blk into release/1.0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
3 deletions
public/js/common/indexof-polyfill.js
public/js/shopping/cart/cart.js
public/js/common/indexof-polyfill.js
0 → 100644
View file @
fccddc3
/**
* Array indexof polyfill
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2016/8/8
* @source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf
*/
if
(
!
Array
.
prototype
.
indexOf
)
{
Array
.
prototype
.
indexOf
=
function
(
searchElement
,
fromIndex
)
{
// eslint-disable-line
var
k
;
var
o
;
var
len
;
var
n
;
if
(
this
==
null
)
{
// eslint-disable-line
throw
new
TypeError
(
'"this" is null or not defined'
);
}
o
=
Object
(
this
);
len
=
o
.
length
>>>
0
;
if
(
len
===
0
)
{
return
-
1
;
}
n
=
+
fromIndex
||
0
;
if
(
Math
.
abs
(
n
)
===
Infinity
)
{
n
=
0
;
}
if
(
n
>=
len
)
{
return
-
1
;
}
k
=
Math
.
max
(
n
>=
0
?
n
:
len
-
Math
.
abs
(
n
),
0
);
while
(
k
<
len
)
{
if
(
k
in
o
&&
o
[
k
]
===
searchElement
)
{
return
k
;
}
k
++
;
}
return
-
1
;
};
}
...
...
public/js/shopping/cart/cart.js
View file @
fccddc3
...
...
@@ -25,6 +25,7 @@ var editTpl = require('../../../tpl/shopping/edit-color-size.hbs');
var
Cart
;
require
(
'yoho-jquery-dotdotdot'
);
require
(
'../../common/indexof-polyfill'
);
// array indexof polyfill
function
dotName
()
{
...
...
@@ -207,7 +208,7 @@ Cart = {
if
(
products
.
length
)
{
dialog
=
new
_confirm
({
content
:
'您确定要从购物
车
中删除该商品吗?'
,
content
:
'您确定要从购物
袋
中删除该商品吗?'
,
cb
:
function
()
{
dialog
.
close
();
Util
.
ajax
({
...
...
@@ -292,14 +293,14 @@ Cart = {
* @params { Function } callback 移入收藏夹成功后回调
*/
sendToFavorite
:
function
(
products
,
callback
)
{
var
msg
=
'<p>确定要将该商品从购物
车中移入收藏吗?</p><p>移入收藏后该商品将不在购物车
中显示</p>'
;
var
msg
=
'<p>确定要将该商品从购物
袋中移入收藏吗?</p><p>移入收藏后该商品将不在购物袋
中显示</p>'
;
var
dialog
;
if
(
!
products
.
length
)
{
new
_alert
(
'请至少选中一件商品!'
).
show
();
}
else
{
if
(
products
.
length
>
1
)
{
msg
=
'<p>确定要将已选中的商品从购物
车中移入收藏吗?</p><p>移入收藏后已选中的商品将不在购物车
中显示</p>'
;
msg
=
'<p>确定要将已选中的商品从购物
袋中移入收藏吗?</p><p>移入收藏后已选中的商品将不在购物袋
中显示</p>'
;
}
// callback存在说明从删除模块收藏
...
...
Please
register
or
login
to post a comment