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

460 lines
12 KiB

<template>
<view class="hr">
<navigation :showBack="true" :bgnum="true">
<text class="big_title">
{{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>
</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>
</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>
<u-radio
:name="item.name"
:disabled="item.disabled"
active-color="#5B53FF"
>
</u-radio>
</view>
</u-radio-group>
<view class="select_btn">
{{i18n.langSelect}}
</view>
</view>
</view>
</view>
</template>
<script>
import cont from "@/components/navigation/navigation.vue"
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-group的v-model绑定的值如果设置为某个radio的name,就会被默认选中
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')
}
},
computed: {
i18n() {
return this.$t('index')
},
},
methods: {
// 唤醒摄像头
chooseImage() {
var _this = this
uni.chooseImage({
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], //从相册选择、摄像头
success: function(res) {
_this.imgShow = res.tempFilePaths[0]
}
});
// 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)
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'
})
}
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;
},
}
};
</script>
<style scoped>
page {
background: #FAFAFA;
height: 100%;
}
</style>
<style>
@import './index.css';
</style>