Browse Source

修改

master
vee 4 years ago
parent
commit
484cb32467
  1. 123
      pages/menu/sendToken/enPassword/index.vue
  2. 155
      pages/menu/sendToken/index.vue
  3. 320
      pages/menu/sendToken/transfer/index.vue
  4. 7
      pages/menu/setting/index.vue
  5. 158
      pages/menu/token/btc/index.css
  6. 2
      pages/menu/token/btc/index.vue
  7. 215
      pages/menu/transction/detail/index.vue
  8. 2
      pages/menu/wallet/cwallet/index.css
  9. 34
      pages/menu/wallet/index.vue
  10. 8
      pages/menu/wallet/mwallet/index.css
  11. 10
      utils/EthUtil.js
  12. 7
      utils/TronUtil.js
  13. 449
      utils/WalletUtil.js

123
pages/menu/sendToken/enPassword/index.vue

@ -34,8 +34,7 @@
info: false,
transInfoPass: {
},
wallet: {}
}
}
},
@ -46,91 +45,79 @@
this.info = false;
}
},
finish2(e) {
if (this.wallet.password != e) {
this.info = true;
return;
} else {
this.info = false;
}
//
// trx
if (this.wallet.type == 'TRX') {
// trx
if (!this.contractAddress) {
this.$TronUtil.sendTransaction(this.transInfoPass.fromAddress, this.transInfoPass.privateKey, this
.transInfoPass.toAddress, this.transInfoPass.amount)
.then((res) => {
console.log(res, 111)
transaction() {
if (this.transInfoPass.type === 'ETH') {
this.$EthUtil.transaction(this.transInfoPass.fromAddress, this.transInfoPass.privateKey,
this.transInfoPass.toAddress, this.transInfoPass.amount, this.transInfoPass.contractAddress,
function(hash, err) {
if (!err) {
uni.showToast({
title: 'Successfully',
icon: 'success',
duration: 2000
})
uni.reLaunch({
url: '/pages/menu/wallet/index'
title: 'Transfer succeeded',
icon: 'none',
duration: 1500
})
}).catch(err => {
setTimeout(() => {
that.fingerSuccess = false;
uni.reLaunch({
url: '/pages/menu/wallet/index'
})
}, 1000)
} else {
console.log(err, 'cuowu')
uni.showToast({
title: err,
title: 'Transfer failed, please confirm the information is correct',
icon: 'none',
duration: 2000
duration: 1500
})
}
})
} else if (this.transInfoPass.type === 'TRX') {
this.$TronUtil.transaction(this.transInfoPass.fromAddress, this.transInfoPass.privateKey,
this.transInfoPass.toAddress, this.transInfoPass.amount, this.transInfoPass.remark, this.transInfoPass.contractAddress)
.then((res) => {
uni.showToast({
title: 'Transfer succeeded',
icon: 'none',
duration: 1500
})
} else {
// trx
this.$TronUtil.sendRawTransaction(this.info.address, this.info.privateKey, this.toAddress, this
.toValue, '', this.contractAddress)
.then((res) => {
uni.showToast({
title: 'Successfully',
icon: 'success',
duration: 2000
})
this.show2 = false;
setTimeout(() => {
uni.reLaunch({
url: '/pages/menu/wallet/index'
})
}).catch(err => {
console.log(err)
uni.showToast({
title: err,
icon: 'none',
duration: 2000
})
}, 1000)
}).catch(err => {
console.log(err, 'cuowu')
uni.showToast({
title: 'Transfer failed, please confirm the information is correct',
icon: 'none',
duration: 1500
})
}
})
}
if (this.wallet.type == 'ETH') {
if (this.info.coinList[0].xname == 'Ethereum') {
this.$EthUtil.transaction(this.info.address, this.toAddress, this.toValue, this.info.privateKey)
.then((
res) => {
console.log(res, '钱包')
this.show2 = false;
uni.reLaunch({
url: '../transfer2/index'
})
}).catch(err => {
console.log(err)
})
}
},
finish2(e) {
if (this.transInfoPass.password != e) {
this.info = true;
return;
} else {
this.info = false;
this.transaction();
}
},
},
onLoad() {
//
this.transInfoPass = uni.getStorageSync('transInfoPass')
//
this.wallet = uni.getStorageSync('wallet')
uni.removeStorageSync('transInfoPass')
console.log(this.transInfoPass, 2222)
console.log(this.wallet, 2222)
}
};
</script>

155
pages/menu/sendToken/index.vue

@ -1,45 +1,46 @@
<template>
<view class="">
<navigation :showBack="true" :bgnum="true">
{{addressInfo.name}} Receive
{{addressInfo.name}} Receive
</navigation>
<view class="main">
<view class="main_con">
<image :src="addressInfo.icon" mode="aspectFit" class="logoimg" ></image>
<view class="title">
{{addressInfo.name}} Receiving address
</view>
<view class="code_con">
<tki-qrcode ref="qrcode" :val="addressInfo.address" :size="size" :unit="unit" :background="background"
:foreground="foreground" :pdground="pdground" :lv="lv" :onval="onval" :loadMake="loadMake"
:showLoading="showLoading" :loadingText="loadingText" :icon="icon" class="test" />
</view>
<view class="text1">
Scan the QR code to transfer to the asset
</view>
<view class="bottom_con">
<view class="text2">
{{addressInfo.address}}
</view>
<view class="text3 copy" @click="copyTextMethod">
<image src="../../../static/tongyonh/copy_24px_2.png" mode="aspectFit" class="copyImg"></image>
Copy address
<view class="main_con">
<image :src="addressInfo.icon" mode="aspectFit" class="logoimg"></image>
<view class="title">
{{addressInfo.name}} Receiving address
</view>
<view class="code_con">
<tki-qrcode ref="qrcode" :val="addressInfo.address" :size="size" :unit="unit"
:background="background" :foreground="foreground" :pdground="pdground" :lv="lv" :onval="onval"
:loadMake="loadMake" :showLoading="showLoading" :loadingText="loadingText" :icon="icon"
class="test" />
</view>
<view class="text1">
Scan the QR code to transfer to the asset
</view>
<view class="bottom_con">
<view class="text2">
{{addressInfo.address}}
</view>
<!-- <view class="text3">
<view class="text3 copy" @click="copyTextMethod">
<image src="../../../static/tongyonh/copy_24px_2.png" mode="aspectFit" class="copyImg"></image>
Copy address
</view>
<!-- <view class="text3">
<image src="../../../static/tongyonh/Frame58.png" mode="aspectFit" class="copyImg"></image>
Switching address
</view> -->
</view>
</view>
</view>
<view class="info_con green" :class="toTop?'goTop':''">
<view class="info_con green" :class="toTop?'goTop':''">
<image src="../../../static/tongyonh/copy_24px_2.png" mode="aspectFit" class="copyImg"></image>
Copy address Successful!
</view>
</view>
</view>
</view>
</template>
@ -53,67 +54,65 @@
},
data() {
return {
addressInfo:{},
toTop:false,
//
showErweiMask: false,
ercodeText: '',
size: 400,
background: '#ffffff',
foreground: '#000000',
pdground: '#000000',
iconsize: 30,
lv: 3,
onval: true,
unit: 'upx',
loadMake: true,
icon: '',
showLoading: true,
loadingText: 'One moment please',
//
}
addressInfo: {},
toTop: false,
//
showErweiMask: false,
ercodeText: '',
size: 400,
background: '#ffffff',
foreground: '#000000',
pdground: '#000000',
iconsize: 30,
lv: 3,
onval: true,
unit: 'upx',
loadMake: true,
icon: '',
showLoading: true,
loadingText: 'One moment please',
//
}
},
methods: {
copyTextMethod() {
// #ifdef H5
this.$copyText(this.addressInfo.address).then(res => {
this.toTop=true;
setTimeout(()=>{
this.toTop=false;
},1500)
})
// #endif
// #ifdef APP-PLUS
var that=this
console.log(123132)
uni.setClipboardData({
data: this.addressInfo.address,
success() {
uni.hideToast()
that.toTop=true;
setTimeout(()=>{
that.toTop=false;
},1500)
}
})
// #endif
},
copyTextMethod() {
// #ifdef H5
this.$copyText(this.addressInfo.address).then(res => {
this.toTop = true;
setTimeout(() => {
this.toTop = false;
}, 1500)
})
// #endif
// #ifdef APP-PLUS
var that = this
console.log(123132)
uni.setClipboardData({
data: this.addressInfo.address,
success() {
uni.hideToast()
that.toTop = true;
setTimeout(() => {
that.toTop = false;
}, 1500)
}
})
// #endif
},
},
onLoad() {
this.addressInfo=uni.getStorageSync('coin')
this.addressInfo = uni.getStorageSync('coin')
}
};
</script>
<style scoped>
page{
page {
background: #FAFAFA;
}
</style>
<style>
@import './index.css';
</style>

320
pages/menu/sendToken/transfer/index.vue

@ -27,7 +27,7 @@
<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" />
v-model="transInfoPass.toAddress" />
<image src="../../../../static/tongyonh/Frame330.png" mode="aspectFit" class="img1"></image>
</view>
</view>
@ -44,15 +44,16 @@
{{coin.name}}
</view>
<input type="text" value="" placeholder-style="font-size: 30rpx; color: #D0D0D2;"
placeholder="0.0000000" class="input3" v-model="transAmount" />
placeholder="0.0000000" class="input3" v-model="transInfoPass.amount" />
</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" />
<input type="text" value="" disabled="disabled"
placeholder-style="font-size: 30rpx; color: #D0D0D2;" placeholder="0.0000000"
class="input3" />
</view>
</view>
<view class="top flex bottom">
@ -74,7 +75,7 @@
</view>
<view class="inputcon">
<input type="text" value="" placeholder-style="font-size: 30rpx; color: #D0D0D2;"
placeholder="Please enter a note (off-chain)" class="input1" />
placeholder="Please enter a note (off-chain)" v-model="transInfoPass.remark" class="input1" />
</view>
</view>
@ -89,7 +90,7 @@
<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="text2">{{coin.type}}</text>
<text class="text2">{{coin.type}}</text>
</view>
</view>
</view>
@ -114,7 +115,7 @@
Amount
</view>
<view class="text1">
{{transAmount}} {{coin.name}}
{{transInfoPass.amount}} {{coin.name}}
</view>
</view>
<view class="item">
@ -122,7 +123,7 @@
Send address
</view>
<view class="text2">
{{coin.address}}
{{transInfoPass.fromAddress}}
</view>
</view>
<view class="item">
@ -130,7 +131,7 @@
Receiving address
</view>
<view class="text2">
{{recipientAddress}}
{{transInfoPass.toAddress}}
</view>
</view>
<view class="item">
@ -156,7 +157,7 @@
</view>
</view>
<u-mask z-index="10" :show="show"></u-mask>
<u-mask z-index="10" :show="show" @click="cancelAll"></u-mask>
<!-- <u-mask z-index="1000" :show="show2" @click="show2 = false"></u-mask> -->
<view class="zhiwen_con" v-if="showFinger">
<view class="tiao" @click="cancel">
@ -170,7 +171,7 @@
Touch the fingerprint sensor
</view>
<view class="flex con">
<view class="textt1" @click="goPassword" v-if="!passShow">
<view class="textt1" @click="goPassword">
Use Password
</view>
<view class="textt2" @click="cancel">
@ -213,14 +214,14 @@
<view class="text1 green">
Fingerprint recognized.
</view>
<!-- <view class="flex con">
<view class="textt1">
Use Password
<view class="flex con">
<view class="textt1">
Use Password
</view>
<view class="textt2">
Confirm
Confirm
</view>
</view> -->
</view>
</view>
</view>
@ -243,15 +244,12 @@
export default {
data() {
return {
coin:{},
coin: {},
fee: 0,
show: false,
show2: false,
showFinger: false,
showBottom: false,
addressInfo: {},
recipientAddress: '',
transAmount: '',
fingerSuccess: false,
fingerFail: false,
// 使
@ -259,16 +257,85 @@
//
transInfoPass: {
fromAddress: '',
toAddress: "",
toAddress: '1',
privateKey: '',
amount: '',
amount: '1',
remark:'1',
contractAddress:'',
password:''
}
}
},
methods: {
cancelAll(){
this.show=false;
this.showBottom=false;
transaction() {
let that=this;
if (this.coin.type === 'ETH') {
this.$EthUtil.transaction(this.transInfoPass.fromAddress, this.transInfoPass.privateKey,
this.transInfoPass.toAddress, this.transInfoPass.amount, this.transInfoPass.contractAddress,
function(hash, err) {
if (!err) {
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)
} else {
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
})
}
})
} else if (this.coin.type === 'TRX') {
this.$TronUtil.transaction(this.transInfoPass.fromAddress, this.transInfoPass.privateKey,
this.transInfoPass.toAddress, this.transInfoPass.amount, this.transInfoPass.remark, this.transInfoPass.contractAddress)
.then((res) => {
console.log(1212121212121212)
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
})
})
}
},
cancelAll() {
this.show = false;
this.showBottom = false;
},
cancelFail() {
this.printCancel()
@ -278,36 +345,39 @@
},
cancel() {
this.showFinger = false
this.showBottom=true;
this.showBottom = true;
this.printCancel()
},
//
goPassword() {
this.printCancel();
this.show = false;
this.showBottom=false;
console.log(111)
uni.setStorageSync('transInfoPass', this.transInfoPass)
uni.navigateTo({
url: '/pages/menu/sendToken/enPassword/index'
})
},
//
confirmTo(type) {
if (type == 'try') {
this.fingerFail = false;
if(!this.passShow){
this.goPassword();
}else{
console.log('点击提交')
if (type == 'try') {
this.fingerFail = false;
}
console.log(123123132132132)
this.show = true
this.showFinger = true
this.showBottom = false;
this.fingerprint();
}
console.log(123123132132132)
this.show = true
this.showFinger = true
this.showBottom = false;
//
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)
this.fingerprint();
},
back() {
uni.reLaunch({
@ -316,12 +386,12 @@
},
//
forAll() {
this.transAmount = this.coin.balance
this.transInfoPass.amount = this.coin.balance
},
//
Confirm() {
//
if (this.transAmount == '') {
if (this.transInfoPass.amount == '') {
uni.showToast({
title: 'Please enter the transfer amount',
icon: 'none',
@ -329,7 +399,7 @@
})
return
}
if (this.recipientAddress == '') {
if (this.transInfoPass.toAddress == '') {
uni.showToast({
title: 'Please enter the receiving address',
icon: 'none',
@ -337,7 +407,7 @@
})
return
}
if (this.transAmount == '' < 0) {
if (Number(this.transInfoPass.amount) == '' < 0) {
uni.showToast({
title: 'The entered amount cannot be less than 0',
icon: 'none',
@ -345,7 +415,7 @@
})
return
}
if( this.transAmount>this.coin.balance){
if (Number(this.transInfoPass.amount) > this.coin.balance) {
uni.showToast({
title: 'Sorry, your credit is running low',
icon: 'none',
@ -357,13 +427,13 @@
this.show = true;
},
//
printCancel(){
this.showFinger=false;
console.log(this.showFinger,4444)
plus.fingerprint.cancel();
console.log(this.showFinger,4444)
},
printCancel() {
this.showFinger = false;
console.log(this.showFinger, 4444)
//plus.fingerprint.cancel();
console.log(this.showFinger, 4444)
},
fingerprint: function(sett) {
let bltype = true;
// #ifdef APP-PLUS
@ -412,127 +482,9 @@
// #ifdef APP-PLUS
plus.fingerprint.authenticate(function() {
plus.nativeUI.closeWaiting(); //Android
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)
// if (!this.contractAddress) {
//
that.$TronUtil.sendTransaction(that.transInfoPass.fromAddress,that.transInfoPass.privateKey,that.transInfoPass.toAddress,that.transInfoPass.amount )
.then((res) => {
console.log(1212121212121212)
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
})
})
// }else{
// this.$TronUtil.sendRawTransaction(this.info.address, this.info.privateKey, this.toAddress, this.toValue,'',this.contractAddress )
// .then((res) => {
// uni.showToast({
// title: 'Successfully',
// icon: 'success',
// duration: 2000
// })
// this.show2 = false;
// uni.reLaunch({
// url: '/pages/menu/wallet/index'
// })
// }).catch(err => {
// console.log(err)
// uni.showToast({
// title: err,
// icon: 'none',
// duration: 2000
// })
// })
// }
}
if (that.addressInfo.type == 'ETH') {
console.log(that.addressInfo.type,11111)
console.log(that.transInfoPass,2222)
// if (!this.contractAddress) {
//
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
})
})
// }else{
// this.$TronUtil.sendRawTransaction(this.info.address, this.info.privateKey, this.toAddress, this.toValue,'',this.contractAddress )
// .then((res) => {
// uni.showToast({
// title: 'Successfully',
// icon: 'success',
// duration: 2000
// })
// this.show2 = false;
// uni.reLaunch({
// url: '/pages/menu/wallet/index'
// })
// }).catch(err => {
// console.log(err)
// uni.showToast({
// title: err,
// icon: 'none',
// duration: 2000
// })
// })
// }
}
that.transaction()
}, function(e) {
switch (e.code) {
case e.AUTHENTICATE_MISMATCH:
@ -609,18 +561,20 @@
}
},
onLoad() {
//
if(uni.getStorageSync('myTransAddress')){
this.recipientAddress=uni.getStorageSync('myTransAddress').address
//
uni.removeStorageSync('myTransAddress')
}
this.coin=uni.getStorageSync('coin')
this.coin = uni.getStorageSync('coin')
//
this.transInfoPass.fromAddress=this.coin.address;
this.transInfoPass.privateKey=this.coin.privateKey;
this.transInfoPass.password=this.coin.password;
this.transInfoPass.contractAddress=this.coin.contractAddress
this.transInfoPass.type=this.coin.type;
console.log(this.transInfoPass,'指纹')
if (uni.getStorageSync('fingerPass')) {
this.passShow = uni.getStorageSync('fingerPass')
}
}
};
</script>

7
pages/menu/setting/index.vue

@ -5,12 +5,7 @@
</navigation>
<view class="main">
<view class="main_con">
<view class="item flex">
<view class="text1">
Payment password
</view>
<image src="../../../static/tongyonh/chevron_right_24px.png" mode="aspectFit" class="img1"></image>
</view>
<view class="item flex">
<view class="text1">
Fingerprint password

158
pages/menu/token/btc/index.css

@ -1,185 +1,211 @@
.renYou{
.renYou {
width: 48rpx;
height: 48rpx;
position: absolute;
right: 30rpx;
}
.big_title{
.big_title {
font-size: 36rpx;
}
.main .money_con{
.main .money_con {
display: block;
width:95%;
width: 95%;
margin: 0 auto;
margin-top: 50rpx;
margin-bottom: 50rpx;
height: 320rpx;
background-image: linear-gradient(to right, #FF820C , #FFB606);
padding: 40rpx 50rpx;
background-image: linear-gradient(to right, #FF820C, #FFB606);
padding: 40rpx 50rpx;
border-radius: 24rpx;
}
.textcon1{
.textcon1 {
display: flex;
align-items: center;
justify-content: space-between;
line-height: 56rpx;
}
.textcon1 .text1{
.textcon1 .text1 {
color: #fff;
font-size: 56rpx ;
font-size: 56rpx;
}
.textcon1 .text1 .text2{
.textcon1 .text1 .text2 {
color: #fff;
font-size: 32rpx ;
font-size: 32rpx;
}
.textcon1 .img1{
.textcon1 .img1 {
width: 100rpx;
height: 110rpx;
}
.textcon1 .v1{
}
.textcon1 .v1 .t1{
.textcon1 .v1 {}
.textcon1 .v1 .t1 {
color: #fff;
font-size: 32rpx;
}
.textcon1 .v1 .t2{
.textcon1 .v1 .t2 {
color: #fff;
font-size: 24rpx;
}
.textcon1 .v2{
.textcon1 .v2 {
margin-right: 100rpx;
}
.select_con{
.select_con {
width: 100%;
padding-bottom: 260rpx;
padding-bottom: 260rpx;
}
.select_con .select{
margin: 0 12px;
.select_con .select {
margin: 0 12px;
border-radius: 30rpx;
background-color: #fff;
background-color: #fff;
box-shadow: 0 0 30px #EBEEF1;
}
/deep/ .u-tabs{
/deep/ .u-tabs {
border-bottom: 2rpx solid #F6F8FD;
border-radius: 30rpx 30rpx 0 0;
}
.select_con .item1{
.select_con .item1 {
display: flex;
justify-content: space-between;
padding-top: 60rpx;
padding-bottom: 50rpx;
border-bottom: 2rpx solid #F6F8FD;
padding-left: 40rpx;
padding-right: 24rpx;
padding-right: 24rpx;
}
.select_con .item1 .lef_con{
.select_con .item1 .lef_con {
display: flex;
align-items: center;
}
.select_con .item1 .lef_con .img1{
.select_con .item1 .lef_con .img1 {
width: 48rpx;
height: 48rpx;
}
.select_con .item1 .lef_con .textcon{
.select_con .item1 .lef_con .textcon {
margin-left: 24rpx;
}
.select_con .item1 .lef_con .textcon .text1{
font-size: 32rpx;
.select_con .item1 .lef_con .textcon .text1 {
font-size: 26rpx;
}
.select_con .item1 .lef_con .textcon .text2{
font-size: 24rpx;
.select_con .item1 .lef_con .textcon .text2 {
font-size: 22rpx;
color: #999;
}
.select_con .item1 .rig_con .text1{
font-size: 32rpx;
.select_con .item1 .rig_con .text1 {
font-size: 24rpx;
}
.select_con .item1 .rig_con .img1{
.select_con .item1 .rig_con .img1 {
width: 28rpx;
height: 20rpx;
float: right;
margin-top: 20rpx;
}
.select_con .item1 .rig_con .img2{
.select_con .item1 .rig_con .img2 {
width: 28rpx;
height: 40rpx;
float: right;
margin-top: 20rpx;
}
.btnconn{
position: fixed;
bottom: 0;
.btnconn {
position: fixed;
bottom: 0;
background-color: #fff;
padding: 24rpx 24rpx;
width: 100%;
display: flex;
justify-content: space-between;
}
.btnconn .btn{
width: 334rpx;
line-height: 96rpx;
.btnconn .btn {
width: 306rpx;
line-height: 78rpx;
border-radius: 30rpx;
border: 2rpx solid #5B53FF;
text-align: center;
display: flex;
align-items: center;
color:#5B53FF;
justify-content: center;
font-size: 34rpx;
color: #5B53FF;
justify-content: center;
font-size: 28rpx;
position: relative;
}
.active{
color: #fff !important;
.active {
color: #fff !important;
background-color: #5B53FF;
}
.btnconn .btn .img1{
.btnconn .btn .img1 {
width: 48rpx;
height: 48rpx;
}
.arrow-up-left{
width: 48rpx;
height: 48rpx;
.arrow-up-left {
width: 44rpx;
height: 44rpx;
position: absolute;
top: 50%;
transform: translateY(-50%);
left: 68rpx;
}
.btn13{
.btn13 {
margin-left: 40rpx;
}
.main .money_con{
.main .money_con {
margin-top: 32rpx;
background-image: linear-gradient(to right, #6441CF , #877BFE);
height: 320rpx;
background-image: linear-gradient(to right, #6441CF, #877BFE);
height: 320rpx;
padding: 40rpx 36rpx;
position: relative;
border-radius: 24rpx;
}
.main .money_con2{
.main .money_con2 {
margin-top: 32rpx;
background-image: linear-gradient(to right, #FF820C , #FFB606);
height: 320rpx;
background-image: linear-gradient(to right, #FF820C, #FFB606);
height: 320rpx;
padding: 40rpx 36rpx;
position: relative;
border-radius: 24rpx;
}
.main .money_con3{
.main .money_con3 {
margin-top: 32rpx;
background-image: linear-gradient(to right, #B6162A , #F96D7D);
height: 320rpx;
background-image: linear-gradient(to right, #B6162A, #F96D7D);
height: 320rpx;
padding: 40rpx 36rpx;
position: relative;
border-radius: 24rpx;
}
.select_con .item1 .rig_con .text1 text{
margin-left: 10rpx;
.select_con .item1 .rig_con .text1 text {
margin-left: 10rpx;
}
/deep/ .u-empty {
padding: 30px !important;
}
padding: 30px !important;
}

2
pages/menu/token/btc/index.vue

@ -45,7 +45,7 @@
<view class="select_con">
<view class="select">
<u-tabs height="120" bar-width="172" active-color="#6F69FF" inactive-color="#A3AED0" :list="list"
<u-tabs height="120" bar-width="172" active-font="13" inactive-font="13" active-color="#6F69FF" inactive-color="#A3AED0" :list="list"
:is-scroll="false" :current="current" @change="change"></u-tabs>
<u-empty text="No content" mode="list" v-if="showInfo"></u-empty>

215
pages/menu/transction/detail/index.vue

@ -2,102 +2,103 @@
<view class="">
<navigation :showBack="true" :bgnum="true">
<text class="big_title">
Transaction details
Transaction details
</text>
</navigation>
<view class="main">
<view class="main_con">
<view class="yuan">
<image src="../../../../static/tongyonh/check-circle.png" mode="aspectFit" class="img1"></image>
</view>
<view class="title">
Confirmed
</view>
<view class="scroll">
<view class="title_con flex">
<view class="text1">
Amount
</view>
<view class="text1">
{{info.value}} {{info.network}}
</view>
</view>
<view class="item">
<view class="text1">
Time
</view>
<view class="text2">
{{info.time}}
</view>
</view>
<view class="item">
<view class="text1">
Tx Fee
</view>
<view class="text2">
{{info.fee}} {{info.network}}
</view>
</view>
<view class="item">
<view class="text1">
Transaction ID
</view>
<view class="text2">
{{info.txid}}
<image src="../../../../static/tongyonh/copy_24px.png" mode="aspectFit" class="img" @click="show = true"></image>
</view>
</view>
<view class="item">
<view class="text1">
Send address
<text v-if="info.type=='out'"> (others)</text>
<text v-else>(me)</text>
</view>
<view class="text2">
{{info.from}}
<image src="../../../../static/tongyonh/copy_24px.png" mode="aspectFit" class="img"></image>
</view>
</view>
<view class="item">
<view class="text1">
Receiving address
<text v-if="info.type=='in'">(me)</text>
<text v-else>(others)</text>
</view>
<view class="text2">
{{info.to}}
<image src="../../../../static/tongyonh/copy_24px.png" mode="aspectFit" class="img"></image>
</view>
</view>
</view>
<view class="item goto">
Go to your browser for more information
</view>
<view class="sett" v-if="show">
<view class="top">
<view class="item">
Copy address
</view>
<view class="item">
Add to Address Book
<view class="main_con">
<view class="yuan">
<image src="../../../../static/tongyonh/check-circle.png" mode="aspectFit" class="img1"></image>
</view>
</view>
<view class="cancel" @click="show = false">
Cancel
<view class="title">
Confirmed
</view>
<view class="scroll">
<view class="title_con flex">
<view class="text1">
Amount
</view>
<view class="text1">
{{info.value}} {{info.network}}
</view>
</view>
<view class="item">
<view class="text1">
Time
</view>
<view class="text2">
{{info.time}}
</view>
</view>
<view class="item">
<view class="text1">
Tx Fee
</view>
<view class="text2">
{{info.fee}} {{info.network}}
</view>
</view>
<view class="item">
<view class="text1">
Transaction ID
</view>
<view class="text2">
{{info.txid}}
<image src="../../../../static/tongyonh/copy_24px.png" mode="aspectFit" class="img"
@click="copyTextMethod(info.txid)"></image>
</view>
</view>
<view class="item">
<view class="text1">
Send address
<text v-if="isIn"> (others)</text>
<text v-else>(me)</text>
</view>
<view class="text2">
{{info.from}}
<image @click="copyTextMethod(info.from)" src="../../../../static/tongyonh/copy_24px.png" mode="aspectFit" class="img"></image>
</view>
</view>
<view class="item">
<view class="text1">
Receiving address
<text v-if="isIn">(me)</text>
<text v-else>(others)</text>
</view>
<view class="text2">
{{info.to}}
<image @click="copyTextMethod(info.to)" src="../../../../static/tongyonh/copy_24px.png" mode="aspectFit" class="img"></image>
</view>
</view>
</view>
<view class="item goto">
Go to your browser for more information
</view>
<!-- <view class="sett" v-if="show">
<view class="top">
<view class="item">
Copy address
</view>
<view class="item">
Add to Address Book
</view>
</view>
<view class="cancel" @click="show = false">
Cancel
</view>
</view> -->
</view>
<u-mask :show="show" z-index="10"></u-mask>
</view>
</view>
<u-mask :show="show" z-index="10"></u-mask>
</view>
</view>
</view>
@ -109,16 +110,48 @@
export default {
data() {
return {
show: false,
info:{},
show: false,
info: {},
isIn:true,
toTop: false,
}
},
methods: {
copyTextMethod(text) {
console.log(text)
// #ifdef H5
this.$copyText(text).then(res => {
// Copy address Successful!
uni.showToast({
title: 'Copy Successful!',
icon: 'none',
duration: 1500
})
})
// #endif
// #ifdef APP-PLUS
var that = this
console.log(123132)
uni.setClipboardData({
data: text,
success() {
uni.showToast({
title: 'Copy Successful!',
icon: 'none',
duration: 1500
})
}
})
// #endif
}
},
onLoad(option) {
this.info=uni.getStorageSync('transDetail')
this.info.time = index.formatyymmddhhmmss33(this.info.time);
this.info = uni.getStorageSync('transDetail')
console.log(this.info.type)
this.isIn=this.info.type==='in';
console.log(this.isIn)
this.info.time = index.formatyymmddhhmmss33(this.info.time);
}
};
</script>

2
pages/menu/wallet/cwallet/index.css

@ -133,7 +133,7 @@
.bot_con .item .rig{
text-align: right;
color: #fff;
font-size: 34rpx;
font-size: 30rpx;
}
.bot_con .item .rig .text1{

34
pages/menu/wallet/index.vue

@ -106,8 +106,11 @@
onLoad() {
//
this.userObj = uni.getStorageSync('wallet');
// this.userObj2 = uni.getStorageSync('wallet');
this.updateData();
let that=this;
this.$walletUtil.updateBalance(function(){
that.userObj = uni.getStorageSync('wallet');
that.userObj2 = uni.getStorageSync('wallet');
});
},
// onPullDownRefresh() {
@ -118,30 +121,7 @@
// }, 500);
// },
methods: {
updateData() {
let thar = this;
setTimeout(
function() {
thar.userObj = uni.getStorageSync('wallet');
thar.userObj2 = uni.getStorageSync('wallet');
// thar.userObj.address = thar.userObj.ellipsisAddress;
// thar.userObj.address =thar.userObj.address.substring(0, 6) + '...' + thar.userObj.address.substring(25,
// thar.userObj.address.length);
// thar.$walletUtil.updateBalance();
// thar.updateData();
// }, 100);
thar.$walletUtil.updateBalance();
console.log(thar.isStop,4444)
if (!thar.isStop) {
// thar.updateData()
}
}, 2000);
},
goOther() {
console.log(this.userObj2, 8888)
let item = JSON.stringify(this.userObj2)
@ -163,7 +143,9 @@
goTrans(itemm, index) {
let coin = this.userObj.coinList[index];
coin.type=this.userObj.type;
coin.privateKey=this.userObj.privateKey;
coin.address=this.userObj.address;
coin.password=this.userObj.password;
uni.setStorageSync('coin',coin)
uni.navigateTo({
url: '/pages/menu/token/btc/index'

8
pages/menu/wallet/mwallet/index.css

@ -102,18 +102,18 @@
width:auto;flex:1
}
.bot_con .item .left .textcon .text1{
font-size: 36rpx;
font-size: 30rpx;
color: #fff;
}
.bot_con .item .left .textcon .text2{
font-size: 28rpx;
color: rgba(255,255,255,.5);
font-size: 24rpx;
color: #FFFFFF;
word-break: break-word;
}
.bot_con .item .rig{
text-align: right;
color: #fff;
font-size: 34rpx;
font-size: 30rpx;
}
.bot_con .item .rig .text1{

10
utils/EthUtil.js

@ -97,7 +97,7 @@ let eth = {
transaction: async function(fromAddress, toAddress, value, privateKey, success) {
sendTransaction: async function(fromAddress, toAddress, value, privateKey, success) {
var nonce = await web3.eth.getTransactionCount(fromAddress);
var gas = await web3.eth.estimateGas({
@ -208,6 +208,14 @@ let eth = {
},
transaction:async function(fromAddress, toAddress, value, privateKey, contract, success){
if(contract){
await this.sendTokenTransaction(fromAddress, toAddress, value, privateKey, contract, success);
}else{
await this.sendTransaction(fromAddress, toAddress, value, privateKey, success)
}
}
}
export default eth;

7
utils/TronUtil.js

@ -76,6 +76,13 @@ let tron = {
}
return null;
},
transaction:async function(fromAddress, privateKey, toAddress, amount, remark, contract){
if(contract){
return await this.sendRawTransaction(fromAddress, privateKey, toAddress, amount, remark, contract);
}else{
return await this.sendTransaction(fromAddress, privateKey, toAddress, amount);
}
},
getContract:function(address,list,success){
uni.request({
url: 'https://apiasia.tronscan.io:5566/api/account/tokens?limit=100&address=' + address, //请求接口

449
utils/WalletUtil.js

@ -7,7 +7,7 @@ let fullWallet = {
"BTC": [{
balance: 0,
name: "BTC",
type:'BTC',
type: 'BTC',
coinList: [{
name: "BTC",
xname: 'Bitcoin',
@ -18,7 +18,7 @@ let fullWallet = {
"ETH": [{
balance: 0,
name: "ETH",
type:'ETH',
type: 'ETH',
coinList: [{
name: "ETH",
xname: 'Ethereum',
@ -37,7 +37,7 @@ let fullWallet = {
"TRX": [{
balance: 0,
name: "TRX",
type:'TRX',
type: 'TRX',
coinList: [{
name: "TRX",
xname: 'TRON',
@ -58,7 +58,7 @@ let fullWallet = {
let WalletUtil = {
//初次创建钱包
initialWallet: function(mnemonic, password) {
console.log(password,'password')
console.log(password, 'password')
let walletInfo = fullWallet;
let btc = TokenUtil.generateBtc(mnemonic);
walletInfo.BTC[0].password = password;
@ -95,30 +95,30 @@ let WalletUtil = {
//助记词新建
mnemonicEstablishWallet: function(type, mnemonic, password) {
let walletInfo = uni.getStorageSync('walletInfo');
console.log(password,'password',type)
console.log(password, 'password', type)
let walletdec;
switch (type) {
case 'BTC':
walletdec = TokenUtil.generateBtc(mnemonic);
if(uni.getStorageSync('walletInfo')){
uni.setStorageSync('walleti',walletdec.address)
if (uni.getStorageSync('walletInfo')) {
uni.setStorageSync('walleti', walletdec.address)
}
break;
case 'ETH':
walletdec = TokenUtil.generateEth(mnemonic);
if(uni.getStorageSync('walletInfo')){
uni.setStorageSync('walleti',walletdec.address)
if (uni.getStorageSync('walletInfo')) {
uni.setStorageSync('walleti', walletdec.address)
}
break;
case 'TRX':
walletdec = TokenUtil.generateTron(mnemonic);
if(uni.getStorageSync('walletInfo')){
uni.setStorageSync('walleti',walletdec.address)
if (uni.getStorageSync('walletInfo')) {
uni.setStorageSync('walleti', walletdec.address)
}
break;
}
let wallet = fullWallet[type][0];
@ -132,13 +132,13 @@ let WalletUtil = {
uni.setStorageSync('walletInfo', walletInfo);
uni.setStorageSync('wallet', wallet);
uni.setStorageSync('walleti', wallet.address);
},
//私钥新建
privateKeyEstablishWallet: function(type, privateKey, password) {
let walletInfo = uni.getStorageSync('walletInfo');
console.log(type)
console.log(password,'password')
console.log(password, 'password')
let walletdec;
switch (type) {
case 'BTC':
@ -156,7 +156,7 @@ let WalletUtil = {
wallet.privateKey = walletdec.privateKey;
wallet.address = walletdec.address;
walletInfo[type].push(wallet);
console.log(walletInfo,'当前私钥建的')
console.log(walletInfo, '当前私钥建的')
uni.setStorageSync('walletInfo', walletInfo);
uni.setStorageSync('wallet', wallet);
uni.setStorageSync('walleti', wallet.address);
@ -176,8 +176,9 @@ let WalletUtil = {
for (let obj in walletInfo) {
for (var k = 0, length = walletInfo[obj].length; k < length; k++) {
let address = walletInfo[obj][k].address;
walletInfo[obj][k].ellipsisAddress = address.substring(0, 6) + '...' + address.substring(address.length-6,
walletInfo[obj][k].ellipsisAddress = address.substring(0, 6) + '...' + address.substring(
address.length - 6,
address.length);
walletInfo[obj][k].type = obj;
walletList.push(walletInfo[obj][k]);
@ -199,78 +200,86 @@ let WalletUtil = {
uni.setStorageSync('wallet', walletList[k]);
break;
}
}
},
updateBalance:function() {
updateBalance: function(success) {
const wallet = uni.getStorageSync('wallet');
console.log(wallet,'更新余额')
console.log(wallet, '更新余额')
const walletInfo = uni.getStorageSync('walletInfo');
for (var k = 0, length = walletInfo[wallet.type].length; k < length; k++) {
if (walletInfo[wallet.type][k].address === wallet.address) {
walletInfo[wallet.type][k]=wallet;
break;
if (walletInfo[wallet.type][k].address === wallet.address) {
walletInfo[wallet.type][k] = wallet;
break;
}
}
uni.setStorageSync('walletInfo', walletInfo);
let that=this
this.getPrice(wallet.type,function(rr){
that.getPrice('USDT',function(usdt){
uni.setStorageSync('walletInfo', walletInfo);
let that = this
this.getPrice(wallet.type, function(rr) {
that.getPrice('USDT', function(usdt) {
switch (wallet.type) {
case 'BTC':
console.log("进来BTC")
BtcUtil.getBalance(wallet.address,function(balance){
wallet.balance=balance;
wallet.balancePrice=(balance*rr).toFixed(2);
wallet.coinList[0].balance=balance
wallet.coinList[0].balancePrice=wallet.balancePrice
console.log("进来BTC")
BtcUtil.getBalance(wallet.address, function(balance) {
wallet.balance = balance;
wallet.balancePrice = (balance * rr).toFixed(2);
wallet.coinList[0].balance = balance
wallet.coinList[0].balancePrice = wallet.balancePrice
uni.setStorageSync('wallet', wallet);
success()
})
break;
case 'ETH':
console.log("进来ETH")
EthUtil.getBalance(wallet.address,function(balance){
wallet.balance=balance;
wallet.balancePrice=(balance*rr).toFixed(2);
wallet.coinList[0].balance=balance
wallet.coinList[0].balancePrice=wallet.balancePrice
for(let i=1;i<wallet.coinList.length;i++){
EthUtil.getTokenBalance(wallet.address,wallet.coinList[i].contractAddress,function(b){
wallet.coinList[i].balance=b;
wallet.coinList[1].balancePrice=(wallet.coinList[1].balance*usdt).toFixed(2);
console.log("进来ETH")
EthUtil.getBalance(wallet.address, function(balance) {
wallet.balance = balance;
wallet.balancePrice = (balance * rr).toFixed(2);
wallet.coinList[0].balance = balance
wallet.coinList[0].balancePrice = wallet.balancePrice
for (let i = 1; i < wallet.coinList.length; i++) {
EthUtil.getTokenBalance(wallet.address, wallet.coinList[
i].contractAddress, function(b) {
wallet.coinList[i].balance = b;
wallet.coinList[1].balancePrice = (wallet
.coinList[1].balance * usdt)
.toFixed(2);
uni.setStorageSync('wallet', wallet);
success()
});
}
});
break;
case 'TRX':
console.log("进来TRX")
TronUtil.getTronBalance(wallet.address).then((res) => {
wallet.balance=res;
wallet.balancePrice=(res*rr).toFixed(2);
wallet.coinList[0].balance=res
wallet.coinList[0].balancePrice=wallet.balancePrice
TronUtil.getContract(wallet.address,wallet.coinList,function(list){
wallet.coinList=list;
wallet.coinList[1].balancePrice=(wallet.coinList[1].balance*usdt).toFixed(2);
console.log(wallet.coinList)
uni.setStorageSync('wallet', wallet);
})
wallet.balance = res;
wallet.balancePrice = (res * rr).toFixed(2);
wallet.coinList[0].balance = res
wallet.coinList[0].balancePrice = wallet.balancePrice
TronUtil.getContract(wallet.address, wallet.coinList,
function(list) {
wallet.coinList = list;
wallet.coinList[1].balancePrice = (wallet
.coinList[1].balance * usdt).toFixed(2);
console.log(wallet.coinList)
uni.setStorageSync('wallet', wallet);
success()
})
})
break;
}
})
})
},
getPrice:function(type,success){
getPrice: function(type, success) {
uni.request({
url: 'https://apilist.tronscan.org/api/token/price?token=' + type.toLowerCase(), //请求接口
header: {
@ -279,61 +288,61 @@ let WalletUtil = {
success: (res) => {
console.log(res.data.price_in_usd)
success(res.data.price_in_usd)
}
});
},
// 封装地址方法
updateAddress:function(type,value,bigAddress,addressName) {
let that=this
switch (wallet.type) {
case 'BTC':
break;
case 'ETH':
break;
case 'TRX':
if(value=='ETH'){
const gai = uni.getStorageSync('ETHAddressInfo')
const gai2 = uni.getStorageSync('TRXAddressInfo')
const index=uni.getStorageSync('editIndex')
let eth=new Object;
eth.address=bigAddress;
eth.name=addressName
eth.coinList=[{
name:"ETH",
name2:"ETH",
xname:'Ethereum',
icon:require('@/static/tongyonh/Frame3299.png')
}];
gai2.splice(index,1)
uni.setStorageSync('TRXAddressInfo',gai2)
gai.push(eth);
uni.setStorageSync('ETHAddressInfo',gai)
uni.showToast({
title: 'Successfully',
icon: 'success',
duration: 1500
})
uni.navigateTo({
url:'../address/index'
})
}
break;
updateAddress: function(type, value, bigAddress, addressName) {
let that = this
switch (wallet.type) {
case 'BTC':
break;
case 'ETH':
break;
case 'TRX':
if (value == 'ETH') {
const gai = uni.getStorageSync('ETHAddressInfo')
const gai2 = uni.getStorageSync('TRXAddressInfo')
const index = uni.getStorageSync('editIndex')
let eth = new Object;
eth.address = bigAddress;
eth.name = addressName
eth.coinList = [{
name: "ETH",
name2: "ETH",
xname: 'Ethereum',
icon: require('@/static/tongyonh/Frame3299.png')
}];
gai2.splice(index, 1)
uni.setStorageSync('TRXAddressInfo', gai2)
gai.push(eth);
uni.setStorageSync('ETHAddressInfo', gai)
uni.showToast({
title: 'Successfully',
icon: 'success',
duration: 1500
})
uni.navigateTo({
url: '../address/index'
})
}
break;
}
},
// 指纹识别
finger(){
finger() {
// #ifdef APP-PLUS
if (!plus.fingerprint.isSupport()) {
this.result = '此设备不支持指纹识别';
@ -357,116 +366,118 @@ let WalletUtil = {
this.result = '此平台不支持指纹识别';
// #endif
},
fingerprint: function(sett) {
let bltype=true;
// #ifdef APP-PLUS
if (!plus.fingerprint.isSupport()) {
uni.showToast({
title: 'This device does not support fingerprint identification',
icon: 'none',
duration: 1500
})
// this.disabled = true;
} 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
})
// this.disabled = true;
} else {
// this.result = '此设备支持指纹识别';
// // this.disabled = false;
// #ifdef MP-WEIXIN
// this.disabled = false;
fingerprint: function(sett) {
let bltype = true;
// #ifdef APP-PLUS
if (!plus.fingerprint.isSupport()) {
uni.showToast({
title: 'This device does not support fingerprint identification',
icon: 'none',
duration: 1500
})
// this.disabled = true;
} 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
})
// this.disabled = true;
} else {
// this.result = '此设备支持指纹识别';
// // this.disabled = false;
// #ifdef MP-WEIXIN
// this.disabled = false;
uni.showToast({
title: 'Please use it in wechat real machine. The simulator does not support it',
icon: 'none',
duration: 1500
})
// #endif
// #ifndef APP-PLUS || MP-WEIXIN
uni.showToast({
title: 'Fingerprint identification is not supported on this platform',
icon: 'none',
duration: 1500,
})
// #endif
let that = this;
let forSett = true;
// #ifdef APP-PLUS
plus.fingerprint.authenticate(function() {
plus.nativeUI.closeWaiting(); //兼容Android平台关闭等待框
// uni.showToast({
// title: 'Fingerprint identification succeeded',
// icon: 'none',
// duration: 1500,
// })
// 存储设置里开启指纹后的状态,隐藏使用密码
console.log(forSett, 12121)
if (sett) {
uni.setStorageSync('fingerPass', true)
console.log(forSett, 12121)
}
//plus.nativeUI.alert('Fingerprint identification succeeded');
}, function(e) {
switch (e.code) {
case e.AUTHENTICATE_MISMATCH:
plus.nativeUI.toast('Fingerprint matching failed, please re-enter');
break;
case e.AUTHENTICATE_OVERLIMIT:
plus.nativeUI.closeWaiting(); //兼容Android平台关闭等待框
plus.nativeUI.alert(
'The number of fingerprint identification failures exceeds the limit. Please use other methods for authentication'
);
break;
case e.CANCEL:
plus.nativeUI.toast('Recognition has been cancelled');
break;
default:
plus.nativeUI.closeWaiting(); //兼容Android平台关闭等待框
plus.nativeUI.alert('Fingerprint identification failed, please try again');
break;
}
});
// Android平台手动弹出等待提示框
if ('Android' == plus.os.name) {
this.show = true;
/* plus.nativeUI.showWaiting('...').onclose = function() {
plus.fingerprint.cancel();
} */
}
// #endif
// #ifdef MP-WEIXIN
wx.startSoterAuthentication({
requestAuthModes: ['fingerPrint'],
challenge: '123456',
authContent: '请用指纹解锁',
success(res) {
uni.showToast({
title: 'Please use it in wechat real machine. The simulator does not support it',
icon: 'none',
title: '识别成功',
mask: false,
duration: 1500
})
// #endif
// #ifndef APP-PLUS || MP-WEIXIN
uni.showToast({
title: 'Fingerprint identification is not supported on this platform',
icon: 'none',
duration: 1500,
})
// #endif
let that=this;
let forSett=true;
// #ifdef APP-PLUS
plus.fingerprint.authenticate(function() {
plus.nativeUI.closeWaiting(); //兼容Android平台关闭等待框
// uni.showToast({
// title: 'Fingerprint identification succeeded',
// icon: 'none',
// duration: 1500,
// })
// 存储设置里开启指纹后的状态,隐藏使用密码
console.log(forSett,12121)
if(sett){
uni.setStorageSync('fingerPass',true)
console.log(forSett,12121)
}
//plus.nativeUI.alert('Fingerprint identification succeeded');
}, function(e) {
switch (e.code) {
case e.AUTHENTICATE_MISMATCH:
plus.nativeUI.toast('Fingerprint matching failed, please re-enter');
break;
case e.AUTHENTICATE_OVERLIMIT:
plus.nativeUI.closeWaiting(); //兼容Android平台关闭等待框
plus.nativeUI.alert('The number of fingerprint identification failures exceeds the limit. Please use other methods for authentication');
break;
case e.CANCEL:
plus.nativeUI.toast('Recognition has been cancelled');
break;
default:
plus.nativeUI.closeWaiting(); //兼容Android平台关闭等待框
plus.nativeUI.alert('Fingerprint identification failed, please try again');
break;
}
});
// Android平台手动弹出等待提示框
if ('Android' == plus.os.name) {
this.show=true;
/* plus.nativeUI.showWaiting('...').onclose = function() {
plus.fingerprint.cancel();
} */
}
// #endif
// #ifdef MP-WEIXIN
wx.startSoterAuthentication({
requestAuthModes: ['fingerPrint'],
challenge: '123456',
authContent: '请用指纹解锁',
success(res) {
uni.showToast({
title: '识别成功',
mask: false,
duration: 1500
});
}
})
// #endif
}
// #endif
},
printCancel:function(){
})
// #endif
}
// #endif
},
printCancel: function() {
plus.fingerprint.cancel();
// this.result="停止指纹识别"
},

Loading…
Cancel
Save