Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
ycc-website
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Website
ycc-website
Commits
afbbc324
Commit
afbbc324
authored
Mar 03, 2022
by
chenqikuai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复交易列表页面,点击其他页数后,再点击首页,页面不会自动查询数据的问题
parent
33c0a4e8
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
13 deletions
+33
-13
block.ts
src/mixin/block.ts
+9
-7
trade.ts
src/mixin/trade.ts
+10
-1
utils.ts
src/utils/utils.ts
+12
-3
trade.vue
src/views/mobile/trade.vue
+1
-1
trade.vue
src/views/pc/trade.vue
+1
-1
No files found.
src/mixin/block.ts
View file @
afbbc324
...
...
@@ -3,8 +3,14 @@ import { message } from "ant-design-vue";
import
{
getRpc
}
from
"ycc-api/dist/cmjs/service/Rpc"
;
import
{
iBlockInBlockMixin
,
iGetBlocksRetResultItem
}
from
"@/types/block"
;
import
{
yccApi
}
from
"@/service/api"
;
import
{
clearTimeoutFromTimerObj
,
registerTimeoutToTimerObj
,
}
from
"@/utils/common"
;
const
Rpc
=
getRpc
(
yccApi
);
const
TimerObj
=
{}
as
any
;
export
default
Vue
.
extend
({
data
()
{
return
{
...
...
@@ -13,7 +19,6 @@ export default Vue.extend({
startHeight
:
0
,
endHeight
:
0
,
Loading
:
false
,
Timer
:
0
,
pages
:
{
currentPage
:
1
,
pageSize
:
20
,
...
...
@@ -48,7 +53,7 @@ export default Vue.extend({
});
},
pageChange
(
page
:
number
)
{
clearTimeout
(
this
.
Timer
);
clearTimeout
FromTimerObj
(
TimerObj
);
this
.
pages
.
currentPage
=
page
;
const
newHeight
=
this
.
maxHeight
-
(
this
.
pages
.
currentPage
-
1
)
*
this
.
pages
.
pageSize
;
...
...
@@ -102,14 +107,11 @@ export default Vue.extend({
watch
:
{
Loading
(
val
)
{
if
(
val
===
false
&&
this
.
pages
.
currentPage
===
1
)
{
this
.
Timer
=
window
.
setTimeout
(()
=>
{
this
.
getLastBlock
();
},
15000
);
registerTimeoutToTimerObj
(
TimerObj
,
this
.
getLastBlock
,
10
*
1
e3
);
}
},
},
beforeDestroy
()
{
//清除定时器
clearTimeout
(
this
.
Timer
);
clearTimeoutFromTimerObj
(
TimerObj
);
},
});
src/mixin/trade.ts
View file @
afbbc324
/* eslint-disable @typescript-eslint/no-explicit-any */
import
{
getTxCount
,
getTxList
}
from
"@/service/api"
;
import
{
filterNum
}
from
"@/utils/utils"
;
import
{
icustomized2Tx
}
from
"@/types/trade"
;
import
Vue
from
"vue"
;
export
default
Vue
.
extend
({
...
...
@@ -21,6 +22,7 @@ export default Vue.extend({
this
.
init
();
},
methods
:
{
filterNum
,
checkGroup
(
arr
:
icustomized2Tx
[])
{
arr
.
map
((
current
,
index
)
=>
{
if
(
current
.
group_count
>
1
)
{
...
...
@@ -69,7 +71,7 @@ export default Vue.extend({
if
(
this
.
pages
.
currentPage
===
1
)
{
this
.
Timer
=
window
.
setTimeout
(()
=>
{
this
.
init
();
},
1
5
*
1
e3
);
},
1
0
*
1
e3
);
}
}
});
...
...
@@ -79,12 +81,19 @@ export default Vue.extend({
pageChange
(
page
:
number
)
{
this
.
pages
.
currentPage
=
page
;
this
.
loading
=
true
;
window
.
clearTimeout
(
this
.
Timer
);
getTxList
(
this
.
pages
.
currentPage
,
this
.
pages
.
pageSize
).
then
((
ret
)
=>
{
if
(
!
ret
.
error
)
{
this
.
txList
=
this
.
checkGroup
(
ret
.
result
);
this
.
loading
=
false
;
if
(
this
.
pages
.
currentPage
===
1
)
{
this
.
Timer
=
window
.
setTimeout
(()
=>
{
this
.
init
();
},
10
*
1
e3
);
}
}
});
},
sizeChange
(
size
:
number
)
{
this
.
pages
.
pageSize
=
size
;
...
...
src/utils/utils.ts
View file @
afbbc324
export
const
checkIsMobile
=
function
()
{
const
flag
=
navigator
.
userAgent
.
match
(
/
(
phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone
)
/i
)
export
const
checkIsMobile
=
function
()
{
const
flag
=
navigator
.
userAgent
.
match
(
/
(
phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone
)
/i
);
const
width
=
document
.
documentElement
.
clientWidth
;
return
!!
(
flag
||
width
<=
500
)
return
!!
(
flag
||
width
<=
500
);
};
export
function
filterNum
(
num
:
number
|
string
)
{
const
str
=
num
.
toString
();
const
reg
=
str
.
indexOf
(
"."
)
>
-
1
?
/
(\d)(?=(\d{3})
+
\.)
/g
:
/
(\d)(?=(?:\d{3})
+$
)
/g
;
return
str
.
replace
(
reg
,
"$1,"
);
}
src/views/mobile/trade.vue
View file @
afbbc324
...
...
@@ -15,7 +15,7 @@
'border-bottom-left-radius': '2px',
'border-bottom-right-radius': '2px',
}"
:title="`${$t('lang.trade.title')}(${
total
}${$t(
:title="`${$t('lang.trade.title')}(${
filterNum(total)
}${$t(
'lang.trade.count',
)}) (${$t('lang.trade.tip')})`"
>
</m-title>
...
...
src/views/pc/trade.vue
View file @
afbbc324
...
...
@@ -15,7 +15,7 @@
class=
"total-block float-left flex items-center"
style=
"height: 32px;"
>
{{
$t
(
'lang.trade.title'
)
}}
(
{{
total
{{
$t
(
'lang.trade.title'
)
}}
(
{{
filterNum
(
total
)
}}{{
$t
(
'lang.trade.count'
)
}}
)
<span
v-if=
"pages.total >= 100000"
>
(
...
...
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