Browse Source

代码

master
Dread 4 years ago
parent
commit
bd944babe4
  1. 31
      pages/menu/sendToken/transfer/index.vue
  2. 150
      pages/menu/setting/currency/index.vue
  3. 499
      pages/menu/setting/index.vue
  4. 191
      pages/menu/setting/lang/index.vue
  5. 10
      pages/menu/token/btc/index.vue
  6. 20
      pages/menu/wallet/index.vue
  7. 93
      unpackage/dist/dev/app-plus/app-service.js
  8. 34
      unpackage/dist/dev/app-plus/app-view.js
  9. 27
      utils/BtcUtil.js
  10. 20
      utils/EthUtil.js
  11. 174
      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

31
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
}) })
@ -618,10 +621,8 @@
} }
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)
}
}
} }
}; };

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

@ -5,32 +5,28 @@
</navigation> </navigation>
<view class="main"> <view class="main">
<view class="main_con"> <view class="main_con">
<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" </u-radio>
active-color="#5B53FF" </view>
>
</u-radio>
</view>
</u-radio-group> </u-radio-group>
<view class="select_btn"> <view class="select_btn" @click="confirmCurrency">
Select Select
</view> </view>
</view>
</view> </view>
</view>
</view> </view>
</template> </template>
<script> <script>
@ -38,69 +34,75 @@
export default { export default {
data() { data() {
return { return {
checked: false, checked: false,
list: [ currency:'USD',
{ list: [{
lang:'USD', lang: 'USD',
disabled: false, disabled: false,
name:"b" name: "USD"
}, },
{ {
lang:'JPY', lang: 'CNY',
disabled: false, disabled: false,
name:"a" name: "CNY"
}, },
{
lang:'EUR', ],
disabled: false, // u-radio-groupv-modelradioname
name:"c"
},
],
// 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(){
// if(item){ uni.setStorageSync('currency',this.currency)
uni.reLaunch({
// } url: '/pages/menu/setting/index'
this.$i18n.locale = item; })
// #ifdef APP-PLUS },
plus.storage.setItem('locale', item); handove(item) {
// #endif // if(item){
// #ifdef H5
localStorage.setItem('locale', item); // }
// #endif this.$i18n.locale = item;
}, // #ifdef APP-PLUS
radioChange(e) { plus.storage.setItem('locale', item);
// console.log(e); // #endif
}, // #ifdef H5
// radioradio-group localStorage.setItem('locale', item);
radioGroupChange(e) { // #endif
// console.log(e); },
}, radioChange(e) {
change(status) { // console.log(e);
// console.log(status); },
}, // radioradio-group
radioGroupChange(e) {
console.log(this.currency)
},
change(status) {
// console.log(status);
},
}, },
computed: { computed: {
i18n() { i18n() {
return this.$t('index') return this.$t('index')
} }
}, },
}; };
</script> </script>
<style scoped> <style scoped>
page { page {
background: #FAFAFA; background: #FAFAFA;
} }
</style> </style>
<style> <style>
@import './index.css'; @import './index.css';
</style> </style>

499
pages/menu/setting/index.vue

@ -6,72 +6,74 @@
</navigation> </navigation>
<view class="main"> <view class="main">
<view class="main_con"> <view class="main_con">
<view class="item flex">
<view class="text1">
{{i18n.fingerPass}}
</view>
<u-switch v-model="checked" active-color="#5B53FF" @change="fingerPass()"></u-switch>
</view>
<view class="item flex" @click="goLang()">
<view class="text1">
{{i18n.lans}}
</view>
<view class="">
<text class="text2">{{value}}</text>
<image src="../../../static/tongyonh/chevron_right_24px.png" mode="aspectFit" class="img1"></image>
</view>
</view>
<view class="item flex" @click="goCurr()">
<view class="text1">
{{i18n.curr}}
</view>
<view class="">
<text class="text2">USD</text>
<image src="../../../static/tongyonh/chevron_right_24px.png" mode="aspectFit" class="img1"></image>
</view>
</view>
<view class="item flex">
<view class="text1">
{{i18n.nodes}}
</view>
<image src="../../../static/tongyonh/chevron_right_24px.png" mode="aspectFit" class="img1"></image>
</view>
</view>
</view>
<u-mask z-index="10" :show="show"></u-mask>
<view class="hou_jia" v-if="showFinger"> <view class="item flex">
<view class="Log"> <view class="text1">
{{i18n.Login}} {{i18n.fingerPass}}
</view>
<u-switch v-model="checked" active-color="#5B53FF" @change="fingerPass()"></u-switch>
</view> </view>
<image src="../../../static/tongyonh/zww.png" mode="aspectFit" class="zzw"></image> <view class="item flex" @click="goLang()">
<view class="Log" @click="cancel"> <view class="text1">
{{i18n.Cancel}} {{i18n.lans}}
</view>
<view class="">
<text class="text2">{{value}}</text>
<image src="../../../static/tongyonh/chevron_right_24px.png" mode="aspectFit" class="img1">
</image>
</view>
</view>
<view class="item flex" @click="goCurr()">
<view class="text1">
{{i18n.curr}}
</view>
<view class="">
<text class="text2">{{currency}}</text>
<image src="../../../static/tongyonh/chevron_right_24px.png" mode="aspectFit" class="img1">
</image>
</view>
</view>
<view class="item flex">
<view class="text1">
{{i18n.nodes}}
</view>
<image src="../../../static/tongyonh/chevron_right_24px.png" mode="aspectFit" class="img1"></image>
</view> </view>
</view> </view>
<view class="hou_jia hou_jia_w" v-if="hou_jia_w">
<view class="fontt">
{{i18n.closevalidation}}
</view> </view>
<view class="ccon"> <u-mask z-index="10" :show="show"></u-mask>
<view class="cancle" @click="cancel_hou">
<view class="hou_jia" v-if="showFinger">
<view class="Log">
{{i18n.Login}}
</view>
<image src="../../../static/tongyonh/zww.png" mode="aspectFit" class="zzw"></image>
<view class="Log" @click="cancel">
{{i18n.Cancel}} {{i18n.Cancel}}
</view>
</view> </view>
<view class="" @click="confirm_hou"> <view class="hou_jia hou_jia_w" v-if="hou_jia_w">
{{i18n.Confirm}} <view class="fontt">
{{i18n.closevalidation}}
</view>
</view> </view>
</view> <view class="ccon">
<view class="cancle" @click="cancel_hou">
{{i18n.Cancel}}
</view>
<view class="" @click="confirm_hou">
{{i18n.Confirm}}
</view>
</view>
</view>
</view> </view>
</template> </template>
<script> <script>
@ -79,221 +81,228 @@
export default { export default {
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(){
uni.navigateTo({
url:'./lang/index'
})
},
goCurr(){
uni.navigateTo({
url:'./currency/index'
})
},
//
cancel_hou(){
this.hou_jia_w=false;
this.show=false;
this.checked=true;
},
//
confirm_hou(){
this.checked=false
this.hou_jia_w=false;
this.show=false;
uni.setStorageSync('fingerPass',false)
},
//
cancel(){
this.showFinger=false;
this.checked=false;
this.show=false;
this.printCancel();
},
//
printCancel(){
this.show=false;
plus.fingerprint.cancel();
console.log(4545454545)
this.showFinger=false
},
fingerPass(){
console.log(this.checked)
//
if(this.checked){
console.log(111)
this.show=true;
this.showFinger=true;
this.fingerprint(true);
}
// false使
if(!this.checked){
this.hou_jia_w=true;
this.show=true
}
},
fingerprint: function() {
//
// #ifdef APP-PLUS
if (!plus.fingerprint.isSupport()) {
uni.showToast({
title:this.$t('index').fingerprintidentification,
icon: 'none',
duration: 1500
})
// this.disabled = true;
} else if (!plus.fingerprint.isKeyguardSecure()) {
uni.showToast({
title: this.$t('index').notequipped,
icon: 'none',
duration: 1500
}) })
},
} else if (!plus.fingerprint.isEnrolledFingerprints()) { //
uni.showToast({ goLang() {
title: this.$t('index').oninthesetting, uni.navigateTo({
icon: 'none', url: './lang/index'
duration: 1500
}) })
// this.disabled = true; },
} else { goCurr() {
// this.result = ''; uni.navigateTo({
// // this.disabled = false; url: './currency/index'
// #ifdef MP-WEIXIN
// this.disabled = false;
uni.showToast({
title: 'Please use it in wechat real machine. The simulator does not support it',
icon: 'none',
duration: 1500
}) })
// #endif },
// #ifndef APP-PLUS || MP-WEIXIN //
uni.showToast({ cancel_hou() {
title: 'Fingerprint identification is not supported on this platform', this.hou_jia_w = false;
icon: 'none', this.show = false;
duration: 1500, this.checked = true;
}) },
// #endif //
confirm_hou() {
this.checked = false
this.hou_jia_w = false;
this.show = false;
uni.setStorageSync('fingerPass', false)
},
//
cancel() {
this.showFinger = false;
this.checked = false;
this.show = false;
this.printCancel();
},
//
printCancel() {
this.show = false;
plus.fingerprint.cancel();
console.log(4545454545)
this.showFinger = false
},
fingerPass() {
console.log(this.checked)
//
if (this.checked) {
console.log(111)
this.show = true;
this.showFinger = true;
this.fingerprint(true);
}
// false使
if (!this.checked) {
this.hou_jia_w = true;
this.show = true
}
},
fingerprint: function() {
// //
let that=this;
// #ifdef APP-PLUS // #ifdef APP-PLUS
plus.fingerprint.authenticate(function() { if (!plus.fingerprint.isSupport()) {
plus.nativeUI.closeWaiting(); //Android uni.showToast({
// title: this.$t('index').fingerprintidentification,
// 使 icon: 'none',
uni.setStorageSync('fingerPass',true) duration: 1500
that.showFinger=false; })
that.fingerSuccess=true; // this.disabled = true;
that.show=false; } else if (!plus.fingerprint.isKeyguardSecure()) {
}, function(e) { uni.showToast({
// title: this.$t('index').notequipped,
switch (e.code) { icon: 'none',
case e.AUTHENTICATE_MISMATCH: duration: 1500
plus.nativeUI.toast(that.$t('index').Fingerprintmatchingfailed); })
uni.setStorageSync('fingerPass',false)
that.showFinger=false; } else if (!plus.fingerprint.isEnrolledFingerprints()) {
that.fingerFail=true; uni.showToast({
that.checked=false title: this.$t('index').oninthesetting,
that.show=false; icon: 'none',
break; duration: 1500
case e.AUTHENTICATE_OVERLIMIT: })
plus.nativeUI.closeWaiting(); //Android // this.disabled = true;
plus.nativeUI.alert(that.$t('index').Thenumberoffingerprint); } else {
uni.setStorageSync('fingerPass',false) // this.result = '';
that.showFinger=false; // // this.disabled = false;
that.fingerFail=true; // #ifdef MP-WEIXIN
that.checked=false // this.disabled = false;
that.show=false; uni.showToast({
break; title: 'Please use it in wechat real machine. The simulator does not support it',
case e.CANCEL: icon: 'none',
plus.nativeUI.toast(that.$t('index').Recognitioncancelled); duration: 1500
uni.setStorageSync('fingerPass',false) })
that.showFinger=false; // #endif
that.checked=false // #ifndef APP-PLUS || MP-WEIXIN
that.fingerFail=true; uni.showToast({
that.show=false; title: 'Fingerprint identification is not supported on this platform',
break; icon: 'none',
default: duration: 1500,
plus.nativeUI.closeWaiting(); //Android })
uni.setStorageSync('fingerPass',false) // #endif
console.log(that.showFinger,454545) //
that.showFinger=false; let that = this;
that.checked=false // #ifdef APP-PLUS
that.show=false; plus.fingerprint.authenticate(function() {
that.fingerFail=true; plus.nativeUI.closeWaiting(); //Android
plus.nativeUI.alert(that.$t('index').Fingerprintidentificationfailed); //
break; // 使
uni.setStorageSync('fingerPass', true)
that.showFinger = false;
that.fingerSuccess = true;
that.show = false;
}, function(e) {
switch (e.code) {
case e.AUTHENTICATE_MISMATCH:
plus.nativeUI.toast(that.$t('index').Fingerprintmatchingfailed);
uni.setStorageSync('fingerPass', false)
that.showFinger = false;
that.fingerFail = true;
that.checked = false
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.showFinger = false;
that.fingerFail = true;
that.checked = false
console.log(that.fingerFail, 454545)
break;
case e.CANCEL:
plus.nativeUI.toast(that.$t('index').Recognitioncancelled);
uni.setStorageSync('fingerPass', false)
console.log(that.showFinger, 454545)
that.showFinger = false;
that.checked = false
that.fingerFail = true;
that.show = false;
console.log(that.fingerFail, 454545)
break;
default:
plus.nativeUI.closeWaiting(); //Android
uni.setStorageSync('fingerPass', false)
console.log(that.showFinger, 454545)
that.showFinger = false;
that.checked = false
that.fingerFail = true;
console.log(that.fingerFail, 454545)
plus.nativeUI.alert(that.$t('index').Fingerprintidentificationfailed);
break;
}
});
// Android
if ('Android' == plus.os.name) {
this.show = true;
/* plus.nativeUI.showWaiting('...').onclose = function() {
plus.fingerprint.cancel();
} */
} }
}); // #endif
// Android
if ('Android' == plus.os.name) {
this.show=true;
/* plus.nativeUI.showWaiting('...').onclose = function() {
plus.fingerprint.cancel();
} */
} }
// #endif // #endif
}
// #endif
},
change(status) {
}, },
change(status) {
},
},
},
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: {
i18n() {
return this.$t('index')
}, },
} computed: {
i18n() {
return this.$t('index')
},
}
}; };
</script> </script>
<style scoped> <style scoped>
page { page {
background: #FAFAFA; background: #FAFAFA;
} }
</style> </style>
<style> <style>
@import './index.css'; @import './index.css';
</style> </style>

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

