Browse Source

修改

master
vee 4 years ago
parent
commit
722d4064f4
  1. 12
      pages.json
  2. 7
      pages/menu/collection/index.vue
  3. 54
      pages/menu/sendToken/transfer2/index.vue
  4. 2
      pages/menu/token/btc/index.css
  5. 7
      pages/menu/token/btc/index.vue
  6. 10
      pages/menu/token/btc/index2.vue
  7. 12
      pages/menu/wallet/index.css
  8. 38
      pages/menu/wallet/index.vue
  9. 8
      utils/TronUtil.js
  10. 2
      utils/WalletUtil.js

12
pages.json

@ -30,7 +30,8 @@
{ {
"path": "pages/menu/token/btc/index", "path": "pages/menu/token/btc/index",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom",
"enablePullDownRefresh": true
} }
}, },
@ -66,7 +67,8 @@
{ {
"path": "pages/menu/collection/index", "path": "pages/menu/collection/index",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom",
"enablePullDownRefresh": true
} }
}, },
@ -289,7 +291,8 @@
{ {
"path": "pages/menu/token/btc/index2", "path": "pages/menu/token/btc/index2",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom",
"enablePullDownRefresh": true
} }
}, },
@ -300,7 +303,8 @@
{ {
"path": "pages/menu/wallet/index", "path": "pages/menu/wallet/index",
"style": { "style": {
"navigationStyle": "custom" "navigationStyle": "custom",
"enablePullDownRefresh": true
} }
}, },
{ {

7
pages/menu/collection/index.vue

@ -95,6 +95,13 @@
this.getCollection(); this.getCollection();
},
onPullDownRefresh() {
console.log('refresh');
this.getCollection();
setTimeout(function() {
uni.stopPullDownRefresh();
}, 500);
}, },
methods: { methods: {
showMsg(item,index){ showMsg(item,index){

54
pages/menu/sendToken/transfer2/index.vue

@ -13,8 +13,10 @@
Collection address Collection address
</view> </view>
<view class="inputcon"> <view class="inputcon">
<input type="text" value="" :placeholder="addValue" placeholder-style="color:#D0D0D2" class="input" v-model="toAddress"/> <input type="text" value="" :placeholder="addValue" placeholder-style="color:#D0D0D2" class="input"
<image src="../../../../static/tongyonh/lu.png" mode="aspectFit" class="img" @click="goAddress"></image> v-model="toAddress" />
<image src="../../../../static/tongyonh/lu.png" mode="aspectFit" class="img" @click="goAddress">
</image>
</view> </view>
</view> </view>
<view class="item"> <view class="item">
@ -24,7 +26,8 @@
</view> </view>
<view class="inputcon2"> <view class="inputcon2">
<view class="input_con"> <view class="input_con">
<input type="text" value="" placeholder="0" placeholder-style="color:#D0D0D2" class="input2" v-model="toValue"/> <input type="text" value="" placeholder="0" placeholder-style="color:#D0D0D2" class="input2"
v-model="toValue" />
<!-- <input type="text" value="" placeholder="Remark" placeholder-style="color:#D0D0D2" class="input1"/> --> <!-- <input type="text" value="" placeholder="Remark" placeholder-style="color:#D0D0D2" class="input1"/> -->
</view> </view>
</view> </view>
@ -47,7 +50,8 @@
Payment details Payment details
</view> </view>
<view class="money_con"> <view class="money_con">
<image src="../../../../static/tongyonh/xg.png" mode="aspectFit" class="img" @click="show=false"></image> <image src="../../../../static/tongyonh/xg.png" mode="aspectFit" class="img" @click="show=false">
</image>
<view class="money"> <view class="money">
<text class="tex1">{{toValue}}</text> <text class="tex1">{{toValue}}</text>
<text class="tex2">{{info.coinList[0].name2}}</text> <text class="tex2">{{info.coinList[0].name2}}</text>
@ -80,7 +84,8 @@
</view> </view>
<view class="money_con money_con2"> <view class="money_con money_con2">
<image src="../../../../static/tongyonh/Vector.png" mode="aspectFit" class="img2" @click="back"></image> <image src="../../../../static/tongyonh/Vector.png" mode="aspectFit" class="img2" @click="back"></image>
<u-input placeholder="Wallet password" v-model="value" :type="type" :border="border" :password-icon="passwordIcon" @input="btnco()" /> <u-input placeholder="Wallet password" v-model="value" :type="type" :border="border"
:password-icon="passwordIcon" @input="btnco()" />
</view> </view>
<view class="btn2" :class="btntype?'btncolor':'btncolor2'" @click="confirm()"> <view class="btn2" :class="btntype?'btncolor':'btncolor2'" @click="confirm()">
Next step Next step
@ -177,7 +182,8 @@
return return
} }
if (this.info.coinList[0].xname == 'Ethereum') { if (this.info.coinList[0].xname == 'Ethereum') {
this.$EthUtil.transaction(this.info.address,this.toAddress,this.toValue,this.info.privateKey).then((res) => { this.$EthUtil.transaction(this.info.address, this.toAddress, this.toValue, this.info.privateKey).then((
res) => {
console.log(res, '钱包') console.log(res, '钱包')
this.show2 = false; this.show2 = false;
uni.reLaunch({ uni.reLaunch({
@ -189,23 +195,47 @@
} }
if (this.info.coinList[0].xname == 'TRON') { if (this.info.coinList[0].xname == 'TRON') {
this.$TronUtil.sendTransaction(this.info.address,this.info.privateKey,this.toAddress,this.toValue,).then((res) => { if (!this.contractAddress) {
this.$TronUtil.sendTransaction(this.info.address, this.info.privateKey, this.toAddress, this.toValue, )
.then((res) => {
uni.showToast({ uni.showToast({
title: 'Successfully', title: 'Successfully',
icon: 'success', icon: 'success',
duration: 1500 duration: 2000
}) })
this.show2 = false; this.show2 = false;
uni.reLaunch({ uni.reLaunch({
url:'../transfer2/index' url: '/pages/menu/wallet/index'
}) })
}).catch(err => { }).catch(err => {
uni.showToast({ uni.showToast({
title: err, title: err,
icon: 'none', icon: 'none',
duration: 1500 duration: 2000
})
})
}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
})
})
}
} }
}, },
@ -229,8 +259,8 @@
}, },
}, },
onLoad(option) { onLoad(option) {
const item = JSON.parse(option.item); this.contractAddress = option.contractAddress;
this.info=item; this.info = uni.getStorageSync('wallet');
this.addValue = this.info.coinList[0].xname + ' Address' this.addValue = this.info.coinList[0].xname + ' Address'
} }
}; };

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

@ -5,7 +5,7 @@
right: 30rpx; right: 30rpx;
} }
.big_title{ .big_title{
font-size: 48rpx; font-size: 36rpx;
} }
.main .money_con{ .main .money_con{

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

@ -232,6 +232,13 @@
console.log(this.infoWallet,1111) console.log(this.infoWallet,1111)
this.getWalletInfo() this.getWalletInfo()
}, },
onPullDownRefresh() {
console.log('refresh');
this.getWalletInfo();
setTimeout(function() {
uni.stopPullDownRefresh();
}, 500);
},
onReachBottom() { onReachBottom() {
this.pageSize += 5; this.pageSize += 5;
this.getWalletInfo() this.getWalletInfo()

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

@ -144,7 +144,7 @@
goSend() { goSend() {
let itemm = JSON.stringify(this.infoWallet) let itemm = JSON.stringify(this.infoWallet)
uni.navigateTo({ uni.navigateTo({
url: '/pages/menu/sendToken/transfer2/index?item=' + itemm url: '/pages/menu/sendToken/transfer2/index?contractAddress=' + this.contractAddress
}) })
}, },
goReceive() { goReceive() {
@ -222,8 +222,16 @@
this.xname=this.infoWallet.coinList[index].xname this.xname=this.infoWallet.coinList[index].xname
this.balance=this.infoWallet.coinList[index].balance this.balance=this.infoWallet.coinList[index].balance
this.xbalance=this.infoWallet.coinList[index].balancePrice this.xbalance=this.infoWallet.coinList[index].balancePrice
this.contractAddress=this.infoWallet.coinList[index].contractAddress
this.getWalletInfo() this.getWalletInfo()
}, },
onPullDownRefresh() {
console.log('refresh');
this.getWalletInfo();
setTimeout(function() {
uni.stopPullDownRefresh();
}, 500);
},
onReachBottom() { onReachBottom() {
this.pageSize += 5; this.pageSize += 5;
this.getWalletInfo() this.getWalletInfo()

12
pages/menu/wallet/index.css

@ -12,7 +12,7 @@
right: 30rpx; right: 30rpx;
} }
.big_title{ .big_title{
font-size: 48rpx; font-size: 36rpx;
} }
.main{ .main{
padding: 0 26rpx; padding: 0 26rpx;
@ -64,7 +64,7 @@
margin-top:40rpx; margin-top:40rpx;
} }
.textcon3{ .textcon3{
color: #D6CAF7; color: #FFFFFF;
font-size: 28rpx; font-size: 28rpx;
margin-top:40rpx; margin-top:40rpx;
} }
@ -109,20 +109,20 @@
margin-right: 20rpx; margin-right: 20rpx;
} }
.bot_con .item .left .textcon .text1{ .bot_con .item .left .textcon .text1{
font-size: 36rpx; font-size: 30rpx;
} }
.bot_con .item .left .textcon .text2{ .bot_con .item .left .textcon .text2{
font-size: 28rpx; font-size: 24rpx;
color: #B0BBD5; color: #B0BBD5;
} }
.bot_con .item .rig{ .bot_con .item .rig{
text-align: right; text-align: right;
} }
.bot_con .item .rig .text1{ .bot_con .item .rig .text1{
font-size: 36rpx; font-size: 32rpx;
} }
.bot_con .item .rig .text2{ .bot_con .item .rig .text2{
font-size: 28rpx; font-size: 24rpx;
color: #B0BBD5; color: #B0BBD5;
} }
.opc{ .opc{

38
pages/menu/wallet/index.vue

@ -10,14 +10,20 @@
</text> </text>
</navigation> </navigation>
<view class="main"> <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'}"> <view
<image src="../../../static/tongyonh/ethereum.png" mode="aspectFit" class="imgicon" v-if="userObj.coinList[0].xname=='Ethereum'"></image> :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/Frame28.png" mode="aspectFit" class="imgicon" v-if="userObj.coinList[0].xname=='Bitcoin'"></image> <image src="../../../static/tongyonh/ethereum.png" mode="aspectFit" class="imgicon"
<image src="../../../static/tongyonh/tronicon.png" mode="aspectFit" class="imgicon" v-if="userObj.coinList[0].xname=='TRON'"></image> 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"> <view class="textcon1 flex">
<text class="text">{{this.userObj.name}}</text> <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/visibility_24px.png" mode="aspectFit" class="img1"
<image src="../../../static/tongyonh/eyeno.png" mode="aspectFit" class="img1" @click="showMoney22()" v-if="showMoney2"></image> @click="showMoney()" v-if="showMoney1"></image>
<image src="../../../static/tongyonh/eyeno.png" mode="aspectFit" class="img1" @click="showMoney22()"
v-if="showMoney2"></image>
</view> </view>
<view class="textcon2" v-if="showMoney1"> <view class="textcon2" v-if="showMoney1">
$ {{!userObj.balancePrice?0.00:userObj.balancePrice}} $ {{!userObj.balancePrice?0.00:userObj.balancePrice}}
@ -35,7 +41,9 @@
<view class="title"> <view class="title">
Assets Assets
</view> </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> <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>
<view class="scroll"> <view class="scroll">
<view class="item flexx" @click="goTrans(item,index)" v-for="item,index in this.userObj.coinList"> <view class="item flexx" @click="goTrans(item,index)" v-for="item,index in this.userObj.coinList">
@ -94,18 +102,27 @@
onLoad() { onLoad() {
this.setStorage(); this.setStorage();
this.$walletUtil.updateBalance();
if (uni.getStorageSync('wallet')) { if (uni.getStorageSync('wallet')) {
this.userObj = uni.getStorageSync('wallet'); this.userObj = uni.getStorageSync('wallet');
this.userObj2 = uni.getStorageSync('wallet'); this.userObj2 = uni.getStorageSync('wallet');
this.updateData(); this.updateData();
this.userObj.address = this.userObj.address.substring(0, 6)+'...'+this.userObj.address.substring(25,this.userObj.address.length); this.userObj.address = this.userObj.address.substring(0, 6) + '...' + this.userObj.address.substring(25,
this.userObj.address.length);
} }
}, },
onPullDownRefresh() {
console.log('refresh');
this.$walletUtil.updateBalance();
setTimeout(function() {
uni.stopPullDownRefresh();
}, 500);
},
methods: { methods: {
updateData() { updateData() {
let thar = this; let thar = this;
@ -137,7 +154,8 @@
setStorage() { setStorage() {
this.walletInfo = uni.getStorageSync('walletInfo'); this.walletInfo = uni.getStorageSync('walletInfo');
this.userObj = this.walletInfo.BTC[0] this.userObj = this.walletInfo.BTC[0]
this.userObj.address = this.userObj.address.substring(0, 6)+'...'+this.userObj.address.substring(25,this.userObj.address.length); this.userObj.address = this.userObj.address.substring(0, 6) + '...' + this.userObj.address.substring(25,
this.userObj.address.length);
console.log(this.walletInfo.BTC[0]) console.log(this.walletInfo.BTC[0])
}, },
goTrans(itemm, index) { goTrans(itemm, index) {

8
utils/TronUtil.js

@ -41,6 +41,7 @@ let tron = {
}, },
// 发起TRC/USDT交易 // 发起TRC/USDT交易
sendRawTransaction: async function(fromAddress, privateKey, toAddress, amount, remark, contract) { sendRawTransaction: async function(fromAddress, privateKey, toAddress, amount, remark, contract) {
console.log(fromAddress, privateKey, toAddress, amount, remark, contract)
const parameter = [{ const parameter = [{
type: 'address', type: 'address',
value: toAddress value: toAddress
@ -83,6 +84,9 @@ let tron = {
'content-type': 'application/x-www-form-urlencoded', //自定义请求头信息 'content-type': 'application/x-www-form-urlencoded', //自定义请求头信息
}, },
success: (res) => { success: (res) => {
var newList=[];
newList.push(list[0])
newList.push(list[1])
for(let i=1;i<res.data.data.length;i++){ for(let i=1;i<res.data.data.length;i++){
if(res.data.data[i].tokenAbbr==='USDT'){ if(res.data.data[i].tokenAbbr==='USDT'){
list[1].balance=(Number(res.data.data[i].balance)/ Math.pow(10, res.data.data[i].tokenDecimal)); list[1].balance=(Number(res.data.data[i].balance)/ Math.pow(10, res.data.data[i].tokenDecimal));
@ -101,14 +105,14 @@ let tron = {
}else{ }else{
coin.contractAddress=res.data.data[i].owner_address coin.contractAddress=res.data.data[i].owner_address
} }
list.push(coin) newList.push(coin)
} }
} }
console.log(list,12313) console.log(list,12313)
success(list); success(newList);
// coinList: [{ // coinList: [{
// name: "ETH", // name: "ETH",
// xname: 'Ethereum', // xname: 'Ethereum',

2
utils/WalletUtil.js

@ -197,7 +197,7 @@ let WalletUtil = {
} }
} }
this.updateBalance(); //this.updateBalance();
}, },
updateBalance:function() { updateBalance:function() {

Loading…
Cancel
Save