vee 4 years ago
parent
commit
0455f6e3d6
  1. 291
      pages/menu/backUp/backUp5/index.vue
  2. 1
      pages/menu/backUp/transPaw/index.vue
  3. 6
      pages/menu/collection/index.vue
  4. 2
      pages/menu/setting/index.vue
  5. 46
      pages/menu/token/btc/index.vue
  6. 216
      pages/menu/token/btc/index2.vue
  7. 16
      pages/menu/wallet/index.vue
  8. 3708
      unpackage/dist/dev/app-plus/app-service.js
  9. 741
      unpackage/dist/dev/app-plus/app-view.js
  10. 19
      utils/DataUtil.js
  11. 12
      utils/WalletUtil.js

291
pages/menu/backUp/backUp5/index.vue

@ -112,180 +112,145 @@
return;
}
var a = uni.getStorageSync('createWalletName')
const a = uni.getStorageSync('createWalletName')
console.log(a)
if (a == 'BTC' && a != '' && a != undefined) {
try {
this.walletInfo = uni.getStorageSync('walletInfo');
var mnemonic = this.wordInfo;
uni.setStorageSync('privateKey', mnemonic);
// privateKeyEstablishWallet
console.log(mnemonic)
let btc = this.$Token.importBtcPrivateKey(mnemonic);
for (var i = 0; i < this.walletInfo.BTC.length; i++) {
if (this.walletInfo.BTC[i].privateKey == btc.privateKey) {
uni.showToast({
title: 'The wallet has been imported',
icon: 'none',
duration: 1500
})
this.go = false;
} else {
this.go = true;
}
}
} catch (err) {
uni.showToast({
title: 'Private key does not exist',
icon: 'none',
duration: 1500
})
}
if (this.go) {
uni.showToast({
title: 'Import succeeded',
icon: 'success',
duration: 1500
})
setTimeout(() => {
uni.navigateTo({
url: '/pages/menu/backUp/transPaw2/index'
})
}, 1500)
}
}
if (a == 'ETH' && a != '' && a != undefined) {
try {
this.walletInfo = uni.getStorageSync('walletInfo');
var mnemonic = this.wordInfo;
uni.setStorageSync('privateKey', mnemonic);
console.log(mnemonic)
let eth = this.$Token.importEthPrivateKey(mnemonic);
for (var i = 0; i < this.walletInfo.ETH.length; i++) {
if (this.walletInfo.ETH[i].privateKey == eth.privateKey) {
uni.showToast({
title: 'The wallet has been imported',
icon: 'none',
duration: 1500
})
this.go = false;
} else {
this.go = true;
}
}
} catch (err) {
uni.showToast({
title: 'Private key does not exist',
icon: 'none',
duration: 1500
})
}
if (this.go) {
uni.showToast({
title: 'Import succeeded',
icon: 'success',
duration: 1500
})
setTimeout(() => {
uni.navigateTo({
url: '/pages/menu/backUp/transPaw2/index'
})
}, 1500)
}
}
if (a == 'TRX' && a != '' && a != undefined) {
try {
this.walletInfo = uni.getStorageSync('walletInfo');
var mnemonic = this.wordInfo;
console.log(this.wordInfo)
uni.setStorageSync('privateKey', mnemonic);
console.log(mnemonic)
this.info = this.$Token.importTronPrivateKey(mnemonic);
for (var i = 0; i < this.walletInfo.TRON.length; i++) {
if (this.walletInfo.TRON[i].privateKey == this.info.privateKey) {
uni.showToast({
title: 'The wallet has been imported',
icon: 'none',
duration: 1500
})
this.go = false;
} else {
this.go = true;
}
}
} catch (err) {
console.log(err)
uni.showToast({
title: 'Private key does not exist',
icon: 'none',
duration: 1500
})
}
if (this.go) {
console.log(this.info, 111)
this.$store.commit('addTroni', 1)
let that = this;
this.$TronUtil.getTronBalance(this.info.address).then((res) => {
that.info.balance = res
}).catch(err => {
console.log(err)
})
this.info.coinList = [
{
name: "TRX",
name2: "TRX",
xname: 'TRON',
icon: require('@/static/tongyonh/tron1.png'),
balance: this.info.balance
},
{
name:"USDT",
name2:"TRC20-USDT",
xname:'Tether USD',
contractAddress:'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',
icon:require('@/static/tongyonh/tether_usd.png')
}
];
uni.setStorageSync('wallet', this.info)
uni.setStorageSync('walleti', this.info.privateKey)
this.walletInfo.TRON[this.$store.state.troni] = this.info
uni.setStorageSync('walletInfo', this.walletInfo)
uni.showToast({
title: 'Import succeeded',
icon: 'success',
duration: 1500
})
setTimeout(() => {
uni.navigateTo({
url: '/pages/menu/backUp/transPaw2/index'
})
}, 1500)
}
}
// if (a == 'ETH' && a != '' && a != undefined) {
// try {
// this.walletInfo = uni.getStorageSync('walletInfo');
// var mnemonic = this.wordInfo;
// uni.setStorageSync('privateKey', mnemonic);
// console.log(mnemonic)
// let eth = this.$Token.importEthPrivateKey(mnemonic);
// for (var i = 0; i < this.walletInfo.ETH.length; i++) {
// if (this.walletInfo.ETH[i].privateKey == eth.privateKey) {
// uni.showToast({
// title: 'The wallet has been imported',
// icon: 'none',
// duration: 1500
// })
// this.go = false;
// } else {
// this.go = true;
// }
// }
// } catch (err) {
// uni.showToast({
// title: 'Private key does not exist',
// icon: 'none',
// duration: 1500
// })
// }
// if (this.go) {
// uni.showToast({
// title: 'Import succeeded',
// icon: 'success',
// duration: 1500
// })
// setTimeout(() => {
// uni.navigateTo({
// url: '/pages/menu/backUp/transPaw2/index'
// })
// }, 1500)
// }
// }
// if (a == 'TRX' && a != '' && a != undefined) {
// try {
// this.walletInfo = uni.getStorageSync('walletInfo');
// var mnemonic = this.wordInfo;
// console.log(this.wordInfo)
// uni.setStorageSync('privateKey', mnemonic);
// console.log(mnemonic)
// this.info = this.$Token.importTronPrivateKey(mnemonic);
// for (var i = 0; i < this.walletInfo.TRON.length; i++) {
// if (this.walletInfo.TRON[i].privateKey == this.info.privateKey) {
// uni.showToast({
// title: 'The wallet has been imported',
// icon: 'none',
// duration: 1500
// })
// this.go = false;
// } else {
// this.go = true;
// }
// }
// } catch (err) {
// console.log(err)
// uni.showToast({
// title: 'Private key does not exist',
// icon: 'none',
// duration: 1500
// })
// }
// if (this.go) {
// console.log(this.info, 111)
// this.$store.commit('addTroni', 1)
// let that = this;
// this.$TronUtil.getTronBalance(this.info.address).then((res) => {
// that.info.balance = res
// }).catch(err => {
// console.log(err)
// })
// this.info.coinList = [
// {
// name: "TRX",
// name2: "TRX",
// xname: 'TRON',
// icon: require('@/static/tongyonh/tron1.png'),
// balance: this.info.balance
// },
// {
// name:"USDT",
// name2:"TRC20-USDT",
// xname:'Tether USD',
// contractAddress:'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',
// icon:require('@/static/tongyonh/tether_usd.png')
// }
// ];
// uni.setStorageSync('wallet', this.info)
// uni.setStorageSync('walleti', this.info.privateKey)
// this.walletInfo.TRON[this.$store.state.troni] = this.info
// uni.setStorageSync('walletInfo', this.walletInfo)
// uni.showToast({
// title: 'Import succeeded',
// icon: 'success',
// duration: 1500
// })
// setTimeout(() => {
// uni.navigateTo({
// url: '/pages/menu/backUp/transPaw2/index'
// })
// }, 1500)
// }
// }
},

