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.
 
 
 
 

378 lines
9.1 KiB

<template>
<view class="hr">
<navigation :showBack="true" :bgnum="true">
<text class="big_title">
Add address
</text>
</navigation>
<view class="main">
<view class="main_con">
<view class="item">
<view class="top flex">
<view class="text1">
Currency
</view>
</view>
<view class="inputcon">
<input type="text" value="" v-model="value" placeholder-style="font-size: 30rpx; color: #D0D0D2;" placeholder="Please select the currency" 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">
Address
</view>
</view>
<view class="inputcon">
<input type="text" value="" @input="showSave()" placeholder-style="font-size: 30rpx; color: #D0D0D2;" placeholder="Please enter the recipient address" 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">
Name
</view>
</view>
<view class="inputcon">
<input type="text" @input="showSave" value="" placeholder-style="font-size: 30rpx; color: #D0D0D2;" placeholder="Please enter the name" class="input1" v-model="addressName"/>
</view>
</view>
<view class="btn" @click="handove()" :class="save?'sheng':''">
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">
Please select currency
</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">
Select
</view>
</view>
</view>
</view>
</template>
<script>
import cont from "@/components/navigation/navigation.vue"
export default {
data() {
return {
AddressInfo:{},
info:{},
addressName:'',
value:'',
bigAddress:'',
save:true,
AddressIndex:-1,
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)){
this.info=uni.getStorageSync('AddressInfo')
console.log(uni.getStorageSync('AddressInfo'),7777)
this.AddressInfo=uni.getStorageSync('AddressInfo')
console.log(this.AddressInfo)
this.addressName=this.AddressInfo.name
this.bigAddress=this.AddressInfo.address,
this.value=uni.getStorageSync('AddressName')
this.AddressIndex=uni.getStorageSync('AddressIndex')
}
},
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.info=item;
this.show=false;
},
showSave(){
if(this.bigAddress!=''&&this.name!=''&&this.value!=''){
this.save=true;
}else{
this.save=false;
}
},
handove(item){
console.log(this.value)
console.log(this.bigAddress)
console.log(this.addressName)
console.log(this.info.name)
if(this.value==''){
this.save=false
uni.showToast({
title: 'Please select a currency',
icon: 'none',
duration: 1500
})
return;
}
if(this.bigAddress==''||this.addressName==''){
this.save=false
uni.showToast({
title: 'Address or name cannot be empty',
icon: 'none',
duration: 1500
})
return;
}
if(this.info.coinList[0].name=='BTC'){
console.log(uni.getStorageSync('BTCAddressInfo'),777)
if(uni.getStorageSync('BTCAddressInfo').length>0){
let btc=new Object;
btc.address=this.bigAddress;
btc.name=this.addressName
btc.coinList=[{
name:"BTC",
xname:'Bitcoin',
icon:require('@/static/tongyonh/bye.png')
}];
let BTCAddressInfo=[]
BTCAddressInfo=uni.getStorageSync('BTCAddressInfo')
BTCAddressInfo[this.AddressIndex]=btc
uni.setStorageSync('BTCAddressInfo',BTCAddressInfo)
console.log(BTCAddressInfo,1111)
uni.showToast({
title: 'Successfully',
icon: 'success',
duration: 1500
})
uni.navigateTo({
url:'../address/index'
})
}else{
let btc=new Object;
btc.address=this.bigAddress;
btc.name=this.addressName
btc.coinList=[{
name:"BTC",
xname:'Bitcoin',
icon:require('@/static/tongyonh/bye.png')
}];
console.log(btc,4444)
let BTCAddressInfo=[]
BTCAddressInfo.push(btc)
console.log(BTCAddressInfo,4444)
uni.setStorageSync('BTCAddressInfo',BTCAddressInfo)
uni.showToast({
title: 'Successfully',
icon: 'success',
duration: 1500
})
setTimeout(()=>{
uni.reLaunch({
url:'../address/index'
})
},1500)
}
}
if(this.info.coinList[0].name=='ETH'){
console.log(uni.getStorageSync('ETHAddressInfo'),777)
if(uni.getStorageSync('ETHAddressInfo').length>0){
let eth=new Object;
eth.address=this.bigAddress;
eth.name=this.addressName
eth.coinList=[{
name:"ETH",
xname:'Ethereum',
icon:require('@/static/tongyonh/Frame3299.png')
}];
let ETHAddressInfo=[]
ETHAddressInfo=uni.getStorageSync('ETHAddressInfo')
ETHAddressInfo[this.AddressIndex]=eth
uni.setStorageSync('ETHAddressInfo',ETHAddressInfo)
console.log(ETHAddressInfo,1111)
uni.showToast({
title: 'Successfully',
icon: 'success',
duration: 1500
})
setTimeout(()=>{
uni.reLaunch({
url:'../address/index'
})
},1500)
}else{
let eth=new Object;
eth.address=this.bigAddress;
eth.name=this.addressName
eth.coinList=[{
name:"ETH",
xname:'Ethereum',
icon:require('@/static/tongyonh/Frame3299.png')
}];
console.log(eth,4444)
let ETHAddressInfo=[]
ETHAddressInfo.push(eth)
console.log(ETHAddressInfo,4444)
uni.setStorageSync('ETHAddressInfo',ETHAddressInfo)
uni.showToast({
title: 'Successfully',
icon: 'success',
duration: 1500
})
setTimeout(()=>{
uni.reLaunch({
url:'../address/index'
})
},1500)
}
}
if(this.info.coinList[0].name=='TRX'){
console.log(uni.getStorageSync('TRXAddressInfo'),777)
if(uni.getStorageSync('TRXAddressInfo').length>0){
let trx=new Object;
trx.address=this.bigAddress;
trx.name=this.addressName
trx.coinList=[{
name:"TRX",
xname:'TRON',
icon:require('@/static/tongyonh/tron1.png')
}];
let TRXAddressInfo=[]
TRXAddressInfo=uni.getStorageSync('TRXAddressInfo')
TRXAddressInfo[this.AddressIndex]=trx
uni.setStorageSync('TRXAddressInfo',TRXAddressInfo)
console.log(TRXAddressInfo,1111)
uni.showToast({
title: 'Successfully',
icon: 'success',
duration: 1500
})
setTimeout(()=>{
uni.reLaunch({
url:'../address/index'
})
},1500)
}else{
let trx=new Object;
trx.address=this.bigAddress;
trx.name=this.addressName
trx.coinList=[{
name:"TRX",
xname:'TRON',
icon:require('@/static/tongyonh/tron1.png')
}];
console.log(trx,4444)
let TRXAddressInfo=[]
TRXAddressInfo.push(trx)
console.log(TRXAddressInfo,4444)
uni.setStorageSync('TRXAddressInfo',TRXAddressInfo)
uni.showToast({
title: 'Successfully',
icon: 'success',
duration: 1500
})
setTimeout(()=>{
uni.reLaunch({
url:'../address/index'
})
},1500)
}
}
},
showSelect(){
this.show=true;
},
}
};
</script>
<style scoped>
page {
background: #FAFAFA;
height: 100%;
}
</style>
<style>
@import './index.css';
</style>