Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dapp-web
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhanglian
dapp-web
Commits
9d3f24c1
提交
9d3f24c1
authored
1月 05, 2022
作者:
zhanglian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
转账成功提示
上级
20c9cf0d
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
44 行增加
和
28 行删除
+44
-28
main.js
src/main.js
+0
-2
vant.js
src/plugin/vant.js
+5
-3
thinkiumBridge.vue
src/views/thinkiumBridge/thinkiumBridge.vue
+39
-23
没有找到文件。
src/main.js
浏览文件 @
9d3f24c1
...
...
@@ -18,8 +18,6 @@ import 'swiper/swiper-bundle.css'
Vue
.
config
.
productionTip
=
false
Vue
.
use
(
animated
)
Vue
.
use
(
AsyncComputed
)
...
...
src/plugin/vant.js
浏览文件 @
9d3f24c1
import
Vue
from
'vue'
import
{
Dialog
}
from
'vant'
;
import
{
Dialog
,
Loading
,
Notify
}
from
'vant'
;
// 全局注册
Vue
.
use
(
Dialog
);
\ No newline at end of file
Vue
.
use
(
Dialog
);
Vue
.
use
(
Loading
);
Vue
.
use
(
Notify
);
\ No newline at end of file
src/views/thinkiumBridge/thinkiumBridge.vue
浏览文件 @
9d3f24c1
...
...
@@ -48,6 +48,7 @@
</li>
</ul>
</EDialog>
<van-loading
class=
"loading-bg"
type=
"spinner"
color=
"#303030"
size=
"24px"
v-show=
"pageLoading"
/>
</div>
</
template
>
...
...
@@ -77,6 +78,7 @@ export default {
data
()
{
return
{
dialogVisible
:
false
,
pageLoading
:
false
,
tokenList
:
[],
tokenListOrigin
:
[{
name
:
'TKM'
,
...
...
@@ -234,13 +236,11 @@ export default {
chainName
:
'tkm'
,
coinData
:
{},
}
let
bsc
=
{
name
:
'BSC'
,
chainName
:
'bsc'
,
coinData
:
{},
}
if
(
this
.
tokenListBSC
.
map
(
item
=>
item
.
chainId
).
includes
(
this
.
chainId
))
{
this
.
holdItem
=
bsc
;
this
.
exchangeItem
=
tkm
;
...
...
@@ -248,10 +248,9 @@ export default {
this
.
holdItem
=
tkm
;
this
.
exchangeItem
=
bsc
;
}
this
.
changeItem
=
'holdItem'
;
let
token
=
this
.
tokenListOrigin
.
find
(
item
=>
item
.
chainId
==
this
.
chainId
&&
item
.
chainName
==
this
.
holdItem
.
chainName
);
if
(
!
token
)
{
if
(
!
token
)
{
token
=
this
.
getTokensByChainName
(
this
.
holdItem
.
chainName
)[
0
]
}
this
.
changeSelect
(
0
,
token
)
...
...
@@ -259,12 +258,12 @@ export default {
formateChainName
(
chainId
)
{
let
tkmChainIds
=
this
.
tokenListTKM
.
map
(
item
=>
item
.
chainId
);
let
bscChainIds
=
this
.
tokenListBSC
.
map
(
item
=>
item
.
chainId
);
if
(
tkmChainIds
.
includes
(
chainId
-
0
))
{
return
`Thinkium
${
chainId
}
#链`
}
else
if
(
bscChainIds
.
includes
(
chainId
-
0
))
{
}
else
if
(
bscChainIds
.
includes
(
chainId
-
0
))
{
return
`BSC`
}
else
{
}
else
{
return
chainId
}
},
...
...
@@ -323,7 +322,7 @@ export default {
this
.
dialogVisible
=
true
this
.
changeItem
=
type
;
},
transfer
()
{
async
transfer
()
{
const
{
inputValue
,
holdItem
,
exchangeItem
}
=
this
;
const
value
=
(
inputValue
+
''
).
trim
()
-
0
;
if
(
!
value
)
{
...
...
@@ -335,21 +334,29 @@ export default {
});
return
;
}
if
(
holdItem
.
coinData
.
type
==
'main'
)
{
this
.
depositNative
({
chain
:
exchangeItem
.
coinData
.
chainId
+
''
,
value
:
this
.
$toBig
(
value
)
});
}
else
{
this
.
depositToken
({
chain
:
exchangeItem
.
coinData
.
chainId
+
''
,
value
:
this
.
$toBig
(
value
),
tokenAddress
:
holdItem
.
coinData
.
contractAddress
,
});
}
this
.
pageLoading
=
true
;
try
{
if
(
holdItem
.
coinData
.
type
==
'main'
)
{
await
this
.
depositNative
({
chain
:
exchangeItem
.
coinData
.
chainId
+
''
,
value
:
this
.
$toBig
(
value
)
});
}
else
{
await
this
.
depositToken
({
chain
:
exchangeItem
.
coinData
.
chainId
+
''
,
value
:
this
.
$toBig
(
value
),
tokenAddress
:
holdItem
.
coinData
.
contractAddress
,
});
}
this
.
$notify
({
type
:
'success'
,
message
:
'转账成功'
});
}
catch
(
err
)
{
this
.
$notify
({
type
:
'warning'
,
message
:
'转账失败'
});
}
this
.
pageLoading
=
false
;
},
depositNative
({
address
=
window
.
defaultAccount
,
chain
,
value
})
{
async
depositNative
({
address
=
window
.
defaultAccount
,
chain
,
value
})
{
let
params
=
[
address
,
chain
,
...
...
@@ -357,7 +364,7 @@ export default {
let
overrides
=
{
value
,
}
bridge
.
methods
.
depositNative
(...
params
).
send
(
overrides
)
await
bridge
.
methods
.
depositNative
(...
params
).
send
(
overrides
)
},
async
depositToken
({
value
,
tokenAddress
,
address
=
window
.
defaultAccount
,
chain
})
{
let
token
=
''
;
...
...
@@ -372,7 +379,7 @@ export default {
address
,
chain
]
bridge
.
methods
.
depositToken
(...
params
).
send
();
await
bridge
.
methods
.
depositToken
(...
params
).
send
();
},
async
approve
({
value
,
contractAddress
,
owner
=
window
.
defaultAccount
,
spender
})
{
console
.
log
({
value
,
contractAddress
,
owner
,
spender
});
...
...
@@ -572,5 +579,14 @@ export default {
background-color
:
rgba
(
$color
:
#FCBF19
,
$alpha
:
0
.1
);
}
}
.loading-bg
{
position
:
fixed
;
width
:
100%
;
height
:
100%
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
background
:
rgba
(
0
,
0
,
0
,
0
.3
);
}
}
</
style
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论