Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
SHR
/
tFIMS
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 1ffdf470
authored
Sep 06, 2019
by
cwq0219
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'master' of
http://192.168.3.233:8090/glsx-web/tFIMS
2 parents
e30a8d8f
cb560f37
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
49 additions
and
40 deletions
src/api/request.js
src/api/sign.js
src/api/sys.account.js
src/libs/util.js
src/libs/util.permision.js
src/plugin/axios/index.js
src/store/modules/d2admin/modules/account.js
src/views/system/login/index.vue
src/views/userManage/role/editDialog.vue
src/views/userManage/user/index.vue
src/api/request.js
View file @
1ffdf47
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: limin
* @Author: limin
* @Date: 2019-08-26 18:02:41
* @Date: 2019-08-26 18:02:41
* @Last Modified by: limin
* @Last Modified by: limin
* @Last Modified time: 2019-09-0
5 19:03:2
4
* @Last Modified time: 2019-09-0
6 14:34:1
4
*/
*/
import
axios
from
'@/plugin/axios'
import
axios
from
'@/plugin/axios'
...
@@ -11,18 +11,18 @@ import RequestMethods from './request.methods'
...
@@ -11,18 +11,18 @@ import RequestMethods from './request.methods'
// import util from '@/libs/util'
// import util from '@/libs/util'
const
request
=
(
params
=
{},
method
=
RequestMethods
.
GET
)
=>
{
const
request
=
(
params
=
{},
method
=
RequestMethods
.
GET
)
=>
{
// params = util.deepClone(params)
// params = util.deepClone(params)
params
.
source
=
''
params
.
source
=
'
1
'
params
.
app_key
=
'48e5e13229b82c1b4e6e8c96151f0637'
params
.
app_key
=
'48e5e13229b82c1b4e6e8c96151f0637'
params
.
timestamp
=
new
Date
().
getTime
()
params
.
timestamp
=
new
Date
().
getTime
()
params
.
v
=
'1.0.0'
params
.
v
=
'1.0.0'
params
.
format
=
'json'
params
.
format
=
'json'
// const url = process.env.NODE_ENV === 'production' ? 'router' : params.method
// const url = process.env.NODE_ENV === 'production' ? 'router' : params.method
// return axios.post(url, { 'params': sign(params) })
// return axios.post(url, { 'params': sign(params) })
const
url
=
params
.
method
const
url
=
''
//
params.method
return
axios
({
return
axios
({
url
,
url
,
method
,
method
,
data
:
sign
(
params
)
params
:
sign
(
params
),
})
})
}
}
export
default
request
export
default
request
src/api/sign.js
View file @
1ffdf47
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: limin
* @Author: limin
* @Date: 2019-08-26 18:02:49
* @Date: 2019-08-26 18:02:49
* @Last Modified by: limin
* @Last Modified by: limin
* @Last Modified time: 2019-0
8-26 18:03:46
* @Last Modified time: 2019-0
9-06 14:17:40
*/
*/
import
MD5
from
'js-md5'
import
MD5
from
'js-md5'
const
secret
=
'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
const
secret
=
'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
...
...
src/api/sys.account.js
View file @
1ffdf47
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* @Author: limin
* @Author: limin
* @Date: 2019-08-26 18:02:55
* @Date: 2019-08-26 18:02:55
* @Last Modified by: limin
* @Last Modified by: limin
* @Last Modified time: 2019-09-0
5 18:22:50
* @Last Modified time: 2019-09-0
6 13:50:36
*/
*/
import
request
from
'./request'
import
request
from
'./request'
...
@@ -80,6 +80,15 @@ export function AccountForbidden (data = {}) {
...
@@ -80,6 +80,15 @@ export function AccountForbidden (data = {}) {
}
}
/**
/**
* 帐户激活
* @param {*} data 参数
*/
export
function
AccountActived
(
data
=
{})
{
data
.
method
=
`
${
user_path
}
actived`
return
request
(
data
,
RequestMethods
.
GET
)
}
/**
* 帐户审核
* 帐户审核
* @param {*} data 参数
* @param {*} data 参数
*/
*/
...
...
src/libs/util.js
View file @
1ffdf47
...
@@ -120,17 +120,4 @@ util.resetForm = function (formName) {
...
@@ -120,17 +120,4 @@ util.resetForm = function (formName) {
this
.
$refs
[
formName
]
&&
this
.
$refs
[
formName
].
resetFields
()
this
.
$refs
[
formName
]
&&
this
.
$refs
[
formName
].
resetFields
()
})
})
}
}
/**
* 扁平化 routes (@/router/routes)
*/
util
.
flatten
=
function
(
arr
)
{
return
arr
.
reduce
((
result
,
item
)
=>
{
item
.
authId
=
item
.
authId
||
item
.
meta
.
authId
item
.
parentId
=
item
.
parentId
||
item
.
meta
.
parentId
const
cloneItem
=
util
.
deepClone
(
item
)
delete
cloneItem
.
auth
return
result
.
concat
(
item
.
auth
?
util
.
flatten
([...
item
.
auth
,
cloneItem
])
:
item
);
},
[]);
}
export
default
util
export
default
util
src/libs/util.permision.js
View file @
1ffdf47
...
@@ -2,8 +2,9 @@
...
@@ -2,8 +2,9 @@
* @Author: limin
* @Author: limin
* @Date: 2019-08-27 19:16:26
* @Date: 2019-08-27 19:16:26
* @Last Modified by: limin
* @Last Modified by: limin
* @Last Modified time: 2019-09-06 13:
08:5
3
* @Last Modified time: 2019-09-06 13:
48:1
3
*/
*/
import
{
cloneDeep
}
from
'lodash'
const
permision
=
{}
const
permision
=
{}
/**
/**
* 打包如有与按钮
* 打包如有与按钮
...
@@ -161,4 +162,16 @@ permision.format2ResourceMenu = function (oMenu) {
...
@@ -161,4 +162,16 @@ permision.format2ResourceMenu = function (oMenu) {
auth
}
auth
}
}
}
/**
* 扁平化 routes (@/router/routes)
*/
permision
.
flatten
=
function
(
arr
)
{
return
arr
.
reduce
((
result
,
item
)
=>
{
item
.
authId
=
item
.
authId
||
item
.
meta
.
authId
item
.
parentId
=
item
.
parentId
||
item
.
meta
.
parentId
const
cloneItem
=
cloneDeep
(
item
)
delete
cloneItem
.
auth
return
result
.
concat
(
item
.
auth
?
permision
.
flatten
([...
item
.
auth
,
cloneItem
])
:
item
);
},
[]);
}
export
default
permision
export
default
permision
src/plugin/axios/index.js
View file @
1ffdf47
...
@@ -40,10 +40,11 @@ function errorLog(error) {
...
@@ -40,10 +40,11 @@ function errorLog(error) {
duration
:
5
*
1000
duration
:
5
*
1000
})
})
}
}
// 网络请求公用地址 http://192.168.3.171:7300/mock/5d638b3b6fbe9a0ac59d872e/tFIMS
// VUE_APP_API=http://192.168.3.191:8944/router
// 创建一个 axios 实例
// 创建一个 axios 实例
const
service
=
axios
.
create
({
const
service
=
axios
.
create
({
baseURL
:
process
.
env
.
VUE_APP_API
,
baseURL
:
'http://192.168.3.191:8944/router'
,
//
process.env.VUE_APP_API,
timeout
:
5000
// 请求超时时间
timeout
:
5000
// 请求超时时间
})
})
...
@@ -56,9 +57,9 @@ service.interceptors.request.use(
...
@@ -56,9 +57,9 @@ service.interceptors.request.use(
return
new
Promise
(
async
resolve
=>
{
return
new
Promise
(
async
resolve
=>
{
const
{
const
{
url
,
url
,
data
params
}
=
config
}
=
config
if
(
!
LogExternals
.
some
(
u
=>
u
===
url
||
u
===
data
.
method
))
{
if
(
!
LogExternals
.
some
(
u
=>
u
===
url
||
(
params
&&
u
===
params
.
method
)
))
{
const
token
=
util
.
cookies
.
get
(
'token'
)
const
token
=
util
.
cookies
.
get
(
'token'
)
if
(
!
token
||
token
===
'undefined'
)
{
if
(
!
token
||
token
===
'undefined'
)
{
await
store
.
dispatch
(
'd2admin/account/logout'
)
await
store
.
dispatch
(
'd2admin/account/logout'
)
...
...
src/store/modules/d2admin/modules/account.js
View file @
1ffdf47
...
@@ -13,17 +13,11 @@ export default {
...
@@ -13,17 +13,11 @@ export default {
* @param {Object} payload password {String} 密码
* @param {Object} payload password {String} 密码
* @param {Object} payload route {Object} 登录成功后定向的路由对象 任何 vue-router 支持的格式
* @param {Object} payload route {Object} 登录成功后定向的路由对象 任何 vue-router 支持的格式
*/
*/
login
({
dispatch
,
commit
},
{
login
({
dispatch
,
commit
},
p
)
{
username
=
''
,
password
=
''
}
=
{})
{
// console.log(router.addRoutes);
// console.log(router.addRoutes);
return
new
Promise
((
resolve
,
reject
)
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
// 开始请求登录接口
// 开始请求登录接口
AccountLogin
({
AccountLogin
(
p
).
then
(
async
(
data
=
{})
=>
{
username
,
password
}).
then
(
async
(
data
=
{})
=>
{
// 设置 cookie 一定要存 uuid 和 token 两个 cookie
// 设置 cookie 一定要存 uuid 和 token 两个 cookie
// 整个系统依赖这两个数据进行校验和存储
// 整个系统依赖这两个数据进行校验和存储
// uuid 是用户身份唯一标识 用户注册的时候确定 并且不可改变 不可重复
// uuid 是用户身份唯一标识 用户注册的时候确定 并且不可改变 不可重复
...
@@ -31,7 +25,7 @@ export default {
...
@@ -31,7 +25,7 @@ export default {
// 如有必要 token 需要定时更新,默认保存一天
// 如有必要 token 需要定时更新,默认保存一天
util
.
cookies
.
set
(
'uuid'
,
data
.
loginName
)
util
.
cookies
.
set
(
'uuid'
,
data
.
loginName
)
const
authes
=
data
.
roleType
===
SUPPER_ADMIN
?
const
authes
=
data
.
roleType
===
SUPPER_ADMIN
?
util
.
flatten
(
Object
.
values
({...
sources
,
[
home
.
meta
.
authId
]:
home
}))
util
.
permision
.
flatten
(
Object
.
values
({...
sources
,
[
home
.
meta
.
authId
]:
home
}))
.
map
(
obj
=>
({
authId
:
obj
.
authId
,
parentId
:
obj
.
parentId
}))
.
map
(
obj
=>
({
authId
:
obj
.
authId
,
parentId
:
obj
.
parentId
}))
:
cloneDeep
(
data
.
authes
)
&&
delete
data
.
authes
:
cloneDeep
(
data
.
authes
)
&&
delete
data
.
authes
await
dispatch
(
'd2admin/auth/set'
,
authes
,
{
root
:
true
})
await
dispatch
(
'd2admin/auth/set'
,
authes
,
{
root
:
true
})
...
...
src/views/system/login/index.vue
View file @
1ffdf47
...
@@ -108,8 +108,8 @@ export default {
...
@@ -108,8 +108,8 @@ export default {
time
:
dayjs
().
format
(
'HH:mm:ss'
),
time
:
dayjs
().
format
(
'HH:mm:ss'
),
// 表单
// 表单
formLogin
:
{
formLogin
:
{
loginName
:
'
admin
'
,
loginName
:
'
test0001
'
,
password
:
'
admin
'
,
password
:
'
123456
'
,
loginType
:
LOGIN_TYPE
loginType
:
LOGIN_TYPE
},
},
// 表单校验
// 表单校验
...
@@ -151,7 +151,9 @@ export default {
...
@@ -151,7 +151,9 @@ export default {
this
.
$refs
.
loginForm
.
validate
((
valid
)
=>
{
this
.
$refs
.
loginForm
.
validate
((
valid
)
=>
{
if
(
valid
)
{
if
(
valid
)
{
const
{
browser
,
os
}
=
this
.
$store
.
state
.
d2admin
.
ua
.
data
const
{
browser
,
os
}
=
this
.
$store
.
state
.
d2admin
.
ua
.
data
console
.
log
(
this
.
formLogin
);
const
_p
=
{...
this
.
formLogin
,
deviceCode
:
`
${
os
.
name
}${
os
.
version
}
-
${
browser
.
name
}${
browser
.
version
}
`
}
const
_p
=
{...
this
.
formLogin
,
deviceCode
:
`
${
os
.
name
}${
os
.
version
}
-
${
browser
.
name
}${
browser
.
version
}
`
}
console
.
log
(
_p
);
// 登录
// 登录
// 注意 这里的演示没有传验证码
// 注意 这里的演示没有传验证码
// 具体需要传递的数据请自行修改代码
// 具体需要传递的数据请自行修改代码
...
...
src/views/userManage/role/editDialog.vue
View file @
1ffdf47
...
@@ -76,7 +76,7 @@ export default {
...
@@ -76,7 +76,7 @@ export default {
resources
()
{
resources
()
{
const
clone
=
util
.
deepClone
(
Object
.
values
(
localRoutes
))
const
clone
=
util
.
deepClone
(
Object
.
values
(
localRoutes
))
const
{
menus
}
=
util
.
permision
.
packMenusBtns
(
clone
)
const
{
menus
}
=
util
.
permision
.
packMenusBtns
(
clone
)
const
all
=
util
.
flatten
(
clone
)
const
all
=
util
.
permision
.
flatten
(
clone
)
return
{
menus
,
all
}
return
{
menus
,
all
}
}
}
},
},
...
...
src/views/userManage/user/index.vue
View file @
1ffdf47
...
@@ -108,7 +108,8 @@ import {
...
@@ -108,7 +108,8 @@ import {
AccountModify
,
AccountModify
,
AccountIncrease
,
AccountIncrease
,
AccountForbidden
,
AccountForbidden
,
AccountValidate
AccountValidate
,
AccountActived
}
from
'@/api/sys.account'
}
from
'@/api/sys.account'
import
notice
from
'@/common/notice'
import
notice
from
'@/common/notice'
import
{
mapActions
}
from
'vuex'
import
{
mapActions
}
from
'vuex'
...
@@ -138,7 +139,7 @@ export default {
...
@@ -138,7 +139,7 @@ export default {
'禁用'
:
AccountForbidden
,
'禁用'
:
AccountForbidden
,
'审核'
:
AccountValidate
,
'审核'
:
AccountValidate
,
'编辑'
:
AccountModify
,
'编辑'
:
AccountModify
,
'激活'
:
''
'激活'
:
AccountActived
}),
}),
// 新增/编辑弹窗
// 新增/编辑弹窗
registerDialogVisible
:
false
,
registerDialogVisible
:
false
,
...
@@ -245,8 +246,10 @@ export default {
...
@@ -245,8 +246,10 @@ export default {
// ------------
// ------------
// 列表各种操作
// 列表各种操作
handleOperation
(
row
,
e
)
{
async
handleOperation
(
row
,
e
)
{
this
.
apiMapping
[
e
.
target
.
innerText
]({
userId
:
row
.
userId
})
const
_actionText
=
e
.
target
.
innerText
await
this
.
apiMapping
[
_actionText
]({
userId
:
row
.
userId
})
notice
.
okTips
(
`
${
_actionText
}
成功!`
)
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment