Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
Community-Mining-Admin
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-Admin
Commits
6e7bedec
Commit
6e7bedec
authored
Mar 18, 2022
by
Ted Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 新增白名单模块
parent
b60eff3e
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
482 additions
and
436 deletions
+482
-436
.prettierrc.js
.prettierrc.js
+8
-0
README.md
README.md
+10
-2
index.html
public/index.html
+2
-1
Breadcrumb.vue
src/components/Breadcrumb.vue
+0
-1
Nav.vue
src/layout/Nav.vue
+18
-20
index.ts
src/router/index.ts
+42
-10
request.ts
src/service/request.ts
+20
-4
element.ts
src/utils/element.ts
+2
-0
menu.ts
src/utils/menu.ts
+0
-314
Details.vue
src/views/whitelist/Details.vue
+153
-0
List.vue
src/views/whitelist/List.vue
+102
-84
Statistics.vue
src/views/whitelist/Statistics.vue
+125
-0
No files found.
.prettierrc.js
0 → 100644
View file @
6e7bedec
module
.
exports
=
{
trailingComma
:
'es5'
,
// 多行的 Object 和 Array 的最后一个元素末位加逗号
tabWidth
:
2
,
// 一个 tab 为 4 个空格
semi
:
false
,
// JS 语句的末位不加封号
singleQuote
:
false
,
// 字符串单引号优先
printWidth
:
80
,
// 一行代码超过 120 个字符时格式化为多行
endOfLine
:
'auto'
,
}
README.md
View file @
6e7bedec
...
...
@@ -31,4 +31,12 @@ See [Configuration Reference](https://cli.vuejs.org/config/).
node 版本 12.x (12.14.0)
### 原型
[
原型地址
](
https://modao.cc/app/de2dec5a3c3966cc036a1e236873dcbf56feab1a#screen=skqxgio647fto10
)
\ No newline at end of file
[
原型地址
](
https://modao.cc/app/de2dec5a3c3966cc036a1e236873dcbf56feab1a#screen=skqxgio647fto10
)
## 测试账户
社区节点账户 cs123456 123456
单独排除在外 admin123 admin123
admin111 admin111
\ No newline at end of file
public/index.html
View file @
6e7bedec
...
...
@@ -14,6 +14,7 @@
<div
id=
"app"
></div>
<!-- built files will be auto injected -->
<!-- <script>console.log('v1.1.0')</script> -->
<script>
console
.
log
(
'dev: 1.0.0'
)
</script>
<script>
console
.
log
(
'dev: 1.1.0'
)
</script>
<!-- <script>console.log('production: 1.0.0')</script> -->
</body>
</html>
src/components/Breadcrumb.vue
View file @
6e7bedec
...
...
@@ -8,7 +8,6 @@
<
script
lang=
"ts"
>
import
Vue
from
'vue'
import
menu
from
'@/utils/menu'
import
{
routes
}
from
'@/router/index'
;
export
default
Vue
.
extend
({
data
()
{
...
...
src/layout/Nav.vue
View file @
6e7bedec
...
...
@@ -6,12 +6,13 @@
text-color=
"#fff"
active-text-color=
"#409EFF"
router
:default-active=
"defaultActive"
>
:default-active=
"defaultActive"
>
<template
v-for=
"(items, index) in menu"
>
<el-submenu
:index=
"items.path"
v-if=
"items.children && items.path !== '/'"
:key=
"index"
>
<template
slot=
"title"
>
<i
:class=
"items.meta && items.meta.icon"
/>
<span
slot=
"title"
>
{{
items
.
meta
.
name
}}
</span>
<span
slot=
"title"
>
{{
items
.
meta
.
name
}}
</span>
</
template
>
<
template
v-for=
"item in items.children"
>
<el-submenu
v-if=
"item.children"
:index=
"item.path"
:key=
"item.path"
>
...
...
@@ -31,7 +32,7 @@
</el-submenu>
<el-menu-item
v-else
:index=
"items.path"
:key=
"index"
>
<i
:class=
"items.meta && items.meta.icon"
/>
<span
slot=
"title"
>
{{
items.meta.name
}}
</span>
<span
slot=
"title"
>
{{
items.meta.name
}}
</span>
</el-menu-item>
</template>
</el-menu>
...
...
@@ -40,7 +41,6 @@
<
script
lang=
"ts"
>
import
Vue
from
'vue'
import
menu
from
'@/utils/menu'
import
{
getStorage
}
from
'@/utils/storage'
import
{
routes
}
from
'@/router/index'
export
default
Vue
.
extend
({
...
...
@@ -48,11 +48,10 @@ export default Vue.extend({
return
{
menu
:
[]
as
any
,
defaultActive
:
'launch'
,
type
:
1
type
:
1
,
}
},
computed
:
{
},
computed
:
{},
methods
:
{
filter
(
type
:
number
,
routers
:
Array
<
any
>
):
any
{
for
(
let
i
=
0
;
i
<
routers
.
length
;
i
++
)
{
...
...
@@ -79,7 +78,7 @@ export default Vue.extend({
const
_route
=
JSON
.
parse
(
JSON
.
stringify
(
routes
)).
slice
(
0
,
routes
.
length
-
3
)
// console.log(JSON.stringify(_route), '-------------routes')
this
.
menu
=
[...
this
.
filter
(
type
,
_route
)]
}
}
,
},
created
()
{
this
.
init
()
...
...
@@ -91,14 +90,14 @@ export default Vue.extend({
</
script
>
<
style
lang=
"scss"
scoped
>
.menu
{
width
:
var
(
--
navWidth
);
height
:
calc
(
100vh
-
var
(
--
headerHeight
));
background
:
#333B54
;
flex-shrink
:
0
;
text-align
:
left
}
/
deep
/
.el-menu
{
border-right
:
none
;
}
</
style
>
\ No newline at end of file
.menu
{
width
:
var
(
--
navWidth
);
height
:
calc
(
100vh
-
var
(
--
headerHeight
));
background
:
#333b54
;
flex-shrink
:
0
;
text-align
:
left
;
}
/
deep
/
.el-menu
{
border-right
:
none
;
}
</
style
>
src/router/index.ts
View file @
6e7bedec
...
...
@@ -83,16 +83,6 @@ export const routes: Array<RouteConfig> = [
user
:
[
1
,
2
]
}
},
{
path
:
'/user/whiteList'
,
name
:
'whiteList'
,
component
:
()
=>
import
(
'@/views/user/WhiteList.vue'
),
meta
:
{
icon
:
''
,
name
:
'用户白名单'
,
user
:
[
1
,
2
]
}
},
]
},
{
...
...
@@ -195,6 +185,48 @@ export const routes: Array<RouteConfig> = [
]
},
{
path
:
'/whitelist'
,
name
:
'whitelist'
,
component
:
()
=>
import
(
'../layout/index.vue'
),
meta
:
{
name
:
'白名单'
,
icon
:
'el-icon-document-checked'
,
user
:
[
1
]
},
children
:
[
{
path
:
'/whitelist/list'
,
name
:
'list'
,
meta
:
{
name
:
'白名单列表'
,
icon
:
''
,
user
:
[
1
]
},
component
:
()
=>
import
(
'@/views/whitelist/List.vue'
),
},
{
path
:
'/whitelist/statistics'
,
name
:
'statistics'
,
meta
:
{
name
:
'白名单数据'
,
icon
:
''
,
user
:
[
1
]
},
component
:
()
=>
import
(
'@/views/whitelist/Statistics.vue'
),
},
{
path
:
'/whitelist/details'
,
name
:
'details'
,
meta
:
{
name
:
'白名单明细'
,
icon
:
''
,
user
:
[
1
]
},
component
:
()
=>
import
(
'@/views/whitelist/Details.vue'
),
},
]
},
{
path
:
'/login'
,
name
:
'Login'
,
component
:
()
=>
import
(
'@/views/Login.vue'
)
...
...
src/service/request.ts
View file @
6e7bedec
...
...
@@ -93,6 +93,22 @@ export const getPoolList = function(data: {page: number, pageSize: number, limit
return
service
.
get
(
'/admin/pool-list'
,
{
params
:
data
})
}
export
const
getWhiteDailyList
=
function
(
query
:
{
poolId
:
string
,
page
:
number
,
pageSize
:
number
,
start
?:
number
,
end
?:
number
})
{
return
service
.
get
(
'/admin/white-daily-list'
,
{
params
:
query
})
}
export
const
getTransList
=
function
(
query
:
{
page
:
number
,
pageSize
:
number
,
poolId
?:
string
,
addr
?:
string
,
start
?:
number
,
end
?:
number
,
type
?:
0
|
1
})
{
return
service
.
get
(
'/admin/trans-list'
,
{
params
:
query
})
}
/**
* 编辑
* @param data
...
...
@@ -195,7 +211,7 @@ export const getCaptainLists = function(data: {page: number, pageSize: number})
* @param data
* @returns
*/
export
const
addWhiteLists
=
function
(
data
:
{
addr
:
string
})
{
export
const
addWhiteLists
=
function
(
data
:
{
addr
:
string
;
poolId
:
number
})
{
return
service
.
post
(
'/admin/add-white'
,
data
)
}
/**
...
...
@@ -203,7 +219,7 @@ export const addWhiteLists = function(data: {addr: string}) {
* @param data
* @returns
*/
export
const
getWhiteLists
=
function
(
data
:
{
page
:
number
,
pageSize
:
number
})
{
export
const
getWhiteLists
=
function
(
data
:
{
id
:
number
,
page
:
number
,
pageSize
:
number
})
{
return
service
.
get
(
'/admin/white-list'
,
{
params
:
data
})
}
/**
...
...
@@ -211,7 +227,7 @@ export const getWhiteLists = function(data: {page: number, pageSize: number}) {
* @param data
* @returns
*/
export
const
addOtherLists
=
function
(
data
:
{
addr
:
string
,
except
:
string
})
{
export
const
addOtherLists
=
function
(
data
:
{
id
:
number
,
except
:
string
})
{
return
service
.
post
(
'/admin/add-except'
,
data
)
}
...
...
@@ -220,6 +236,6 @@ export const addOtherLists = function(data: {addr: string, except: string}) {
* @param data
* @returns
*/
export
const
delWhiteList
=
function
(
data
:
{
addr
:
string
})
{
export
const
delWhiteList
=
function
(
data
:
{
id
:
number
})
{
return
service
.
post
(
'/admin/del-white'
,
data
)
}
src/utils/element.ts
View file @
6e7bedec
...
...
@@ -29,6 +29,7 @@ import {
Loading
,
Message
,
MessageBox
,
DatePicker
,
}
from
'element-ui'
;
Vue
.
use
(
Avatar
);
...
...
@@ -57,6 +58,7 @@ Vue.use(BreadcrumbItem);
Vue
.
use
(
Form
);
Vue
.
use
(
FormItem
);
Vue
.
use
(
Icon
);
Vue
.
use
(
DatePicker
);
Vue
.
use
(
Loading
.
directive
);
...
...
src/utils/menu.ts
deleted
100644 → 0
View file @
b60eff3e
const
menu
=
{
root
:
[
{
id
:
'4'
,
pid
:
'0'
,
name
:
'设置'
,
path
:
'/setting'
,
icon
:
'el-icon-setting'
,
children
:
[
{
id
:
'4-1'
,
pid
:
'4'
,
name
:
'添加节点'
,
path
:
'/add'
,
icon
:
''
},
{
id
:
'4-1'
,
pid
:
'4'
,
name
:
'修改密码'
,
path
:
'/reset'
,
icon
:
''
}
]
}
],
admin
:
[
{
id
:
'1'
,
pid
:
'0'
,
path
:
'/home'
,
meta
:
{
icon
:
'el-icon-s-home'
,
name
:
'首页'
,
}
},
{
id
:
'2'
,
pid
:
'0'
,
path
:
'/guest'
,
meta
:
{
name
:
'用户管理'
,
icon
:
'el-icon-user'
,
},
children
:
[
{
id
:
'2-1'
,
pid
:
'2'
,
path
:
'/info'
,
meta
:
{
icon
:
''
,
name
:
'用户信息'
,
}
}
]
},
{
id
:
'3'
,
pid
:
'0'
,
path
:
'/manage'
,
meta
:
{
name
:
'票池管理'
,
icon
:
'el-icon-s-order'
,
},
children
:
[
{
id
:
'3-1'
,
pid
:
'3'
,
path
:
'/launch'
,
meta
:
{
name
:
'票池列表'
,
icon
:
''
,
},
},
{
id
:
'3-2'
,
pid
:
'3'
,
path
:
'/minTicket'
,
meta
:
{
name
:
'最小票数设置'
,
icon
:
''
,
},
}
]
},
{
id
:
'4'
,
pid
:
'0'
,
path
:
'/manage'
,
meta
:
{
name
:
'记录管理'
,
icon
:
'el-icon-s-order'
,
},
children
:
[
{
id
:
'4-1'
,
pid
:
'4'
,
path
:
'/trust'
,
meta
:
{
name
:
'委托记录'
,
icon
:
''
,
},
},
{
id
:
'4-2'
,
pid
:
'4'
,
path
:
'/invite'
,
meta
:
{
name
:
'绑定记录'
,
icon
:
''
,
},
}
]
},
{
id
:
'10'
,
pid
:
'0'
,
path
:
'/setting'
,
meta
:
{
name
:
'设置'
,
icon
:
'el-icon-setting'
,
},
children
:
[
{
id
:
'10-1'
,
pid
:
'10'
,
path
:
'/add'
,
meta
:
{
name
:
'添加节点'
,
icon
:
''
,
},
},
{
id
:
'10-1'
,
pid
:
'10'
,
path
:
'/reset'
,
meta
:
{
name
:
'修改密码'
,
icon
:
''
,
},
}
]
}
],
groupLeader
:
[
{
id
:
'1'
,
pid
:
'0'
,
path
:
'/home'
,
meta
:
{
icon
:
'el-icon-s-home'
,
name
:
'首页'
,
}
},
{
id
:
'2'
,
pid
:
'0'
,
path
:
'/guest'
,
meta
:
{
name
:
'用户管理'
,
icon
:
'el-icon-user'
,
},
children
:
[
{
id
:
'2-1'
,
pid
:
'2'
,
path
:
'/info'
,
meta
:
{
icon
:
''
,
name
:
'用户信息'
,
}
}
]
},
{
id
:
'3'
,
pid
:
'0'
,
path
:
'/manage'
,
meta
:
{
name
:
'票池管理'
,
icon
:
'el-icon-s-order'
,
},
children
:
[
{
id
:
'3-1'
,
pid
:
'3'
,
path
:
'/launch'
,
meta
:
{
name
:
'票池列表'
,
icon
:
''
,
},
},
]
},
{
id
:
'4'
,
pid
:
'0'
,
path
:
'/manage'
,
meta
:
{
name
:
'记录管理'
,
icon
:
'el-icon-s-order'
,
},
children
:
[
{
id
:
'4-1'
,
pid
:
'4'
,
path
:
'/trust'
,
meta
:
{
name
:
'委托记录'
,
icon
:
''
,
},
},
{
id
:
'4-2'
,
pid
:
'4'
,
path
:
'/invite'
,
meta
:
{
name
:
'绑定记录'
,
icon
:
''
,
},
}
]
},
{
id
:
'10'
,
pid
:
'0'
,
path
:
'/setting'
,
meta
:
{
name
:
'设置'
,
icon
:
''
,
},
children
:
[
{
id
:
'10-1'
,
pid
:
'10'
,
path
:
'/reset'
,
meta
:
{
name
:
'修改密码'
,
icon
:
''
,
},
}
]
}
],
// groupLeader: [
// {
// name: '首页',
// path: '/home',
// icon: ''
// },
// {
// name: '用户管理',
// path: '/guest',
// icon: '',
// children: [
// {
// name: '用户信息',
// path: '/info',
// icon: ''
// }
// ]
// },
// {
// name: '票池管理',
// path: '/manage',
// icon: '',
// children: [
// {
// name: '票池列表',
// path: '/launch',
// icon: ''
// }
// ]
// },
// {
// id: '4',
// pid: '0',
// name: '记录管理',
// path: '/logs',
// icon: '',
// children: [
// {
// id: '4-1',
// pid: '4',
// name: '委托记录',
// path: '/trust',
// icon: ''
// },
// {
// id: '4-2',
// pid: '4',
// name: '绑定记录',
// path: '/invite',
// icon: ''
// }
// ]
// },
// {
// name: '设置',
// path: '/setting',
// icon: '',
// children: [
// {
// name: '修改密码',
// path: '/reset',
// icon: ''
// }
// ]
// },
// ]
}
export
default
menu
\ No newline at end of file
src/views/whitelist/Details.vue
0 → 100644
View file @
6e7bedec
<
template
>
<div
class=
"white-list"
>
<div
class=
"search-bar"
>
<!-- 选择票池 -->
<el-select
v-model=
"currPoolIndex"
:loading=
"loading"
placeholder=
"选择票池"
style=
"margin-right: 15px"
>
<el-option
v-for=
"(item, index) in poolList"
:key=
"item.id"
:label=
"item.name"
:value=
"index"
>
</el-option>
</el-select>
<!-- 选择明细用户类型 -->
<el-select
v-model=
"addressType"
:disabled=
"loading"
style=
"margin-right: 15px"
>
<el-option
label=
"普通地址"
:value=
"0"
></el-option>
<el-option
label=
"白名单地址"
:value=
"1"
></el-option>
</el-select>
<!-- 日期 -->
<el-date-picker
v-model=
"datePick"
type=
"daterange"
range-separator=
"至"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
value-format=
"timestamp"
:disabled=
"loading"
style=
"margin-right: 15px"
>
</el-date-picker>
<!-- 地址 -->
<el-input
placeholder=
"地址"
v-model=
"address"
style=
"width: 220px"
></el-input>
<div
style=
"flex: 1"
></div>
<el-button
type=
"primary"
@
click=
"requestWhiteDailyList"
>
搜索
</el-button>
</div>
<p
v-if=
"transListData"
style=
"margin-bottom: 10px"
>
<span
style=
"padding-right: 10px"
>
累积委托票数:
{{
transListData
.
totalEntrustTicket
}}
</span>
<span
style=
"padding-right: 10px"
>
累积有效票数:
{{
transListData
.
totalPopTicket
}}
</span>
<span>
累积空投数量:
{{
transListData
.
totalAirAmount
}}
</span>
</p>
<el-table
:data=
"list"
:empty-text=
"loading ? '正在加载...' : '暂无数据'"
border
style=
"width: 100%"
>
<el-table-column
prop=
"addr"
label=
"用户地址"
>
</el-table-column>
<el-table-column
prop=
"inviteAddr"
label=
"推荐人地址"
>
</el-table-column>
<el-table-column
prop=
"tickets"
label=
"委托票数"
>
</el-table-column>
<el-table-column
prop=
"amount"
label=
"空投数量"
>
</el-table-column>
<el-table-column
prop=
"jobTime"
label=
"空投日期"
>
</el-table-column>
<el-table-column
prop=
"popTicket"
label=
"空投有效票数"
>
</el-table-column>
</el-table>
<Pagination
:total=
"total"
:page=
"page"
:pageSize=
"pageSize"
@
pagination=
"getPage"
/>
</div>
</
template
>
<
script
lang=
"ts"
>
import
Vue
from
'vue'
import
dayjs
from
'dayjs'
import
Pagination
from
'@/components/Panigation.vue'
import
{
getPoolList
,
getTransList
}
from
'@/service/request'
export
default
Vue
.
extend
({
components
:
{
Pagination
,
},
data
()
{
return
{
/* 矿池列表 */
poolList
:
[]
as
any
,
/** 当前选中的矿池 */
currPoolIndex
:
null
as
number
|
null
,
/** 白名单列表 */
list
:
[]
as
any
,
/** 0: 普通地址; 1: 白名单地址 */
addressType
:
undefined
as
0
|
1
|
undefined
,
loading
:
true
,
page
:
1
,
pageSize
:
10
,
total
:
0
,
datePick
:
[
undefined
,
undefined
]
as
[
number
|
undefined
,
number
|
undefined
],
address
:
''
,
transListData
:
null
as
{
totalAirAmount
:
number
totalEntrustTicket
:
string
totalPopTicket
:
string
}
|
null
,
}
},
created
()
{
this
.
requestPoolList
()
this
.
requestWhiteDailyList
()
},
methods
:
{
getPage
(
v
:
{
page
:
number
;
pageSize
:
number
})
{
this
.
page
=
v
.
page
this
.
pageSize
=
v
.
pageSize
this
.
requestWhiteDailyList
()
},
/** 获取票池列表 */
requestPoolList
()
{
getPoolList
({
page
:
1
,
pageSize
:
5
,
limit
:
5
,
})
.
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
list
.
length
)
{
this
.
poolList
=
res
.
data
.
list
}
})
.
catch
(()
=>
this
.
$message
({
type
:
'error'
,
message
:
'获取票池列表失败'
}))
.
finally
(()
=>
(
this
.
loading
=
false
))
},
/** 获取 (票池对应的) 白名单列表 */
async
requestWhiteDailyList
()
{
this
.
loading
=
true
this
.
list
=
[]
try
{
const
payload
=
{
page
:
this
.
page
,
pageSize
:
this
.
pageSize
,
}
as
Parameters
<
typeof
getTransList
>
[
0
]
this
.
currPoolIndex
!==
null
&&
(
payload
.
poolId
=
this
.
poolList
[
this
.
currPoolIndex
].
id
)
this
.
addressType
!==
undefined
&&
(
payload
.
type
=
this
.
addressType
)
if
(
this
.
datePick
[
0
]
&&
this
.
datePick
[
1
])
{
payload
.
start
=
dayjs
(
this
.
datePick
[
0
]).
unix
()
payload
.
end
=
dayjs
(
this
.
datePick
[
1
]).
unix
()
}
this
.
address
&&
(
payload
.
addr
=
this
.
address
)
const
result
=
await
getTransList
(
payload
)
this
.
list
=
result
.
data
.
tx
this
.
transListData
=
result
.
data
.
data
this
.
total
=
parseInt
(
result
.
data
.
count
)
}
catch
{
this
.
$message
({
type
:
'error'
,
message
:
'获取白名单数据失败'
})
}
finally
{
this
.
loading
=
false
}
},
},
})
</
script
>
<
style
lang=
"scss"
scoped
>
.white-list
{
.search-bar
{
margin-bottom
:
20px
;
display
:
flex
;
align-items
:
center
;
}
}
</
style
>
src/views/
user/White
List.vue
→
src/views/
whitelist/
List.vue
View file @
6e7bedec
<
template
>
<div
class=
"white-list"
>
<div
class=
"search-bar"
>
<el-select
v-model=
"currPoolIndex"
:disabled=
"loading"
>
<el-option
v-for=
"(item, index) in poolList"
:key=
"item.id"
:label=
"item.name"
:value=
"index"
>
</el-option>
</el-select>
<el-button
type=
"primary"
@
click=
"init"
>
添加白名单
</el-button>
</div>
<el-table
:data=
"list"
border
style=
"width: 100%"
>
<el-table-column
prop=
"addr"
label=
"用户地址"
>
</el-table-column>
<el-table-column
width=
"300"
prop=
"except"
label=
"例外地址"
>
<el-table
:data=
"list"
:empty-text=
"loading ? '正在加载...' : '暂无数据'"
border
style=
"width: 100%"
>
<el-table-column
prop=
"addr"
label=
"用户地址"
>
</el-table-column>
<el-table-column
prop=
"except"
label=
"例外地址"
>
<template
slot-scope=
"scope"
>
<div
style=
"word-break: break-word;"
>
{{
scope
.
row
.
excepts
&&
scope
.
row
.
excepts
.
replace
(
/
\,
/g
,
',
\
n'
)
}}
</div>
<div
style=
"word-break: break-word;"
>
{{
scope
.
row
.
excepts
&&
scope
.
row
.
excepts
.
replace
(
/
\,
/g
,
',
\
n'
)
}}
</div>
</
template
>
</el-table-column>
<el-table-column
prop=
"inviter"
label=
"推荐人数"
>
</el-table-column>
<el-table-column
prop=
"tickets"
label=
"线下总票数"
>
</el-table-column>
<el-table-column
prop=
"percent"
label=
"票数占比"
>
</el-table-column>
<el-table-column
width=
"90"
label=
"操作"
>
<el-table-column
width=
"200px"
label=
"操作"
>
<
template
slot-scope=
"scope"
>
<el-button
@
click=
"initOther(scope.row)"
type=
"text"
size=
"small"
>
操作
</el-button>
<el-button
@
click=
"handleRemove(scope.row)"
type=
"text"
size=
"small"
>
删除
</el-button>
...
...
@@ -69,80 +49,73 @@
<
script
lang=
"ts"
>
import
Vue
from
'vue'
import
Pagination
from
'@/components/Panigation.vue'
import
{
addOtherLists
,
addWhiteLists
,
delWhiteList
,
getWhiteLists
}
from
'@/service/request'
import
{
addOtherLists
,
addWhiteLists
,
delWhiteList
,
get
PoolList
,
get
WhiteLists
}
from
'@/service/request'
const
baseForm
=
():
{
addr
:
string
}
=>
{
const
baseForm
=
():
{
addr
:
string
}
=>
{
return
{
addr
:
''
,
}
}
const
_form
=
():
{
addr
:
string
,
except
:
string
}
=>
{
const
_form
=
():
{
except
:
string
}
=>
{
return
{
addr
:
''
,
except
:
''
,
}
}
export
default
Vue
.
extend
({
components
:
{
Pagination
Pagination
,
},
data
()
{
return
{
list
:
[]
as
any
,
/* 存放所有存在的矿池 id */
poolList
:
[]
as
any
,
/** 当前选中的矿池 id */
currPoolIndex
:
null
as
number
|
null
,
loading
:
true
,
page
:
1
,
pageSize
:
10
,
total
:
0
,
dialogVisible
:
false
,
dialogOtherVisible
:
false
,
form
:
baseForm
(),
otherForm
:
_form
(),
otherForm
:
_form
()
as
any
,
rule
:
{
addr
:
[
{
required
:
true
,
message
:
'请输入用户地址'
,
trigger
:
'blur'
},
],
addr
:
[{
required
:
true
,
message
:
'请输入用户地址'
,
trigger
:
'blur'
}],
},
otherRule
:
{
except
:
[
{
required
:
true
,
message
:
'请输入例外地址'
,
trigger
:
'blur'
},
],
except
:
[{
required
:
true
,
message
:
'请输入例外地址'
,
trigger
:
'blur'
}],
},
}
},
created
()
{
this
.
get
List
()
this
.
requestPool
List
()
},
methods
:
{
init
()
{
this
.
dialogVisible
=
true
this
.
form
=
baseForm
()
},
initOther
(
item
:
{
addr
:
string
})
{
initOther
(
item
:
{
id
:
string
})
{
this
.
dialogOtherVisible
=
true
this
.
otherForm
=
{
...
_form
(),
addr
:
item
.
addr
}
this
.
otherForm
=
{
...
_form
(),
id
:
item
.
id
}
},
getPage
(
v
:
{
page
:
number
,
pageSize
:
number
})
{
getPage
(
v
:
{
page
:
number
;
pageSize
:
number
})
{
this
.
page
=
v
.
page
this
.
pageSize
=
v
.
pageSize
this
.
getList
()
},
getList
()
{
getWhiteLists
({
page
:
this
.
page
,
pageSize
:
this
.
pageSize
}).
then
(
res
=>
{
this
.
list
=
res
.
data
.
list
})
this
.
requestPoolList
()
},
submitClick
(
formName
:
string
)
{
(
this
.
$refs
[
formName
]
as
any
).
validate
((
valid
:
any
)
=>
{
if
(
this
.
currPoolIndex
===
null
)
return
if
(
valid
)
{
addWhiteLists
(
this
.
form
).
then
(
res
=>
{
addWhiteLists
(
{
...
this
.
form
,
poolId
:
this
.
poolList
[
this
.
currPoolIndex
].
id
}
).
then
(
res
=>
{
if
(
res
.
data
?.
isSucc
)
{
this
.
$message
.
success
(
'新增成功'
)
this
.
dialogVisible
=
false
this
.
get
List
()
this
.
requestWhite
List
()
}
})
}
else
{
...
...
@@ -152,12 +125,13 @@ export default Vue.extend({
},
handleAddOther
(
formName
:
string
)
{
(
this
.
$refs
[
formName
]
as
any
).
validate
((
valid
:
any
)
=>
{
if
(
this
.
currPoolIndex
===
null
)
return
if
(
valid
)
{
addOtherLists
(
this
.
otherForm
).
then
(
res
=>
{
addOtherLists
(
{
...
this
.
otherForm
}
).
then
(
res
=>
{
if
(
res
.
data
?.
isSucc
)
{
this
.
$message
.
success
(
'新增例外地址成功'
)
this
.
dialogOtherVisible
=
false
this
.
get
List
()
this
.
requestWhite
List
()
}
})
}
else
{
...
...
@@ -165,39 +139,84 @@ export default Vue.extend({
}
})
},
handleRemove
(
item
:
{
addr
:
string
})
{
handleRemove
(
item
:
{
id
:
number
})
{
this
.
$confirm
(
'此操作将删除该条白名单, 是否继续?'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
}).
then
(()
=>
{
delWhiteList
({
addr
:
item
.
addr
}).
then
(
res
=>
{
if
(
res
.
data
?.
isSucc
)
{
this
.
$message
({
type
:
'success'
,
message
:
'删除成功!'
});
this
.
getList
()
}
type
:
'warning'
,
})
.
then
(()
=>
{
if
(
this
.
currPoolIndex
===
null
)
return
delWhiteList
({
id
:
item
.
id
}).
then
(
res
=>
{
if
(
res
.
data
?.
isSucc
)
{
this
.
$message
({
type
:
'success'
,
message
:
'删除成功!'
,
})
this
.
requestWhiteList
()
}
})
})
.
catch
(()
=>
{
this
.
$message
({
type
:
'info'
,
message
:
'已取消删除'
,
})
})
},
/** 获取票池列表 */
requestPoolList
()
{
getPoolList
({
page
:
1
,
pageSize
:
5
,
limit
:
5
,
}).
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
list
.
length
)
{
this
.
poolList
=
res
.
data
.
list
this
.
currPoolIndex
=
0
}
})
},
/** 获取 (票池对应的) 白名单列表 */
async
requestWhiteList
()
{
if
(
this
.
currPoolIndex
===
null
)
return
this
.
loading
=
true
this
.
list
=
[]
try
{
const
result
=
await
getWhiteLists
({
page
:
this
.
page
,
pageSize
:
this
.
pageSize
,
id
:
this
.
poolList
[
this
.
currPoolIndex
].
id
,
})
}).
catch
(()
=>
{
this
.
list
=
result
.
data
.
list
}
catch
{
this
.
$message
({
type
:
'info'
,
message
:
'已取消删除'
});
});
}
}
type
:
'error'
,
message
:
'获取白名单失败'
,
})
}
finally
{
this
.
loading
=
false
}
},
},
watch
:
{
async
currPoolIndex
()
{
this
.
requestWhiteList
()
},
},
})
</
script
>
<
style
lang=
"scss"
scoped
>
.white-list
{
.search-bar
{
margin-bottom
:
20px
;
display
:
flex
;
align-items
:
center
;
justify-content
:
flex-end
;
}
.white-list
{
.search-bar
{
margin-bottom
:
20px
;
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
}
</
style
>
\ No newline at end of file
}
</
style
>
src/views/whitelist/Statistics.vue
0 → 100644
View file @
6e7bedec
<
template
>
<div
class=
"white-list"
>
<div
class=
"search-bar"
>
<el-select
v-model=
"currPoolIndex"
:disabled=
"loading"
style=
"margin-right: 15px"
>
<el-option
v-for=
"(item, index) in poolList"
:key=
"item.id"
:label=
"item.name"
:value=
"index"
>
</el-option>
</el-select>
<el-date-picker
v-model=
"datePick"
type=
"daterange"
range-separator=
"至"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
value-format=
"timestamp"
:disabled=
"loading"
>
</el-date-picker>
</div>
<el-table
:data=
"list"
:empty-text=
"loading ? '正在加载...' : '暂无数据'"
border
style=
"width: 100%"
>
<el-table-column
prop=
"addr"
label=
"用户地址"
>
</el-table-column>
<el-table-column
prop=
"inviter"
label=
"推荐人数"
>
</el-table-column>
<el-table-column
prop=
"tickets"
label=
"累积总票数"
>
</el-table-column>
<el-table-column
prop=
"totalAirAmount"
label=
"累积空投"
>
</el-table-column>
<el-table-column
prop=
"totalPopTicket"
label=
"推广有效票数"
>
</el-table-column>
</el-table>
<Pagination
:total=
"total"
:page=
"page"
:pageSize=
"pageSize"
@
pagination=
"getPage"
/>
</div>
</
template
>
<
script
lang=
"ts"
>
import
Vue
from
'vue'
import
dayjs
from
'dayjs'
import
Pagination
from
'@/components/Panigation.vue'
import
{
getPoolList
,
getWhiteDailyList
}
from
'@/service/request'
export
default
Vue
.
extend
({
components
:
{
Pagination
,
},
data
()
{
return
{
/* 矿池列表 */
poolList
:
[]
as
any
,
/** 当前选中的矿池 */
currPoolIndex
:
null
as
number
|
null
,
/** 白名单列表 */
list
:
[]
as
any
,
loading
:
true
,
page
:
1
,
pageSize
:
10
,
total
:
0
,
datePick
:
[
undefined
,
undefined
]
as
[
number
|
undefined
,
number
|
undefined
],
}
},
created
()
{
this
.
requestPoolList
()
},
methods
:
{
getPage
(
v
:
{
page
:
number
;
pageSize
:
number
})
{
this
.
page
=
v
.
page
this
.
pageSize
=
v
.
pageSize
this
.
requestWhiteDailyList
()
},
/** 获取票池列表 */
requestPoolList
()
{
getPoolList
({
page
:
1
,
pageSize
:
5
,
limit
:
5
,
})
.
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
list
.
length
)
{
this
.
poolList
=
res
.
data
.
list
this
.
currPoolIndex
=
0
}
})
.
catch
(()
=>
this
.
$message
({
type
:
'error'
,
message
:
'获取票池列表失败'
}))
},
/** 获取 (票池对应的) 白名单列表 */
async
requestWhiteDailyList
()
{
if
(
this
.
currPoolIndex
===
null
)
return
this
.
loading
=
true
this
.
list
=
[]
try
{
const
payload
=
{
page
:
this
.
page
,
pageSize
:
this
.
pageSize
,
poolId
:
this
.
poolList
[
this
.
currPoolIndex
].
id
,
}
as
any
if
(
this
.
datePick
[
0
]
&&
this
.
datePick
[
1
])
{
payload
.
startTime
=
dayjs
(
this
.
datePick
[
0
]).
format
(
'YYYY-MM-DD'
)
payload
.
endTime
=
dayjs
(
this
.
datePick
[
1
]).
format
(
'YYYY-MM-DD'
)
}
const
result
=
await
getWhiteDailyList
(
payload
)
this
.
list
=
result
.
data
.
list
this
.
total
=
parseInt
(
result
.
data
.
count
)
}
catch
{
this
.
$message
({
type
:
'error'
,
message
:
'获取白名单数据失败'
})
}
finally
{
this
.
loading
=
false
}
},
},
watch
:
{
currPoolIndex
:
'requestWhiteDailyList'
,
datePick
:
'requestWhiteDailyList'
,
},
})
</
script
>
<
style
lang=
"scss"
scoped
>
.white-list
{
.search-bar
{
margin-bottom
:
20px
;
display
:
flex
;
align-items
:
center
;
}
}
</
style
>
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