155 lines
3.5 KiB
Vue
155 lines
3.5 KiB
Vue
<template>
|
||
<view class="content">
|
||
<TopSafe bgColor="rgba(0,0,0,0)"></TopSafe>
|
||
<Header title="绑定区块链地址" bgColor="rgba(0,0,0,0)" />
|
||
<view class="setting-view">
|
||
<view class="mid-view">
|
||
<text class="text-gray text-32 mt-24">地址</text>
|
||
<view class="input-view">
|
||
<up-input placeholder="请输入地址" border="surround" v-model="account" :customStyle="inputCss"></up-input>
|
||
</view>
|
||
<text class="text-gray text-32 mt-48">主网络</text>
|
||
<view class="input-view">
|
||
<up-input placeholder="请选择主网络" border="surround" v-model="name" :customStyle="inputCss"></up-input>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="bottom-btn">
|
||
<MyBtn text="添加" @ok="onAdd"></MyBtn>
|
||
</view>
|
||
<up-toast ref="uToastRef"></up-toast>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import { bindExchUsers } from '@/api/finance.js';
|
||
import Header from '@/components/common/header.vue';
|
||
import { clear } from '@/utils/auth.js';
|
||
import TopSafe from '@/components/common/top-safe.nvue'
|
||
import MyBtn from '@/components/common/my-btn.vue'
|
||
import func from '@/utils/func.js';
|
||
import AccountItem from './components/account-item.vue'
|
||
|
||
export default {
|
||
components: { Header, TopSafe,MyBtn,AccountItem },
|
||
data() {
|
||
return {
|
||
topText:'',
|
||
type:0,
|
||
account:'',
|
||
name:'BNB Smart Chain(BEP20)',
|
||
wxCode:'',
|
||
inputCss: {
|
||
"height": '80rpx',
|
||
"background": "#F3F3F3FF",
|
||
"border-radius": "30rpx",
|
||
"border": "0rpx",
|
||
"padding-left": "12rpx",
|
||
},
|
||
};
|
||
},
|
||
onLoad(option) {
|
||
|
||
},
|
||
methods: {
|
||
onAdd(){
|
||
if(!this.account){
|
||
this.$refs.uToastRef.show({
|
||
type: 'error',
|
||
message: '地址不可为空',
|
||
});
|
||
return;
|
||
}
|
||
if(this.account[0] != 0 || (this.account[1] != 'x' && this.account[1] != 'X') || this.account.length != 42){
|
||
this.$refs.uToastRef.show({
|
||
type: 'error',
|
||
message: '请输入正确的地址',
|
||
});
|
||
return;
|
||
}
|
||
if(!this.name){
|
||
this.$refs.uToastRef.show({
|
||
type: 'error',
|
||
message: '请选择网络',
|
||
});
|
||
return;
|
||
}
|
||
let params = {
|
||
name:'WALLET',
|
||
address:this.account,
|
||
netword:this.name
|
||
}
|
||
bindExchUsers(params).then(res=>{
|
||
if (res.bizcode === 100) {
|
||
this.$refs.uToastRef.show({
|
||
type: 'success',
|
||
message: '绑定成功',
|
||
});
|
||
this.account = '';
|
||
this.name = '';
|
||
setTimeout(()=>{
|
||
uni.navigateBack();
|
||
},1000)
|
||
} else {
|
||
this.$refs.uToastRef.show({
|
||
type: 'error',
|
||
message: res.msg,
|
||
});
|
||
return null;
|
||
}
|
||
})
|
||
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.bottom-btn{
|
||
width: 100%;
|
||
margin-bottom:92rpx;
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
padding: 0 32rpx;
|
||
box-sizing: border-box;
|
||
position: relative;
|
||
|
||
}
|
||
.setting-view {
|
||
width: 100%;
|
||
height: calc(100% - 88rpx - 92rpx - 88rpx - var(--status-bar-height));
|
||
display: flex;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
overflow-y: auto;
|
||
padding: 0 32rpx;
|
||
box-sizing: border-box;
|
||
position: relative;
|
||
.mid-view{
|
||
width:100%;
|
||
display: flex;
|
||
flex-direction: column;
|
||
overflow-y: auto;
|
||
box-sizing: border-box;
|
||
background-color: #fff;
|
||
border-radius: 16rpx;
|
||
padding: 48rpx 32rpx;
|
||
margin-top:24rpx;
|
||
.input-view{
|
||
width:100%;
|
||
height:100rpx;
|
||
background-color: #f5f5f5;
|
||
border-radius: 20rpx;
|
||
margin-top:32rpx;
|
||
display: flex;
|
||
flex-direction: row;
|
||
align-items: center;
|
||
|
||
}
|
||
}
|
||
|
||
|
||
}
|
||
</style>
|