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.
409 lines
9.8 KiB
409 lines
9.8 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="scanCode"></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,value=''"></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,index)">
|
|
<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" @click="selectA">
|
|
{{i18n.langSelect}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
<script>
|
|
import cont from "@/components/navigation/navigation.vue"
|
|
export default {
|
|
data() {
|
|
return {
|
|
teee1: this.$t('index').selectcurrency,
|
|
teee2: this.$t('index').Pleaserecipientaddress,
|
|
teee3: this.$t('index').enterthename,
|
|
info: {},
|
|
addressName: '',
|
|
bigAddress: '',
|
|
save: false,
|
|
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: '',
|
|
transfer: '',
|
|
}
|
|
},
|
|
onLoad() {
|
|
|
|
},
|
|
computed: {
|
|
i18n() {
|
|
return this.$t('index')
|
|
},
|
|
},
|
|
methods: {
|
|
selectA() {
|
|
this.show = false
|
|
},
|
|
scanCode() {
|
|
var _this = this
|
|
uni.scanCode({
|
|
success: function(res) {
|
|
console.log('扫码内容', res.result)
|
|
|
|
_this.bigAddress = res.result;
|
|
}
|
|
});
|
|
},
|
|
|
|
handove2(item, index) {
|
|
this.value = item.name;
|
|
|
|
},
|
|
showSave() {
|
|
if (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.value == 'BTC') {
|
|
|
|
if(!this.$Token.validateBtc(this.bigAddress))
|
|
{
|
|
uni.showToast({
|
|
title: this.$t('index').addressFormatError,
|
|
icon: 'none',
|
|
duration: 1500
|
|
})
|
|
return
|
|
}
|
|
|
|
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",
|
|
name2: "BTC",
|
|
xname: 'Bitcoin',
|
|
icon: require('@/static/tongyonh/bye.png')
|
|
}];
|
|
let BTCAddressInfo = []
|
|
BTCAddressInfo = uni.getStorageSync('BTCAddressInfo')
|
|
BTCAddressInfo.push(btc)
|
|
uni.setStorageSync('BTCAddressInfo', BTCAddressInfo)
|
|
console.log(BTCAddressInfo, 1111)
|
|
uni.showToast({
|
|
title: this.$t('index').Successful,
|
|
icon: 'success',
|
|
duration: 1500
|
|
})
|
|
uni.redirectTo({
|
|
url: '../address/index'
|
|
})
|
|
} else {
|
|
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')
|
|
}];
|
|
console.log(btc, 4444)
|
|
let BTCAddressInfo = []
|
|
BTCAddressInfo.push(btc)
|
|
console.log(BTCAddressInfo, 4444)
|
|
uni.setStorageSync('BTCAddressInfo', BTCAddressInfo)
|
|
|
|
uni.showToast({
|
|
title: this.$t('index').Successful,
|
|
icon: 'success',
|
|
duration: 1500
|
|
})
|
|
setTimeout(() => {
|
|
uni.redirectTo({
|
|
url: '../address/index'
|
|
})
|
|
}, 1500)
|
|
}
|
|
|
|
}
|
|
|
|
|
|
if (this.value == 'ETH') {
|
|
console.log(this.bigAddress,this.$Token.validateEth(this.bigAddress))
|
|
if(!this.$Token.validateEth(this.bigAddress))
|
|
{
|
|
uni.showToast({
|
|
title: this.$t('index').addressFormatError,
|
|
icon: 'none',
|
|
duration: 1500
|
|
})
|
|
return
|
|
}
|
|
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",
|
|
name2: "ETH",
|
|
xname: 'Ethereum',
|
|
icon: require('@/static/tongyonh/Frame3299.png')
|
|
}];
|
|
let ETHAddressInfo = []
|
|
ETHAddressInfo = uni.getStorageSync('ETHAddressInfo')
|
|
ETHAddressInfo.push(eth)
|
|
uni.setStorageSync('ETHAddressInfo', ETHAddressInfo)
|
|
console.log(ETHAddressInfo, 1111)
|
|
uni.showToast({
|
|
title: this.$t('index').Successful,
|
|
icon: 'success',
|
|
duration: 1500
|
|
})
|
|
|
|
setTimeout(() => {
|
|
uni.redirectTo({
|
|
url: '../address/index'
|
|
})
|
|
}, 1500)
|
|
|
|
} else {
|
|
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')
|
|
}];
|
|
console.log(eth, 4444)
|
|
let ETHAddressInfo = []
|
|
ETHAddressInfo.push(eth)
|
|
console.log(ETHAddressInfo, 4444)
|
|
uni.setStorageSync('ETHAddressInfo', ETHAddressInfo)
|
|
uni.showToast({
|
|
title: this.$t('index').Successful,
|
|
icon: 'success',
|
|
duration: 1500
|
|
})
|
|
setTimeout(() => {
|
|
uni.redirectTo({
|
|
url: '../address/index'
|
|
})
|
|
}, 1500)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (this.value == 'TRX') {
|
|
if(!this.$Token.validateTrx(this.bigAddress))
|
|
{
|
|
uni.showToast({
|
|
title: this.$t('index').addressFormatError,
|
|
icon: 'none',
|
|
duration: 1500
|
|
})
|
|
return
|
|
}
|
|
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",
|
|
name2: "TRX",
|
|
xname: 'TRON',
|
|
icon: require('@/static/tongyonh/tron1.png')
|
|
}];
|
|
let TRXAddressInfo = []
|
|
TRXAddressInfo = uni.getStorageSync('TRXAddressInfo')
|
|
TRXAddressInfo.push(trx)
|
|
uni.setStorageSync('TRXAddressInfo', TRXAddressInfo)
|
|
console.log(TRXAddressInfo, 1111)
|
|
uni.showToast({
|
|
title: this.$t('index').Successful,
|
|
icon: 'success',
|
|
duration: 1500
|
|
})
|
|
setTimeout(() => {
|
|
uni.redirectTo({
|
|
url: '../address/index'
|
|
})
|
|
}, 1500)
|
|
} else {
|
|
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')
|
|
}];
|
|
console.log(trx, 4444)
|
|
let TRXAddressInfo = []
|
|
TRXAddressInfo.push(trx)
|
|
console.log(TRXAddressInfo, 4444)
|
|
uni.setStorageSync('TRXAddressInfo', TRXAddressInfo)
|
|
uni.showToast({
|
|
title: this.$t('index').Successful,
|
|
icon: 'success',
|
|
duration: 1500
|
|
})
|
|
setTimeout(() => {
|
|
uni.redirectTo({
|
|
url: '../address/index'
|
|
})
|
|
}, 1500)
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
showSelect() {
|
|
this.show = true;
|
|
},
|
|
}
|
|
};
|
|
</script>
|
|
<style scoped>
|
|
page {
|
|
background: #FAFAFA;
|
|
height: 100%;
|
|
}
|
|
</style>
|
|
|
|
<style>
|
|
@import './index.css';
|
|
</style>
|
|
|