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

调整 没选择钱包时的交互

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