Browse Source

下拉刷新

master
vee 4 years ago
parent
commit
fd50283974
  1. 9
      pages/menu/about/index.vue
  2. 795
      pages/menu/sendToken/addAddress2/index.vue
  3. 6
      pages/menu/wallet/index.vue
  4. 16
      unpackage/dist/dev/app-plus/app-service.js
  5. 2
      unpackage/dist/dev/app-plus/app-view.js
  6. 37
      utils/EthUtil.js
  7. 3
      utils/TronUtil.js
  8. 10
      utils/WalletUtil.js
  9. 44
      utils/locales/zh-F.js
  10. 20
      utils/locales/zh.js

9
pages/menu/about/index.vue

@ -57,7 +57,7 @@
export default {
data() {
return {
version:'1.0.0'
version: '1.0.0'
};
},
computed: {
@ -67,7 +67,12 @@
},
onLoad() {
// #ifdef APP-PLUS
this.version=plus.runtime.versionName;
let that=this
plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
console.log(wgtinfo,123132)
that.version = wgtinfo.version;
})
// #endif
},
methods: {

795
pages/menu/sendToken/addAddress2/index.vue

@ -2,92 +2,95 @@
<view class="hr">
<navigation :showBack="true" :bgnum="true">
<text class="big_title">
{{i18n.Addaddress}}
{{i18n.Addaddress}}
</text>
</navigation>
<view class="main">
<view class="main_con">
<view class="item">
<view class="top flex">
<view class="text1">
{{i18n.curr}}
</view>
</view>
<view class="inputcon">
<input type="text" value="" v-model="value" placeholder-style="font-size: 30rpx; color: #D0D0D2;" :placeholder="teee1" class="input1" @click="showSelect()" :disabled="true"/>
<image src="../../../../static/tongyonh/chevron_right_24px.png" mode="aspectFit" class="img1"></image>
</view>
</view>
<view class="item">
<view class="top flex">
<view class="text1">
{{i18n.Address}}
</view>
</view>
<view class="inputcon">
<input type="text" value="" @input="showSave()" placeholder-style="font-size: 30rpx; color: #D0D0D2;" :placeholder="teee2" class="input1" v-model="bigAddress"/>
<image src="../../../../static/tongyonh/Frame330.png" mode="aspectFit" class="img2" @click="chooseImage"></image>
</view>
</view>
<view class="item">
<view class="top flex">
<view class="text1">
{{i18n.Name}}
<view class="main">
<view class="main_con">
<view class="item">
<view class="top flex">
<view class="text1">
{{i18n.curr}}
</view>
</view>
<view class="inputcon">
<input type="text" value="" v-model="value"
placeholder-style="font-size: 30rpx; color: #D0D0D2;" :placeholder="teee1" class="input1"
@click="showSelect()" :disabled="true" />
<image src="../../../../static/tongyonh/chevron_right_24px.png" mode="aspectFit" class="img1">
</image>
</view>
</view>
<view class="item">
<view class="top flex">
<view class="text1">
{{i18n.Address}}
</view>
</view>
<view class="inputcon">
<input type="text" value="" @input="showSave()"
placeholder-style="font-size: 30rpx; color: #D0D0D2;" :placeholder="teee2" class="input1"
v-model="bigAddress" />
<image src="../../../../static/tongyonh/Frame330.png" mode="aspectFit" class="img2"
@click="chooseImage"></image>
</view>
</view>
<view class="item">
<view class="top flex">
<view class="text1">
{{i18n.Name}}
</view>
</view>
<view class="inputcon">
<input type="text" @input="showSave" value=""
placeholder-style="font-size: 30rpx; color: #D0D0D2;" :placeholder="teee3" class="input1"
v-model="addressName" />
</view>
</view>
<view class="btn" @click="handove()" :class="save?'sheng':''">
{{i18n.Save}}
</view>
</view>
</view>
<view class="inputcon">
<input type="text" @input="showSave" value="" placeholder-style="font-size: 30rpx; color: #D0D0D2;" :placeholder="teee3" class="input1" v-model="addressName"/>
</view>
</view>
<view class="btn" @click="handove()" :class="save?'sheng':''">
{{i18n.Save}}
</view>
</view>
<u-mask z-index="10" :show="show" @click="show = false"></u-mask>
<u-mask z-index="10" :show="show" @click="show = false"></u-mask>
</view>
<view class="big_con w100" v-if="show">
<view class="tiao" @click="show=false"></view>
<view class="title">
{{i18n.selectcurrency}}
</view>
<view class="bottom_con zindex" v-if="show">
<u-radio-group v-model="value" >
<view class="item flex" v-for="(item, index) in list" :key="index" @click="handove2(item)">
<view class="text1 flex">
<image :src="item.url" mode="aspectFit" class="img"></image>
<view class="textcon">
<view class="text1">
{{item.lang}}
</view>
<view class="text2">
{{item.name}}
</view>
</view>
<view class="title">
{{i18n.selectcurrency}}
</view>
<view class="bottom_con zindex" v-if="show">
<u-radio-group v-model="value">
<view class="item flex" v-for="(item, index) in list" :key="index" @click="handove2(item)">
<view class="text1 flex">
<image :src="item.url" mode="aspectFit" class="img"></image>
<view class="textcon">
<view class="text1">
{{item.lang}}
</view>
<view class="text2">
{{item.name}}
</view>
</view>
</view>
<u-radio :name="item.name" :disabled="item.disabled" active-color="#5B53FF">
</u-radio>
</view>
<u-radio
:name="item.name"
:disabled="item.disabled"
active-color="#5B53FF"
>
</u-radio>
</view>
</u-radio-group>
<view class="select_btn">
{{i18n.langSelect}}
</u-radio-group>
<view class="select_btn">
{{i18n.langSelect}}
</view>
</view>
</view>
</view>
</view>
</view>
@ -98,52 +101,51 @@
export default {
data() {
return {
AddressInfo:{},
teee1:this.$t('index').selectcurrency,
teee2:this.$t('index').Pleaserecipientaddress,
teee3:this.$t('index').enterthename,
info:{},
addressName:'',
value:'',
bigAddress:'',
save:true,
AddressIndex:-1,
gai:{},
show: false,
checked: false,
list: [
{
url:'../../../../static/tongyonh/bye.png',
lang:'Bitcoin',
disabled: false,
name:"BTC"
},
{
url:'../../../../static/tongyonh/Frame3299.png',
lang:'Ethereum',
disabled: false,
name:"ETH"
},
{
url:'../../../../static/tongyonh/tron1.png',
lang:'Tron',
disabled: false,
name:"TRX"
},
],
// u-radio-groupv-modelradioname
value: '',
AddressInfo: {},
teee1: this.$t('index').selectcurrency,
teee2: this.$t('index').Pleaserecipientaddress,
teee3: this.$t('index').enterthename,
info: {},
addressName: '',
value: '',
bigAddress: '',
save: true,
AddressIndex: -1,
gai: {},
show: false,
checked: false,
list: [{
url: '../../../../static/tongyonh/bye.png',
lang: 'Bitcoin',
disabled: false,
name: "BTC"
},
{
url: '../../../../static/tongyonh/Frame3299.png',
lang: 'Ethereum',
disabled: false,
name: "ETH"
},
{
url: '../../../../static/tongyonh/tron1.png',
lang: 'Tron',
disabled: false,
name: "TRX"
},
],
// u-radio-groupv-modelradioname
value: '',
}
},
onLoad() {
if(uni.getStorageSync('AddressInfo')){
this.info=uni.getStorageSync('AddressInfo')
this.AddressInfo=uni.getStorageSync('AddressInfo')
this.addressName=this.AddressInfo.name
this.bigAddress=this.AddressInfo.address,
this.value=uni.getStorageSync('AddressName')
this.AddressIndex=uni.getStorageSync('AddressIndex')
if (uni.getStorageSync('AddressInfo')) {
this.info = uni.getStorageSync('AddressInfo')
this.AddressInfo = uni.getStorageSync('AddressInfo')
this.addressName = this.AddressInfo.name
this.bigAddress = this.AddressInfo.address,
this.value = uni.getStorageSync('AddressName')
this.AddressIndex = uni.getStorageSync('AddressIndex')
}
},
computed: {
@ -153,305 +155,306 @@ show: false,
},
methods: {
//
chooseImage() {
var _this = this
uni.chooseImage({
count: 1, //9
sizeType: ['original', 'compressed'], //
sourceType: ['album', 'camera'], //
uni.scanCode({
success: function(res) {
_this.imgShow = res.tempFilePaths[0]
console.log('扫码内容', res.result)
_this.bigAddress = res.result;
}
});
// ass()
},
handove2(item){
this.value=item.name;
this.show=false;
},
showSave(){
if(this.bigAddress!=''&&this.name!=''&&this.value!=''){
this.save=true;
}else{
this.save=false;
}
},
handove(item){
if(this.value==''){
this.save=false
uni.showToast({
title: this.$t('index').selectcurrency,
icon: 'none',
duration: 1500
})
return;
}
if(this.bigAddress==''||this.addressName==''){
this.save=false
uni.showToast({
title: this.$t('index').Addressorname,
icon: 'none',
duration: 1500
})
return;
}
if(this.info.coinList[0].name2=='TRX'){
this.$walletUtil.updateAddress(this.info.coinList[0].name2,this.value);
if(this.value=='ETH'){
this.gai = uni.getStorageSync('ETHAddressInfo')
this.gai2 = uni.getStorageSync('TRXAddressInfo')
var index=uni.getStorageSync('editIndex')
let eth=new Object;
eth.address=this.bigAddress;
eth.name=this.addressName
eth.coinList=[{
name:"ETH",
name2:"ETH",
xname:'Ethereum',
icon:require('@/static/tongyonh/Frame3299.png')
}];
this.gai2.splice(index,1)
uni.setStorageSync('TRXAddressInfo',this.gai2)
this.gai.push(eth);
uni.setStorageSync('ETHAddressInfo',this.gai)
handove2(item) {
this.value = item.name;
this.show = false;
},
showSave() {
if (this.bigAddress != '' && this.name != '' && this.value != '') {
this.save = true;
} else {
this.save = false;
}
},
handove(item) {
if (this.value == '') {
this.save = false
uni.showToast({
title: this.$t('index').selectcurrency,
icon: 'none',
duration: 1500
})
return;
}
if (this.bigAddress == '' || this.addressName == '') {
this.save = false
uni.showToast({
title: this.$t('index').Addressorname,
icon: 'none',
duration: 1500
})
return;
}
if (this.info.coinList[0].name2 == 'TRX') {
this.$walletUtil.updateAddress(this.info.coinList[0].name2, this.value);
if (this.value == 'ETH') {
this.gai = uni.getStorageSync('ETHAddressInfo')
this.gai2 = uni.getStorageSync('TRXAddressInfo')
var index = uni.getStorageSync('editIndex')
let eth = new Object;
eth.address = this.bigAddress;
eth.name = this.addressName
eth.coinList = [{
name: "ETH",
name2: "ETH",
xname: 'Ethereum',
icon: require('@/static/tongyonh/Frame3299.png')
}];
this.gai2.splice(index, 1)
uni.setStorageSync('TRXAddressInfo', this.gai2)
this.gai.push(eth);
uni.setStorageSync('ETHAddressInfo', this.gai)
uni.showToast({
title: this.$t('index').Successful,
icon: 'success',
duration: 1500
})
uni.navigateTo({
url: '../address/index'
})
}
if (this.value == 'TRX') {
this.gai = uni.getStorageSync('TRXAddressInfo')
var index = uni.getStorageSync('editIndex')
let trx = new Object;
trx.address = this.bigAddress;
trx.name = this.addressName
trx.coinList = [{
name: "TRX",
name2: "TRX",
xname: 'TRON',
icon: require('@/static/tongyonh/tron1.png')
}];
this.gai[index] = trx;
uni.setStorageSync('TRXAddressInfo', this.gai)
uni.showToast({
title: this.$t('index').Successful,
icon: 'success',
duration: 1500
})
uni.navigateTo({
url:'../address/index'
url: '../address/index'
})
}
if(this.value=='TRX'){
this.gai = uni.getStorageSync('TRXAddressInfo')
var index=uni.getStorageSync('editIndex')
let trx=new Object;
trx.address=this.bigAddress;
trx.name=this.addressName
trx.coinList=[{
name:"TRX",
name2:"TRX",
xname:'TRON',
icon:require('@/static/tongyonh/tron1.png')
}];
this.gai[index]=trx;
uni.setStorageSync( 'TRXAddressInfo',this.gai)
uni.showToast({
title: this.$t('index').Successful,
icon: 'success',
duration: 1500
})
uni.navigateTo({
url:'../address/index'
})
}
}
if(this.value=='BTC'){
this.gai = uni.getStorageSync('BTCAddressInfo')
this.gai2 = uni.getStorageSync('TRXAddressInfo')
var index=uni.getStorageSync('editIndex')
let btc=new Object;
btc.address=this.bigAddress;
btc.name=this.addressName
btc.coinList=[{
name:"BTC",
name2:"BTC",
xname:'Bitcoin',
icon:require('@/static/tongyonh/bye.png')
if (this.value == 'BTC') {
this.gai = uni.getStorageSync('BTCAddressInfo')
this.gai2 = uni.getStorageSync('TRXAddressInfo')
var index = uni.getStorageSync('editIndex')
let btc = new Object;
btc.address = this.bigAddress;
btc.name = this.addressName
btc.coinList = [{
name: "BTC",
name2: "BTC",
xname: 'Bitcoin',
icon: require('@/static/tongyonh/bye.png')
}];
this.gai2.splice(index,1)
uni.setStorageSync('TRXAddressInfo',this.gai2)
this.gai.push(btc);
uni.setStorageSync('BTCAddressInfo',this.gai)
uni.showToast({
title: this.$t('index').Successful,
icon: 'success',
duration: 1500
})
uni.navigateTo({
url:'../address/index'
})
}
}
if(this.info.coinList[0].name2=='ETH'){
if(this.value=='TRX'){
this.gai = uni.getStorageSync('TRXAddressInfo')
this.gai2 = uni.getStorageSync('ETHAddressInfo')
var index=uni.getStorageSync('editIndex')
let trx=new Object;
trx.address=this.bigAddress;
trx.name=this.addressName
trx.coinList=[{
name:"TRX",
name2:"TRX",
xname:'TRON',
icon:require('@/static/tongyonh/tron1.png')
}];
this.gai2.splice(index,1)
uni.setStorageSync('ETHAddressInfo',this.gai2)
this.gai.push(trx);
uni.setStorageSync('TRXAddressInfo',this.gai)
uni.showToast({
title: this.$t('index').Successful,
icon: 'success',
duration: 1500
})
uni.navigateTo({
url:'../address/index'
})
}
if(this.value=='ETH'){
this.gai = uni.getStorageSync('ETHAddressInfo')
var index=uni.getStorageSync('editIndex')
let eth=new Object;
eth.address=this.bigAddress;
eth.name=this.addressName
eth.coinList=[{
name:"ETH",
name2:"ETH",
xname:'Ethereum',
icon:require('@/static/tongyonh/Frame3299.png')
}];
this.gai[index]=eth;
uni.setStorageSync('ETHAddressInfo',this.gai)
uni.showToast({
title: this.$t('index').Successful,
icon: 'success',
duration: 1500
})
uni.navigateTo({
url:'../address/index'
})
}
if(this.value=='BTC'){
this.gai = uni.getStorageSync('BTCAddressInfo')
this.gai2 = uni.getStorageSync('ETHAddressInfo')
var index=uni.getStorageSync('editIndex')
let btc=new Object;
btc.address=this.bigAddress;
btc.name=this.addressName
btc.coinList=[{
name:"BTC",
name2:"BTC",
xname:'Bitcoin',
icon:require('@/static/tongyonh/bye.png')
}];
this.gai2.splice(index,1)
uni.setStorageSync('ETHAddressInfo',this.gai2)
this.gai.push(btc);
uni.setStorageSync('BTCAddressInfo',this.gai)
uni.showToast({
title: this.$t('index').Successful,
icon: 'success',
duration: 1500
})
uni.navigateTo({
url:'../address/index'
})
}
}
if(this.info.coinList[0].name2=='BTC'){
if(this.value=='TRX'){
this.gai = uni.getStorageSync('TRXAddressInfo')
this.gai2 = uni.getStorageSync('BTCAddressInfo')
var index=uni.getStorageSync('editIndex')
let trx=new Object;
trx.address=this.bigAddress;
trx.name=this.addressName
trx.coinList=[{
name:"TRX",
name2:"TRX",
xname:'TRON',
icon:require('@/static/tongyonh/tron1.png')
}];
this.gai2.splice(index,1)
uni.setStorageSync('BTCAddressInfo',this.gai2)
this.gai.push(trx);
uni.setStorageSync('TRXAddressInfo',this.gai)
uni.showToast({
title: this.$t('index').Successful,
icon: 'success',
duration: 1500
})
uni.navigateTo({
url:'../address/index'
})
}
if(this.value=='BTC'){
this.gai = uni.getStorageSync('BTCAddressInfo')
var index=uni.getStorageSync('editIndex')
let btc=new Object;
btc.address=this.bigAddress;
btc.name=this.addressName
btc.coinList=[{
name:"BTC",
name2:"BTC",
xname:'Bitcoin',
icon:require('@/static/tongyonh/bye.png')
}];
this.gai[index]=btc;
uni.setStorageSync('BTCAddressInfo',this.gai)
uni.showToast({
title: this.$t('index').Successful,
icon: 'success',
duration: 1500
})
uni.navigateTo({
url:'../address/index'
})
}
if(this.value=='ETH'){
this.gai = uni.getStorageSync('ETHAddressInfo')
this.gai2 = uni.getStorageSync('BTCAddressInfo')
var index=uni.getStorageSync('editIndex')
let eth=new Object;
eth.address=this.bigAddress;
eth.name=this.addressName
eth.coinList=[{
name:"ETH",
name2:"ETH",
xname:'Ethereum',
icon:require('@/static/tongyonh/Frame3299.png')
}];
this.gai2.splice(index,1)
uni.setStorageSync('BTCAddressInfo',this.gai2)
this.gai.push(eth);
uni.setStorageSync('ETHAddressInfo',this.gai)
uni.showToast({
title: this.$t('index').Successful,
icon: 'success',
duration: 1500
})
uni.navigateTo({
url:'../address/index'
})
}
}
},
showSelect(){
this.show=true;
},
this.gai2.splice(index, 1)
uni.setStorageSync('TRXAddressInfo', this.gai2)
this.gai.push(btc);
uni.setStorageSync('BTCAddressInfo', this.gai)
uni.showToast({
title: this.$t('index').Successful,
icon: 'success',
duration: 1500
})
uni.navigateTo({
url: '../address/index'
})
}
}
if (this.info.coinList[0].name2 == 'ETH') {
if (this.value == 'TRX') {
this.gai = uni.getStorageSync('TRXAddressInfo')
this.gai2 = uni.getStorageSync('ETHAddressInfo')
var index = uni.getStorageSync('editIndex')
let trx = new Object;
trx.address = this.bigAddress;
trx.name = this.addressName
trx.coinList = [{
name: "TRX",
name2: "TRX",
xname: 'TRON',
icon: require('@/static/tongyonh/tron1.png')
}];
this.gai2.splice(index, 1)
uni.setStorageSync('ETHAddressInfo', this.gai2)
this.gai.push(trx);
uni.setStorageSync('TRXAddressInfo', this.gai)
uni.showToast({
title: this.$t('index').Successful,
icon: 'success',
duration: 1500
})
uni.navigateTo({
url: '../address/index'
})
}
if (this.value == 'ETH') {
this.gai = uni.getStorageSync('ETHAddressInfo')
var index = uni.getStorageSync('editIndex')
let eth = new Object;
eth.address = this.bigAddress;
eth.name = this.addressName
eth.coinList = [{
name: "ETH",
name2: "ETH",
xname: 'Ethereum',
icon: require('@/static/tongyonh/Frame3299.png')
}];
this.gai[index] = eth;
uni.setStorageSync('ETHAddressInfo', this.gai)
uni.showToast({
title: this.$t('index').Successful,
icon: 'success',
duration: 1500
})
uni.navigateTo({
url: '../address/index'
})
}
if (this.value == 'BTC') {
this.gai = uni.getStorageSync('BTCAddressInfo')
this.gai2 = uni.getStorageSync('ETHAddressInfo')
var index = uni.getStorageSync('editIndex')
let btc = new Object;
btc.address = this.bigAddress;
btc.name = this.addressName
btc.coinList = [{
name: "BTC",
name2: "BTC",
xname: 'Bitcoin',
icon: require('@/static/tongyonh/bye.png')
}];
this.gai2.splice(index, 1)
uni.setStorageSync('ETHAddressInfo', this.gai2)
this.gai.push(btc);
uni.setStorageSync('BTCAddressInfo', this.gai)
uni.showToast({
title: this.$t('index').Successful,
icon: 'success',
duration: 1500
})
uni.navigateTo({
url: '../address/index'
})
}
}
if (this.info.coinList[0].name2 == 'BTC') {
if (this.value == 'TRX') {
this.gai = uni.getStorageSync('TRXAddressInfo')
this.gai2 = uni.getStorageSync('BTCAddressInfo')
var index = uni.getStorageSync('editIndex')
let trx = new Object;
trx.address = this.bigAddress;
trx.name = this.addressName
trx.coinList = [{
name: "TRX",
name2: "TRX",
xname: 'TRON',
icon: require('@/static/tongyonh/tron1.png')
}];
this.gai2.splice(index, 1)
uni.setStorageSync('BTCAddressInfo', this.gai2)
this.gai.push(trx);
uni.setStorageSync('TRXAddressInfo', this.gai)
uni.showToast({
title: this.$t('index').Successful,
icon: 'success',
duration: 1500
})
uni.navigateTo({
url: '../address/index'
})
}
if (this.value == 'BTC') {
this.gai = uni.getStorageSync('BTCAddressInfo')
var index = uni.getStorageSync('editIndex')
let btc = new Object;
btc.address = this.bigAddress;
btc.name = this.addressName
btc.coinList = [{
name: "BTC",
name2: "BTC",
xname: 'Bitcoin',
icon: require('@/static/tongyonh/bye.png')
}];
this.gai[index] = btc;
uni.setStorageSync('BTCAddressInfo', this.gai)
uni.showToast({
title: this.$t('index').Successful,
icon: 'success',
duration: 1500
})
uni.navigateTo({
url: '../address/index'
})
}
if (this.value == 'ETH') {
this.gai = uni.getStorageSync('ETHAddressInfo')
this.gai2 = uni.getStorageSync('BTCAddressInfo')
var index = uni.getStorageSync('editIndex')
let eth = new Object;
eth.address = this.bigAddress;
eth.name = this.addressName
eth.coinList = [{
name: "ETH",
name2: "ETH",
xname: 'Ethereum',
icon: require('@/static/tongyonh/Frame3299.png')
}];
this.gai2.splice(index, 1)
uni.setStorageSync('BTCAddressInfo', this.gai2)
this.gai.push(eth);
uni.setStorageSync('ETHAddressInfo', this.gai)
uni.showToast({
title: this.$t('index').Successful,
icon: 'success',
duration: 1500
})
uni.navigateTo({
url: '../address/index'
})
}
}
},
showSelect() {
this.show = true;
},
}
};
</script>
<style scoped>
page {
background: #FAFAFA;
height: 100%;
height: 100%;
}
</style>

6
pages/menu/wallet/index.vue

@ -116,9 +116,9 @@
if (currency) {
this.currency = currency;
}
uni.setStorageSync('isWallet', true);
//
//
//console.log(this.$TronUtil.decode("TBk72yKTJWppCsa7XrsU7Qhfo4yNvbm8rE"))
this.userObj = uni.getStorageSync('wallet');
this.userObj = await this.$walletUtil.updateBalance();
@ -146,7 +146,7 @@
let param = {
'appId': uni.getSystemInfoSync().platform
}
console.log('ss' + this.$api)
console.log('ss' + JSON.stringify(uni.getSystemInfoSync()))
const response = await this.$api.versionUpgrade(param)
plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
console.log('当前版本号' + wgtinfo.versionCode)

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

File diff suppressed because one or more lines are too long

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

@ -14404,7 +14404,7 @@ if(false) {}
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(/*! ./node_modules/css-loader/dist/runtime/api.js */ 13);
exports = ___CSS_LOADER_API_IMPORT___(false);
// Module
exports.push([module.i, "\nbody[data-v-7c44e0c6] {\n\t\tbackground: #FAFAFA;\n height: 100%;\n}\n", ""]);
exports.push([module.i, "\nbody[data-v-7c44e0c6] {\n\tbackground: #FAFAFA;\n\theight: 100%;\n}\n", ""]);
// Exports
module.exports = exports;

37
utils/EthUtil.js

@ -5,9 +5,9 @@ const Tx = require('ethereumjs-tx');
let web3;
// let tx;
if (typeof web3 !== 'undefined') {
web3 = new Web3(web3.currentProvider);
web3 = new Web3(web3.currentProvider);
} else {
web3 = new Web3(new Web3.providers.HttpProvider(systemConfiguration.constant.ethNode));
web3 = new Web3(new Web3.providers.HttpProvider(systemConfiguration.constant.ethNode));
}
@ -34,24 +34,25 @@ let eth = {
const gasPrice = await web3.eth.getGasPrice().then((v) => {
return v
});
console.log(gasPrice,'gasPrice')
console.log(gasPrice, 'gasPrice')
return gasPrice;
},
//获取主币eth余额
getBalance:async function(address) {
web3 = new Web3();
getBalance: async function(address) {
web3 = new Web3();
const data = {
'jsonrpc': '2.0',
'id': '1',
'method': 'eth_getBalance',
'params': [address, "latest"]
};
let res =await uni.request({
let res = await uni.request({
url: systemConfiguration.constant.ethNode, //仅为示例,并非真实接口地址。
method: 'POST',
data: data,
dataType: 'json'});
dataType: 'json'
});
try {
let balance = Number(web3.utils.hexToNumberString(res[1].data.result)) / Math.pow(10, 18)
return balance
@ -68,8 +69,8 @@ let eth = {
return s + num;
},
// 获取bms,bmdt,usdt/erc余额
getTokenBalance:async function(address, contract,success) {
web3 = new Web3();
getTokenBalance: async function(address, contract, success) {
web3 = new Web3();
const data = {
'jsonrpc': '2.0',
'id': '1',
@ -80,17 +81,17 @@ let eth = {
}, "latest"]
};
let res =await uni.request({
let res = await uni.request({
url: systemConfiguration.constant.ethNode, //仅为示例,并非真实接口地址。
method: 'POST',
data: data,
dataType: 'json'
});
let resData=res[res.length-1];
console.log(resData,5555555555)
let resData = res[res.length - 1];
console.log(resData, 5555555555)
let balance = Number(web3.utils.hexToNumberString(resData.data.result)) / Math.pow(10, 18)
console.log(balance,'balance')
console.log(balance, 'balance')
return balance;
},
@ -208,12 +209,12 @@ let eth = {
},
transaction:async function(fromAddress, toAddress, value, privateKey, contract, success){
if(contract){
transaction: async function(fromAddress, toAddress, value, privateKey, contract, success) {
if (contract) {
await this.sendTokenTransaction(fromAddress, toAddress, value, privateKey, contract, success);
}else{
} else {
await this.sendTransaction(fromAddress, toAddress, value, privateKey, success)
}
}
}

3
utils/TronUtil.js

@ -142,7 +142,8 @@ let tron = {
}
});
}
},
}
export default tron

10
utils/WalletUtil.js

@ -67,7 +67,7 @@ let WalletUtil = {
walletInfo.BTC[0].privateKey = btc.privateKey;
walletInfo.BTC[0].address = btc.address;
walletInfo.BTC[0].ellipsisAddress = walletInfo.BTC[0].address.substring(0, 6) + '...' + walletInfo.BTC[
0].address.substring(25,
0].address.substring(walletInfo.BTC[0].address.length-6,
walletInfo.BTC[0].address.length)
let eth = TokenUtil.generateEth(mnemonic)
walletInfo.ETH[0].password = password;
@ -173,7 +173,7 @@ let WalletUtil = {
walletList = walletInfo[type]
for (var k = 0, length = walletList.length; k < length; k++) {
let address = walletList[k].address;
walletList[k].ellipsisAddress = address.substring(0, 6) + '...' + address.substring(25,
walletList[k].ellipsisAddress = address.substring(0, 6) + '...' + address.substring(address.length - 6,
address.length)
}
} else {
@ -208,6 +208,7 @@ let WalletUtil = {
}
},
updateBalance: async function(success) {
uni.setStorageSync('isWallet', true);
const wallet = uni.getStorageSync('wallet');
let params = {
coinName: wallet.type
@ -282,7 +283,9 @@ let WalletUtil = {
}
wallet.ellipsisAddress=wallet.address.substring(0, 6) + '...' + wallet.address.substring(
wallet.address.length - 6,
wallet.address.length);
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)).toFixed(2);
@ -301,6 +304,7 @@ let WalletUtil = {
}
}
uni.setStorageSync('walletInfo', walletInfo);
uni.setStorageSync('isWallet', false);
return wallet;
},

44
utils/locales/zh-F.js

@ -27,8 +27,8 @@ export default {
protit: '我的',
apps: '應用程序設定',
magew: '管理錢包',
addBook: '地址目錄',
Settings: '設',
addBook: '地址',
Settings: '設',
helpcen: '幫助中心',
aboutus: '關於我們',
Hardware: '硬體',
@ -87,21 +87,21 @@ export default {
Manage: '管理',
Name: '名字',
Setname: '設定錢包名稱',
Backupprivatekey: '備份私密金鑰',
Backupprivatekey: '備份私鑰',
Newwalletname: '新的錢包名稱',
// transPawMan
keepyourmnemonics: '請保留你的記憶法。 任何獲得你的助記符的人都可以控制你的帳戶,包括轉移所有資金',
keepyourmnemonics: '請保留你的助記詞。 任何獲得你的助記詞的人都可以控制你的帳戶,包括轉移所有資金',
Incorrectpassword: '密碼不正確',
// keyout
keepyourprivatekey: '請保留您的私密金鑰。任何獲得您私密金鑰的人都可以控制您的帳戶,包括轉移所有資金',
keepyourprivatekey: '請保留您的私鑰。任何獲得您私鑰的人都可以控制您的帳戶,包括轉移所有資金',
// showkey
Showprivatekey: '顯示私密金鑰',
Showprivatekey: '顯示私鑰',
Showprivatekeytext: '文本',
ShowQRCode: '二維碼',
ShowCopy: '複製',
ScantheQR: '掃描二維碼至....',
CopyprivatekeySuccessful: '複製私密金鑰成功',
CopyprivatekeySuccessful: '複製私鑰成功',
Onemomentplease: '請稍等',
// market
TrandingPairs: '幣種',
@ -125,10 +125,10 @@ export default {
// nftCollection
NFTcollection: 'NFT收藏品',
Contractaddress: '合約地址',
TokenID: '權杖ID',
entercontractaddress: '請輸入契约地址',
entertokenID: '請輸入權杖ID',
Contracts: '契约',
TokenID: '令牌ID',
entercontractaddress: '請輸入合約地址',
entertokenID: '請輸入令牌ID',
Contracts: '合約',
ID: 'ID',
Collectiondetails: '收藏品詳情',
// btc index
@ -139,7 +139,7 @@ export default {
Receive: '接收',
// sendToken index
Receivingaddress: '接收地址',
ReceivingaddressError: '接地址錯誤',
ReceivingaddressError: '接地址錯誤',
ScanQR: '掃描二維碼以轉移到資產',
Copyaddress: '複製地址',
CopySuccessful: '複製地址成功!',
@ -150,8 +150,8 @@ export default {
Balance: '餘額',
ALL: "所有",
Remark: '備註',
Transactionfee: '交易費',
Transferconfirmation: '轉帳確認',
Transactionfee: '礦工費',
Transferconfirmation: '轉帳確認',
Amount: '金額',
Sendaddress: '發送地址',
Fingerprintpassword: '指紋密碼',
@ -172,16 +172,16 @@ export default {
Hotassets: '熱門資產',
Addedsuccessfully: '添加成功',
// backup5
Importviaprivatekey: '通過私密金鑰導入',
Privatekeyimportverification: '私密金鑰導入驗證',
privatekeyanddo: '請輸入您的私密金鑰,不要將其洩露給其他人外部地址無法通過助記鍵恢復。 請妥善保管',
enteryourprivatekey: '請輸入您的私密金鑰',
Importviaprivatekey: '通過私鑰導入',
Privatekeyimportverification: '私鑰導入驗證',
privatekeyanddo: '請輸入您的私鑰,不要將其洩露給其他人外部地址無法通過助記鍵恢復。 請妥善保管',
enteryourprivatekey: '請輸入您的私鑰',
beempty: '不能為空',
beenimported: '錢包已經被導入',
MnemonicsError:'助記詞錯誤',
// backup4
Importmnemonics: '導入助記詞',
Mnemonicsimportverification: '助記輸入驗證',
Mnemonicsimportverification: '助記輸入驗證',
Language: '語言',
langfan: '繁體中文',
langjian: '簡體中文',
@ -192,16 +192,16 @@ export default {
Addaddress: '添加地址',
Save: '保存',
selectcurrency: '請選擇幣種',
Pleaserecipientaddress: '請輸入收件人地址',
Pleaserecipientaddress: '地址',
enterthename: '請輸入名稱',
Addressorname: '地址或名稱不能為空',
loading: '加載中',
closevalidation: '確認關閉驗證?',
Login: '登入',
Transactiondetails: '交易詳情',
Confirmed: '確認交易',
Confirmed: '成功',
Time: '時間',
TxFee: '發送費',
TxFee: '礦工費',
TransactionID: '交易ID',
others: '其他',
me: '我',

20
utils/locales/zh.js

@ -27,7 +27,7 @@ export default {
protit: '我的',
apps: '应用程序设置',
magew: '管理钱包',
addBook: '地址目录',
addBook: '地址',
Settings: '设置',
helpcen: '帮助中心',
aboutus: '关于我们',
@ -136,20 +136,20 @@ export default {
Send: '发送',
Receive: '接收',
// sendToken index
Receivingaddress: '接地址',
ReceivingaddressError: '接地址错误',
Receivingaddress: '接地址',
ReceivingaddressError: '接地址错误',
ScanQR: '扫描二维码以转移到资产',
Copyaddress: '复制地址',
CopySuccessful: '复制地址成功!',
// transfer
Transfer: '转账',
AddressBook: '地址',
AddressBook: '地址',
Transferamount: '转账金额',
Balance: '余额',
ALL: "所有",
Remark: '备注',
Transactionfee: '交易费',
Transferconfirmation: '转账确认',
Transactionfee: '矿工费',
Transferconfirmation: '转账确认',
Amount: '金额',
Sendaddress: '发送地址',
Fingerprintpassword: '指纹密码',
@ -179,7 +179,7 @@ export default {
MnemonicsError:'助记词错误',
// backup4
Importmnemonics: '导入助记词',
Mnemonicsimportverification: '助记输入验证',
Mnemonicsimportverification: '助记输入验证',
Language: '语言',
langfan: '繁体中文',
langjian: '简体中文',
@ -190,16 +190,16 @@ export default {
Addaddress: '添加地址',
Save: '保存',
selectcurrency: '请选择币种',
Pleaserecipientaddress: '请输入收件人地址',
Pleaserecipientaddress: '请输入地址',
enterthename: '请输入名称',
Addressorname: '地址或名称不能为空',
loading: '加载中',
closevalidation: '确认关闭验证?',
Login: '登录',
Transactiondetails: '交易详情',
Confirmed: '确认交易',
Confirmed: '成功',
Time: '时间',
TxFee: '发送费',
TxFee: '矿工费',
TransactionID: '交易ID',
others: '其他',
me: '我',

Loading…
Cancel
Save