Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wechat_lung
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hanpeng
wechat_lung
Commits
1bfa12ed
Commit
1bfa12ed
authored
Dec 02, 2019
by
zujiaozhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
'修改链接无法点击问题'
parent
ce61e7bc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
102 deletions
+16
-102
freeChat.js
wechat_lung_chat/javaScript/freeChat.js
+16
-102
No files found.
wechat_lung_chat/javaScript/freeChat.js
View file @
1bfa12ed
...
@@ -44,107 +44,22 @@ define([ 'zepto', 'medtap','mui'], function($, medtap,mui) {
...
@@ -44,107 +44,22 @@ define([ 'zepto', 'medtap','mui'], function($, medtap,mui) {
chat
.
talkRelation
();
chat
.
talkRelation
();
chat
.
getWechatTicket
();
chat
.
getWechatTicket
();
chat
.
getAttention
();
chat
.
getAttention
();
// var getTalk = setInterval(function() {
var
getTalk
=
setInterval
(
function
()
{
// chat.getTalkRecord();
chat
.
getTalkRecord
();
// window.scrollTo(0, document.documentElement.clientHeight);
window
.
scrollTo
(
0
,
document
.
documentElement
.
clientHeight
);
// }, 10000)
},
10000
)
// $('input').on('focus',function(){
$
(
'input'
).
on
(
'focus'
,
function
(){
// //$('body').scrollTop(0);
$
(
'body'
).
scrollTop
(
0
);
// clearInterval(getTalk);
clearInterval
(
getTalk
);
// });
// $('input').on('blur',function(){
// //$('body').scrollTop(0);
// var getTalk = setInterval(function() {
// chat.getTalkRecord();
// window.scrollTo(0, document.documentElement.clientHeight);
// }, 5000)
// });
// 监听页面滚动到底部的方法
// document.querySelector('body').addEventListener('touchmove', function (e) {
// if (!document.querySelector('#content').contains(e.target)) {
// e.preventDefault();
// }
// }, {passive: false});
// 新方法
var
overscroll
=
function
(
el
)
{
el
.
addEventListener
(
'touchstart'
,
function
()
{
var
top
=
el
.
scrollTop
,
totalScroll
=
el
.
scrollHeight
,
currentScroll
=
top
+
el
.
offsetHeight
;
if
(
top
===
0
)
{
el
.
scrollTop
=
1
;
}
else
if
(
currentScroll
===
totalScroll
)
{
el
.
scrollTop
=
top
-
1
;
}
});
el
.
addEventListener
(
'touchmove'
,
function
(
evt
)
{
if
(
el
.
offsetHeight
<
el
.
scrollHeight
)
evt
.
_isScroller
=
true
;
});
}
overscroll
(
document
.
querySelector
(
'.chat_list'
));
document
.
body
.
addEventListener
(
'touchmove'
,
function
(
evt
)
{
if
(
!
evt
.
_isScroller
)
{
evt
.
preventDefault
();
}
});
});
//1.获取到列表的dom,刷新显示部分的dom,列表父容器的dom
$
(
'input'
).
on
(
'blur'
,
function
(){
var
container
=
document
.
querySelector
(
'.chat_list'
);
$
(
'body'
).
scrollTop
(
0
);
var
refreshText
=
document
.
querySelector
(
'.refreshText'
);
var
getTalk
=
setInterval
(
function
()
{
var
parent
=
document
.
querySelector
(
'.container'
);
chat
.
getTalkRecord
();
//2.定义一些需要常用的变量
window
.
scrollTo
(
0
,
document
.
documentElement
.
clientHeight
);
var
startY
=
0
;
//手指触摸最开始的Y坐标
},
5000
)
var
endY
=
0
;
//手指结束触摸时的Y坐标
//3.给列表dom监听touchstart事件,得到起始位置的Y坐标
parent
.
addEventListener
(
'touchstart'
,
function
(
e
){
startY
=
e
.
touches
[
0
].
pageY
;
container
.
style
.
position
=
'relative'
;
container
.
style
.
transition
=
'transform 0s'
;
});
});
// container.ontouchmove = function (e) {
// var point = e.touches[0],
// eleTop = container.scrollTop,
// eleScrollHeight = container.scrollHeight,
// eleOffsetHeight = container.offsetHeight,
// eleTouchBottom = eleScrollHeight - eleOffsetHeight;
// if (eleTop === 0) {
// if (point.clientY > startY) {
// e.preventDefault();
// }
// }
// else if (eleTop === eleTouchBottom) {
// if (point.clientY < startY) {
// e.preventDefault()
// }
// }
// };
//4.给列表dom监听touchmove事件,当移动到一定程度需要显示上面的文字
parent
.
addEventListener
(
'touchmove'
,
function
(
e
)
{
if
(
isTop
()
&&
(
e
.
touches
[
0
].
pageY
-
startY
)
>
0
){
refreshText
.
style
.
height
=
"50px"
;
parent
.
style
.
transform
=
"translateY(50px)"
;
parent
.
style
.
transition
=
"all ease 0.3s"
;
refreshText
.
innerHTML
=
"获取更多聊天记录..."
;
}
});
//5.给列表dom监听touchend事件,此时说明用户已经松开了手指,应该进行异步操作了
parent
.
addEventListener
(
'touchend'
,
function
(
e
)
{
if
(
isTop
()){
refreshText
.
innerHTML
=
"正在刷新..."
;
setTimeout
(
function
(){
parent
.
style
.
transform
=
"translateY(0)"
;
console
.
log
(
'成功刷新'
);
},
800
)
}
medtap
.
loading
(
1
);
chat
.
refreshRecord
(
1
)
return
;
})
function
isTop
(){
var
t
=
document
.
documentElement
.
scrollTop
||
document
.
body
.
scrollTop
;
return
t
===
0
?
true
:
false
;
}
},
},
bindEve
:
function
()
{
bindEve
:
function
()
{
$
(
'.close_info_btn'
).
unbind
().
bind
(
'click'
,
function
()
{
$
(
'.close_info_btn'
).
unbind
().
bind
(
'click'
,
function
()
{
...
@@ -619,7 +534,6 @@ define([ 'zepto', 'medtap','mui'], function($, medtap,mui) {
...
@@ -619,7 +534,6 @@ define([ 'zepto', 'medtap','mui'], function($, medtap,mui) {
startId
:
id
startId
:
id
},
},
success
:
function
(
res
)
{
success
:
function
(
res
)
{
$
(
'.refreshText'
).
html
(
''
)
console
.
log
(
'刷新的消息'
,
res
)
console
.
log
(
'刷新的消息'
,
res
)
medtap
.
loading
(
0
);
medtap
.
loading
(
0
);
chat
.
offsetRefresh
+=
1
;
chat
.
offsetRefresh
+=
1
;
...
@@ -628,9 +542,9 @@ define([ 'zepto', 'medtap','mui'], function($, medtap,mui) {
...
@@ -628,9 +542,9 @@ define([ 'zepto', 'medtap','mui'], function($, medtap,mui) {
var
html
=
''
;
var
html
=
''
;
if
(
record
.
length
==
0
)
{
if
(
record
.
length
==
0
)
{
chat
.
hasMore
=
false
;
chat
.
hasMore
=
false
;
medtap
.
toast
({
//
medtap.toast({
message
:
'没有更多了'
//
message: '没有更多了'
})
//
})
}
else
{
}
else
{
chat
.
hasMore
=
true
;
chat
.
hasMore
=
true
;
if
(
operateType
==
0
)
{
if
(
operateType
==
0
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment