bitcooo
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

237 lines
6.1 KiB

<template>
<view class="">
<navigation :showBack="false" :bgnum="true" class="head">
<view class="rela" slot="logo">
<view class="ms_con">
<text class="abs">...</text>
</view>
<image src="../../../static/tongyonh/Icon.png" mode="aspectFit"
class="message"
@click=""></image>
</view>
<image src="../../../static/tongyonh/san.png" mode="aspectFit" class="renYou" slot="logo"
@click="goCwallet()"></image>
<image src="../../../static/tongyonh/erwei.png" mode="aspectFit" class="renYou2" slot="logo"
@click="chooseImage()"></image>
<text class="big_title">
{{i18n.Wallet}}
</text>
</navigation>
<view class="main">
<view
:class="{'money_con': userObj.coinList[0].xname=='Ethereum', 'money_con2': userObj.coinList[0].xname=='Bitcoin', 'money_con3': userObj.coinList[0].xname=='TRON'}">
<image src="../../../static/tongyonh/ethereum.png" mode="aspectFit" class="imgicon"
v-if="userObj.coinList[0].xname=='Ethereum'"></image>
<image src="../../../static/tongyonh/Frame28.png" mode="aspectFit" class="imgicon"
v-if="userObj.coinList[0].xname=='Bitcoin'"></image>
<image src="../../../static/tongyonh/tronicon.png" mode="aspectFit" class="imgicon"
v-if="userObj.coinList[0].xname=='TRON'"></image>
<view class="textcon1 flex">
<text class="text">{{this.userObj.name}}</text>
<image src="../../../static/tongyonh/visibility_24px.png" mode="aspectFit" class="img1"
@click="showMoney()" v-if="showMoney1"></image>
<image src="../../../static/tongyonh/eyeno.png" mode="aspectFit" class="img1" @click="showMoney22()"
v-if="showMoney2"></image>
</view>
<view class="textcon2" v-if="showMoney1">
{{currency=='USD'?'$ '+(!userObj.totalBalancePrice?0.00:userObj.totalBalancePrice):'¥ '+(!userObj.totalBalanceCnyPrice?0.00:userObj.totalBalanceCnyPrice)}}
</view>
<view class="textcon2" v-if="showMoney2">
***
</view>
<view class="textcon3">
{{this.userObj.ellipsisAddress}}
</view>
</view>
<view class="bot_con">
<view class="jiacon">
<view class="title">
{{i18n.assets}}
</view>
<image src="../../../static/tongyonh/IconGroup.png" mode="aspectFit" class="jiaimg"
v-if="userObj.coinList[0].xname!='Bitcoin'&&userObj.coinList[0].xname!='TRON'" @click="goOther">
</image>
</view>
<!-- <view class="scroll"> -->
<scroll-view :scroll-y="true" style="max-height: 800rpx;" lower-threshold="50">
<view class="item flexx" @click="goTrans(item,index)" v-for="item,index in this.userObj.coinList">
<view class="left flex ">
<view class="img1">
<image :src="item.icon" mode="aspectFit" class="icon"></image>
</view>
<view class="textcon">
<view class="text1">
{{item.name}}
</view>
<view class="text2">
{{item.xname}}
</view>
</view>
</view>
<view class="rig">
<view class="text1">
{{item.balance}}
</view>
<view class="text2" v-if="item.balancePrice">
{{currency=='USD'?'$ '+(!item.balancePrice?0.00:item.balancePrice):'¥ '+(!item.balanceCnyPrice?0.00:item.balanceCnyPrice)}}
</view>
<view class="text2" v-if="!item.balancePrice">
≈ $ 0.00
</view>
</view>
</view>
<!-- </view> -->
</scroll-view>
</view>
</view>
<tab-bar :selectActive="1"></tab-bar>
</view>
</template>
<script>
import cont from "@/components/navigation/navigation.vue"
import token from "@/utils/TokenUtil"
export default {
data() {
return {
eth: '',
trc: 'Hello',
currency: 'USD',
walletInfo: {},
userObj: {},
userObj2: {},
showMoney1: true,
showMoney2: false,
btcBalance: 0,
isStop: false,
timer: null
}
},
onUnload: function() {
console.log("停止了")
uni.setStorageSync('isWallet', false);
if (this.timer) {
console.log("停止了")
clearInterval(this.timer);
this.timer = null;
}
},
onShow() {
this.timer = setInterval(() => {
this.updateBalance();
}, 5000)
},
onHide() {
if (this.timer) {
console.log("停止了")
clearInterval(this.timer);
this.timer = null;
}
},
onLoad() {
// this.$Token.searchMnemonic('gam')
// this.$BtcUtil.sendTransaction('n2YtuKz8JvKeWqfhmNPP8XMJenaShqZCTs',
// 'mrHdfpDqetHCJXT7ZP1anAFXsXvXL8h11i',
// '0.001','cSgoXHGhU5o3Xhv6FFvAERsaMqUD964uYhZik5hizu6QjUdcxJ2c')
let currency = uni.getStorageSync('currency');
if (currency) {
this.currency = currency;
}
// 拿钱包
//console.log(this.$TronUtil.decode("TBk72yKTJWppCsa7XrsU7Qhfo4yNvbm8rE"))
this.userObj = uni.getStorageSync('wallet');
console.log('eth有走这吗')
this.updateBalance();
},
computed: {
i18n() {
return this.$t('index')
},
},
onPullDownRefresh() {
this.updateBalance();
setTimeout(function() {
uni.stopPullDownRefresh();
}, 500);
},
methods: {
async updateBalance() {
this.userObj = await this.$walletUtil.updateBalance();
},
goOther() {
uni.navigateTo({
url: 'otherCoin/index'
})
},
showMoney() {
this.showMoney1 = false
this.showMoney2 = true
},
showMoney22() {
this.showMoney1 = true
this.showMoney2 = false
},
setStorage() {
},
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'
})
},
// 唤醒摄像头
chooseImage() {
var _this = this
uni.scanCode({
success: function(res) {
uni.setStorageSync('address', res.result)
uni.navigateTo({
url: '/pages/menu/sendToken/transfer/index?item=index'
})
}
});
},
goCwallet() {
this.isStop = true
uni.navigateTo({
url: './cwallet/index'
})
}
}
};
</script>
<style scoped>
page {
background: #FAFAFA;
}
</style>
<style>
@import './index.css';
</style>