Browse Source

代码

master
Dread 4 years ago
parent
commit
0ddf2b9119
  1. 305
      pages/menu/sendToken/transfer/index.vue
  2. 20
      pages/menu/wallet/index.vue
  3. 21
      pages/menu/wallet/otherCoin/index.vue
  4. 10062
      unpackage/dist/dev/app-plus/app-service.js
  5. 32212
      unpackage/dist/dev/app-plus/app-view.js
  6. 2
      utils/WalletUtil.js
  7. 3
      utils/axios.js

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

@ -1,7 +1,7 @@
<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>
@ -25,7 +25,9 @@
</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" />
<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>
@ -41,14 +43,16 @@
<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"/>
<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"/>
<input type="text" value="" placeholder-style="font-size: 30rpx; color: #D0D0D2;"
placeholder="0.0000000" class="input3" />
</view>
</view>
<view class="top flex bottom">
@ -69,7 +73,8 @@
</view>
<view class="inputcon">
<input type="text" value="" placeholder-style="font-size: 30rpx; color: #D0D0D2;" placeholder="Please enter a note (off-chain)" class="input1"/>
<input type="text" value="" placeholder-style="font-size: 30rpx; color: #D0D0D2;"
placeholder="Please enter a note (off-chain)" class="input1" />
</view>
</view>
@ -80,8 +85,9 @@
</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="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>
@ -91,7 +97,7 @@
</view>
<view class="big_con" v-if="showBottom">
<view class="tiao" @click="show=false">
<view class="tiao" @click="cancelAll">
</view>
<view class="bigtitle">
Transfer confirmation
@ -183,13 +189,13 @@
<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> .
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">
<view class="textt2" @click="cancelFail">
Cancel
</view>
</view>
@ -218,15 +224,15 @@
</view>
</view>
<view class="btn_con" @click="Confirm">
<view class="btn_con" @click="Confirm">
<view class="btn">
Confirm
</view>
</view>
</view>
</view>
</view>
@ -237,70 +243,83 @@
export default {
data() {
return {
fee:1000,
fee: 1000,
show: false,
show2: false,
showFinger:false,
showBottom:false,
addressInfo:{},
recipientAddress:'',
transAmount:'',
fingerSuccess:false,
fingerFail:false,
showFinger: false,
showBottom: false,
addressInfo: {},
recipientAddress: '',
transAmount: '',
fingerSuccess: false,
fingerFail: false,
// 使
passShow:false,
passShow: false,
//
transInfoPass:{
fromAddress:'',
toAddress:"",
privateKey:'',
amount:'',
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;
// true
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,13 +351,13 @@
// })
// return
// }
this.showBottom=true;
this.show=true;
this.showBottom = true;
this.show = true;
},
//
fingerprint: function(sett) {
let bltype=true;
let bltype = true;
// #ifdef APP-PLUS
if (!plus.fingerprint.isSupport()) {
uni.showToast({
@ -381,63 +400,174 @@
// #endif
let that=this;
let that = this;
// #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(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
// })
// })
// }
}
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: 'Fingerprint identification succeeded',
// 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: 1500,
// duration: 2000
// })
// })
// 使
// }
}
// uni.setStorageSync('fingerPass',true)
that.showBottom=false;
that.fingerSuccess=true;
console.log(that.fingerSuccess,454545)
}, function(e) {
switch (e.code) {
case e.AUTHENTICATE_MISMATCH:
// plus.nativeUI.toast('Fingerprint matching failed, please re-enter');
// uni.setStorageSync('fingerPass',false)
console.log(that.showFinger,454545)
that.showBottom=false;
that.fingerFail=true;
console.log(that.fingerFail,454545)
console.log(that.showFinger, 454545)
that.showBottom = false;
that.fingerFail = true;
console.log(that.fingerFail, 454545)
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');
// uni.setStorageSync('fingerPass',false)
console.log(that.showFinger,454545)
that.showBottom=false;
that.fingerFail=true;
console.log(that.fingerFail,454545)
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');
// uni.setStorageSync('fingerPass',false)
console.log(that.showFinger,454545)
that.showBottom=false;
that.fingerFail=true;
console.log(that.fingerFail,454545)
console.log(that.showFinger, 454545)
that.showBottom = false;
that.fingerFail = true;
console.log(that.fingerFail, 454545)
break;
default:
plus.nativeUI.closeWaiting(); //Android
uni.setStorageSync('fingerPass',false)
console.log(that.showFinger,454545)
that.showBottom=false;
that.fingerFail=true;
console.log(that.fingerFail,454545)
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;
}
});
// Android
if ('Android' == plus.os.name) {
this.show=true;
this.show = true;
/* plus.nativeUI.showWaiting('...').onclose = function() {
plus.fingerprint.cancel();
} */
@ -465,24 +595,25 @@
},
goAddress(text){
goAddress(text) {
console.log(text)
uni.navigateTo({
url:'../address/index?item='+text
url: '../address/index?item=' + text
})
}
},
onLoad() {
//
if(uni.getStorageSync('myTransAddress')){
this.recipientAddress=uni.getStorageSync('myTransAddress').address
if (uni.getStorageSync('myTransAddress')) {
this.recipientAddress = uni.getStorageSync('myTransAddress').address
uni.removeStorageSync('myTransAddress')
}
//
if(uni.getStorageSync('fingerPass')){
this.passShow=uni.getStorageSync('fingerPass')
if (uni.getStorageSync('fingerPass')) {
this.passShow = uni.getStorageSync('fingerPass')
}
this.addressInfo=uni.getStorageSync('infoWallet')
console.log(this.addressInfo,1111)
this.addressInfo = uni.getStorageSync('infoWallet')
console.log(this.addressInfo, 1111)
}
};
</script>

20
pages/menu/wallet/index.vue

@ -125,22 +125,22 @@
thar.userObj = uni.getStorageSync('wallet');
thar.userObj2 = uni.getStorageSync('wallet');
// thar.userObj.address = thar.userObj.ellipsisAddress;
<<<<<<< HEAD
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.userObj.address =thar.userObj.address.substring(0, 6) + '...' + thar.userObj.address.substring(25,
// thar.userObj.address.length);
// thar.$walletUtil.updateBalance();
// thar.updateData();
// }, 100);
thar.userObj.address = thar.userObj.address.substring(0, 6) + '...' + thar.userObj.address
.substring(25,
thar.userObj.address.length);
thar.$walletUtil.updateBalance();
// thar.$walletUtil.updateBalance();
if (!thar.isStop) {
thar.updateData()
}
}, 2000);
>>>>>>> ecf936884019d656c3291d2f722529a76c9bbfd5
}, 10);
},
goOther() {

21
pages/menu/wallet/otherCoin/index.vue

@ -83,22 +83,23 @@
//
addOther(item,index){
console.log(item,444)
if(uni.getStorageSync('imgindex').length>0){
// if(uni.getStorageSync('imgindex').length>0){
// this.imgindex.push(index)
// this.toTop=true
// setTimeout(()=>{
// this.toTop=false
// },1500)
// uni.setStorageSync('imgindex',this.imgindex)
// }else{
this.imgindex.push(index)
this.toTop=true
setTimeout(()=>{
this.toTop=false
},1500)
uni.setStorageSync('imgindex',this.imgindex)
}else{
this.imgindex.push(index)
this.toTop=true
setTimeout(()=>{
this.toTop=false
},1500)
uni.setStorageSync('imgindex',this.imgindex)
}
// }
console.log(this.coinType,444444)
if(this.coinType=='ETH'){
const walleti=uni.getStorageSync('walleti')
const walletInfo=uni.getStorageSync('walletInfo')

10062
unpackage/dist/dev/app-plus/app-service.js

File diff suppressed because one or more lines are too long

32212
unpackage/dist/dev/app-plus/app-view.js

File diff suppressed because one or more lines are too long

2
utils/WalletUtil.js

@ -200,7 +200,7 @@ let WalletUtil = {
}
}
// this.updateBalance();
this.updateBalance();
},
updateBalance:function() {
const wallet = uni.getStorageSync('wallet');

3
utils/axios.js

@ -73,11 +73,12 @@ service.interceptors.response.use(res => {
axios.defaults.adapter = function(config) { //自己定义个适配器,用来适配uniapp的语法
return new Promise((resolve, reject) => {
console.log(config)
console.log(config,'我请求的')
var settle = require('axios/lib/core/settle');
var buildURL = require('axios/lib/helpers/buildURL');
uni.request({
method: config.method.toUpperCase(),
// url: buildURL(config.url, config.params, config.paramsSerializer),
url: config.baseURL+'/' + buildURL(config.url, config.params, config.paramsSerializer),
header: config.headers,
data: config.data,

Loading…
Cancel
Save