Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
biao
9 years ago
Commit
4797ad9c2fdb4335a383af146d5938dfd63efd41
1 parent
152ed333
update for consult update
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
213 additions
and
5 deletions
static/js/product/detail/comments-consults.js
static/js/product/detail/fav.js
static/sass/product/_comments-consults.scss
template/m.yohobuy.com/actions/product/detail/consults.phtml
static/js/product/detail/comments-consults.js
View file @
4797ad9
...
...
@@ -9,11 +9,18 @@ var $ = require('jquery'),
var
commentsNum
,
consultsNum
;
var
navtabEle
=
document
.
getElementById
(
'nav-tab'
),
var
consultFooterEle
=
$
(
'.consult-content-footer'
)[
0
],
consultFooterHammer
=
consultFooterEle
&&
new
Hammer
(
consultFooterEle
),
navtabEle
=
document
.
getElementById
(
'nav-tab'
),
navtabHammer
=
navtabEle
&&
new
Hammer
(
navtabEle
),
gotoConsultEle
=
document
.
getElementById
(
'goto-consult'
),
gotoConsultHammer
=
gotoConsultEle
&&
new
Hammer
(
gotoConsultEle
);
gotoConsultHammer
=
gotoConsultEle
&&
new
Hammer
(
gotoConsultEle
),
readmore
=
document
.
getElementById
(
'readmore'
),
readmoreHammer
=
readmore
&&
new
Hammer
(
readmore
);
(
function
()
{
...
...
@@ -63,9 +70,15 @@ if (navtabHammer) {
});
}
if
(
consultFooterHammer
)
{
consultFooterHammer
.
on
(
'tap'
,
function
()
{
location
.
href
=
$
(
consultFooterEle
).
data
(
'href'
);
});
}
if
(
gotoConsultHammer
)
{
gotoConsultHammer
.
on
(
'tap'
,
function
()
{
location
.
href
=
$
(
gotoConsultEle
).
find
(
'a'
).
attr
(
'href'
);
location
.
href
=
$
(
gotoConsultEle
).
data
(
'href'
);
});
}
...
...
@@ -74,3 +87,22 @@ if ($('.goods-consults-page').length > 0) {
$
(
'#yoho-header'
).
css
(
'position'
,
'fixed'
).
css
(
'top'
,
'0'
);
}
if
(
$
(
'.goods-consults-page'
).
length
>
0
)
{
$
(
'#yoho-footer'
).
css
(
'border-top'
,
'1px solid #e0e0e0'
);
}
if
(
$
(
'.goods-consults .consult-item'
).
length
>
10
)
{
$
(
'.readmore'
).
show
();
}
else
{
$
(
'.readmore'
).
hide
();
}
if
(
readmoreHammer
)
{
readmoreHammer
.
on
(
'tap'
,
function
()
{
$
(
'.readmore'
).
hide
();
$
(
'.goods-consults .consult-item:nth-child(n+11)'
).
show
();
return
false
;
});
}
require
(
'./fav'
);
\ No newline at end of file
...
...
static/js/product/detail/fav.js
0 → 100755
View file @
4797ad9
/**
* 商品详情咨询页 --点赞和帮助功能
* @author: Lynnic
* @date: 2015/12/09
*/
var
$
=
require
(
'jquery'
),
Hammer
=
require
(
'yoho.hammer'
),
tip
=
require
(
'../../plugin/tip'
);
var
goodsConsultsEle
=
$
(
'#goods-consults'
)[
0
],
goodsConsultsHammer
=
goodsConsultsEle
&&
new
Hammer
(
goodsConsultsEle
);
// $favBtn.on('click', function() {
// var id = $(this).closest('.consult-item').data('id'),
// $that = $(this),
// count = $that.find('.count').html() - 0;
// if (!$(this).hasClass('highlight')) {
// $.ajax({
// method: 'post',
// url: '/home/upxxDown',
// data: {
// consult_id: id
// }
// }).done(function(data) {
// if (data.code === 200) {
// $that.addClass('highlight');
// $that.find('.count').html(count+1);
// } else if (data.code === 400) {
// location.href = data.data;//未登录跳转登录页
// }
// }).fail(function(data) {
// $that.addClass('highlight');
// $that.find('.count').html(count+1);
// });
// }
// });
if
(
goodsConsultsHammer
)
{
goodsConsultsHammer
.
on
(
'tap'
,
function
(
e
)
{
var
$this
=
$
(
e
.
target
).
closest
(
'li'
),
id
=
$this
.
closest
(
'.consult-item'
).
data
(
'id'
),
count
=
$this
.
find
(
'.count'
).
html
()
-
0
,
url
;
if
(
!
$this
.
hasClass
(
'highlight'
))
{
if
(
$this
.
hasClass
(
'fav'
))
{
url
=
'/product/opt/fav'
;
}
else
if
(
$this
.
hasClass
(
'usefull'
))
{
url
=
'/product/opt/usefull'
;
}
$
.
ajax
({
method
:
'post'
,
url
:
url
,
data
:
{
consult_id
:
id
}
}).
done
(
function
(
data
)
{
if
(
data
.
code
===
200
)
{
$this
.
addClass
(
'highlight'
);
$this
.
find
(
'.count'
).
html
(
count
+
1
);
}
else
if
(
data
.
code
===
400
)
{
location
.
href
=
data
.
data
;
//未登录跳转登录页
}
}).
fail
(
function
(
data
)
{
tip
.
show
(
'网络断开连接了~'
);
});
}
});
}
\ No newline at end of file
...
...
static/sass/product/_comments-consults.scss
View file @
4797ad9
...
...
@@ -114,6 +114,60 @@
overflow
:
hidden
;
}
}
.operation
{
width
:
120%
;
height
:
pxToRem
(
60px
);
line-height
:
pxToRem
(
80px
);
position
:
relative
;
right
:
12%
;
border-top
:
1px
solid
#e0e0e0
;
margin-top
:
pxToRem
(
20px
);
li
{
&
.highlight
{
color
:
$basicBtnC
;
}
font-size
:pxToRem
(
28px
)
;
float
:left
;
width
:
50%
;
text-align
:
center
;
color
:
$subFontC
;
.iconfont
{
display
:
inline-block
;
padding-right
:
5px
;
font-size
:
inherit
;
}
}
}
}
}
.readmore
{
display
:
block
;
height
:
pxToRem
(
88px
);
line-height
:
pxToRem
(
88px
);
background-color
:
#fff
;
text-align
:
center
;
color
:
$subFontC
;
margin-top
:
pxToRem
(
30px
);
border-top
:
1px
solid
$borderC
;
border-bottom
:
1px
solid
$borderC
;
font-size
:
pxToRem
(
28px
);
i
{
font-size
:
inherit
;
}
}
.faq-title
{
height
:
pxToRem
(
88px
);
line-height
:
pxToRem
(
88px
);
text-align
:
center
;
font-size
:
pxToRem
(
32px
);
}
.goods-consults
.faq-item
{
@extend
.consult-item
;
margin-top
:
0
;
margin-bottom
:
pxToRem
(
30px
);
.answer
{
border-bottom
:
none
;
}
}
// .gap-block {
...
...
@@ -174,6 +228,9 @@
&
.focus
{
color
:
#000
;
}
.comments-num
{
display
:
none
;
}
}
.comment-nav
{
border-right
:
1px
solid
#ccc
;
...
...
template/m.yohobuy.com/actions/product/detail/consults.phtml
View file @
4797ad9
...
...
@@ -3,12 +3,12 @@
<div
class=
"goto-consult tap-hightlight"
id=
"goto-consult"
data-href=
"{{link}}"
>
<i
class=
"iconfont consult-logo"
>
639
;</i>
<span>我要咨询</span>
<a
href=
"
{{link}}
"
class=
"iconfont enter-consult-page"
>
604
;</a>
<a
href=
"
javascript:;
"
class=
"iconfont enter-consult-page"
>
604
;</a>
</div>
{
{#
consults
}
}
<div
class=
"goods-consults"
id=
"goods-consults"
>
{
{#list
}
}
<div
class=
"consult-item"
>
<div
class=
"consult-item"
data-id=
"{{consult-id}}"
>
<div
class=
"question"
>
<span
class=
"iconfont"
>
639
;</span>
<p>
...
...
@@ -21,10 +21,54 @@
<span
class=
"iconfont"
>
63
f;</span>
<p>
{
{answer
}
}</p>
</div>
<ul
class=
"operation"
>
<li
class=
"fav {{#if fav}}highlight{{/if}}"
>
<i
class=
"iconfont "
>
601
;</i>
赞
<i
class=
"count"
>
{
{#if
favNum
}
}
{
{favNum
}
}
{
{/if
}
}</i>
</li>
<li
class=
"usefull {{#if usefull}}highlight{{/if}}"
>
<i
class=
"iconfont "
>
605
;</i>
有用
<i
class=
"count"
>
{
{#if
usefullNum
}
}
{
{usefullNum
}
}
{
{/if
}
}</i>
</li>
</ul>
</div>
{
{/list
}
}
</div>
{
{/
consults
}
}
<a
href=
"javascript:;"
id=
"readmore"
class=
"readmore tap-hightlight"
>查看更多
<i
class=
"iconfont"
>
604
;</i></a>
{
{#faq
}
}
<h
1
class=
"faq-title"
>
常见问题
</h
1
>
{
{/faq
}
}
{
{#faq
}
}
<div
class=
"goods-consults"
style=
"margin-top:0"
>
{
{#list
}
}
<div
class=
"faq-item"
>
<div
class=
"question"
>
<span
class=
"iconfont"
>
639
;</span>
<p>
{
{question
}
}
</p>
</div>
<div
class=
"answer"
>
<span
class=
"iconfont"
>
63
f;</span>
<p>
{
{answer
}
}</p>
</div>
</div>
{
{/list
}
}
</div>
{
{/faq
}
}
</div>
{
{>
layout/footer
}
}
...
...
Please
register
or
login
to post a comment