Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
F
fhjw-vue
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mengmeng
fhjw-vue
Commits
ef503eaa
Commit
ef503eaa
authored
Nov 23, 2021
by
mengmeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
定期修改密码demo
parent
d7285a00
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
1 deletion
+79
-1
crypto.js
src/utils/crypto.js
+60
-0
home.vue
src/views/modules/home.vue
+19
-1
No files found.
src/utils/crypto.js
0 → 100644
View file @
ef503eaa
const
CryptoJS
=
require
(
'crypto-js'
)
// 引用AES源码js
// const key = CryptoJS.enc.Utf8.parse('1234123412ABCDEF') // 十六位十六进制数作为密钥
// const iv = CryptoJS.enc.Utf8.parse('ABCDEF1234123412') // 十六位十六进制数作为密钥偏移量
const
DEF_KEY
=
'2020020202020202'
// 解密方法
export
function
decrypt
(
word
,
key
)
{
if
(
!
key
)
{
key
=
DEF_KEY
}
let
ckey
=
CryptoJS
.
enc
.
Utf8
.
parse
(
key
)
// 十六位十六进制数作为密钥
// let encryptedHexStr = CryptoJS.enc.Hex.parse(word)
// let srcs = CryptoJS.enc.Base64.stringify(encryptedHexStr)
let
decrypt
=
CryptoJS
.
AES
.
decrypt
(
word
,
ckey
,
{
mode
:
CryptoJS
.
mode
.
ECB
,
padding
:
CryptoJS
.
pad
.
Pkcs7
})
let
decryptedStr
=
decrypt
.
toString
(
CryptoJS
.
enc
.
Utf8
)
// console.log('decryptedStr', decryptedStr.toString())
return
decryptedStr
.
toString
()
}
// 加密方法
export
function
encrypt
(
word
,
key
)
{
if
(
!
key
)
{
key
=
DEF_KEY
}
let
ckey
=
CryptoJS
.
enc
.
Utf8
.
parse
(
key
)
// let srcs = CryptoJS.enc.Utf8.parse(word)
let
encrypted
=
CryptoJS
.
AES
.
encrypt
(
word
,
ckey
,
{
mode
:
CryptoJS
.
mode
.
ECB
,
padding
:
CryptoJS
.
pad
.
Pkcs7
})
// console.log('encrypted', encrypted.toString())
return
encrypted
.
toString
()
}
// 加密dataForm
function
enf
(
dataForm
,
sf
,
st
)
{
let
dataForm1
=
{
...
dataForm
,
sf
:
sf
,
st
:
st
}
let
sfs
=
sf
.
split
(
','
)
sfs
.
forEach
((
itm
,
ind
)
=>
{
dataForm1
[
itm
]
=
encrypt
(
dataForm1
[
itm
])
})
return
dataForm1
}
export
default
{
decrypt
,
encrypt
,
enf
}
src/views/modules/home.vue
View file @
ef503eaa
...
@@ -104,7 +104,7 @@
...
@@ -104,7 +104,7 @@
<!--
<div
class=
"bottom"
>
<!--
<div
class=
"bottom"
>
<div
style=
"width:60%;transform: translate3d(0, -10%, 0);"
>
<div
style=
"width:60%;transform: translate3d(0, -10%, 0);"
>
<Echarts
<Echarts
:options=
"optionHandlingSituationZhe"
:options=
"optionHandlingSituationZhe"
...
@@ -462,6 +462,24 @@ export default {
...
@@ -462,6 +462,24 @@ export default {
})
})
.
catch
(()
=>
{});
.
catch
(()
=>
{});
},
},
getUpdatePass
()
{
this
.
$http
.
get
(
"/sys/updatePassInfo"
)
.
then
(({
data
:
res
})
=>
{
if
(
res
.
data
!==
""
)
{
this
.
$confirm
(
`
${
res
.
data
}
`
,
"密码更新"
,
{
confirmButtonText
:
"确定"
,
type
:
"warning"
,
}
).
then
({
})
}
})
},
getPie
()
{
getPie
()
{
console
.
log
(
"data"
,
this
.
data
);
console
.
log
(
"data"
,
this
.
data
);
this
.
optionHandlingSituation
=
{
this
.
optionHandlingSituation
=
{
...
...
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