Browse Source

代码

master
Dread 4 years ago
parent
commit
bd944babe4
  1. 29
      pages/menu/sendToken/transfer/index.vue
  2. 54
      pages/menu/setting/currency/index.vue
  3. 171
      pages/menu/setting/index.vue
  4. 69
      pages/menu/setting/lang/index.vue
  5. 10
      pages/menu/token/btc/index.vue
  6. 20
      pages/menu/wallet/index.vue
  7. 83
      unpackage/dist/dev/app-plus/app-service.js
  8. 34
      unpackage/dist/dev/app-plus/app-view.js
  9. 13
      utils/BtcUtil.js
  10. 20
      utils/EthUtil.js
  11. 146
      utils/WalletUtil.js
  12. 1
      utils/api.js
  13. 1
      utils/locales/en.js
  14. 1
      utils/locales/zh-F.js
  15. 1
      utils/locales/zh.js

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

@ -49,7 +49,7 @@
<text> </text> <text> </text>
<view class="inputc flex"> <view class="inputc flex">
<view class="textt"> <view class="textt">
USD {{currency}}
</view> </view>
<input type="text" :value="(price*transInfoPass.amount).toFixed(2)" disabled="disabled" <input type="text" :value="(price*transInfoPass.amount).toFixed(2)" disabled="disabled"
placeholder-style="font-size: 30rpx; color: #D0D0D2;" placeholder="0.0000000" placeholder-style="font-size: 30rpx; color: #D0D0D2;" placeholder="0.0000000"
@ -250,6 +250,7 @@
fee: 0, fee: 0,
show: false, show: false,
show2: false, show2: false,
currency:'USD',
showFinger: false, showFinger: false,
showBottom: false, showBottom: false,
fingerSuccess: false, fingerSuccess: false,
@ -436,8 +437,7 @@
}) })
return return
} }
this.showBottom = true;
this.show = true;
let that = this let that = this
if (this.coin.type === 'ETH') { if (this.coin.type === 'ETH') {
this.$EthUtil.getGas().then((res) => { this.$EthUtil.getGas().then((res) => {
@ -460,12 +460,15 @@
console.log(size.toString().length, "size") console.log(size.toString().length, "size")
that.transInfoPass.fee = Number(size) * (size.toString().length + 1) * 1000 / Math.pow(10, that.transInfoPass.fee = Number(size) * (size.toString().length + 1) * 1000 / Math.pow(10,
6) 6)
that.showBottom = true;
that.show = true;
}).catch(err => { }).catch(err => {
console.log(err) console.log(err)
that.showFinger = false; that.showFinger = false;
that.showBottom = true;
uni.showToast({ uni.showToast({
title: this.$t('index').addresserror, title: this.$t('index').addresserror,
icon: 'none', icon: 'none',
duration: 1500 duration: 1500
}) })
@ -619,9 +622,7 @@
this.coin = uni.getStorageSync('coin') this.coin = uni.getStorageSync('coin')
if (this.coin.balancePrice) {
this.price = (this.coin.balancePrice / this.coin.balance).toFixed(2)
}
// //
this.transInfoPass.fromAddress = this.coin.address; this.transInfoPass.fromAddress = this.coin.address;
this.transInfoPass.privateKey = this.coin.privateKey; this.transInfoPass.privateKey = this.coin.privateKey;
@ -632,7 +633,19 @@
if (uni.getStorageSync('fingerPass')) { if (uni.getStorageSync('fingerPass')) {
this.passShow = uni.getStorageSync('fingerPass') this.passShow = uni.getStorageSync('fingerPass')
} }
let currency=uni.getStorageSync('currency');
if(currency){
this.currency=currency;
}
if(this.currency==='USD'){
if (this.coin.balancePrice) {
this.price = (this.coin.balancePrice / this.coin.balance).toFixed(2)
}
}else{
if (this.coin.balanceCnyPrice) {
this.price = (this.coin.balanceCnyPrice / this.coin.balance).toFixed(2)
}
}
} }
}; };

54
pages/menu/setting/currency/index.vue

@ -8,23 +8,19 @@
<u-radio-group v-model="value" @change="radioGroupChange"> <u-radio-group v-model="currency" @change="radioGroupChange">
<view class="item flex" v-for="(item, index) in list" :key="index" @click="handove('en')"> <view class="item flex" v-for="(item, index) in list" :key="index" @click="handove('en')">
<view class="text1"> <view class="text1">
{{item.lang}} {{item.lang}}
</view> </view>
<u-radio <u-radio @change="radioChange" :name="item.name" :disabled="item.disabled"
@change="radioChange" active-color="#5B53FF">
:name="item.name"
:disabled="item.disabled"
active-color="#5B53FF"
>
</u-radio> </u-radio>
</view> </view>
</u-radio-group> </u-radio-group>
<view class="select_btn"> <view class="select_btn" @click="confirmCurrency">
Select Select
</view> </view>
</view> </view>
@ -39,31 +35,39 @@
data() { data() {
return { return {
checked: false, checked: false,
list: [ currency:'USD',
{ list: [{
lang:'USD', lang: 'USD',
disabled: false,
name:"b"
},
{
lang:'JPY',
disabled: false, disabled: false,
name:"a" name: "USD"
}, },
{ {
lang:'EUR', lang: 'CNY',
disabled: false, disabled: false,
name:"c" name: "CNY"
}, },
], ],
// u-radio-groupv-modelradioname // u-radio-groupv-modelradioname
value: '',
}; };
}, },
onLoad(){
let currency=uni.getStorageSync('currency');
if(currency){
this.currency=currency;
}else{
uni.setStorageSync('currency',this.currency)
}
},
methods: { methods: {
handove(item){ confirmCurrency(){
uni.setStorageSync('currency',this.currency)
uni.reLaunch({
url: '/pages/menu/setting/index'
})
},
handove(item) {
// if(item){ // if(item){
// } // }
@ -80,7 +84,7 @@
}, },
// radioradio-group // radioradio-group
radioGroupChange(e) { radioGroupChange(e) {
// console.log(e); console.log(this.currency)
}, },
change(status) { change(status) {
// console.log(status); // console.log(status);
@ -94,13 +98,11 @@
}; };
</script> </script>
<style scoped> <style scoped>
page { page {
background: #FAFAFA; background: #FAFAFA;
} }
</style> </style>
<style> <style>
@import './index.css'; @import './index.css';
</style> </style>

171
pages/menu/setting/index.vue

@ -19,7 +19,8 @@
</view> </view>
<view class=""> <view class="">
<text class="text2">{{value}}</text> <text class="text2">{{value}}</text>
<image src="../../../static/tongyonh/chevron_right_24px.png" mode="aspectFit" class="img1"></image> <image src="../../../static/tongyonh/chevron_right_24px.png" mode="aspectFit" class="img1">
</image>
</view> </view>
</view> </view>
<view class="item flex" @click="goCurr()"> <view class="item flex" @click="goCurr()">
@ -27,8 +28,9 @@
{{i18n.curr}} {{i18n.curr}}
</view> </view>
<view class=""> <view class="">
<text class="text2">USD</text> <text class="text2">{{currency}}</text>
<image src="../../../static/tongyonh/chevron_right_24px.png" mode="aspectFit" class="img1"></image> <image src="../../../static/tongyonh/chevron_right_24px.png" mode="aspectFit" class="img1">
</image>
</view> </view>
</view> </view>
<view class="item flex"> <view class="item flex">
@ -80,73 +82,74 @@
data() { data() {
return { return {
checked: false, checked: false,
show:false, show: false,
showFinger:false, showFinger: false,
fingerSuccess:false, fingerSuccess: false,
fingerFail:false, fingerFail: false,
hou_jia_w:false, hou_jia_w: false,
value:'English', currency: 'USD',
value: 'English',
}; };
}, },
methods: { methods: {
back(){ back() {
uni.reLaunch({ uni.reLaunch({
url:'/pages/menu/profile/index' url: '/pages/menu/profile/index'
}) })
}, },
// //
goLang(){ goLang() {
uni.navigateTo({ uni.navigateTo({
url:'./lang/index' url: './lang/index'
}) })
}, },
goCurr(){ goCurr() {
uni.navigateTo({ uni.navigateTo({
url:'./currency/index' url: './currency/index'
}) })
}, },
// //
cancel_hou(){ cancel_hou() {
this.hou_jia_w=false; this.hou_jia_w = false;
this.show=false; this.show = false;
this.checked=true; this.checked = true;
}, },
// //
confirm_hou(){ confirm_hou() {
this.checked=false this.checked = false
this.hou_jia_w=false; this.hou_jia_w = false;
this.show=false; this.show = false;
uni.setStorageSync('fingerPass',false) uni.setStorageSync('fingerPass', false)
}, },
// //
cancel(){ cancel() {
this.showFinger=false; this.showFinger = false;
this.checked=false; this.checked = false;
this.show=false; this.show = false;
this.printCancel(); this.printCancel();
}, },
// //
printCancel(){ printCancel() {
this.show=false; this.show = false;
plus.fingerprint.cancel(); plus.fingerprint.cancel();
console.log(4545454545) console.log(4545454545)
this.showFinger=false this.showFinger = false
}, },
fingerPass(){ fingerPass() {
console.log(this.checked) console.log(this.checked)
// //
if(this.checked){ if (this.checked) {
console.log(111) console.log(111)
this.show=true; this.show = true;
this.showFinger=true; this.showFinger = true;
this.fingerprint(true); this.fingerprint(true);
} }
// false使 // false使
if(!this.checked){ if (!this.checked) {
this.hou_jia_w=true; this.hou_jia_w = true;
this.show=true this.show = true
} }
@ -156,7 +159,7 @@
// #ifdef APP-PLUS // #ifdef APP-PLUS
if (!plus.fingerprint.isSupport()) { if (!plus.fingerprint.isSupport()) {
uni.showToast({ uni.showToast({
title:this.$t('index').fingerprintidentification, title: this.$t('index').fingerprintidentification,
icon: 'none', icon: 'none',
duration: 1500 duration: 1500
}) })
@ -193,68 +196,68 @@
duration: 1500, duration: 1500,
}) })
// #endif // #endif
// //
let that = this;
let that=this;
// #ifdef APP-PLUS // #ifdef APP-PLUS
plus.fingerprint.authenticate(function() { plus.fingerprint.authenticate(function() {
plus.nativeUI.closeWaiting(); //Android plus.nativeUI.closeWaiting(); //Android
// //
// 使 // 使
uni.setStorageSync('fingerPass',true) uni.setStorageSync('fingerPass', true)
that.showFinger=false; that.showFinger = false;
that.fingerSuccess=true; that.fingerSuccess = true;
that.show=false; that.show = false;
}, function(e) { }, function(e) {
//
switch (e.code) { switch (e.code) {
case e.AUTHENTICATE_MISMATCH: case e.AUTHENTICATE_MISMATCH:
plus.nativeUI.toast(that.$t('index').Fingerprintmatchingfailed); plus.nativeUI.toast(that.$t('index').Fingerprintmatchingfailed);
uni.setStorageSync('fingerPass',false) uni.setStorageSync('fingerPass', false)
that.showFinger=false; that.showFinger = false;
that.fingerFail=true; that.fingerFail = true;
that.checked=false that.checked = false
that.show=false;
break; break;
case e.AUTHENTICATE_OVERLIMIT: case e.AUTHENTICATE_OVERLIMIT:
plus.nativeUI.closeWaiting(); //Android plus.nativeUI.closeWaiting(); //Android
plus.nativeUI.alert(that.$t('index').Thenumberoffingerprint); plus.nativeUI.alert(
uni.setStorageSync('fingerPass',false) 'The number of fingerprint identification failures exceeds the limit. Please use other methods for authentication'
that.showFinger=false; );
that.fingerFail=true; uni.setStorageSync('fingerPass', false)
that.checked=false console.log(that.showFinger, 454545)
that.show=false; that.showFinger = false;
that.fingerFail = true;
that.checked = false
console.log(that.fingerFail, 454545)
break; break;
case e.CANCEL: case e.CANCEL:
plus.nativeUI.toast(that.$t('index').Recognitioncancelled); plus.nativeUI.toast(that.$t('index').Recognitioncancelled);
uni.setStorageSync('fingerPass',false) uni.setStorageSync('fingerPass', false)
that.showFinger=false; console.log(that.showFinger, 454545)
that.checked=false that.showFinger = false;
that.fingerFail=true; that.checked = false
that.show=false; that.fingerFail = true;
that.show = false;
console.log(that.fingerFail, 454545)
break; break;
default: default:
plus.nativeUI.closeWaiting(); //Android plus.nativeUI.closeWaiting(); //Android
uni.setStorageSync('fingerPass',false) uni.setStorageSync('fingerPass', false)
console.log(that.showFinger,454545) console.log(that.showFinger, 454545)
that.showFinger=false; that.showFinger = false;
that.checked=false that.checked = false
that.show=false; that.fingerFail = true;
that.fingerFail=true; console.log(that.fingerFail, 454545)
plus.nativeUI.alert(that.$t('index').Fingerprintidentificationfailed); plus.nativeUI.alert(that.$t('index').Fingerprintidentificationfailed);
break; break;
} }
}); });
// Android // Android
if ('Android' == plus.os.name) { if ('Android' == plus.os.name) {
this.show=true; this.show = true;
/* plus.nativeUI.showWaiting('...').onclose = function() { /* plus.nativeUI.showWaiting('...').onclose = function() {
plus.fingerprint.cancel(); plus.fingerprint.cancel();
} */ } */
} }
// #endif // #endif
} }
// #endif // #endif
}, },
@ -264,20 +267,28 @@
}, },
onShow() { onShow() {
if(uni.getStorageSync('langTrue')){ if (uni.getStorageSync('langTrue')) {
this.value=uni.getStorageSync('langTrue') this.value = uni.getStorageSync('langTrue')
console.log(this.value,454545) console.log(this.value, 454545)
}else{ } else {
uni.setStorageSync('langTrue',this.value) uni.setStorageSync('langTrue', this.value)
}
let currency = uni.getStorageSync('currency');
if (currency) {
this.currency = currency;
console.log(this.currency)
} else {
uni.setStorageSync('currency', this.currency)
} }
}, },
onLoad() { onLoad() {
// //
if(uni.getStorageSync('fingerPass')){ if (uni.getStorageSync('fingerPass')) {
this.checked=uni.getStorageSync('fingerPass') this.checked = uni.getStorageSync('fingerPass')
} }
}, },
computed: { computed: {
i18n() { i18n() {
@ -287,13 +298,11 @@
}; };
</script> </script>
<style scoped> <style scoped>
page { page {
background: #FAFAFA; background: #FAFAFA;
} }
</style> </style>
<style> <style>
@import './index.css'; @import './index.css';
</style> </style>

69
pages/menu/setting/lang/index.vue

@ -10,12 +10,8 @@
<view class="text1"> <view class="text1">
{{item.lang}} {{item.lang}}
</view> </view>
<u-radio <u-radio @change="radioChange" :name="item.name" :disabled="item.disabled"
@change="radioChange" active-color="#5B53FF">
:name="item.name"
:disabled="item.disabled"
active-color="#5B53FF"
>
</u-radio> </u-radio>
</view> </view>
@ -35,25 +31,24 @@
export default { export default {
data() { data() {
return { return {
language: this.$store.state.language == 'en' ? 'English' : '简体中文' , language: this.$store.state.language == 'en' ? 'English' : '简体中文',
checked: false, checked: false,
langInfo:{}, langInfo: {},
lang:'', lang: '',
list: [ list: [{
{ lang: this.$t('index').langfan,
lang:this.$t('index').langfan,
disabled: false, disabled: false,
name:"b", name: "b",
}, },
{ {
lang:this.$t('index').langjian, lang: this.$t('index').langjian,
disabled: false, disabled: false,
name:"a", name: "a",
}, },
{ {
lang:this.$t('index').eng, lang: this.$t('index').eng,
disabled: false, disabled: false,
name:"c", name: "c",
}, },
], ],
@ -65,35 +60,35 @@
methods: { methods: {
// //
// //
nowLanguage(e,i) { nowLanguage(e, i) {
console.log(e,22222) console.log(e, 22222)
this.value=e.name this.value = e.name
this.lang=e.lang this.lang = e.lang
this.langInfo=e; this.langInfo = e;
console.log(this.langInfo,22222) console.log(this.langInfo, 22222)
}, },
confirmLanguage(){ confirmLanguage() {
uni.setStorageSync('lang',this.value) uni.setStorageSync('lang', this.value)
console.log(this.langInfo,1212212) console.log(this.langInfo, 1212212)
if (this.langInfo.name == 'c') { if (this.langInfo.name == 'c') {
this._i18n.locale = 'en' this._i18n.locale = 'en'
this.$store.commit('setLanguage', 'en') this.$store.commit('setLanguage', 'en')
uni.setStorageSync('langTrue','English') uni.setStorageSync('langTrue', 'English')
uni.setStorageSync("language", 'en') uni.setStorageSync("language", 'en')
} else if (this.langInfo.name == 'a') { } else if (this.langInfo.name == 'a') {
this._i18n.locale = 'zh-CN' this._i18n.locale = 'zh-CN'
this.$store.commit('setLanguage', 'zh-CN') this.$store.commit('setLanguage', 'zh-CN')
uni.setStorageSync("language", 'zh-CN') uni.setStorageSync("language", 'zh-CN')
uni.setStorageSync('langTrue','简体中文') uni.setStorageSync('langTrue', '简体中文')
}else{ } else {
this._i18n.locale = 'zh-CNF' this._i18n.locale = 'zh-CNF'
this.$store.commit('setLanguage', 'zh-CNF') this.$store.commit('setLanguage', 'zh-CNF')
uni.setStorageSync("language", 'zh-CNF') uni.setStorageSync("language", 'zh-CNF')
uni.setStorageSync('langTrue','繁體中文') uni.setStorageSync('langTrue', '繁體中文')
} }
uni.reLaunch({ uni.reLaunch({
url:'/pages/menu/setting/index' url: '/pages/menu/setting/index'
}) })
}, },
radioChange(e) { radioChange(e) {
@ -113,22 +108,20 @@
}, },
}, },
onLoad() { onLoad() {
if(uni.getStorageSync('lang')){ if (uni.getStorageSync('lang')) {
this.value=uni.getStorageSync('lang') this.value = uni.getStorageSync('lang')
}else{ } else {
uni.setStorageSync('lang',this.value) uni.setStorageSync('lang', this.value)
} }
} }
}; };
</script> </script>
<style scoped> <style scoped>
page { page {
background: #FAFAFA; background: #FAFAFA;
} }
</style> </style>
<style> <style>
@import './index.css'; @import './index.css';
</style> </style>

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

@ -15,7 +15,10 @@
<view class=""> <view class="">
{{coin.balance}} {{coin.name}} {{coin.balance}} {{coin.name}}
</view> </view>
<text class="text2"> $ {{coin.balancePrice?coin.balancePrice:0}}</text> <text class="text2">
{{currency=='USD'?'$ '+(!coin.balancePrice?0.00:coin.balancePrice):'¥ '+(!coin.balanceCnyPrice?0.00:coin.balanceCnyPrice)}}
</text>
</text> </text>
<image src="../../../../static/tongyonh/ethereum.png" mode="aspectFit" class="img1" <image src="../../../../static/tongyonh/ethereum.png" mode="aspectFit" class="img1"
v-if="coin.type=='ETH'&&!coin.contractAddress"></image> v-if="coin.type=='ETH'&&!coin.contractAddress"></image>
@ -114,6 +117,7 @@
// address // address
trxs: [], trxs: [],
coin: {}, coin: {},
currency:'USD',
isNoData:false, isNoData:false,
showInfo: false, showInfo: false,
list: [{ list: [{
@ -231,6 +235,10 @@
onLoad() { onLoad() {
this.coin = uni.getStorageSync('coin'); this.coin = uni.getStorageSync('coin');
this.change(0); this.change(0);
let currency=uni.getStorageSync('currency');
if(currency){
this.currency=currency;
}
} }
}; };

20
pages/menu/wallet/index.vue

@ -26,7 +26,7 @@
v-if="showMoney2"></image> v-if="showMoney2"></image>
</view> </view>
<view class="textcon2" v-if="showMoney1"> <view class="textcon2" v-if="showMoney1">
$ {{!userObj.balancePrice?0.00:userObj.balancePrice}} {{currency=='USD'?'$ '+(!userObj.totalBalancePrice?0.00:userObj.totalBalancePrice):'¥ '+(!userObj.totalBalanceCnyPrice?0.00:userObj.totalBalanceCnyPrice)}}
</view> </view>
<view class="textcon2" v-if="showMoney2"> <view class="textcon2" v-if="showMoney2">
*** ***
@ -63,7 +63,8 @@
{{item.balance}} {{item.balance}}
</view> </view>
<view class="text2" v-if="item.balancePrice"> <view class="text2" v-if="item.balancePrice">
$ {{item.balancePrice}}
{{currency=='USD'?'$ '+(!item.balancePrice?0.00:item.balancePrice):'¥ '+(!item.balanceCnyPrice?0.00:item.balanceCnyPrice)}}
</view> </view>
<view class="text2" v-if="!item.balancePrice"> <view class="text2" v-if="!item.balancePrice">
$ 0.00 $ 0.00
@ -91,6 +92,7 @@
return { return {
eth: '', eth: '',
trc: 'Hello', trc: 'Hello',
currency:'USD',
walletInfo: {}, walletInfo: {},
userObj: {}, userObj: {},
userObj2: {}, userObj2: {},
@ -104,14 +106,16 @@
this.isStop = true this.isStop = true
}, },
onLoad() { onLoad() {
let currency=uni.getStorageSync('currency');
if(currency){
this.currency=currency;
}
// //
this.$walletUtil.updateBalance();
this.userObj = uni.getStorageSync('wallet'); this.userObj = uni.getStorageSync('wallet');
let that = this;
this.$walletUtil.updateBalance(function() {
that.userObj = uni.getStorageSync('wallet');
that.userObj2 = uni.getStorageSync('wallet');
});
}, },
computed: { computed: {
i18n() { i18n() {

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

File diff suppressed because one or more lines are too long

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

@ -2319,7 +2319,7 @@ var render = function() {
_c( _c(
"v-uni-text", "v-uni-text",
{ staticClass: _vm._$g(9, "sc"), attrs: { _i: 9 } }, { staticClass: _vm._$g(9, "sc"), attrs: { _i: 9 } },
[_vm._v("≈ $ " + _vm._$g(9, "t0-0"))] [_vm._v("≈ " + _vm._$g(9, "t0-0"))]
) )
], ],
1 1
@ -16198,7 +16198,7 @@ var render = function() {
staticClass: _vm._$g(25, "sc"), staticClass: _vm._$g(25, "sc"),
attrs: { _i: 25 } attrs: { _i: 25 }
}, },
[_vm._v("USD")] [_vm._v(_vm._$g(25, "t0-0"))]
), ),
_c("v-uni-input", { _c("v-uni-input", {
staticClass: _vm._$g(26, "sc"), staticClass: _vm._$g(26, "sc"),
@ -17381,7 +17381,7 @@ var render = function() {
_c( _c(
"v-uni-text", "v-uni-text",
{ staticClass: _vm._$g(16, "sc"), attrs: { _i: 16 } }, { staticClass: _vm._$g(16, "sc"), attrs: { _i: 16 } },
[_vm._v("USD")] [_vm._v(_vm._$g(16, "t0-0"))]
), ),
_c("v-uni-image", { _c("v-uni-image", {
staticClass: _vm._$g(17, "sc"), staticClass: _vm._$g(17, "sc"),
@ -17997,7 +17997,7 @@ if(false) {}
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../../HBuilderX/plugins/uniapp-cli/node_modules/css-loader/dist/runtime/api.js */ 10); var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../../HBuilderX/plugins/uniapp-cli/node_modules/css-loader/dist/runtime/api.js */ 10);
exports = ___CSS_LOADER_API_IMPORT___(false); exports = ___CSS_LOADER_API_IMPORT___(false);
// Module // Module
exports.push([module.i, "\nbody[data-v-8b9a2ca8] {\r\n\t\tbackground: #FAFAFA;\n}\r\n", ""]); exports.push([module.i, "\nbody[data-v-8b9a2ca8] {\n\tbackground: #FAFAFA;\n}\n", ""]);
// Exports // Exports
module.exports = exports; module.exports = exports;
@ -18049,7 +18049,7 @@ if(false) {}
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../../HBuilderX/plugins/uniapp-cli/node_modules/css-loader/dist/runtime/api.js */ 10); var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../../HBuilderX/plugins/uniapp-cli/node_modules/css-loader/dist/runtime/api.js */ 10);
exports = ___CSS_LOADER_API_IMPORT___(false); exports = ___CSS_LOADER_API_IMPORT___(false);
// Module // Module
exports.push([module.i, ".main{\r\n\tpadding: 0 24rpx;\r\n\tmargin-top: 40rpx;\n}\n.main_con{\r\n\tbackground-color: #fff;\r\n\tborder-radius: 20rpx;\r\n\tbox-shadow: 0 0 30rpx #EDEFF2;\r\n\tpadding: 0 24rpx;\n}\n.flex{\r\n\tdisplay: flex;\r\n\tjustify-content: space-between;\r\n\talign-items: center;\n}\n.back{\r\n\t\twidth: 30rpx;\r\n\t\theight: 30rpx;\r\n\t\tposition: absolute;\r\n\t\tleft:36rpx;\r\n\t top: 50%;\r\n\t\t-webkit-transform: translateY(-50%);\r\n\t\t transform: translateY(-50%);\n}\n.main .item{\r\n\t\tpadding: 30rpx 0;\r\n\t\theight: 136rpx;\r\n\t\tborder-bottom: 2rpx solid #F4F7FE;\n}\n.main .item .text1{\r\n\t\tfont-weight: 500;\n}\n.img1{\r\n\t\twidth: 24rpx;\r\n\t\theight: 24rpx;\r\n\t\tvertical-align: middle;\n}\n.main .item .text2{\r\n\t\tcolor: #A3AED0;\r\n\t\tmargin-right: 20rpx;\n}\n.zhiwen_con{\r\n\t\tbackground-color: #F8F8F9;\r\n\t\tborder-radius: 26rpx 26rpx 0 0;\r\n\t\tpadding: 0 24rpx;\r\n\t\tposition: absolute;\r\n\t\tz-index: 9999;\r\n\t\tbottom: 0;\r\n\t\t\t\tpadding-top: 24rpx;\r\n\t\t\t\tpadding-bottom: 100rpx;\r\n\t\t\t\twidth: 100%;\n}\n.zhiwen_con .tiao{\r\n\t\twidth: 96rpx;\r\n\t\theight: 8rpx;\r\n\t\tbackground-color: #C9D4EA;\r\n\t\tborder-radius: 8rpx;\r\n\t\tmargin: 0 auto;\n}\n.zhiwen_con .bigtitle{\r\n\t\ttext-align: center;\r\n\t\tfont-weight: 700;\r\n\t\tfont-size: 36rpx;\r\n\t\tpadding-top: 34rpx;\r\n\t\tpadding-bottom: 36rpx;\n}\n.zhiwen_con .bottom_con {\r\n\t\tbackground-color: #fff;\r\n\t\tborder-radius: 26rpx;\r\n\t\tpadding-left: 26rpx;\r\n\t\tpadding-right: 40rpx;\r\n\t\tposition: relative;\r\n\t\theight: 480rpx;\r\n\t\tpadding-top: 100rpx;\n}\n.zhiwen_con .bottom_con .img1{\r\n\t\tdisplay: block;\r\n\t\twidth: 96rpx;\r\n\t\theight: 106rpx;\r\n\t\tmargin: 0 auto;\n}\n.zhiwen_con .bottom_con .text1{\r\n\t\ttext-align: center;\r\n\t\tcolor: #7D87A6;\r\n\t\tfont-size: 28rpx;\r\n\t\tmargin-top: 45rpx;\r\n\t\tmargin-bottom: 80rpx;\n}\n.zhiwen_con .bottom_con .con .textt1{\r\n\t\tcolor: #5B53FF;\n}\n.zhiwen_con .bottom_con .con .textt2{\r\n\t\tcolor: #639AF2;\n}\n.red{\r\n\t\tcolor: #F16063 !important;\n}\n.green{\r\n\t\tcolor: #6AD6A8 !important;\n}\r\n/* 指纹后加 */\n.hou_jia{\r\n\t\twidth: 95%;\r\n\t\theight: 300rpx;\r\n\t\tborder-radius: 20rpx;\r\n\t\tposition: relative;\r\n\t\tleft: 50%;\r\n\t\ttop: 40%;\r\n\t\t-webkit-transform: translate(-50%,-60%);\r\n\t\t transform: translate(-50%,-60%);\r\n\t\tbackground-color: #414141;\r\n\t\tpadding: 48rpx;\r\n\t\tz-index: 9999;\n}\n.rela{\n}\n.zzw{\r\n\t\tdisplay: block;\r\n\t\twidth: 88rpx;\r\n\t\theight: 88rpx;\r\n\t\tmargin: 20rpx auto;\n}\n.Log{\r\n\t\ttext-align: center;\r\n\t\tcolor: #fff;\n}\n.hou_jia_w{\r\n\t\tbackground-color: #fff !important;\n}\n.fontt{\r\n\t\tfont-size: 32rpx;\n}\n.ccon{\r\n\t\tdisplay: flex;\r\n\t\tposition: absolute;\r\n\t\tright: 50rpx;\r\n\t\tbottom: 50rpx;\n}\n.cancle{\r\n\t\tmargin-right: 50rpx;\n}\r\n\r\n", ""]); exports.push([module.i, ".main{\r\n\tpadding: 0 24rpx;\r\n\tmargin-top: 40rpx;\n}\n.main_con{\r\n\tbackground-color: #fff;\r\n\tborder-radius: 20rpx;\r\n\tbox-shadow: 0 0 30rpx #EDEFF2;\r\n\tpadding: 0 24rpx;\n}\n.flex{\r\n\tdisplay: flex;\r\n\tjustify-content: space-between;\r\n\talign-items: center;\n}\n.back{\r\n\t\twidth: 30rpx;\r\n\t\theight: 30rpx;\r\n\t\tposition: absolute;\r\n\t\tleft:36rpx;\r\n\t top: 50%;\r\n\t\t-webkit-transform: translateY(-50%);\r\n\t\t transform: translateY(-50%);\n}\n.main .item{\r\n\t\tpadding: 30rpx 0;\r\n\t\theight: 136rpx;\r\n\t\tborder-bottom: 2rpx solid #F4F7FE;\n}\n.main .item .text1{\r\n\t\tfont-weight: 500;\n}\n.img1{\r\n\t\twidth: 24rpx;\r\n\t\theight: 24rpx;\r\n\t\tvertical-align: middle;\n}\n.main .item .text2{\r\n\t\tcolor: #A3AED0;\r\n\t\tmargin-right: 20rpx;\n}\n.zhiwen_con{\r\n\t\tbackground-color: #F8F8F9;\r\n\t\tborder-radius: 26rpx 26rpx 0 0;\r\n\t\tpadding: 0 24rpx;\r\n\t\tposition: absolute;\r\n\t\tz-index: 9999;\r\n\t\tbottom: 0;\r\n\t\t\t\tpadding-top: 24rpx;\r\n\t\t\t\tpadding-bottom: 100rpx;\r\n\t\t\t\twidth: 100%;\n}\n.zhiwen_con .tiao{\r\n\t\twidth: 96rpx;\r\n\t\theight: 8rpx;\r\n\t\tbackground-color: #C9D4EA;\r\n\t\tborder-radius: 8rpx;\r\n\t\tmargin: 0 auto;\n}\n.zhiwen_con .bigtitle{\r\n\t\ttext-align: center;\r\n\t\tfont-weight: 700;\r\n\t\tfont-size: 36rpx;\r\n\t\tpadding-top: 34rpx;\r\n\t\tpadding-bottom: 36rpx;\n}\n.zhiwen_con .bottom_con {\r\n\t\tbackground-color: #fff;\r\n\t\tborder-radius: 26rpx;\r\n\t\tpadding-left: 26rpx;\r\n\t\tpadding-right: 40rpx;\r\n\t\tposition: relative;\r\n\t\theight: 480rpx;\r\n\t\tpadding-top: 100rpx;\n}\n.zhiwen_con .bottom_con .img1{\r\n\t\tdisplay: block;\r\n\t\twidth: 96rpx;\r\n\t\theight: 106rpx;\r\n\t\tmargin: 0 auto;\n}\n.zhiwen_con .bottom_con .text1{\r\n\t\ttext-align: center;\r\n\t\tcolor: #7D87A6;\r\n\t\tfont-size: 28rpx;\r\n\t\tmargin-top: 45rpx;\r\n\t\tmargin-bottom: 80rpx;\n}\n.zhiwen_con .bottom_con .con .textt1{\r\n\t\tcolor: #5B53FF;\n}\n.zhiwen_con .bottom_con .con .textt2{\r\n\t\tcolor: #639AF2;\n}\n.red{\r\n\t\tcolor: #F16063 !important;\n}\n.green{\r\n\t\tcolor: #6AD6A8 !important;\n}\r\n/* 指纹后加 */\n.hou_jia{\r\n\t\twidth: 95%;\r\n\t\theight: 300rpx;\r\n\t\tborder-radius: 20rpx;\r\n\t\tposition: relative;\r\n\t\tleft: 50%;\r\n\t\ttop: 40%;\r\n\t\t-webkit-transform: translate(-50%,-60%);\r\n\t\t transform: translate(-50%,-60%);\r\n\t\tbackground-color: #414141;\r\n\t\tpadding: 48rpx;\r\n\t\tz-index: 9999;\n}\n.rela{\n}\n.zzw{\r\n\t\tdisplay: block;\r\n\t\twidth: 88rpx;\r\n\t\theight: 88rpx;\r\n\t\tmargin: 20rpx auto;\n}\n.Log{\r\n\t\ttext-align: center;\r\n\t\tcolor: #fff;\n}\n.hou_jia_w{\r\n\t\tbackground-color: #fff !important;\n}\n.fontt{\r\n\t\tfont-size: 32rpx;\n}\n.ccon{\r\n\t\tdisplay: flex;\r\n\t\tposition: absolute;\r\n\t\tright: 50rpx;\r\n\t\tbottom: 50rpx;\n}\n.cancle{\r\n\t\tmargin-right: 50rpx;\n}\r\n", ""]);
// Exports // Exports
module.exports = exports; module.exports = exports;
@ -21078,7 +21078,7 @@ var render = function() {
? _c( ? _c(
"v-uni-view", "v-uni-view",
{ staticClass: _vm._$g(14, "sc"), attrs: { _i: 14 } }, { staticClass: _vm._$g(14, "sc"), attrs: { _i: 14 } },
[_vm._v("$ " + _vm._$g(14, "t0-0"))] [_vm._v(_vm._$g(14, "t0-0"))]
) )
: _vm._e(), : _vm._e(),
_vm._$g(15, "i") _vm._$g(15, "i")
@ -21210,7 +21210,7 @@ var render = function() {
staticClass: _vm._$g("30-" + $30, "sc"), staticClass: _vm._$g("30-" + $30, "sc"),
attrs: { _i: "30-" + $30 } attrs: { _i: "30-" + $30 }
}, },
[_vm._v("≈ $ " + _vm._$g("30-" + $30, "t0-0"))] [_vm._v("≈ " + _vm._$g("30-" + $30, "t0-0"))]
) )
: _vm._e(), : _vm._e(),
_vm._$g("31-" + $30, "i") _vm._$g("31-" + $30, "i")
@ -23736,7 +23736,7 @@ var render = function() {
model: { model: {
value: _vm._$g(4, "v-model"), value: _vm._$g(4, "v-model"),
callback: function() {}, callback: function() {},
expression: "value" expression: "currency"
} }
}, },
_vm._l(_vm._$g(5, "f"), function(item, index, $20, $30) { _vm._l(_vm._$g(5, "f"), function(item, index, $20, $30) {
@ -23777,7 +23777,15 @@ var render = function() {
), ),
_c( _c(
"v-uni-view", "v-uni-view",
{ staticClass: _vm._$g(8, "sc"), attrs: { _i: 8 } }, {
staticClass: _vm._$g(8, "sc"),
attrs: { _i: 8 },
on: {
click: function($event) {
return _vm.$handleViewEvent($event)
}
}
},
[_vm._v("Select")] [_vm._v("Select")]
) )
], ],
@ -23878,7 +23886,7 @@ if(false) {}
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../../../HBuilderX/plugins/uniapp-cli/node_modules/css-loader/dist/runtime/api.js */ 10); var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../../../HBuilderX/plugins/uniapp-cli/node_modules/css-loader/dist/runtime/api.js */ 10);
exports = ___CSS_LOADER_API_IMPORT___(false); exports = ___CSS_LOADER_API_IMPORT___(false);
// Module // Module
exports.push([module.i, "\nbody[data-v-5c7fa88a] {\r\n\t\tbackground: #FAFAFA;\n}\r\n", ""]); exports.push([module.i, "\nbody[data-v-5c7fa88a] {\n\tbackground: #FAFAFA;\n}\n", ""]);
// Exports // Exports
module.exports = exports; module.exports = exports;
@ -23930,7 +23938,7 @@ if(false) {}
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../../../HBuilderX/plugins/uniapp-cli/node_modules/css-loader/dist/runtime/api.js */ 10); var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../../../HBuilderX/plugins/uniapp-cli/node_modules/css-loader/dist/runtime/api.js */ 10);
exports = ___CSS_LOADER_API_IMPORT___(false); exports = ___CSS_LOADER_API_IMPORT___(false);
// Module // Module
exports.push([module.i, ".main{\r\n\tpadding: 0 24rpx;\r\n\tmargin-top: 40rpx;\n}\n.main_con{\r\n\tbackground-color: #fff;\r\n\tborder-radius: 20rpx;\r\n\tbox-shadow: 0 0 30rpx #EDEFF2;\r\n\tpadding: 0 24rpx;\r\n\tpadding-bottom: 60rpx;\n}\n.flex{\r\n\tdisplay: flex;\r\n\tjustify-content: space-between;\r\n\talign-items: center;\n}\n.main .item{\r\n\t\tpadding: 30rpx 0;\r\n\t\theight: 136rpx;\r\n\t\tborder-bottom: 2rpx solid #F4F7FE;\r\n\t\twidth: 100%;\n}\n .u-radio-group{\r\n\twidth: 100% !important;\n}\n.select_btn{\r\n\twidth: 100%;\r\n\tbackground-color: #5B53FF;\r\n\tborder-radius: 30rpx;\r\n\ttext-align: center;\r\n\tcolor: #fff;\r\n\tfont-size: 32rpx;\r\n\tmargin-top: 40rpx;\r\n\tline-height: 96rpx;\n}\r\n\r\n", ""]); exports.push([module.i, ".main{\r\n\tpadding: 0 24rpx;\r\n\tmargin-top: 40rpx;\n}\n.main_con{\r\n\tbackground-color: #fff;\r\n\tborder-radius: 20rpx;\r\n\tbox-shadow: 0 0 30rpx #EDEFF2;\r\n\tpadding: 0 24rpx;\r\n\tpadding-bottom: 60rpx;\n}\n.flex{\r\n\tdisplay: flex;\r\n\tjustify-content: space-between;\r\n\talign-items: center;\n}\n.main .item{\r\n\t\tpadding: 30rpx 0;\r\n\t\theight: 136rpx;\r\n\t\tborder-bottom: 2rpx solid #F4F7FE;\r\n\t\twidth: 100%;\n}\n .u-radio-group{\r\n\twidth: 100% !important;\n}\n.select_btn{\r\n\twidth: 100%;\r\n\tbackground-color: #5B53FF;\r\n\tborder-radius: 30rpx;\r\n\ttext-align: center;\r\n\tcolor: #fff;\r\n\tfont-size: 32rpx;\r\n\tmargin-top: 40rpx;\r\n\tline-height: 96rpx;\n}\r\n", ""]);
// Exports // Exports
module.exports = exports; module.exports = exports;
@ -24216,7 +24224,7 @@ if(false) {}
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../../../HBuilderX/plugins/uniapp-cli/node_modules/css-loader/dist/runtime/api.js */ 10); var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../../../HBuilderX/plugins/uniapp-cli/node_modules/css-loader/dist/runtime/api.js */ 10);
exports = ___CSS_LOADER_API_IMPORT___(false); exports = ___CSS_LOADER_API_IMPORT___(false);
// Module // Module
exports.push([module.i, "\nbody[data-v-3c7cada7] {\r\n\t\tbackground: #FAFAFA;\n}\r\n", ""]); exports.push([module.i, "\nbody[data-v-3c7cada7] {\n\tbackground: #FAFAFA;\n}\n", ""]);
// Exports // Exports
module.exports = exports; module.exports = exports;
@ -24268,7 +24276,7 @@ if(false) {}
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../../../HBuilderX/plugins/uniapp-cli/node_modules/css-loader/dist/runtime/api.js */ 10); var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ../../../../../HBuilderX/plugins/uniapp-cli/node_modules/css-loader/dist/runtime/api.js */ 10);
exports = ___CSS_LOADER_API_IMPORT___(false); exports = ___CSS_LOADER_API_IMPORT___(false);
// Module // Module
exports.push([module.i, ".main{\r\n\tpadding: 0 24rpx;\r\n\tmargin-top: 40rpx;\n}\n.main_con{\r\n\tbackground-color: #fff;\r\n\tborder-radius: 20rpx;\r\n\tbox-shadow: 0 0 30rpx #EDEFF2;\r\n\tpadding: 0 24rpx;\r\n\tpadding-bottom: 60rpx;\n}\n.flex{\r\n\tdisplay: flex;\r\n\tjustify-content: space-between;\r\n\talign-items: center;\n}\n.main .item{\r\n\t\tpadding: 30rpx 0;\r\n\t\theight: 136rpx;\r\n\t\tborder-bottom: 2rpx solid #F4F7FE;\r\n\t\twidth: 100%;\n}\n .u-radio-group{\r\n\twidth: 100% !important;\n}\n.select_btn{\r\n\twidth: 100%;\r\n\tbackground-color: #5B53FF;\r\n\tborder-radius: 30rpx;\r\n\ttext-align: center;\r\n\tcolor: #fff;\r\n\tfont-size: 32rpx;\r\n\tmargin-top: 40rpx;\r\n\tline-height: 96rpx;\n}\r\n\r\n", ""]); exports.push([module.i, ".main{\r\n\tpadding: 0 24rpx;\r\n\tmargin-top: 40rpx;\n}\n.main_con{\r\n\tbackground-color: #fff;\r\n\tborder-radius: 20rpx;\r\n\tbox-shadow: 0 0 30rpx #EDEFF2;\r\n\tpadding: 0 24rpx;\r\n\tpadding-bottom: 60rpx;\n}\n.flex{\r\n\tdisplay: flex;\r\n\tjustify-content: space-between;\r\n\talign-items: center;\n}\n.main .item{\r\n\t\tpadding: 30rpx 0;\r\n\t\theight: 136rpx;\r\n\t\tborder-bottom: 2rpx solid #F4F7FE;\r\n\t\twidth: 100%;\n}\n .u-radio-group{\r\n\twidth: 100% !important;\n}\n.select_btn{\r\n\twidth: 100%;\r\n\tbackground-color: #5B53FF;\r\n\tborder-radius: 30rpx;\r\n\ttext-align: center;\r\n\tcolor: #fff;\r\n\tfont-size: 32rpx;\r\n\tmargin-top: 40rpx;\r\n\tline-height: 96rpx;\n}\r\n", ""]);
// Exports // Exports
module.exports = exports; module.exports = exports;

13
utils/BtcUtil.js

@ -1,14 +1,13 @@
let BtcUtil = { let BtcUtil = {
getBalance: function(address,success) { getBalance:async function(address,success) {
let balance=0; let balance=0;
try{ try{
uni.request({ let res= await uni.request({
url: 'http://scan.weirui0755.com/btc/api/address/balancetrend/btc/' + address, //请求接口 url: 'http://scan.weirui0755.com/btc/api/address/balancetrend/btc/' + address, //请求接口
header: { header: {
'content-type': 'application/x-www-form-urlencoded', //自定义请求头信息 'content-type': 'application/x-www-form-urlencoded', //自定义请求头信息
}, }
success: (res) => { });
if (res.data.code === 1) { if (res.data.code === 1) {
if(res.data.data.length>0){ if(res.data.data.length>0){
var data=res.data.data[0]; var data=res.data.data[0];
@ -18,12 +17,10 @@ let BtcUtil = {
} }
} }
} }
}
});
}catch(e){ }catch(e){
//TODO handle the exception //TODO handle the exception
} }
success(balance); return balance;
} }
} }
export default BtcUtil export default BtcUtil

20
utils/EthUtil.js

@ -48,14 +48,12 @@ let eth = {
'params': [address, "latest"] 'params': [address, "latest"]
}; };
let res =await uni.request({ let res =await uni.request({
url: 'http://47.245.25.82:8545', //仅为示例,并非真实接口地址。 url: systemConfiguration.constant.ethNode, //仅为示例,并非真实接口地址。
method: 'POST', method: 'POST',
data: data, data: data,
dataType: 'json'}); dataType: 'json'});
try { try {
let balance = Number(web3.utils.hexToNumberString(res[1].data.result)) / Math.pow(10, 18) let balance = Number(web3.utils.hexToNumberString(res[1].data.result)) / Math.pow(10, 18)
console.log(balance,45465465)
return balance return balance
} catch (e) { } catch (e) {
return 0; return 0;
@ -70,7 +68,7 @@ let eth = {
return s + num; return s + num;
}, },
// 获取bms,bmdt,usdt/erc余额 // 获取bms,bmdt,usdt/erc余额
getTokenBalance: function(address, contract,success) { getTokenBalance:async function(address, contract,success) {
web3 = new Web3(); web3 = new Web3();
const data = { const data = {
'jsonrpc': '2.0', 'jsonrpc': '2.0',
@ -83,19 +81,15 @@ let eth = {
}; };
uni.request({ let res =await uni.request({
url: 'https://mainnet.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161', //仅为示例,并非真实接口地址。 url: 'https://mainnet.infura.io/v3/9aa3d95b3bc440fa88ea12eaa4456161', //仅为示例,并非真实接口地址。
method: 'POST', method: 'POST',
data: data, data: data,
dataType: 'json', dataType: 'json'
success: (res) => {
console.log(res,45454)
let balance = Number(web3.utils.hexToNumberString(res['data']['result'])) / Math.pow(10, 18)
console.log(balance,45454)
success(balance)
}
}); });
let balance = Number(web3.utils.hexToNumberString(res['data']['result'])) / Math.pow(10, 18)
return balance;
}, },

146
utils/WalletUtil.js

@ -2,6 +2,7 @@ import TokenUtil from './TokenUtil.js'
import BtcUtil from './BtcUtil.js' import BtcUtil from './BtcUtil.js'
import TronUtil from './TronUtil.js' import TronUtil from './TronUtil.js'
import EthUtil from './EthUtil.js' import EthUtil from './EthUtil.js'
import api from './api.js'
let fullWallet = { let fullWallet = {
"BTC": [{ "BTC": [{
@ -65,7 +66,8 @@ let WalletUtil = {
walletInfo.BTC[0].mnemonic = mnemonic; walletInfo.BTC[0].mnemonic = mnemonic;
walletInfo.BTC[0].privateKey = btc.privateKey; walletInfo.BTC[0].privateKey = btc.privateKey;
walletInfo.BTC[0].address = btc.address; walletInfo.BTC[0].address = btc.address;
walletInfo.BTC[0].ellipsisAddress =walletInfo.BTC[0].address.substring(0, 6) + '...' + walletInfo.BTC[0].address.substring(25, walletInfo.BTC[0].ellipsisAddress = walletInfo.BTC[0].address.substring(0, 6) + '...' + walletInfo.BTC[
0].address.substring(25,
walletInfo.BTC[0].address.length) walletInfo.BTC[0].address.length)
let eth = TokenUtil.generateEth(mnemonic) let eth = TokenUtil.generateEth(mnemonic)
walletInfo.ETH[0].password = password; walletInfo.ETH[0].password = password;
@ -205,100 +207,98 @@ let WalletUtil = {
} }
}, },
updateBalance: function(success) { updateBalance: async function(success) {
const wallet = uni.getStorageSync('wallet'); const wallet = uni.getStorageSync('wallet');
console.log(wallet, '更新余额') let params = {
const walletInfo = uni.getStorageSync('walletInfo'); coinName: wallet.type
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;
}
} }
uni.setStorageSync('walletInfo', walletInfo); const mainCoinP = await api.getCoinRate(params);
let that = this params.coinName = 'USDT';
this.getPrice(wallet.type, function(rr) { const usdtU = await api.getCoinRate(params);
that.getPrice('USDT', function(usdt) { wallet.totalBalancePrice = 0
wallet.totalBalanceCnyPrice=0
console.log(usdtU, 8888)
switch (wallet.type) { switch (wallet.type) {
case 'BTC': case 'BTC':
console.log("进来BTC") console.log("进来BTC")
BtcUtil.getBalance(wallet.address, function(balance) { wallet.balance = await BtcUtil.getBalance(wallet.address)
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; break;
case 'ETH': case 'ETH':
console.log("进来ETH") console.log("进来ETH")
EthUtil.getBalance(wallet.address, function(balance) { wallet.balance = await EthUtil.getBalance(wallet.address);
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++) { for (let i = 1; i < wallet.coinList.length; i++) {
EthUtil.getTokenBalance(wallet.address, wallet.coinList[ wallet.coinList[i].balance = EthUtil.getTokenBalance(wallet.address, wallet.coinList[
i].contractAddress, function(b) { i].contractAddress);
wallet.coinList[i].balance = b;
wallet.coinList[1].balancePrice = (wallet
.coinList[1].balance * usdt)
.toFixed(2);
uni.setStorageSync('wallet', wallet);
success()
});
} }
}); wallet.totalBalancePrice = wallet.coinList[1].balancePrice
wallet.totalBalanceCnyPrice=wallet.coinList[1].balanceCnyPrice
wallet.coinList[1].balancePrice = (wallet
.coinList[1].balance * usdtU.data.priceInUsd).toFixed(2);
wallet.coinList[1].balanceCnyPrice = (wallet
.coinList[1].balance * usdtU.data.priceCny).toFixed(2);
break; break;
case 'TRX': case 'TRX':
console.log("进来TRX") console.log("进来TRX")
TronUtil.getTronBalance(wallet.address).then((res) => { wallet.balance = await TronUtil.getTronBalance(wallet.address);
wallet.balance = res; params.address = wallet.address;
wallet.balancePrice = (res * rr).toFixed(2); params.chainName = wallet.type;
wallet.coinList[0].balance = res const tronCoin = await api.getBalance(params);
wallet.coinList[0].balancePrice = wallet.balancePrice var newList=[];
TronUtil.getContract(wallet.address, wallet.coinList, newList.push(wallet.coinList[0])
function(list) { newList.push(wallet.coinList[1])
wallet.coinList = list; for (let i = 1; i < tronCoin.data.length; i++) {
wallet.coinList[1].balancePrice = (wallet if (tronCoin.data[i].tokenAbbr === 'USDT') {
.coinList[1].balance * usdt).toFixed(2); newList[1].balance = (Number(tronCoin.data[i].balance) / Math.pow(10, tronCoin
console.log(wallet.coinList) .data[i].tokenDecimal));
uni.setStorageSync('wallet', wallet); newList[1].balanceCnyPrice = (newList[1].balance * usdtU.data.priceCny).toFixed(2);
success() newList[1].balancePrice = (newList[1].balance * usdtU.data.priceInUsd).toFixed(2);
}) wallet.totalBalancePrice = newList[1].balancePrice
wallet.totalBalanceCnyPrice=newList[1].balanceCnyPrice
}) } else {
console.log(Number(tronCoin.data[i].balance) / Math.pow(10, tronCoin.data[i]
break; .tokenDecimal))
var coin = {
name: tronCoin.data[i].tokenAbbr,
xname: tronCoin.data[i].tokenName,
balance: (Number(tronCoin.data[i].balance) / Math.pow(10, tronCoin.data[i]
.tokenDecimal)),
icon: tronCoin.data[i].tokenLogo,
} }
if (tronCoin.data[i].tokenType === 'trc20') {
}) coin.contractAddress = tronCoin.data[i].tokenId
} else {
}) coin.contractAddress = tronCoin.data[i].owner_address
}
}, newList.push(coin)
getPrice: function(type, success) { }
uni.request({
url: 'https://apilist.tronscan.org/api/token/price?token=' + type.toLowerCase(), //请求接口
header: {
'content-type': 'application/x-www-form-urlencoded', //自定义请求头信息
},
success: (res) => {
console.log(res.data.price_in_usd)
success(res.data.price_in_usd)
}
wallet.coinList=newList;
break;
} }
});
wallet.balancePrice = (wallet.balance * mainCoinP.data.priceInUsd).toFixed(2);
wallet.balanceCnyPrice = (wallet.balance * mainCoinP.data.priceCny).toFixed(2);
wallet.totalBalancePrice=Number(wallet.totalBalancePrice)+Number(wallet.balancePrice);
wallet.totalBalanceCnyPrice=Number(wallet.totalBalanceCnyPrice)+Number(wallet.balanceCnyPrice);
wallet.coinList[0].balance = wallet.balance
wallet.coinList[0].balancePrice = wallet.balancePrice
wallet.coinList[0].balanceCnyPrice = wallet.balanceCnyPrice
uni.setStorageSync('wallet',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;
}
}
uni.setStorageSync('walletInfo', walletInfo);
return wallet;
}, },
// 封装地址方法 // 封装地址方法
updateAddress: function(type, value, bigAddress, addressName) { updateAddress: function(type, value, bigAddress, addressName) {
let that = this let that = this

1
utils/api.js

@ -12,6 +12,7 @@ const api = {
getCoinRate: (params) => Vue.prototype.$axios.get('/api/coinRate/getCoinRate?' + qs.stringify(params)), getCoinRate: (params) => Vue.prototype.$axios.get('/api/coinRate/getCoinRate?' + qs.stringify(params)),
getChainDataList: (params) => Vue.prototype.$axios.get('/api/chainData/getChainDataList?' + qs.stringify(params)), getChainDataList: (params) => Vue.prototype.$axios.get('/api/chainData/getChainDataList?' + qs.stringify(params)),
getCoinTickerList: (params) => Vue.prototype.$axios.get('/api/coinTicker/getCoinTickerList'), getCoinTickerList: (params) => Vue.prototype.$axios.get('/api/coinTicker/getCoinTickerList'),
getBalance: (params) => Vue.prototype.$axios.get('/api/balance/getBalance?' + qs.stringify(params))
//--------------------------------- free --------------------------------- //--------------------------------- free ---------------------------------
} }

1
utils/locales/en.js

@ -140,6 +140,7 @@ export default {
Receive:'Receive', Receive:'Receive',
// sendToken index // sendToken index
Receivingaddress:'Receiving address', Receivingaddress:'Receiving address',
ReceivingaddressError:'Receiving address error',
ScanQR:'Scan the QR code to transfer to the asset', ScanQR:'Scan the QR code to transfer to the asset',
Copyaddress:'Copy address', Copyaddress:'Copy address',
CopySuccessful:'Copy address Successful!', CopySuccessful:'Copy address Successful!',

1
utils/locales/zh-F.js

@ -140,6 +140,7 @@ export default {
Receive:'接收', Receive:'接收',
// sendToken index // sendToken index
Receivingaddress:'接收地址', Receivingaddress:'接收地址',
ReceivingaddressError:'接受地址錯誤',
ScanQR:'掃描二維碼以轉移到資產', ScanQR:'掃描二維碼以轉移到資產',
Copyaddress:'複製地址', Copyaddress:'複製地址',
CopySuccessful:'複製地址成功!', CopySuccessful:'複製地址成功!',

1
utils/locales/zh.js

@ -138,6 +138,7 @@ export default {
Receive:'接收', Receive:'接收',
// sendToken index // sendToken index
Receivingaddress:'接受地址', Receivingaddress:'接受地址',
ReceivingaddressError:'接受地址错误',
ScanQR:'扫描二维码以转移到资产', ScanQR:'扫描二维码以转移到资产',
Copyaddress:'复制地址', Copyaddress:'复制地址',
CopySuccessful:'复制地址成功!', CopySuccessful:'复制地址成功!',

Loading…
Cancel
Save