Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
Community-Mining-Client
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mining
Community-Mining-Client
Commits
5dd832ec
Commit
5dd832ec
authored
Dec 16, 2021
by
xhx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:多账户切换的界面初始化
parent
552737cd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
24 deletions
+32
-24
App.vue
src/App.vue
+29
-5
PoolList.vue
src/views/Home/PoolList.vue
+2
-18
vue.config.js
vue.config.js
+1
-1
No files found.
src/App.vue
View file @
5dd832ec
...
...
@@ -11,9 +11,10 @@ import service from '@/service/chain33'
import
{
getDeviceId
,
getCurrentBTYAddress
}
from
'@/utils/bridge'
// 币钱包环境
import
{
test
}
from
'@/utils/test'
// 本地测试
import
{
Toast
}
from
'vant'
import
{
getUserInfo
}
from
'@/service/pool'
export
default
Vue
.
extend
({
methods
:
{
// 账号是否能进入投票
// 账号是否能进入投票
,账户可多次切换,刷新时判断是否需重定向回首页
async
hasPoolAddr
(
addr
:
string
)
{
Toast
.
loading
({
duration
:
0
,
...
...
@@ -26,27 +27,49 @@ export default Vue.extend({
const
_result
=
response
.
data
.
result
?.
data
Toast
.
clear
()
if
(
walletRes
.
data
.
result
?.
datas
)
{
// 查询到存在冷钱包,跳转空白页
// 查询到存在冷钱包,跳转空白页
(即存在挖矿用户,为票池地址)
this
.
$router
.
replace
({
path
:
'/noPage'
,
query
:
{
type
:
'3'
,
status
:
'1'
}})
}
else
{
// 多账户切换时重定向
this
.
$router
.
replace
({
path
:
'/'
})
}
//
存在地址,判断此地址是否属于当前项目,
//
若存在地址,判断此地址是否属于当前项目,catch 表明不是当前项目用户
if
(
_result
)
{
isBind
(
_result
).
catch
((
res
:
any
)
=>
{
const
reason
=
res
.
response
.
data
.
reason
if
(
reason
)
{
this
.
$router
.
replace
({
path
:
'/noPage'
,
query
:
{
type
:
'3'
}})
}
else
{
// 多账户切换时重定向
this
.
$router
.
replace
({
path
:
'/'
})
}
}).
then
(()
=>
{
// 多账户切换时重定向
this
.
$router
.
replace
({
path
:
'/'
})
})
}
}
catch
(
e
)
{
console
.
log
(
e
)
Toast
({
message
:
'请求超时,请稍后再试'
,
className
:
'toast_x'
})
}
},
// 获取用户类型,type -> 1: 社区阶段 2:超级节点 status -> 1:票池地址
getInfo
()
{
getUserInfo
().
then
(
res
=>
{
const
type
=
res
.
data
.
data
.
type
+
''
const
status
=
res
.
data
.
data
.
status
+
''
if
(
type
===
'1'
||
type
===
'2'
)
{
this
.
$router
.
replace
({
path
:
'/noPage'
,
query
:
{
type
:
type
}})
}
else
if
(
status
===
'1'
)
{
this
.
$router
.
replace
({
path
:
'/noPage'
,
query
:
{
status
}})
}
else
{
// 多账户切换时重定向
this
.
$router
.
replace
({
path
:
'/'
})
}
})
},
},
mounted
()
{
...
...
@@ -57,6 +80,7 @@ export default Vue.extend({
console
.
log
(
ret
,
'DEVICEID'
)
this
.
$store
.
commit
(
'app/SET_DEVICEID'
,
ret
)
this
.
hasPoolAddr
(
res
)
this
.
getInfo
()
})
})
// this.$store.commit('app/SET_ADDRESS', test.addr)
...
...
src/views/Home/PoolList.vue
View file @
5dd832ec
...
...
@@ -45,11 +45,10 @@ import MiningCard from '@/components/MiningCard.vue'
import
xPopup
from
'@/components/Popup.vue'
import
constant
from
'@/constance/Image'
import
Bus
from
'@/utils/bus'
import
{
invitePool
,
poolList
,
checkBind
,
getUserInfo
}
from
'@/service/pool'
import
{
invitePool
,
poolList
,
checkBind
}
from
'@/service/pool'
import
service
from
'@/service/chain33'
import
{
PullRefresh
,
Toast
,
Popup
}
from
'vant'
// import { getDeviceId, getCurrentBTYAddress } from '@/utils/bridge' // 币钱包环境
import
{
test
}
from
'@/utils/test'
// 本地测试
export
default
Vue
.
extend
({
components
:
{
...
...
@@ -80,17 +79,7 @@ export default Vue.extend({
},
},
methods
:
{
getInfo
()
{
getUserInfo
().
then
(
res
=>
{
const
type
=
res
.
data
.
data
.
type
+
''
const
status
=
res
.
data
.
data
.
status
+
''
if
(
type
===
'1'
||
type
===
'2'
)
{
this
.
$router
.
replace
({
path
:
'/noPage'
,
query
:
{
type
:
type
}})
}
else
if
(
status
===
'1'
)
{
this
.
$router
.
replace
({
path
:
'/noPage'
,
query
:
{
status
}})
}
})
},
getCoins
()
{
service
.
getBalance
(
this
.
$store
.
state
.
app
.
address
,
'coins'
).
then
((
res
:
any
)
=>
{
this
.
coins
=
Math
.
floor
(
res
.
data
.
result
[
0
].
balance
/
1
e8
)
...
...
@@ -218,11 +207,6 @@ export default Vue.extend({
},
mounted
()
{
setTimeout
(()
=>
{
// Toast.loading({
// forbidClick: true,
// duration: 0
// })
this
.
getInfo
()
this
.
getCoins
()
this
.
getList
()
this
.
setTimer
()
...
...
vue.config.js
View file @
5dd832ec
...
...
@@ -4,7 +4,7 @@
module
.
exports
=
{
// ...other vue-cli plugin options...
// 项目方地址
publicPath
:
'/vote'
,
//
publicPath: '/vote',
css
:
{
// loaderOptions: {
// less: {
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment