@ -1,213 +1,219 @@
< template >
< view class = "ac" >
< navigation :showBack ="false" :bgnum ="true" >
< image src = "../../../../static/tongyonh/Vector.png" mode = "aspectFit" class = "back" @click ="back()" > < / image >
< image src = "../../../../static/tongyonh/Vector.png" mode = "aspectFit" class = "back" @click ="back()" > < / image >
< text class = "big_title" >
{ { addressInfo . type } } Transfer
< / text >
< / navigation >
< view class = "main" >
< view class = "main_con" >
< view class = "yuan" >
< image :src ="addressInfo.coinList[0].icon" mode = "aspectFit" class = "img1" > < / image >
< / view >
< view class = "title" >
{ { addressInfo . type } }
< / view >
< view class = "item" >
< view class = "top flex" >
< view class = "text1" >
Receiving address
< / view >
< view class = "text2" @click ="goAddress('transfer')" >
Adress Book
< / view >
< / view >
< view class = "inputcon" >
< input type = "text" value = "" placeholder -style = " font -size : 30rpx ; color : # D0D0D2 ; " placeholder = "Please enter the recipient address" class = "input1" v -model = " recipientAddress " / >
< image src = "../../../../static/tongyonh/Frame330.png" mode = "aspectFit" class = "img1" > < / image >
< / view >
< / view >
< view class = "item" >
< view class = "top flex" >
< view class = "text1" >
Transfer amount
< / view >
< / view >
< view class = "inputcon2 flex" >
< view class = "inputc flex" >
< view class = "textt" >
< view class = "main_con" >
< view class = "yuan" >
< image :src ="addressInfo.coinList[0].icon" mode = "aspectFit" class = "img1" > < / image >
< / view >
< view class = "title" >
{ { addressInfo . type } }
< / view >
< input type = "text" value = "" placeholder -style = " font -size : 30rpx ; color : # D0D0D2 ; " placeholder = "0.0000000" class = "input3" v -model = " transAmount " / >
< / view >
< text > ≈ < / text >
< view class = "inputc flex" >
< view class = "textt" >
USD
< / view >
< input type = "text" value = "" placeholder -style = " font -size : 30rpx ; color : # D0D0D2 ; " placeholder = "0.0000000" class = "input3" / >
< / view >
< / view >
< view class = "top flex bottom" >
< view class = "text3" >
Balance : { { addressInfo . balance } }
< / view >
< view class = "text1 bg" @click ="forAll" >
ALL
< / view >
< / view >
< / view >
< view class = "item" >
< view class = "top flex" >
< view class = "text1" >
Remark
< / view >
< / view >
< view class = "inputcon" >
< input type = "text" value = "" placeholder -style = " font -size : 30rpx ; color : # D0D0D2 ; " placeholder = "Please enter a note (off-chain)" class = "input1" / >
< / view >
< / view >
< view class = "item" >
< view class = "top flex" >
< view class = "text1" >
Transaction fee
< / view >
< / view >
< view class = "inputcon" >
< input type = "text" v -model = " fee " value = "" placeholder -style = " font -size : 30rpx ; color : # D0D0D2 ; " placeholder = "Please enter a note (off-chain)" class = "input2" / >
< view class = "rig" >
< text class = "text1 ac" > { { addressInfo . type } } < / text > | < text class = "text2" > USDT < / text >
< / view >
< / view >
< / view >
< / view >
< / view >
< view class = "big_con" v-if ="showBottom" >
< view class = "tiao" @click ="show=false" >
< / view >
< view class = "bigtitle" >
Transfer confirmation
< / view >
< view class = "bottom_con" >
< view class = "yuan" >
< image :src ="addressInfo.coinList[0].icon" mode = "aspectFit" class = "img1" > < / image >
< / view >
< view class = "title" >
{ { addressInfo . type } }
< / view >
< view class = "title_con flex" >
< view class = "text1" >
Amount
< / view >
< view class = "text1" >
{ { transAmount } } { { addressInfo . type } }
< / view >
< / view >
< view class = "item" >
< view class = "text1" >
Send address
< / view >
< view class = "text2" >
{ { addressInfo . address } }
< view class = "item" >
< view class = "top flex" >
< view class = "text1" >
Receiving address
< / view >
< view class = "text2" @click ="goAddress('transfer')" >
Adress Book
< / view >
< / view >
< view class = "inputcon" >
< input type = "text" value = "" placeholder -style = " font -size : 30rpx ; color : # D0D0D2 ; "
placeholder = "Please enter the recipient address" class = "input1"
v - model = "recipientAddress" / >
< image src = "../../../../static/tongyonh/Frame330.png" mode = "aspectFit" class = "img1" > < / image >
< / view >
< / view >
< view class = "item" >
< view class = "top flex" >
< view class = "text1" >
Transfer amount
< / view >
< / view >
< view class = "inputcon2 flex" >
< view class = "inputc flex" >
< view class = "textt" >
{ { addressInfo . type } }
< / view >
< input type = "text" value = "" placeholder -style = " font -size : 30rpx ; color : # D0D0D2 ; "
placeholder = "0.0000000" class = "input3" v - model = "transAmount" / >
< / view >
< text > ≈ < / text >
< view class = "inputc flex" >
< view class = "textt" >
USD
< / view >
< input type = "text" value = "" placeholder -style = " font -size : 30rpx ; color : # D0D0D2 ; "
placeholder = "0.0000000" class = "input3" / >
< / view >
< / view >
< view class = "top flex bottom" >
< view class = "text3" >
Balance : { { addressInfo . balance } }
< / view >
< view class = "text1 bg" @click ="forAll" >
ALL
< / view >
< / view >
< / view >
< view class = "item" >
< view class = "top flex" >
< view class = "text1" >
Remark
< / view >
< / view >
< view class = "inputcon" >
< input type = "text" value = "" placeholder -style = " font -size : 30rpx ; color : # D0D0D2 ; "
placeholder = "Please enter a note (off-chain)" class = "input1" / >
< / view >
< / view >
< view class = "item" >
< view class = "top flex" >
< view class = "text1" >
Transaction fee
< / view >
< / view >
< view class = "inputcon" >
< input type = "text" v -model = " fee " value = "" placeholder -style = " font -size : 30rpx ; color : # D0D0D2 ; "
placeholder = "Please enter a note (off-chain)" class = "input2" / >
< view class = "rig" >
< text class = "text1 ac" > { { addressInfo . type } } < / text > | < text class = "text2" > USDT < / text >
< / view >
< / view >
< / view >
< / view >
< / view >
< view class = "item" >
< view class = "text1" >
Receiving address
< / view >
< view class = "text2" >
{ { recipientAddress } }
< view class = "big_con" v-if ="showBottom" >
< view class = "tiao" @click ="cancelAll" >
< / view >
< / view >
< view class = "item" >
< view class = "text1" >
Remark
< view class = "bigtitle" >
Transfer confirmation
< / view >
< view class = "text2" >
1.00 TRX
< view class = "bottom_con" >
< view class = "yuan" >
< image :src ="addressInfo.coinList[0].icon" mode = "aspectFit" class = "img1" > < / image >
< / view >
< view class = "title" >
{ { addressInfo . type } }
< / view >
< view class = "title_con flex" >
< view class = "text1" >
Amount
< / view >
< view class = "text1" >
{ { transAmount } } { { addressInfo . type } }
< / view >
< / view >
< view class = "item" >
< view class = "text1" >
Send address
< / view >
< view class = "text2" >
{ { addressInfo . address } }
< / view >
< / view >
< view class = "item" >
< view class = "text1" >
Receiving address
< / view >
< view class = "text2" >
{ { recipientAddress } }
< / view >
< / view >
< view class = "item" >
< view class = "text1" >
Remark
< / view >
< view class = "text2" >
1.00 TRX
< / view >
< / view >
< view class = "item" >
< view class = "text1" >
Transaction fee
< / view >
< view class = "text2" >
{ { fee } } { { addressInfo . type } }
< / view >
< / view >
< view class = "goto" @click ="confirmTo" >
Confirm
< / view >
< / view >
< / view >
< view class = "item" >
< view class = "text1" >
Transaction fee
< u -mask z -index = " 10 " :show ="show" > < / u - m a s k >
<!-- < u -mask z -index = " 1000 " :show ="show2" @ click = "show2 = false" > < / u - m a s k > - - >
< view class = "zhiwen_con" v-if ="showFinger" >
< view class = "tiao" @click ="cancel" >
< / view >
< view class = "text2" >
{ { fee } } { { addressInfo . type } }
< view class = "bigti tl e" >
Fingerprint password
< / view >
< / view >
< view class = "goto" @click ="confirmTo" >
Confirm
< / view >
< / view >
< / view >
< u -mask z -index = " 10 " :show ="show" > < / u - m a s k >
<!-- < u -mask z -index = " 1000 " :show ="show2" @ click = "show2 = false" > < / u - m a s k > - - >
< view class = "zhiwen_con" v-if ="showFinger" >
< view class = "tiao" @click ="cancel" >
< / view >
< view class = "bigtitle" >
Fingerprint password
< / view >
< view class = "bottom_con" >
< image src = "../../../../static/tongyonh/zhiwen.png" mode = "aspectFit" class = "img1" > < / image >
< view class = "text1" >
Touch the fingerprint sensor
< / view >
< view class = "flex con" >
< view class = "textt1" @click ="goPassword" v-if ="!passShow" >
Use Password
< view class = "bottom_con" >
< image src = "../../../../static/tongyonh/zhiwen.png" mode = "aspectFit" class = "img1" > < / image >
< view class = "text1" >
Touch the fingerprint sensor
< / view >
< view class = "flex con" >
< view class = "textt1" @click ="goPassword" v-if ="!passShow" >
Use Password
< / view >
< view class = "textt2" @click ="cancel" >
Cancel
Cancel
< / view >
< / view >
< / view >
< / view >
< / view >
< / view >
< view class = "zhiwen_con" v-if ="fingerFail" >
< view class = "tiao" >
< / view >
< view class = "bigtitle" >
Fingerprint password
< / view >
< view class = "bottom_con" >
< image src = "../../../../static/tongyonh/alert-circle.png" mode = "aspectFit" class = "img1" > < / image >
< view class = "text1 red" >
Fingerprint not recognized . < br > < text @ click = "" > Try again < / text > .
< / view >
< view class = "flex con" >
< view class = "textt1" @click ="goPassword" >
Use Password
< view class = "zhiwen_con" v-if ="fingerFail" >
< view class = "tiao" >
< / view >
< view class = "bigtitle" >
Fingerprint password
< / view >
< view class = "bottom_con" >
< image src = "../../../../static/tongyonh/alert-circle.png" mode = "aspectFit" class = "img1" > < / image >
< view class = "text1 red" >
Fingerprint not recognized . < br > < text @click ="confirmTo('try')" > Try again < / text > .
< / view >
< view class = "flex con" >
< view class = "textt1" @click ="goPassword" >
Use Password
< / view >
< view class = "textt2" >
Cancel
< view class = "textt2" @click ="cancelFail" >
Cancel
< / view >
< / view >
< / view >
< / view >
< / view >
< / view >
< view class = "zhiwen_con" v-if ="fingerSuccess" >
< view class = "tiao" >
< / view >
< view class = "bigtitle" >
Fingerprint password
< / view >
< view class = "bottom_con" >
< image src = "../../../../static/tongyonh/x-circle.png" mode = "aspectFit" class = "img1" > < / image >
< view class = "text1 green" >
Fingerprint recognized .
< / view >
<!-- < view class = "flex con" >
< view class = "zhiwen_con" v-if ="fingerSuccess" >
< view class = "tiao" >
< / view >
< view class = "bigtitle" >
Fingerprint password
< / view >
< view class = "bottom_con" >
< image src = "../../../../static/tongyonh/x-circle.png" mode = "aspectFit" class = "img1" > < / image >
< view class = "text1 green" >
Fingerprint recognized .
< / view >
<!-- < view class = "flex con" >
< view class = "textt1" >
Use Password
< / view >
@ -215,18 +221,18 @@
Confirm
< / view >
< / view > -- >
< / view >
< / view >
< / view >
< view class = "btn_con" @click ="Confirm" >
< view class = "btn" >
Confirm
< / view >
< / view >
< view class = "btn_con" @click ="Confirm" >
< view class = "btn" >
Confirm
< / view >
< / view >
< / view >
< / view >
@ -237,70 +243,83 @@
export default {
data ( ) {
return {
fee : 1000 ,
show : false ,
show2 : false ,
showFinger : false ,
showBottom : false ,
addressInfo : { } ,
recipientAddress : '' ,
transAmount : '' ,
fingerSuccess : false ,
fingerFail : false ,
/ / 是 否 显 示 使 用 密 码 , 有 设 置 指 纹 就 不 显 示
passShow : false ,
/ / 不 用 指 纹 去 密 码 页 面 存 的 信 息
transInfoPass : {
fromAddress : '' ,
toAddress : "" ,
privateKey : '' ,
amount : '' ,
}
fee : 1000 ,
show : false ,
show2 : false ,
showFinger : false ,
showBottom : false ,
addressInfo : { } ,
recipientAddress : '' ,
transAmount : '' ,
fingerSuccess : false ,
fingerFail : false ,
/ / 是 否 显 示 使 用 密 码 , 有 设 置 指 纹 就 不 显 示
passShow : false ,
/ / 不 用 指 纹 去 密 码 页 面 存 的 信 息
transInfoPass : {
fromAddress : '' ,
toAddress : "" ,
privateKey : '' ,
amount : '' ,
}
}
} ,
methods : {
cancel ( ) {
this . show = false
this . showFinger = false
cancelAll ( ) {
this . show = false ;
this . showBottom = false ;
} ,
cancelFail ( ) {
this . $walletUtil . printCancel ( )
this . fingerFail = false
this . showBottom = true ;
this . showFinger = false ;
} ,
cancel ( ) {
this . showFinger = false
this . showBottom = true ;
this . $walletUtil . printCancel ( )
} ,
/ / 不 用 指 纹 去 密 码 页
goPassword ( ) {
goPassword ( ) {
this . $walletUtil . printCancel ( ) ;
console . log ( 111 )
uni . navigateTo ( {
url : '/pages/menu/sendToken/enPassword/index'
url : '/pages/menu/sendToken/enPassword/index'
} )
} ,
/ / 唤 起 指 纹
confirmTo ( ) {
this . show = true
this . showFinger = true
this . showBottom = false ;
confirmTo ( type ) {
if ( type == 'try' ) {
this . fingerFail = false ;
}
this . show = true
this . showFinger = true
this . showBottom = false ;
/ / 指 纹 识 别 成 功 返 回 一 个 t r u e
this . fingerprint ( ) ;
this . fingerprint ( ) ;
/ / 存 储 去 密 码 页 面 的 信 息
this . transInfoPass . fromAddress = this . addressInfo . address ;
this . transInfoPass . toAddress = this . recipientAddress ;
this . transInfoPass . privateKey = this . addressInfo . privateKey ;
this . transInfoPass . amount = this . transAmount ;
console . log ( this . transInfoPass , 444 )
this . transInfoPass . fromAddress = this . addressInfo . address ;
this . transInfoPass . toAddress = this . recipientAddress ;
this . transInfoPass . privateKey = this . addressInfo . privateKey ;
this . transInfoPass . amount = this . transAmount ;
console . log ( this . transInfoPass , 444 )
/ / 存 储 去 密 码 页 面 的 信 息
uni . setStorageSync ( 'transInfoPass' , this . transInfoPass )
uni . setStorageSync ( 'transInfoPass' , this . transInfoPass )
} ,
back ( ) {
back ( ) {
uni . reLaunch ( {
url : '../../wallet/index'
url : '../../wallet/index'
} )
} ,
/ / 点 击 获 取 所 有 钱
forAll ( ) {
this . transAmount = this . addressInfo . balance
forAll ( ) {
this . transAmount = this . addressInfo . balance
} ,
/ / 确 认 提 交
Confirm ( ) {
Confirm ( ) {
/ / 做 判 断
if ( this . transAmount == '' ) {
if ( this . transAmount == '' ) {
uni . showToast ( {
title : 'Please enter the transfer amount' ,
icon : 'none' ,
@ -308,7 +327,7 @@
} )
return
}
if ( this . recipientAddress == '' ) {
if ( this . recipientAddress == '' ) {
uni . showToast ( {
title : 'Please enter the receiving address' ,
icon : 'none' ,
@ -316,7 +335,7 @@
} )
return
}
if ( this . transAmount == '' < 0 ) {
if ( this . transAmount == '' < 0 ) {
uni . showToast ( {
title : 'The entered amount cannot be less than 0' ,
icon : 'none' ,
@ -332,164 +351,276 @@
/ / } )
/ / r e t u r n
/ / }
this . showBottom = true ;
this . show = true ;
this . showBottom = true ;
this . show = true ;
} ,
/ / 指 纹 识 别
fingerprint : function ( sett ) {
let bltype = true ;
/ / # i f d e f A P P - P L U S
if ( ! plus . fingerprint . isSupport ( ) ) {
uni . showToast ( {
title : 'This device does not support fingerprint identification' ,
icon : 'none' ,
duration : 1500
} )
/ / t h i s . d i s a b l e d = t r u e ;
} else if ( ! plus . fingerprint . isKeyguardSecure ( ) ) {
uni . showToast ( {
title : 'This device is not equipped with a password lock screen and cannot use fingerprint identification' ,
icon : 'none' ,
duration : 1500
} )
} else if ( ! plus . fingerprint . isEnrolledFingerprints ( ) ) {
uni . showToast ( {
title : 'There is no fingerprint entered in this device. Please turn it on in the setting' ,
icon : 'none' ,
duration : 1500
} )
/ / t h i s . d i s a b l e d = t r u e ;
} else {
/ / t h i s . r e s u l t = ' 此 设 备 支 持 指 纹 识 别 ' ;
/ / / / t h i s . d i s a b l e d = f a l s e ;
/ / # i f d e f M P - W E I X I N
/ / t h i s . d i s a b l e d = f a l s e ;
uni . showToast ( {
title : 'Please use it in wechat real machine. The simulator does not support it' ,
icon : 'none' ,
duration : 1500
} )
/ / # e n d i f
/ / # i f n d e f A P P - P L U S | | M P - W E I X I N
uni . showToast ( {
title : 'Fingerprint identification is not supported on this platform' ,
icon : 'none' ,
duration : 1500 ,
} )
/ / # e n d i f
let that = this ;
/ / # i f d e f A P P - P L U S
plus . fingerprint . authenticate ( function ( ) {
plus . nativeUI . closeWaiting ( ) ; / / 兼 容 A n d r o i d 平 台 关 闭 等 待 框
/ / u n i . s h o w T o a s t ( {
/ / t i t l e : ' F i n g e r p r i n t i d e n t i f i c a t i o n s u c c e e d e d ' ,
/ / i c o n : ' n o n e ' ,
/ / d u r a t i o n : 1 5 0 0 ,
/ / } )
/ / 存 储 设 置 里 开 启 指 纹 后 的 状 态 , 隐 藏 使 用 密 码
/ / u n i . s e t S t o r a g e S y n c ( ' f i n g e r P a s s ' , t r u e )
let bltype = true ;
/ / # i f d e f A P P - P L U S
if ( ! plus . fingerprint . isSupport ( ) ) {
uni . showToast ( {
title : 'This device does not support fingerprint identification' ,
icon : 'none' ,
duration : 1500
} )
/ / t h i s . d i s a b l e d = t r u e ;
} else if ( ! plus . fingerprint . isKeyguardSecure ( ) ) {
uni . showToast ( {
title : 'This device is not equipped with a password lock screen and cannot use fingerprint identification' ,
icon : 'none' ,
duration : 1500
} )
} else if ( ! plus . fingerprint . isEnrolledFingerprints ( ) ) {
uni . showToast ( {
title : 'There is no fingerprint entered in this device. Please turn it on in the setting' ,
icon : 'none' ,
duration : 1500
} )
/ / t h i s . d i s a b l e d = t r u e ;
} else {
/ / t h i s . r e s u l t = ' 此 设 备 支 持 指 纹 识 别 ' ;
/ / / / t h i s . d i s a b l e d = f a l s e ;
/ / # i f d e f M P - W E I X I N
/ / t h i s . d i s a b l e d = f a l s e ;
uni . showToast ( {
title : 'Please use it in wechat real machine. The simulator does not support it' ,
icon : 'none' ,
duration : 1500
} )
/ / # e n d i f
/ / # i f n d e f A P P - P L U S | | M P - W E I X I N
uni . showToast ( {
title : 'Fingerprint identification is not supported on this platform' ,
icon : 'none' ,
duration : 1500 ,
} )
/ / # e n d i f
that . showBottom = false ;
that . fingerSuccess = true ;
console . log ( that . fingerSuccess , 454545 )
} , function ( e ) {
switch ( e . code ) {
case e . AUTHENTICATE_MISMATCH :
/ / p l u s . n a t i v e U I . t o a s t ( ' F i n g e r p r i n t m a t c h i n g f a i l e d , p l e a s e r e - e n t e r ' ) ;
/ / u n i . s e t S t o r a g e S y n c ( ' f i n g e r P a s s ' , f a l s e )
console . log ( that . showFinger , 454545 )
that . showBottom = false ;
that . fingerFail = true ;
console . log ( that . fingerFail , 454545 )
break ;
case e . AUTHENTICATE_OVERLIMIT :
plus . nativeUI . closeWaiting ( ) ; / / 兼 容 A n d r o i d 平 台 关 闭 等 待 框
/ / p l u s . n a t i v e U I . a l e r t ( ' T h e n u m b e r o f f i n g e r p r i n t i d e n t i f i c a t i o n f a i l u r e s e x c e e d s t h e l i m i t . P l e a s e u s e o t h e r m e t h o d s f o r a u t h e n t i c a t i o n ' ) ;
/ / u n i . s e t S t o r a g e S y n c ( ' f i n g e r P a s s ' , f a l s e )
console . log ( that . showFinger , 454545 )
that . showBottom = false ;
that . fingerFail = true ;
console . log ( that . fingerFail , 454545 )
break ;
case e . CANCEL :
plus . nativeUI . toast ( 'Recognition has been cancelled' ) ;
/ / u n i . s e t S t o r a g e S y n c ( ' f i n g e r P a s s ' , f a l s e )
console . log ( that . showFinger , 454545 )
that . showBottom = false ;
that . fingerFail = true ;
console . log ( that . fingerFail , 454545 )
break ;
default :
plus . nativeUI . closeWaiting ( ) ; / / 兼 容 A n d r o i d 平 台 关 闭 等 待 框
uni . setStorageSync ( 'fingerPass' , false )
console . log ( that . showFinger , 454545 )
that . showBottom = false ;
that . fingerFail = true ;
console . log ( that . fingerFail , 454545 )
plus . nativeUI . alert ( 'Fingerprint identification failed, please try again' ) ;
break ;
let that = this ;
/ / # i f d e f A P P - P L U S
plus . fingerprint . authenticate ( function ( ) {
plus . nativeUI . closeWaiting ( ) ; / / 兼 容 A n d r o i d 平 台 关 闭 等 待 框
console . log ( that . transInfoPass , 5656 )
console . log ( that . addressInfo , 56556656 )
if ( that . addressInfo . type == 'TRX' ) {
console . log ( that . addressInfo . type , 11111 )
console . log ( that . transInfoPass , 2222 )
/ / i f ( ! t h i s . c o n t r a c t A d d r e s s ) {
/ / 指 纹 通 过 转 账 成 功
that . $TronUtil . sendTransaction ( that . transInfoPass . fromAddress , that . transInfoPass . privateKey , that . transInfoPass . toAddress , that . transInfoPass . amount )
. then ( ( res ) => {
console . log ( 2222211111 )
that . showFinger = false
that . showBottom = false ;
that . fingerSuccess = true ;
uni . showToast ( {
title : 'Transfer succeeded' ,
icon : 'none' ,
duration : 1500
} )
setTimeout ( ( ) => {
that . fingerSuccess = false ;
uni . reLaunch ( {
url : '/pages/menu/wallet/index'
} )
} , 1000 )
} ) . catch ( err => {
console . log ( err , 'cuowu' )
that . showFinger = false ;
that . showBottom = true ;
uni . showToast ( {
title : 'Transfer failed, please confirm the information is correct' ,
icon : 'none' ,
duration : 1500
} )
} )
/ / } e l s e {
/ / t h i s . $ T r o n U t i l . s e n d R a w T r a n s a c t i o n ( t h i s . i n f o . a d d r e s s , t h i s . i n f o . p r i v a t e K e y , t h i s . t o A d d r e s s , t h i s . t o V a l u e , ' ' , t h i s . c o n t r a c t A d d r e s s )
/ / . t h e n ( ( r e s ) = > {
/ / u n i . s h o w T o a s t ( {
/ / t i t l e : ' S u c c e s s f u l l y ' ,
/ / i c o n : ' s u c c e s s ' ,
/ / d u r a t i o n : 2 0 0 0
/ / } )
/ / t h i s . s h o w 2 = f a l s e ;
/ / u n i . r e L a u n c h ( {
/ / u r l : ' / p a g e s / m e n u / w a l l e t / i n d e x '
/ / } )
/ / } ) . c a t c h ( e r r = > {
/ / c o n s o l e . l o g ( e r r )
/ / u n i . s h o w T o a s t ( {
/ / t i t l e : e r r ,
/ / i c o n : ' n o n e ' ,
/ / d u r a t i o n : 2 0 0 0
/ / } )
/ / } )
/ / }
}
} ) ;
/ / A n d r o i d 平 台 手 动 弹 出 等 待 提 示 框
if ( 'Android' == plus . os . name ) {
this . show = true ;
/ * p l u s . n a t i v e U I . s h o w W a i t i n g ( ' 指 纹 识 别 中 . . . ' ) . o n c l o s e = f u n c t i o n ( ) {
plus . fingerprint . cancel ( ) ;
} * /
}
/ / # e n d i f
/ / # i f d e f M P - W E I X I N
wx . startSoterAuthentication ( {
requestAuthModes : [ 'fingerPrint' ] ,
challenge : '123456' ,
authContent : '请用指纹解锁' ,
success ( res ) {
uni . showToast ( {
title : '识别成功' ,
mask : false ,
duration : 1500
} ) ;
if ( that . addressInfo . type == 'ETH' ) {
console . log ( that . addressInfo . type , 11111 )
console . log ( that . transInfoPass , 2222 )
/ / i f ( ! t h i s . c o n t r a c t A d d r e s s ) {
/ / 指 纹 通 过 转 账 成 功
that . $EthUtil . transaction ( that . transInfoPass . fromAddress , that . transInfoPass . privateKey , that . transInfoPass . toAddress , that . transInfoPass . amount )
. then ( ( res ) => {
console . log ( 2222211111 )
that . showFinger = false
that . showBottom = false ;
that . fingerSuccess = true ;
uni . showToast ( {
title : 'Transfer succeeded' ,
icon : 'none' ,
duration : 1500
} )
setTimeout ( ( ) => {
that . fingerSuccess = false ;
uni . reLaunch ( {
url : '/pages/menu/wallet/index'
} )
} , 1000 )
} ) . catch ( err => {
console . log ( err , 'cuowu' )
that . showFinger = false ;
that . showBottom = true ;
uni . showToast ( {
title : 'Transfer failed, please confirm the information is correct' ,
icon : 'none' ,
duration : 1500
} )
} )
/ / } e l s e {
/ / t h i s . $ T r o n U t i l . s e n d R a w T r a n s a c t i o n ( t h i s . i n f o . a d d r e s s , t h i s . i n f o . p r i v a t e K e y , t h i s . t o A d d r e s s , t h i s . t o V a l u e , ' ' , t h i s . c o n t r a c t A d d r e s s )
/ / . t h e n ( ( r e s ) = > {
/ / u n i . s h o w T o a s t ( {
/ / t i t l e : ' S u c c e s s f u l l y ' ,
/ / i c o n : ' s u c c e s s ' ,
/ / d u r a t i o n : 2 0 0 0
/ / } )
/ / t h i s . s h o w 2 = f a l s e ;
/ / u n i . r e L a u n c h ( {
/ / u r l : ' / p a g e s / m e n u / w a l l e t / i n d e x '
/ / } )
/ / } ) . c a t c h ( e r r = > {
/ / c o n s o l e . l o g ( e r r )
/ / u n i . s h o w T o a s t ( {
/ / t i t l e : e r r ,
/ / i c o n : ' n o n e ' ,
/ / d u r a t i o n : 2 0 0 0
/ / } )
/ / } )
/ / }
}
} )
/ / # e n d i f
} , function ( e ) {
switch ( e . code ) {
case e . AUTHENTICATE_MISMATCH :
/ / p l u s . n a t i v e U I . t o a s t ( ' F i n g e r p r i n t m a t c h i n g f a i l e d , p l e a s e r e - e n t e r ' ) ;
/ / u n i . s e t S t o r a g e S y n c ( ' f i n g e r P a s s ' , f a l s e )
console . log ( that . showFinger , 454545 )
that . showBottom = false ;
that . fingerFail = true ;
console . log ( that . fingerFail , 454545 )
break ;
case e . AUTHENTICATE_OVERLIMIT :
plus . nativeUI . closeWaiting ( ) ; / / 兼 容 A n d r o i d 平 台 关 闭 等 待 框
/ / p l u s . n a t i v e U I . a l e r t ( ' T h e n u m b e r o f f i n g e r p r i n t i d e n t i f i c a t i o n f a i l u r e s e x c e e d s t h e l i m i t . P l e a s e u s e o t h e r m e t h o d s f o r a u t h e n t i c a t i o n ' ) ;
/ / u n i . s e t S t o r a g e S y n c ( ' f i n g e r P a s s ' , f a l s e )
console . log ( that . showFinger , 454545 )
that . showBottom = false ;
that . fingerFail = true ;
console . log ( that . fingerFail , 454545 )
break ;
case e . CANCEL :
plus . nativeUI . toast ( 'Recognition has been cancelled' ) ;
/ / u n i . s e t S t o r a g e S y n c ( ' f i n g e r P a s s ' , f a l s e )
console . log ( that . showFinger , 454545 )
that . showBottom = false ;
that . fingerFail = true ;
console . log ( that . fingerFail , 454545 )
break ;
default :
plus . nativeUI . closeWaiting ( ) ; / / 兼 容 A n d r o i d 平 台 关 闭 等 待 框
uni . setStorageSync ( 'fingerPass' , false )
console . log ( that . showFinger , 454545 )
that . showBottom = false ;
that . fingerFail = true ;
console . log ( that . fingerFail , 454545 )
plus . nativeUI . alert ( 'Fingerprint identification failed, please try again' ) ;
break ;
}
} ) ;
/ / A n d r o i d 平 台 手 动 弹 出 等 待 提 示 框
if ( 'Android' == plus . os . name ) {
this . show = true ;
/ * p l u s . n a t i v e U I . s h o w W a i t i n g ( ' 指 纹 识 别 中 . . . ' ) . o n c l o s e = f u n c t i o n ( ) {
plus . fingerprint . cancel ( ) ;
} * /
}
/ / # e n d i f
} ,
goAddress ( text ) {
console . log ( text )
uni . navigateTo ( {
url : '../address/index?item=' + text
} )
}
/ / # i f d e f M P - W E I X I N
wx . startSoterAuthentication ( {
requestAuthModes : [ 'fingerPrint' ] ,
challenge : '123456' ,
authContent : '请用指纹解锁' ,
success ( res ) {
uni . showToast ( {
title : '识别成功' ,
mask : false ,
duration : 1500
} ) ;
}
} )
/ / # e n d i f
}
/ / # e n d i f
} ,
goAddress ( text ) {
console . log ( text )
uni . navigateTo ( {
url : '../address/index?item=' + text
} )
}
} ,
onLoad ( ) {
/ / 判 断 是 否 从 地 址 页 有 传 地 址 过 来
if ( uni . getStorageSync ( 'myTransAddress' ) ) {
this . recipientAddress = uni . getStorageSync ( 'myTransAddress' ) . address
}
/ / 每 次 进 来 拿 缓 存 里 有 没 有 指 纹
if ( uni . getStorageSync ( 'fingerPass' ) ) {
this . passShow = uni . getStorageSync ( 'fingerPass' )
}
this . addressInfo = uni . getStorageSync ( 'infoWallet' )
console . log ( this . addressInfo , 1111 )
if ( uni . getStorageSync ( 'myTransAddress' ) ) {
this . recipientAddress = uni . getStorageSync ( 'myTransAddress' ) . address
uni . removeStorageSync ( 'myTransAddress' )
}
/ / 每 次 进 来 拿 缓 存 里 有 没 有 指 纹
if ( uni . getStorageSync ( 'fingerPass' ) ) {
this . passShow = uni . getStorageSync ( 'fingerPass' )
}
this . addressInfo = uni . getStorageSync ( 'infoWallet' )
console . log ( this . addressInfo , 1111 )
}
} ;
< / script >
< style scoped >
page {
background : # FAFAFA ;
height : 100 % ;
height : 100 % ;
}
< / style >