1
pages/menu/backUp/transPaw/index.vue

@ -83,6 +83,7 @@
var a = uni.getStorageSync('createWalletName')
var mnemonic = uni.getStorageSync('word');
this.$walletUtil.mnemonicEstablishWallet(a,mnemonic,e)
uni.showToast({
title: 'Set successfully',
icon: 'success',

6
pages/menu/collection/index.vue

@ -21,7 +21,7 @@
</view>
</view>
</view>
<image src="../../../static/tongyonh/chevron_right_24px.png" mode="aspectFit" class="letImg"></image>
<image src="../../../../tongyonh/chevron_right_24px.png" mode="aspectFit" class="letImg"></image>
</view>
@ -100,7 +100,7 @@
showMsg(item,index){
this.test=item
this.testindex=index
if(uni.getStorageSync('wallet').coinList[0].name2=='ETH'){
if(uni.getStorageSync('wallet').type=='ETH'){
this.showbottom=false
this.goDetail();
}else{
@ -127,7 +127,7 @@
goDetail2(itemm,index){
uni.setStorageSync('proid',this.test.id)
uni.setStorageSync('wallet',itemm)
uni.setStorageSync('walleti',itemm.privateKey)
uni.setStorageSync('walleti',itemm.address)
console.log(itemm,444)
uni.setStorageSync('nftIndex',this.testindex)
let item = JSON.stringify(this.test)

2
pages/menu/setting/index.vue

@ -19,7 +19,7 @@
</view>
<view class="item flex">
<view class="text1">
Payment password
Language settings
</view>
<view class="">
<text class="text2">English</text>

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

@ -16,14 +16,8 @@
:class="{'money_con': userObject.coinList[0].xname=='Ethereum', 'money_con2': userObject.coinList[0].xname=='Bitcoin', 'money_con3': userObject.coinList[0].xname=='TRON'}">
<view class="textcon1">
<text class="text1">
<view class="" v-if="userObject.coinList[0].xname=='Bitcoin'">
0.00 BTC
</view>
<view class="" v-if="userObject.coinList[0].xname=='Ethereum'">
0.00 ETH
</view>
<view class="" v-if="userObject.coinList[0].xname=='TRON'">
0.00 TRX
<view class="" >
{{infoWallet.balance}}
</view>
<text class="text2"> $0.0</text>
</text>
@ -146,16 +140,15 @@
}],
infoWallet: {},
current: 0,
pageSize: 10,
pageSize: 20,
pageNum: 1,
param: {
'address': '',
'pageNum': 1,
'pageSize': 10,
},
address:'0x56eddb7aa87536c09ccc2793473599fd21a8b17f',
address2:'0x56eddb7aa87536c09ccc2793473599fd21a8b17f',
type:'',
balance:0,
address:'',
type:'all',
trueType:'',
contract:'',
}
},
methods: {
@ -194,15 +187,14 @@
},
getWalletInfo() {
// this.address = this.infoWallet.address
// this.address2 = this.infoWallet.address
this.param.address = this.address
this.userObject = this.infoWallet
var that = this
this.$dataUtil.transactionData('ETH', this.type, this.address2, '0xdac17f958d2ee523a2206206994597c13d831ec7',
1, 20,
console.log(this.trueType, this.type, this.address, this.contract,
this.pageNum, this.pageSize)
this.$dataUtil.transactionData(this.trueType, this.type, this.address, this.contract,
this.pageNum, this.pageSize,
function(data) {
console.log(data,121211212112121)
if(data.length==0){
that.showInfo=true;
}else{
@ -211,7 +203,6 @@
that.trxs = data
that.trxs2 = data
console.log(that.trxs, 12121)
console.log(data)
})
@ -232,14 +223,15 @@
}
},
onLoad(option) {
const item = JSON.parse(option.item);
this.infoWallet = item
this.address=item.address
this.trueType=item.type
console.log(this.infoWallet,1111)
this.getWalletInfo()
},
onReachBottom() {
this.param.pageSize += 5;
this.pageSize += 5;
this.getWalletInfo()
}
};

216
pages/menu/token/btc/index2.vue

@ -1,34 +1,19 @@
<template>
<view class="">
<navigation :showBack="true" :bgnum="true">
<text class="big_title">
{{userObjectss.name2}}
</text>
{{xname}}
</navigation>
<view class="main">
<view class="money_con"
:class="{'money_con': userObject.coinList[0].xname=='Ethereum', 'money_con2': userObject.coinList[0].xname=='Bitcoin', 'money_con3': userObject.coinList[0].xname=='TRON'}">
<view class="textcon1">
<text class="text1">
<view class="" v-if="userObject.coinList[0].xname=='Bitcoin'">
0.00 BTC
</view>
<view class="" v-if="userObject.coinList[0].xname=='Ethereum'">
0.00
</view>
<view class="" v-if="userObject.coinList[0].xname=='TRON'">
0.00 TRX
<view class="" >
{{infoWallet.balance}}
</view>
<text class="text2"> $0.0</text>
</text>
<!-- <image src="../../../../static/tongyonh/ethereum.png" mode="aspectFit" class="img1"
v-if="userObject.coinList[0].xname=='Ethereum'"></image>
<image src="../../../../static/tongyonh/Frame28.png" mode="aspectFit" class="img1"
v-if="userObject.coinList[0].xname=='Bitcoin'"></image>
<image src="../../../../static/tongyonh/tronicon.png" mode="aspectFit" class="img1"
v-if="userObject.coinList[0].xname=='TRON'"></image> -->
</view>
<view class="textcon1">
<view class="v1">
@ -58,39 +43,7 @@
<u-empty text="No content" mode="list" v-if="showInfo"></u-empty>
<view class="" v-if="!showInfo">
<view class="item1" v-for="(item,index) in trxs" v-if="current==1&&address==item.from"
@click="goDetail(item,index)">
<view class="lef_con">
<image src="../../../../static/tongyonh/arrow-up-left_1.png" mode="aspectFit"
class="img1" v-if="address==item.from"></image>
<view class="textcon">
<view class="text1" v-if="address==item.from">
{{item.to}}
</view>
<view class="text2" v-if="address==item.from">
{{item.time}}
</view>
</view>
</view>
<view class="rig_con">
<view class="text1">
<text v-if="address==item.from">-</text>
{{item.value}}
<text class="">
{{item.network}}
</text>
</view>
<image src="../../../../static/tongyonh/Shape.png" mode="aspectFit" class="img1">
</image>
</view>
</view>
<view class="item1" v-for="(item,index) in trxs" v-if="current==0"
<view class="item1" v-for="(item,index) in trxs"
@click="goDetail(item,index)">
<view class="lef_con">
<image src="../../../../static/tongyonh/arrow-up-left.png" mode="aspectFit" class="img1"
@ -98,11 +51,9 @@
<image src="../../../../static/tongyonh/arrow-up-left_1.png" mode="aspectFit"
class="img1" v-if="address==item.from"></image>
<view class="textcon">
<view class="text1" v-if="address==item.from">
{{item.to}}
</view>
<view class="text1" v-if="address==item.to">
{{item.from}}
<view class="text1">
{{item.address}}
</view>
<view class="text2">
{{item.time}}
@ -126,36 +77,7 @@
</view>
</view>
<view class="item1" v-for="(item,index) in trxs" v-if="current==2&&address==item.to"
@click="goDetail(item,index)">
<view class="lef_con">
<image src="../../../../static/tongyonh/arrow-up-left.png" mode="aspectFit" class="img1"
v-if="address==item.to"></image>
<view class="textcon">
<view class="text1" v-if="address==item.to">
{{item.from}}
</view>
<view class="text2" v-if="address==item.to">
{{item.time}}
</view>
</view>
</view>
<view class="rig_con">
<view class="text1">
<text v-if="address==item.to">+</text>
{{item.value}}
<text class="">
{{item.network}}
</text>
</view>
<image src="../../../../static/tongyonh/Shape.png" mode="aspectFit" class="img1">
</image>
</view>
</view>
</view>
</view>
@ -192,25 +114,29 @@
trxs2: [],
address: '',
userObject: {},
userObjectss: {},
showInfo: false,
list: [{
name: 'All'
name: 'All',
}, {
name: 'Send'
name: 'Send',
}, {
name: 'Receive',
}],
infoWallet: {},
current: 0,
pageSize:10,
pageSize: 20,
pageNum: 1,
param : {
'address':'',
'pageNum':1,
'pageSize':10,
'address2':'',
},
balance:0,
address:'',
type:'all',
trueType:'',
contract:'',
xname:'',
}
},
methods: {
@ -234,76 +160,47 @@
},
change(index) {
console.log(index)
if(index==0){
this.type='all'
}
if(index==1){
this.type='send'
}
if(index==2){
this.type='receive'
}
this.current = index;
console.log(this.current)
this.getWalletInfo();
},
getWalletInfo() {
if (this.infoWallet.coinList[0].xname == 'Ethereum') {
this.param.address2=this.infoWallet.address
this.address = this.userObjectss.contractAddress
this.address2 =this.userObjectss.contractAddress
console.log( this.userObjectss.contractAddress,111)
this.param.address= this.userObjectss.contractAddress
console.log(this.param,2222)
this.userObject = this.infoWallet
const post = api.addressOther(
this.param
)
post.then(res => {
console.log(res, 77)
if (res.data.code == 404) {
this.showInfo = true;
return;
var that = this
this.$dataUtil.transactionData(this.trueType, this.type, this.address, this.contract,
this.pageNum, this.pageSize,
function(data) {
console.log(data,121211212112121)
if(data.length==0){
that.showInfo=true;
}else{
that.showInfo=false;
}
that.trxs = data
that.trxs2 = data
console.log(that.trxs, 12121)
})
this.trxs = res.data.data
console.log(this.trxs,7878)
for (var i = 0; i < this.trxs.length; i++) {
this.trxs[i].from = this.trxs[i].from.substring(0, 6) + '...' + this.trxs[i].from
.substring(35, this.trxs[i].from.length);
this.trxs[i].to = this.trxs[i].to.substring(0, 6) + '...' + this.trxs[i].to.substring(
35, this.trxs[i].to.length);
this.trxs[i].time = index.formatyymmddhhmmss(this.trxs[i].time);
this.trxs[i].value = parseFloat(this.trxs[i].value).toFixed(0)
}
})
this.address = this.address.substring(0, 6) + '...' + this.address.substring(35, this.address.length);
this.getInfo()
} else if (this.infoWallet.coinList[0].xname == 'TRON') {
this.address = this.infoWallet.address
this.param.address=this.address
this.address2 = this.infoWallet.address
this.userObject =this.infoWallet
const post = api.addresstrx(
this.param
)
post.then(res => {
if (res.data.code == 404) {
this.showInfo = true;
return;
}
if (res.data.data.network == 'TRX') {
this.trxs = res.data.data.txs
for (var i = 0; i < this.trxs.length; i++) {
this.trxs[i].from = this.trxs[i].from.substring(0, 6) + '...' + this.trxs[i].from
.substring(35, this.trxs[i].from.length);
this.trxs[i].to = this.trxs[i].to.substring(0, 6) + '...' + this.trxs[i].to.substring(
35, this.trxs[i].to.length);
this.trxs[i].time = index.formatyymmddhhmmss(this.trxs[i].time);
this.trxs[i].value = parseFloat(this.trxs[i].value).toFixed(5)
}
}
})
this.address = this.address.substring(0, 6) + '...' + this.address.substring(35, this.address.length);
}
},
getInfo() {
this.param.address = this.address2
const post = api.addressOther(
const post = api.address(
this.param
)
post.then(res => {
@ -312,14 +209,19 @@
}
},
onLoad(option) {
this.userObjectss=uni.getStorageSync('daiInfo')
console.log(this.userObjectss,777)
const item = JSON.parse(option.item);
this.infoWallet = item
this.address=item.address
this.trueType=item.type
var index=uni.getStorageSync('otherCoin')
this.contract=item.coinList[index].contractAddress
this.xname=item.coinList[index].xname
console.log(this.infoWallet,1111)
this.getWalletInfo()
},
onReachBottom() {
this.param.pageSize+=5;
this.pageSize += 5;
this.getWalletInfo()
}
};

16
pages/menu/wallet/index.vue

@ -126,26 +126,21 @@
goTrans(itemm,index) {
console.log(index,444)
let item = JSON.stringify(this.userObj2)
if(this.userObj2.coinList[0].xname=='Bitcoin'){
uni.navigateTo({
url:'/pages/menu/token/btctrue/index?item='+item
})
}else{
console.log(item,454545)
if(index==0){
uni.navigateTo({
url:'/pages/menu/token/btc/index?item='+item
})
}else{
uni.setStorageSync('daiInfo',itemm)
//
uni.setStorageSync('otherCoin',index)
uni.navigateTo({
url:'/pages/menu/token/btc/index2?item='+item
})
}
}
},
//
chooseImage() {
var _this = this
@ -165,8 +160,7 @@
url: './cwallet/index'
})
}
},
}
};
</script>
<style scoped>

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

