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
29a9151e
Commit
29a9151e
authored
Dec 21, 2021
by
xhx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:代码调整
parent
8094ca79
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
110 additions
and
123 deletions
+110
-123
.env.development
.env.development
+2
-2
.env.test
.env.test
+3
-3
.eslintrc.js
.eslintrc.js
+3
-1
index.html
public/index.html
+1
-1
Password.vue
src/components/Password.vue
+21
-8
index.ts
src/router/index.ts
+9
-9
http.ts
src/service/http.ts
+3
-29
request.ts
src/service/request.ts
+2
-15
AdminInfo.ts
src/type/AdminInfo.ts
+7
-0
Info.ts
src/type/Info.ts
+9
-0
PoolInfo.ts
src/type/PoolInfo.ts
+14
-0
index.ts
src/type/index.ts
+4
-0
Home.vue
src/views/Home.vue
+5
-20
Login.vue
src/views/Login.vue
+5
-10
Add.vue
src/views/setting/Add.vue
+6
-8
Reset.vue
src/views/setting/Reset.vue
+16
-17
No files found.
.env.development
View file @
29a9151e
NODE_ENV="development"
VUE_APP_URL="http://172.16.100.59:8090"
\ No newline at end of file
VUE_APP_URL="http://172.16.100.59:8092"
\ No newline at end of file
.env.test
View file @
29a9151e
NODE_ENV
=
'development'
VUE_APP_URL
=
"http://172.16.100.59:8090"
#VUE_APP_URL="http://172.16.100.59:8092"
\ No newline at end of file
#VUE_APP_URL="http://172.16.100.59:8090"
VUE_APP_URL
=
"http://172.16.100.59:8092"
\ No newline at end of file
.eslintrc.js
View file @
29a9151e
...
...
@@ -14,6 +14,8 @@ module.exports = {
rules
:
{
'no-console'
:
process
.
env
.
NODE_ENV
===
'production'
?
'warn'
:
'off'
,
'no-debugger'
:
process
.
env
.
NODE_ENV
===
'production'
?
'warn'
:
'off'
,
"@typescript-eslint/no-explicit-any"
:
0
"@typescript-eslint/no-explicit-any"
:
0
,
"vue/no-unused-components"
:
"off"
,
"@typescript-eslint/explicit-module-boundary-types"
:
"off"
}
}
public/index.html
View file @
29a9151e
...
...
@@ -3,7 +3,7 @@
<head>
<meta
charset=
"utf-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<meta
name=
"viewport"
content=
"
width=device-width,initial-scale=1.0
"
>
<meta
name=
"viewport"
content=
"
user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width
"
>
<link
rel=
"icon"
href=
"<%= BASE_URL %>favicon.ico"
>
<title><
%=
htmlWebpackPlugin
.
options
.
title
%
></title>
</head>
...
...
src/components/P
wInput
.vue
→
src/components/P
assword
.vue
View file @
29a9151e
<
template
>
<div>
<el-input
type=
"input"
v-if=
"show"
v-model=
"pw
"
>
<i
slot=
"suffix"
class=
"el-input__icon el-icon-view"
@
click=
"
show = !s
how"
></i>
<el-input
type=
"input"
v-if=
"show"
:value=
"value"
@
input=
"handleChange
"
>
<i
slot=
"suffix"
class=
"el-input__icon el-icon-view"
@
click=
"
handleS
how"
></i>
</el-input>
<el-input
type=
"password"
v-if=
"!show"
v-model=
"pw
"
>
<i
slot=
"suffix"
class=
"el-input__icon el-icon-view"
@
click=
"
show = !s
how"
></i>
<el-input
type=
"password"
v-if=
"!show"
:value=
"value"
@
input=
"handleChange
"
>
<i
slot=
"suffix"
class=
"el-input__icon el-icon-view"
@
click=
"
handleS
how"
></i>
</el-input>
</div>
</
template
>
...
...
@@ -12,15 +12,28 @@
<
script
lang=
"ts"
>
import
Vue
from
'vue'
export
default
Vue
.
extend
({
data
()
{
return
{
show
:
true
computed
:
{
value
():
string
{
return
this
.
password
}
},
props
:
{
p
w
:
{
p
assword
:
{
type
:
String
,
default
:
''
},
show
:
{
type
:
Boolean
,
default
:
true
}
},
methods
:
{
handleChange
(
value
:
string
)
{
const
_value
=
value
this
.
$emit
(
'update:password'
,
_value
)
},
handleShow
()
{
this
.
$emit
(
'update:show'
,
!
this
.
show
)
}
}
})
...
...
src/router/index.ts
View file @
29a9151e
...
...
@@ -18,27 +18,27 @@ const routes: Array<RouteConfig> = [
{
path
:
'/info'
,
name
:
'info'
,
component
:
()
=>
import
(
'@/views/
u
ser/Info.vue'
)
component
:
()
=>
import
(
'@/views/
U
ser/Info.vue'
)
},
{
path
:
'/launch'
,
name
:
'launch'
,
component
:
()
=>
import
(
'@/views/
m
ining/Launch.vue'
)
component
:
()
=>
import
(
'@/views/
M
ining/Launch.vue'
)
},
{
path
:
'/minTicket'
,
name
:
'minTicket'
,
component
:
()
=>
import
(
'@/views/
m
ining/MinTicket.vue'
)
component
:
()
=>
import
(
'@/views/
M
ining/MinTicket.vue'
)
},
{
path
:
'/add'
,
name
:
'add'
,
component
:
()
=>
import
(
'@/views/
s
etting/Add.vue'
)
component
:
()
=>
import
(
'@/views/
S
etting/Add.vue'
)
},
{
path
:
'/reset'
,
name
:
'reset'
,
component
:
()
=>
import
(
'@/views/
s
etting/Reset.vue'
)
component
:
()
=>
import
(
'@/views/
S
etting/Reset.vue'
)
},
]
...
...
@@ -53,10 +53,10 @@ const routes: Array<RouteConfig> = [
name
:
'404'
,
component
:
()
=>
import
(
'@/views/404.vue'
)
},
//
{
//
path: '*',
//
redirect: '/404'
//
}
{
path
:
'*'
,
redirect
:
'/404'
}
]
const
router
=
new
VueRouter
({
...
...
src/service/http.ts
View file @
29a9151e
...
...
@@ -4,35 +4,8 @@ import { ElLoadingComponent } from 'element-ui/types/loading'
import
{
getStorage
,
saveStorage
}
from
'@/utils/storage'
import
router
from
'@/router'
let
loading
:
ElLoadingComponent
function
startLoading
()
{
loading
=
Loading
.
service
({
target
:
'.content-r'
})
}
function
endLoading
()
{
loading
.
close
()
}
let
needLoadingRequestCount
=
0
export
function
showFullScreenLoading
()
{
if
(
needLoadingRequestCount
===
0
)
{
startLoading
()
}
needLoadingRequestCount
++
}
export
function
tryHideFullScreenLoading
()
{
if
(
needLoadingRequestCount
<=
0
)
return
needLoadingRequestCount
--
if
(
needLoadingRequestCount
===
0
)
{
endLoading
()
}
}
const
service
=
axios
.
create
({
baseURL
:
'/api'
,
...
...
@@ -65,8 +38,9 @@ service.interceptors.response.use(
return
res
},
error
=>
{
// Do something with response error
// console.log(error.response)
if
(
error
.
response
.
data
?.
reason
===
'TOKEN'
)
{
console
.
log
(
error
.
response
)
const
REASON
=
error
.
response
.
data
?.
reason
if
(
REASON
===
'TOKEN'
)
{
router
.
push
(
'/login'
)
Message
({
message
:
'登录已过期'
,
...
...
src/service/request.ts
View file @
29a9151e
import
service
from
"./http"
;
interface
poolInfo
{
name
:
string
;
desc
:
string
;
minerAddr
:
string
;
advantage
:
string
;
reason
:
string
;
friendlyName
:
string
;
minTicket
:
number
;
deposit
:
string
;
selfAddr
:
string
;
days
:
string
;
creator
?:
string
}
import
{
poolInfo
,
adminInfo
}
from
"@/type/index"
;
/**
* 登录
...
...
@@ -48,7 +35,7 @@ export const getStatistic = function() {
* @param data
* @returns
*/
export
const
addAdmin
=
function
(
data
:
{
name
:
string
,
addr
:
string
,
pwd
:
string
,
type
:
number
}
)
{
export
const
addAdmin
=
function
(
data
:
adminInfo
)
{
return
service
.
post
(
'/admin/add-admin'
,
data
)
}
...
...
src/type/AdminInfo.ts
0 → 100644
View file @
29a9151e
export
interface
adminInfo
{
name
:
string
;
addr
:
string
;
pwd
:
string
;
type
:
number
;
}
\ No newline at end of file
src/type/Info.ts
0 → 100644
View file @
29a9151e
export
interface
Info
{
captainPoolNum
:
number
;
officalAmount
:
number
;
totalPoolTicket
:
number
;
miningPerson
:
number
;
totalPopAmount
:
number
;
todayPoPAmount
:
number
}
\ No newline at end of file
src/type/PoolInfo.ts
0 → 100644
View file @
29a9151e
export
interface
poolInfo
{
name
:
string
;
desc
:
string
;
minerAddr
:
string
;
advantage
:
string
;
reason
:
string
;
friendlyName
:
string
;
minTicket
:
number
;
deposit
:
string
;
selfAddr
:
string
;
days
:
string
;
creator
?:
string
}
\ No newline at end of file
src/type/index.ts
0 → 100644
View file @
29a9151e
export
{
Info
}
from
'./Info'
export
{
poolInfo
}
from
'./PoolInfo'
export
{
adminInfo
}
from
'./AdminInfo'
\ No newline at end of file
src/views/Home.vue
View file @
29a9151e
...
...
@@ -33,34 +33,19 @@
</
template
>
<
script
lang=
"ts"
>
// import { Component, Vue } from 'vue-property-decorator';
// @Component({
// components: {
// },
// })
// export default class Home extends Vue {}
import
Vue
from
'vue'
import
{
getStatistic
}
from
'@/service/request'
import
{
Info
}
from
'@/type/Info'
;
export
default
Vue
.
extend
({
data
()
{
return
{
info
:
{}
}
},
methods
:
{
getInfo
()
{
// ...
getStatistic
().
then
(
res
=>
{
this
.
info
=
res
.
data
console
.
log
(
this
.
info
)
})
console
.
log
(
111
)
info
:
{}
as
Info
}
},
created
()
{
this
.
getInfo
()
getStatistic
().
then
(
res
=>
{
this
.
info
=
res
.
data
})
}
})
</
script
>
...
...
src/views/Login.vue
View file @
29a9151e
...
...
@@ -7,14 +7,8 @@
<el-input
v-model=
"form.name"
></el-input>
</el-form-item>
<el-form-item
label=
"密码"
prop=
"password"
>
<el-input
type=
"password"
v-model=
"form.password"
show-password
autocomplete=
"off"
></el-input>
<!--
<el-input
v-show=
"!show"
v-model=
"form.password"
type=
"password"
>
<i
slot=
"suffix"
class=
"el-input__icon el-icon-view"
@
click=
"show = !show"
></i>
</el-input>
<el-input
v-show=
"show"
v-model=
"form.password"
>
<i
slot=
"suffix"
class=
"el-input__icon el-icon-view"
@
click=
"show = !show"
></i>
</el-input>
-->
<!--
<PwInput
:pw
.
sync=
"form.password"
/>
-->
<!--
<el-input
type=
"password"
v-model=
"form.password"
show-password
autocomplete=
"off"
></el-input>
-->
<Password
:password
.
sync=
"form.password"
:show
.
sync=
"show"
/>
</el-form-item>
</el-form>
<el-button
class=
"w-full"
type=
"primary"
@
keypress
.
enter=
"login"
:disabled=
"isLogin"
@
click=
"login"
>
登 录
</el-button>
...
...
@@ -26,12 +20,14 @@
import
Vue
from
'vue'
import
{
saveStorage
}
from
'@/utils/storage'
import
{
info
,
login
}
from
'@/service/request'
import
Password
from
'@/components/Password.vue'
export
default
Vue
.
extend
({
components
:
{
Password
},
data
()
{
return
{
show
:
tru
e
,
show
:
fals
e
,
form
:
{
name
:
''
,
password
:
''
...
...
@@ -58,7 +54,6 @@ export default Vue.extend({
login
(
this
.
form
).
then
((
res
:
any
)
=>
{
if
(
res
.
data
.
isSucc
)
{
info
().
then
((
res
:
any
)
=>
{
// window.localStorage.setItem('user', JSON.stringify(res.data))
saveStorage
(
'user'
,
res
.
data
)
saveStorage
(
'type'
,
res
.
data
.
type
)
this
.
$router
.
push
(
'/home'
)
...
...
src/views/setting/Add.vue
View file @
29a9151e
...
...
@@ -58,13 +58,13 @@
<el-input
v-model=
"form.name"
></el-input>
</el-form-item>
<el-form-item
label=
"节点登录密码"
prop=
"pwd"
>
<el-input
v-show=
"!show"
v-model=
"form.pwd"
type=
"password"
>
<
!-- <
el-input v-show="!show" v-model="form.pwd" type="password">
<i slot="suffix" class="el-input__icon el-icon-view" @click="show = !show"></i>
</el-input>
<el-input v-show="show" v-model="form.pwd">
<i slot="suffix" class="el-input__icon el-icon-view" @click="show = !show"></i>
</el-input>
<
!-- <el-input v-model="form.pwd" show-password></el-input> --
>
</el-input>
-->
<
Password
:password
.
sync=
"form.pwd"
:show
.
sync=
"show"
/
>
</el-form-item>
<el-form-item
label=
"节点身份地址"
prop=
"addr"
>
<el-input
v-model=
"form.addr"
></el-input>
...
...
@@ -94,9 +94,11 @@ import Vue from 'vue'
import
Pagination
from
'@/components/Panigation.vue'
import
{
addAdmin
,
getAdminLists
,
delAdmin
}
from
'@/service/request'
import
{
getDateTime
}
from
'@/utils/utils'
import
Password
from
'@/components/Password.vue'
export
default
Vue
.
extend
({
components
:
{
Pagination
Pagination
,
Password
,
},
data
()
{
return
{
...
...
@@ -163,7 +165,6 @@ export default Vue.extend({
(
this
.
$refs
[
formName
]
as
any
).
validate
((
valid
:
any
)
=>
{
if
(
valid
)
{
addAdmin
(
this
.
form
).
then
((
res
:
any
)
=>
{
// if (res.code === 200) {
if
(
res
.
data
?.
isSucc
)
{
this
.
$message
.
success
(
'添加成功'
)
this
.
getList
()
...
...
@@ -180,9 +181,6 @@ export default Vue.extend({
this
.
pageSize
=
v
.
pageSize
this
.
getList
()
},
// statusClick(item: any) {
// // this.dialogVisible = true
// },
delClick
(
item
:
{
id
:
string
})
{
this
.
id
=
item
.
id
this
.
delVisible
=
true
...
...
src/views/setting/Reset.vue
View file @
29a9151e
...
...
@@ -2,31 +2,27 @@
<div
class=
"reset"
>
<el-form
:model=
"ruleForm"
:rules=
"rules"
ref=
"ruleForm"
label-width=
"100px"
class=
"demo-ruleForm"
>
<el-form-item
label=
"原密码"
prop=
"old"
>
<el-input
v-show=
"!showOld"
v-model=
"ruleForm.old"
type=
"password"
>
<
!--
<
el-input
v-show=
"!showOld"
v-model=
"ruleForm.old"
type=
"password"
>
<i
slot=
"suffix"
class=
"el-input__icon el-icon-view"
@
click=
"showOld = !showOld"
></i>
</el-input>
<el-input
v-show=
"showOld"
v-model=
"ruleForm.old"
>
<i
slot=
"suffix"
class=
"el-input__icon el-icon-view"
@
click=
"showOld = !showOld"
></i>
</el-input>
</el-input>
-->
<!--
<el-input
v-model=
"ruleForm.old"
show-password
autocomplete=
"off"
></el-input>
-->
<Password
:password
.
sync=
"ruleForm.old"
:show
.
sync=
"showOld"
/>
</el-form-item>
<el-form-item
label=
"新密码"
prop=
"new"
>
<el-input
v-show=
"!show"
v-model=
"ruleForm.new"
type=
"password"
>
<
!--
<
el-input
v-show=
"!show"
v-model=
"ruleForm.new"
type=
"password"
>
<i
slot=
"suffix"
class=
"el-input__icon el-icon-view"
@
click=
"show = !show"
></i>
</el-input>
<el-input
v-show=
"show"
v-model=
"ruleForm.new"
>
<i
slot=
"suffix"
class=
"el-input__icon el-icon-view"
@
click=
"show = !show"
></i>
</el-input>
</el-input>
-->
<!--
<el-input
type=
"password"
v-model=
"ruleForm.new"
show-password
autocomplete=
"off"
></el-input>
-->
<Password
:password
.
sync=
"ruleForm.new"
:show
.
sync=
"show"
/>
</el-form-item>
<el-form-item
label=
"确认密码"
prop=
"confirm"
>
<el-input
v-show=
"!showCheck"
v-model=
"ruleForm.confirm"
type=
"password"
>
<i
slot=
"suffix"
class=
"el-input__icon el-icon-view"
@
click=
"showCheck = !showCheck"
></i>
</el-input>
<el-input
v-show=
"showCheck"
v-model=
"ruleForm.confirm"
>
<i
slot=
"suffix"
class=
"el-input__icon el-icon-view"
@
click=
"showCheck = !showCheck"
></i>
</el-input>
<!--
<el-input
type=
"password"
v-model=
"ruleForm.confirm"
show-password
autocomplete=
"off"
></el-input>
-->
<Password
:password
.
sync=
"ruleForm.confirm"
:show
.
sync=
"showCheck"
/>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
@
click=
"submitForm('ruleForm')"
>
提交
</el-button>
...
...
@@ -39,15 +35,19 @@
<
script
lang=
"ts"
>
import
Vue
from
'vue'
import
{
changePassword
}
from
'@/service/request'
import
Password
from
'@/components/Password.vue'
export
default
Vue
.
extend
({
components
:
{
Password
},
data
()
{
var
checkAge
=
(
rule
:
any
,
value
:
any
,
callback
:
any
)
=>
{
var
checkAge
=
(
rule
:
any
,
value
:
string
,
callback
:
any
)
=>
{
if
(
!
value
)
{
return
callback
(
new
Error
(
'原密码不能为空'
));
}
callback
()
};
var
validatePass
=
(
rule
:
any
,
value
:
any
,
callback
:
any
)
=>
{
var
validatePass
=
(
rule
:
any
,
value
:
string
,
callback
:
any
)
=>
{
if
(
value
===
''
)
{
callback
(
new
Error
(
'请输入新密码'
));
}
else
{
...
...
@@ -57,7 +57,7 @@ export default Vue.extend({
callback
();
}
};
var
validatePass2
=
(
rule
:
any
,
value
:
any
,
callback
:
any
)
=>
{
var
validatePass2
=
(
rule
:
any
,
value
:
string
,
callback
:
any
)
=>
{
if
(
value
===
''
)
{
callback
(
new
Error
(
'请再次输入密码'
));
}
else
if
(
value
!==
(
this
as
any
).
ruleForm
.
new
)
{
...
...
@@ -89,11 +89,10 @@ export default Vue.extend({
}
},
methods
:
{
submitForm
(
formName
:
any
)
{
submitForm
(
formName
:
string
)
{
(
this
.
$refs
[
formName
]
as
any
).
validate
((
valid
:
any
)
=>
{
if
(
valid
)
{
changePassword
(
this
.
ruleForm
).
then
((
res
:
any
)
=>
{
// if (res.code === 200) {
if
(
res
.
data
.
isSucc
)
{
this
.
$message
.
success
(
'修改成功'
);
(
this
.
$refs
[
formName
]
as
any
).
resetFields
();
...
...
@@ -105,7 +104,7 @@ export default Vue.extend({
}
});
},
resetForm
(
formName
:
any
)
{
resetForm
(
formName
:
string
)
{
(
this
.
$refs
[
formName
]
as
any
).
resetFields
();
}
}
...
...
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