提交 101cec40 authored 作者: zhanglian's avatar zhanglian

调整 没选择钱包时的交互

上级 88065d2e
......@@ -14,5 +14,7 @@ export default {
placeholder4: 'You have selected the cross-chain access from {fromChainName} to {toChainName}. The current connection network is not the {fromChainName} network. Please switch the {fromChainName} network to complete the cross-chain operation.',
confirm: 'confirm',
chooseToken: 'Choose Token',
pleaseLinkTheWallet: 'Please link the wallet',
OK: 'OK',
}
......@@ -14,5 +14,6 @@ export default {
placeholder4: '{fromChainName}から{toChainName}へのクロスチェーンアクセスを選択しました。現在の接続ネットワークは{fromChainName}ネットワークではありません。{fromChainName}ネットワークを切り替えてクロスチェーン操作を完了してください。',
confirm: '確認',
chooseToken: '選ぶToken',
pleaseLinkTheWallet: 'ウォレットをリンクしてください',
OK: 'わかった',
}
\ No newline at end of file
......@@ -14,5 +14,7 @@ export default {
placeholder4: '{fromChainName}에서 {toChainName}(으)로의 교차 체인 액세스를 선택했습니다. 현재 연결 네트워크는 {fromChainName} 네트워크가 아닙니다. 교차 체인 작업을 완료하려면 {fromChainName} 네트워크를 전환하십시오.',
confirm: '확인하다',
chooseToken: '선택하다Token',
pleaseLinkTheWallet: '지갑을 연결해주세요',
OK: '확인',
}
\ No newline at end of file
......@@ -14,4 +14,6 @@ export default {
placeholder4: '您已选择了从{fromChainName}到{toChainName}的跨链访问,当前连接网络并非{fromChainName}网络,请切换{fromChainName}网络后完成跨链操作。',
confirm: '确认',
chooseToken: '选择Token',
pleaseLinkTheWallet: '请链接钱包',
OK: '好的',
}
......@@ -8,7 +8,7 @@ const tokenListLocal = [
const tokenListDev = [{
name: 'TKM',
index: 1,
chainName: 'tkm',
chainName: 'thk',
chainId: 60001,
url: '',
balance: '0',
......@@ -18,7 +18,7 @@ const tokenListDev = [{
{
name: 'TUSDT',
index: 2,
chainName: 'tkm',
chainName: 'thk',
chainId: 60001,
url: '',
balance: '0',
......@@ -49,7 +49,7 @@ const tokenListDev = [{
{
name: 'TKM3',
index: 3,
chainName: 'tkm',
chainName: 'thk',
chainId: 60001,
url: '',
balance: '0',
......@@ -59,7 +59,7 @@ const tokenListDev = [{
{
name: 'TUSDT3',
index: 4,
chainName: 'tkm',
chainName: 'thk',
chainId: 60001,
url: '',
balance: '0',
......
......@@ -40,7 +40,7 @@
</div>
<div class="convert-btn pointer" @click="transfer">{{$t('transfer')}}</div>
<EDialog :title="$t('chooseToken')" :visible="dialogVisible" @close="dialogVisible = false" v-if="dialogVisible">
<ul class="select-list" v-if="walletConnected">
<ul class="select-list">
<li class="select-item" v-for="(item, index) in tokenList" :key="index" @click="changeSelect(index,item)" :class="selectIndex === index ? 'active' : ''">
<div class="item-left">
<img :src="item.url || require(`@/assets/images/logo.png`)" alt="">
......@@ -49,7 +49,6 @@
<img v-if="selectIndex === index" src="../../assets/images/select.png" alt="">
</li>
</ul>
<div class="cannect-wallet2 pointer" v-else @click="toCannectWallet">{{$t('connectWallet')}}</div>
</EDialog>
<van-loading class="loading-bg" type="spinner" color="#303030" size="24px" v-show="pageLoading" />
</div>
......@@ -91,7 +90,7 @@ export default {
selectIndex: '',
holdItem: {
name: 'THINKIUM',
chainName: 'tkm',
chainName: 'thk',
coinData: {},
},
exchangeItem: {
......@@ -128,8 +127,8 @@ export default {
this.networkAlert();
return 0;
}
if(!this.rbalance){
if (!this.rbalance) {
}
if (coinData.type == 'main') {
return this.getAccountBalance().then(res => res);
......@@ -144,24 +143,13 @@ export default {
},
methods: {
async init() {
if (!this.walletConnected) {
return;
}
let overrides = {
gasLimit: 300000,
from: window.defaultAccount,
// gasLimit: 1000000,
value: '0x0'
}
bridge = new window.web3.eth.Contract(bridgeAbi, bridgeContractAddress, overrides);
this.tokenListOrigin = getTokenList(this.chainId);
this.tokenListTKM = this.getTokensByChainName('tkm') || [];
this.tokenListTKM = this.getTokensByChainName('thk') || [];
this.tokenListBSC = this.getTokensByChainName('bsc') || [];
let tkm = {
let thk = {
name: 'THINKIUM',
chainName: 'tkm',
chainName: 'thk',
coinData: {},
}
let bsc = {
......@@ -171,9 +159,9 @@ export default {
}
if (this.tokenListBSC.map(item => item.chainId).includes(this.chainId)) {
this.holdItem = bsc;
this.exchangeItem = tkm;
this.exchangeItem = thk;
} else {
this.holdItem = tkm;
this.holdItem = thk;
this.exchangeItem = bsc;
}
this.changeItem = 'holdItem';
......@@ -183,8 +171,20 @@ export default {
}
console.log('----123', token);
this.changeSelect(0, token)
if (!this.walletConnected) {
return;
}
let overrides = {
gasLimit: 300000,
from: window.defaultAccount,
// gasLimit: 1000000,
value: '0x0'
}
bridge = new window.web3.eth.Contract(bridgeAbi, bridgeContractAddress, overrides);
},
refreshBalance(){
refreshBalance() {
this.rbalance++
},
formateChainName(chainId) {
......@@ -230,7 +230,7 @@ export default {
let chainName = this[this.changeItem].chainName;
let tokenList, anotherToken;
if (chainName == 'tkm') {
if (chainName == 'thk') {
tokenList = this.tokenListBSC;
} else if (chainName == 'bsc') {
tokenList = this.tokenListTKM;
......@@ -243,7 +243,7 @@ export default {
}
setTimeout(() => {
this.dialogVisible = false
},500)
}, 500)
},
getTokensByChainName(chainName) {
return this.tokenListOrigin.filter(item => item.chainName == chainName);
......@@ -261,6 +261,16 @@ export default {
async transfer() {
const { inputValue, holdItem, exchangeItem } = this;
const value = (inputValue + '').trim() - 0;
if (!this.walletConnected) {
this.$dialog.alert({
title: this.$t('title'),
message: this.$t('pleaseLinkTheWallet'),
confirmButtonText: this.$t('OK')
}).then(() => {
connectWallet()
})
return;
}
if (holdItem.coinData.chainId != this.chainId) {
this.networkAlert();
return;
......@@ -282,7 +292,7 @@ export default {
minNum = 1000
this.$dialog.alert({
title: this.$t('title'),
message: this.$t('placeholder3', {minNum}),
message: this.$t('placeholder3', { minNum }),
confirmButtonText: this.$t('confirm')
}).then(() => {
// on close
......@@ -292,7 +302,7 @@ export default {
minNum = 200
this.$dialog.alert({
title: this.$t('title'),
message: this.$t('placeholder3', {minNum}),
message: this.$t('placeholder3', { minNum }),
confirmButtonText: this.$t('confirm')
}).then(() => {
// on close
......@@ -568,7 +578,7 @@ export default {
align-items: center;
background: rgba(0, 0, 0, 0.3);
}
.cannect-wallet2{
.cannect-wallet2 {
text-align: center;
margin: 1rem auto;
color: red;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论