File diff suppressed because one or more lines are too long

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

File diff suppressed because it is too large

19
utils/DataUtil.js

@ -66,10 +66,13 @@ let DataUtil = {
}
}
success(dataList)
}
}
success(dataList)
},
error: (res) => {
success(dataList)
}
});
} else {
@ -121,9 +124,9 @@ let DataUtil = {
}
}
success(dataList)
}
}
success(dataList)
}
});
@ -183,9 +186,9 @@ let DataUtil = {
dataList.push(transactionData)
}
success(dataList)
}
}
success(dataList)
}
});
@ -238,9 +241,9 @@ let DataUtil = {
}
}
success(dataList)
}
}
success(dataList)
}
});

12
utils/WalletUtil.js

@ -99,12 +99,24 @@ console.log(password,'password')
switch (type) {
case 'BTC':
walletdec = TokenUtil.generateBtc(mnemonic);
if(uni.getStorageSync('walletInfo')){
uni.setStorageSync('walleti',walletdec.address)
}
break;
case 'ETH':
walletdec = TokenUtil.generateTron(mnemonic);
if(uni.getStorageSync('walletInfo')){
uni.setStorageSync('walleti',walletdec.address)
}
break;
case 'TRX':
walletdec = TokenUtil.generateEth(mnemonic);
if(uni.getStorageSync('walletInfo')){
uni.setStorageSync('walleti',walletdec.address)
}
break;
}
let wallet = fullWallet[type][0];

Loading…
Cancel
Save