Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
confucius
Project
Project
Details
Activity
Releases
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
罗超
confucius
Commits
a23fbae5
Commit
a23fbae5
authored
Dec 22, 2021
by
罗超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增加密解密
parent
5c524d73
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
0 deletions
+42
-0
index.vue
src/components/work/index.vue
+5
-0
encrypt.js
src/utils/encrypt.js
+37
-0
No files found.
src/components/work/index.vue
View file @
a23fbae5
...
...
@@ -154,6 +154,8 @@ import { mapGetters } from "vuex";
import
{
queryOKRMyEmployeeList
}
from
"../../api/okr/work"
;
import
{
queryEmployee
}
from
"../../api/users/user"
;
import
dasbord
from
"./dasbord.vue"
;
import
{
Encrypt
,
Decrypt
}
from
'../../utils/encrypt'
export
default
{
components
:
{
dasbord
},
data
()
{
...
...
@@ -168,6 +170,9 @@ export default {
},
created
()
{
this
.
getUserList
();
let
str
=
Encrypt
(
"2"
)
console
.
log
(
str
)
console
.
log
(
Decrypt
(
str
))
},
computed
:
{
...
mapGetters
([
"userInfo"
])
...
...
src/utils/encrypt.js
0 → 100644
View file @
a23fbae5
import
JSEncrypt
from
'jsencrypt/bin/jsencrypt'
export
function
Encrypt
(
msg
){
let
encryptor
=
new
JSEncrypt
()
// 新建JSEncrypt对象
let
publicKey
=
`MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCnnN+B85XMqZfwjFon/D+wsLrH
1/IPmWa9hwM/9DWK7Z2Q+Tvbxx2WHnL2r3x/0RO5DelfhxTAuPHFmj67SfSlTXce
bZt2ZJLRhg0pDbpVyTILpKzUVYq3kl0AJoUTNv4qSQyRb8tL82ZgJObvLc5CvDN5
fd4hBhVrRKVF5aOX7QIDAQAB`
encryptor
.
setPublicKey
(
publicKey
)
return
encryptor
.
encrypt
(
msg
)
}
export
function
Decrypt
(
secretWord
){
let
decrypt
=
new
JSEncrypt
()
// 新建JSEncrypt对象
let
privateKey
=
`MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAKec34Hzlcypl/CM
Wif8P7CwusfX8g+ZZr2HAz/0NYrtnZD5O9vHHZYecvavfH/RE7kN6V+HFMC48cWa
PrtJ9KVNdx5tm3ZkktGGDSkNulXJMgukrNRVireSXQAmhRM2/ipJDJFvy0vzZmAk
5u8tzkK8M3l93iEGFWtEpUXlo5ftAgMBAAECgYADOkQbjoM9864XVbyOtI7NajnO
i1v/7OZLlAP+AUfeqwCzv/jlHIp3T5LLKUnudCo7EAeEbWd65pTRR00Z8iyh0kYQ
fNfUQ88DINAX8McTozFJP5s0E1PaeORaBcpy//qdDmRbAUya8bqyY92q1MmdHX1b
/4z3kbvUSTimaCuVwQJBANe2oXj1sDW2CWF5M30aoxpATNqoZzUtoB7LDRtCthXN
T8ibC86iQ9VzrEc+OvUv5iQEXtMGMUgq5GwMwaC4tokCQQDG6obqCPJ6eGHwzjpb
rQCGL7qNEeEM53pK1RxlosLf82HNpZMWfPaakoa36rFJ+UJnzw5PxQv/wytZa48O
jf1FAkEAo4btrhcCuBUB04TgBYz17GamXHShmOy3n+BqVSojgy+btgXj04erSNth
1LhWVZ00KEWv5OWi4oSxmT+qYb7lkQJAA5Az9oFOhq8dYgjvtrC0r7KvLtPBKlAD
Os/ygEeYIhbkC6EJr39xk3dIfobvwhl6/Q0Sfo9TFbPTVPi+SU512QJBAISrfyP6
WQI3AoY1cNU/C2PVDan28NCP/U1I26K1+5WDASX/PiQBwQtMbg4VkbABU429O065
D9csEdHix0CDolc=`
decrypt
.
setPrivateKey
(
privateKey
)
return
decrypt
.
decrypt
(
secretWord
)
}
\ No newline at end of file
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