Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
NFT
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
hanfeng zhang
NFT
Commits
a70d378d
Commit
a70d378d
authored
Jul 28, 2021
by
hanfeng zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
321
parent
1106bc79
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
92 additions
and
28 deletions
+92
-28
Child.vue
src/layout/Child.vue
+52
-11
Service.ts
src/service/Service.ts
+7
-3
nftService.ts
src/service/nftService/nftService.ts
+2
-2
codeConfimer.ts
src/store/codeConfimer.ts
+27
-10
index.vue
src/view/NFT/Mynft/index.vue
+0
-1
confirm.vue
src/view/NFT/Transfer/confirm.vue
+4
-1
No files found.
src/layout/Child.vue
View file @
a70d378d
...
@@ -3,17 +3,24 @@
...
@@ -3,17 +3,24 @@
<div
id=
"Child"
class=
"bg-font-black"
>
<div
id=
"Child"
class=
"bg-font-black"
>
<van-overlay
:show=
"CodeData.show"
class=
'z-50'
>
<van-overlay
:show=
"CodeData.show"
class=
'z-50'
>
<div
class=
"code-confirm flex flex-row item-center content-center justify-center text-font-white h-full"
@
click
.
stop
>
<div
class=
"code-confirm flex flex-row item-center content-center justify-center text-font-white h-full"
@
click
.
stop
>
<div
class=
"self-center bg-font-light-black rounded-lg"
>
<div
class=
"self-center rounded-lg"
:class=
"!CodeData.onAction?'bg-font-light-black':''"
>
<div
class=
" flex flex-col text-font-white p-6 "
>
<div
class=
" flex flex-col text-font-white p-6 px-10"
v-if=
"!CodeData.onAction"
>
<div
class=
' text-font-dark-blue'
>
安全验证
</div>
<div
class=
' text-font-dark-blue flex justify-between'
>
<div>
安全验证
</div>
<app-icon
name=
"icon-shanchu"
size=
"8px"
@
click
.
native=
"closeOverlay"
></app-icon>
</div>
<div
class=
'text-xs my-1'
>
验证码已发送到您绑定的手机
</div>
<div
class=
'text-xs my-1'
>
验证码已发送到您绑定的手机
</div>
<input
type=
"number"
class=
" bg-font-black py-2 px-1 w-48 my-3"
v-model=
"codeValue"
placeholder=
"请输入验证码"
>
<input
type=
"number"
class=
" bg-font-black py-2 px-1 w-48 my-3"
v-model=
"codeValue"
placeholder=
"请输入验证码"
>
<div
class=
' text-font-dark-blue text-xs self-end'
>
<span
v-if=
"CodeData.resend"
>
{{
CodeData
.
count
}}
秒后,重新发送
</span>
<span
v-else
class=
'text-font-blue'
>
重新发送
</span></div>
<div
class=
' text-font-dark-blue text-xs self-end'
>
<span
v-if=
"!CodeData.resend"
>
{{
CodeData
.
count
}}
秒后,重新发送
</span>
<span
v-else
class=
'text-font-blue'
@
click=
"resendCode"
>
重新发送
</span></div>
</div>
<div
class=
"flex flex-col items-center w-full justify-center"
v-else
>
<breeding-rhombus-spinner
:animation-duration=
"2000"
:size=
"60"
:color=
"'#0078FF'"
/>
<div
class=
" mt-6 text-font-dark-blue"
>
NFT正在转出,请耐心等待...
</div>
</div>
</div>
<!--
<div
class=
'flex w-10/12 mx-auto justify-between'
>
<app-btn
text=
"取消"
class=
" text-font-gray"
></app-btn>
<app-btn
text=
"确认"
class=
' text-font-blue'
></app-btn>
</div>
-->
</div>
</div>
</div>
</div>
</van-overlay>
</van-overlay>
...
@@ -30,6 +37,7 @@
...
@@ -30,6 +37,7 @@
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
Vue
from
'vue'
;
import
Vue
from
'vue'
;
import
NavHeader
from
'./NavHeader.vue'
import
NavHeader
from
'./NavHeader.vue'
import
{
BreedingRhombusSpinner
}
from
'epic-spinners'
export
default
Vue
.
extend
({
export
default
Vue
.
extend
({
data
(){
data
(){
return
{
return
{
...
@@ -37,10 +45,26 @@ export default Vue.extend({
...
@@ -37,10 +45,26 @@ export default Vue.extend({
}
}
},
},
watch
:{
watch
:{
codeValue
(
newV
,
oldV
){
async
codeValue
(
newV
,
oldV
){
console
.
log
(
newV
.
length
);
console
.
log
(
newV
.
length
);
if
(
newV
.
length
==
4
){
if
(
newV
.
length
==
4
){
console
.
log
(
'send'
);
const
{
nftid
,
count
,
receiveWallet
}
=
this
.
formData
const
data
=
{
id
:
Number
(
nftid
),
count
:
Number
(
count
),
receiveWallet
,
code
:
Number
(
newV
),
codeType
:
'sms'
}
console
.
log
(
data
,
this
.
formData
);
const
req
=
await
this
.
$store
.
dispatch
(
'codeConfirmer/doTransfer'
,
data
)
console
.
log
(
req
);
if
(
req
&&!
req
.
message
){
this
.
$router
.
push
({
name
:
'Home'
})
this
.
$toast
.
success
(
'NFT已经成功转出'
)
}
else
{
this
.
$toast
.
fail
(
req
.
message
||
'发送失败'
)
}
}
else
if
(
newV
.
length
>
4
){
}
else
if
(
newV
.
length
>
4
){
this
.
codeValue
=
oldV
this
.
codeValue
=
oldV
}
}
...
@@ -49,11 +73,28 @@ export default Vue.extend({
...
@@ -49,11 +73,28 @@ export default Vue.extend({
computed
:{
computed
:{
CodeData
:
function
(){
CodeData
:
function
(){
return
this
.
$store
.
state
.
codeConfirmer
return
this
.
$store
.
state
.
codeConfirmer
}
},
formData
:
function
(){
return
this
.
$store
.
state
.
transfer
},
},
},
name
:
'layout_child'
,
name
:
'layout_child'
,
methods
:{
async
resendCode
(){
const
req
=
await
this
.
$store
.
dispatch
(
'codeConfirmer/getVertiryCode'
)
console
.
log
(
req
);
},
closeOverlay
(){
if
(
this
.
$store
.
state
.
codeConfirmer
.
show
){
this
.
$store
.
commit
(
'codeConfirmer/ToggleCode'
)
}
}
},
components
:{
components
:{
NavHeader
,
NavHeader
,
'app-icon'
:()
=>
import
(
'@/components/common/Icon.vue'
),
'breeding-rhombus-spinner'
:
BreedingRhombusSpinner
// 'app-btn':()=>import('@/components/common/Btn.vue')
// 'app-btn':()=>import('@/components/common/Btn.vue')
}
}
});
});
...
...
src/service/Service.ts
View file @
a70d378d
...
@@ -32,21 +32,25 @@ export class Service {
...
@@ -32,21 +32,25 @@ export class Service {
}
}
return
ret
return
ret
}
else
{
}
else
{
if
(
ret
.
code
===
401
){
if
(
ret
.
code
===
401
){
await
logoutUser
().
then
(()
=>
{
await
logoutUser
().
then
(()
=>
{
router
.
push
({
name
:
'Login'
})
router
.
push
({
name
:
'Login'
})
})
})
}
}
console
.
log
(
ret
,
'err ret'
);
Toast
.
fail
(
typeof
ret
.
data
===
"string"
?
ret
.
data
:
ret
.
message
)
Toast
.
fail
(
typeof
ret
.
data
===
"string"
?
ret
.
data
:
ret
.
message
)
throw
new
Error
(
ret
.
message
)
return
ret
;
// throw new Error(ret.message)
}
}
}
}
this
.
service
.
get
=
(...
res
)
=>
get
(...
res
).
then
(
ret
=>
resolveData
(
ret
.
data
)).
catch
(
err
=>
{
this
.
service
.
get
=
(...
res
)
=>
get
(...
res
).
then
(
ret
=>
resolveData
(
ret
.
data
)).
catch
(
err
=>
{
resolveData
(
err
.
response
.
data
)
resolveData
(
err
.
response
.
data
)
})
})
this
.
service
.
post
=
(...
res
)
=>
post
(...
res
).
then
(
ret
=>
resolveData
(
ret
.
data
)).
catch
(
err
=>
{
this
.
service
.
post
=
(...
res
)
=>
post
(...
res
).
then
(
ret
=>
resolveData
(
ret
.
data
)).
catch
(
err
=>
{
resolveData
(
err
.
response
.
data
)
err
.
response
?
resolveData
(
err
.
response
.
data
):
err
});
});
}
}
...
...
src/service/nftService/nftService.ts
View file @
a70d378d
...
@@ -351,7 +351,7 @@ export class NFTService extends Service {
...
@@ -351,7 +351,7 @@ export class NFTService extends Service {
* @param data NftTransferDTO
* @param data NftTransferDTO
* @returns
* @returns
*/
*/
async
nftTransfer
(
data
:
NftTransferDTO
){
async
nftTransfer
(
data
:
NftTransferDTO
)
:
Promise
<
any
>
{
return
this
.
service
.
post
(
this
.
router
.
nftTransfer
.
path
,
data
,{
return
this
.
service
.
post
(
this
.
router
.
nftTransfer
.
path
,
data
,{
headers
:
{
headers
:
{
Authorization
:
this
.
getAuth
()
Authorization
:
this
.
getAuth
()
...
@@ -359,7 +359,7 @@ export class NFTService extends Service {
...
@@ -359,7 +359,7 @@ export class NFTService extends Service {
})
})
}
}
async
sendTransferCode
(){
async
sendTransferCode
()
:
Promise
<
any
>
{
return
await
this
.
service
.
post
(
this
.
router
.
sendTransferCode
.
path
,{},{
return
await
this
.
service
.
post
(
this
.
router
.
sendTransferCode
.
path
,{},{
headers
:
{
headers
:
{
Authorization
:
this
.
getAuth
(),
Authorization
:
this
.
getAuth
(),
...
...
src/store/codeConfimer.ts
View file @
a70d378d
...
@@ -8,6 +8,7 @@ const stateData = {
...
@@ -8,6 +8,7 @@ const stateData = {
counter
:
null
as
any
,
counter
:
null
as
any
,
value
:
null
as
any
,
value
:
null
as
any
,
resend
:
false
,
resend
:
false
,
onAction
:
false
,
}
}
export
type
CodeType
=
typeof
stateData
export
type
CodeType
=
typeof
stateData
...
@@ -18,10 +19,8 @@ const stateData = {
...
@@ -18,10 +19,8 @@ const stateData = {
}),
}),
mutations
:
{
mutations
:
{
CountDown
(
state
:
CodeType
):
void
{
CountDown
(
state
:
CodeType
):
void
{
console
.
log
(
state
.
count
);
if
(
!
state
.
counter
){
state
.
counter
=
setInterval
(()
=>
{
state
.
counter
=
setInterval
(()
=>
{
if
(
state
.
count
>
-
1
){
if
(
state
.
count
>
0
){
state
.
resend
=
false
state
.
resend
=
false
state
.
count
--
state
.
count
--
}
else
{
}
else
{
...
@@ -30,7 +29,6 @@ const stateData = {
...
@@ -30,7 +29,6 @@ const stateData = {
clearInterval
(
state
.
counter
)
clearInterval
(
state
.
counter
)
}
}
},
1000
)
},
1000
)
}
},
},
SET_CODE
(
state
:
CodeType
,
payload
:
any
){
SET_CODE
(
state
:
CodeType
,
payload
:
any
){
state
.
value
=
payload
state
.
value
=
payload
...
@@ -41,15 +39,34 @@ const stateData = {
...
@@ -41,15 +39,34 @@ const stateData = {
},
},
actions
:
{
actions
:
{
async
openCodeConfirm
({
commit
,
state
}
:
any
){
// async getVertiryCode(){
if
(
!
state
.
show
){
// const code = await nftService.sendTransferCode()
commit
(
'ToggleCode'
)
// return code
console
.
log
(
state
.
count
);
// },
async
getVertiryCode
({
commit
,
state
}
:
any
){
if
(
state
.
count
==
30
){
const
req
=
await
nftService
.
sendTransferCode
()
console
.
log
(
req
);
if
(
req
){
commit
(
'CountDown'
)
commit
(
'CountDown'
)
await
nftService
.
sendTransferCode
()
}
return
req
}
}
},
},
async
doTransfer
({
commit
,
state
}
:
any
,
payload
:
any
){
state
.
onAction
=
true
const
req
=
await
nftService
.
nftTransfer
(
payload
)
if
(
state
.
show
){
commit
(
'ToggleCode'
)
}
console
.
log
(
req
,
'nftTransfer'
,
req
.
code
);
if
(
req
&&!
req
.
message
){
clearInterval
(
state
.
counter
)
state
.
count
=
30
}
state
.
onAction
=
false
return
req
}
},
},
getters
:
{},
getters
:
{},
}
}
...
...
src/view/NFT/Mynft/index.vue
View file @
a70d378d
...
@@ -85,7 +85,6 @@ export default Vue.extend({
...
@@ -85,7 +85,6 @@ export default Vue.extend({
this
.
defaultIndex
=
index
this
.
defaultIndex
=
index
}
}
console
.
log
(
this
.
defaultIndex
);
this
.
categoryTypes
=
cates
this
.
categoryTypes
=
cates
},
},
async
mounted
()
{
async
mounted
()
{
...
...
src/view/NFT/Transfer/confirm.vue
View file @
a70d378d
...
@@ -43,7 +43,10 @@ export default Vue.extend({
...
@@ -43,7 +43,10 @@ export default Vue.extend({
},
},
methods
:{
methods
:{
submitTransfer
(){
submitTransfer
(){
this
.
$store
.
dispatch
(
'codeConfirmer/openCodeConfirm'
)
if
(
!
this
.
$store
.
state
.
codeConfirmer
.
show
){
this
.
$store
.
commit
(
'codeConfirmer/ToggleCode'
)
this
.
$store
.
dispatch
(
'codeConfirmer/getVertiryCode'
)
}
}
}
},
},
computed
:{
computed
:{
...
...
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