@ -5,29 +5,25 @@
</navigation> </navigation>
<view class="main"> <view class="main">
<view class="main_con"> <view class="main_con">
<u-radio-group v-model="value" @change="radioGroupChange"> <u-radio-group v-model="value" @change="radioGroupChange">
<view class="item flex" v-for="(item, index) in list" :key="index" @click="nowLanguage(item,index)"> <view class="item flex" v-for="(item, index) in list" :key="index" @click="nowLanguage(item,index)">
<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" </u-radio>
active-color="#5B53FF" </view>
>
</u-radio>
</view>
</u-radio-group> </u-radio-group>
<view class="select_btn" @click="confirmLanguage"> <view class="select_btn" @click="confirmLanguage">
{{ i18n.langSelect }} {{ i18n.langSelect }}
</view> </view>
</view>
</view> </view>
</view>
</view> </view>
</template> </template>
<script> <script>
@ -35,100 +31,97 @@
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", },
},
],
], // u-radio-groupv-modelradioname
// u-radio-groupv-modelradioname value: 'c',
value: 'c',
}; };
}, },
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) {
},
// radioradio-group
radioGroupChange(e) {
},
change(status) {
}, },
radioChange(e) {
},
// radioradio-group
radioGroupChange(e) {
},
change(status) {
},
}, },
computed: { computed: {
i18n() { i18n() {
return this.$t('index') return this.$t('index')
},
}, },
}, 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() {

93
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;

27
utils/BtcUtil.js

@ -1,29 +1,26 @@
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.data.length>0){
var data=res.data.data[0];
console.log(data,11111)
for(let b in data){
balance=data[b];
}
}
}
} }
}); });
if (res.data.code === 1) {
if(res.data.data.length>0){
var data=res.data.data[0];
console.log(data,11111)
for(let b in data){
balance=data[b];
}
}
}
}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;
}, },

174
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,8 +66,9 @@ 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[
walletInfo.BTC[0].address.length) 0].address.substring(25,
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;
walletInfo.ETH[0].mnemonic = mnemonic; walletInfo.ETH[0].mnemonic = mnemonic;
@ -205,9 +207,87 @@ let WalletUtil = {
} }
}, },
updateBalance: function(success) { updateBalance: async function(success) {
const wallet = uni.getStorageSync('wallet'); const wallet = uni.getStorageSync('wallet');
console.log(wallet, '更新余额') let params = {
coinName: wallet.type
}
const mainCoinP = await api.getCoinRate(params);
params.coinName = 'USDT';
const usdtU = await api.getCoinRate(params);
wallet.totalBalancePrice = 0
wallet.totalBalanceCnyPrice=0
console.log(usdtU, 8888)
switch (wallet.type) {
case 'BTC':
console.log("进来BTC")
wallet.balance = await BtcUtil.getBalance(wallet.address)
break;
case 'ETH':
console.log("进来ETH")
wallet.balance = await EthUtil.getBalance(wallet.address);
for (let i = 1; i < wallet.coinList.length; i++) {
wallet.coinList[i].balance = EthUtil.getTokenBalance(wallet.address, wallet.coinList[
i].contractAddress);
}
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;
case 'TRX':
console.log("进来TRX")
wallet.balance = await TronUtil.getTronBalance(wallet.address);
params.address = wallet.address;
params.chainName = wallet.type;
const tronCoin = await api.getBalance(params);
var newList=[];
newList.push(wallet.coinList[0])
newList.push(wallet.coinList[1])
for (let i = 1; i < tronCoin.data.length; i++) {
if (tronCoin.data[i].tokenAbbr === 'USDT') {
newList[1].balance = (Number(tronCoin.data[i].balance) / Math.pow(10, tronCoin
.data[i].tokenDecimal));
newList[1].balanceCnyPrice = (newList[1].balance * usdtU.data.priceCny).toFixed(2);
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]
.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)
}
}
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'); const walletInfo = uni.getStorageSync('walletInfo');
for (var k = 0, length = walletInfo[wallet.type].length; k < length; k++) { for (var k = 0, length = walletInfo[wallet.type].length; k < length; k++) {
if (walletInfo[wallet.type][k].address === wallet.address) { if (walletInfo[wallet.type][k].address === wallet.address) {
@ -216,88 +296,8 @@ let WalletUtil = {
} }
} }
uni.setStorageSync('walletInfo', walletInfo); uni.setStorageSync('walletInfo', walletInfo);
let that = this return wallet;
this.getPrice(wallet.type, function(rr) {
that.getPrice('USDT', function(usdt) {
switch (wallet.type) {
case 'BTC':
console.log("进来BTC")
BtcUtil.getBalance(wallet.address, function(balance) {
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;
case 'ETH':
console.log("进来ETH")
EthUtil.getBalance(wallet.address, function(balance) {
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++) {
EthUtil.getTokenBalance(wallet.address, wallet.coinList[
i].contractAddress, function(b) {
wallet.coinList[i].balance = b;
wallet.coinList[1].balancePrice = (wallet
.coinList[1].balance * usdt)
.toFixed(2);
uni.setStorageSync('wallet', wallet);
success()
});
}
});
break;
case 'TRX':
console.log("进来TRX")
TronUtil.getTronBalance(wallet.address).then((res) => {
wallet.balance = res;
wallet.balancePrice = (res * rr).toFixed(2);
wallet.coinList[0].balance = res
wallet.coinList[0].balancePrice = wallet.balancePrice
TronUtil.getContract(wallet.address, wallet.coinList,
function(list) {
wallet.coinList = list;
wallet.coinList[1].balancePrice = (wallet
.coinList[1].balance * usdt).toFixed(2);
console.log(wallet.coinList)
uni.setStorageSync('wallet', wallet);
success()
})
})
break;
}
})
})
}, },
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)
}
});
},
// 封装地址方法 // 封装地址方法
updateAddress: function(type, value, bigAddress, addressName) { updateAddress: function(type, value, bigAddress, addressName) {
@ -440,8 +440,8 @@ let WalletUtil = {
plus.nativeUI.closeWaiting(); //兼容Android平台关闭等待框 plus.nativeUI.closeWaiting(); //兼容Android平台关闭等待框
plus.nativeUI.alert( plus.nativeUI.alert(
'The number of fingerprint identification failures exceeds the limit. Please use other methods for authentication' 'The number of fingerprint identification failures exceeds the limit. Please use other methods for authentication'
); );
break; break;
case e.CANCEL: case e.CANCEL:
plus.nativeUI.toast('Recognition has been cancelled'); plus.nativeUI.toast('Recognition has been cancelled');
break; break;

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