Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
aic_duty_strategy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
yinxiaoling
aic_duty_strategy
Commits
b940553e
Commit
b940553e
authored
May 12, 2020
by
puyongsong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导入数据界面
parent
dd7d6fa8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
42 deletions
+58
-42
publicTools.js
public/zjtlj/src/utils/publicTools.js
+4
-4
import-data.vue
public/zjtlj/src/views/dashboard/import-data.vue
+39
-34
index.vue
public/zjtlj/src/views/login/index.vue
+15
-4
No files found.
public/zjtlj/src/utils/publicTools.js
View file @
b940553e
...
...
@@ -14,18 +14,18 @@ function deepClone(source) {
})
return
targetObj
}
// 加密
//
aes
加密
function
encrypt
(
word
,
keyStr
)
{
keyStr
=
keyStr
||
'
abcdefgabcdefg12
'
var
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
keyStr
)
// Latin1 w8m31+Yy/Nw6thPsMpO5fg==
var
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
keyStr
)
var
srcs
=
CryptoJS
.
enc
.
Utf8
.
parse
(
word
)
var
encrypted
=
CryptoJS
.
AES
.
encrypt
(
srcs
,
key
,
{
mode
:
CryptoJS
.
mode
.
ECB
,
padding
:
CryptoJS
.
pad
.
Pkcs7
})
return
encrypted
.
toString
()
}
// 解密
//
aes
解密
function
decrypt
(
word
,
keyStr
)
{
keyStr
=
keyStr
||
'
abcdefgabcdefg12
'
var
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
keyStr
)
// Latin1 w8m31+Yy/Nw6thPsMpO5fg==
var
key
=
CryptoJS
.
enc
.
Utf8
.
parse
(
keyStr
)
var
decrypt
=
CryptoJS
.
AES
.
decrypt
(
word
,
key
,
{
mode
:
CryptoJS
.
mode
.
ECB
,
padding
:
CryptoJS
.
pad
.
Pkcs7
})
return
CryptoJS
.
enc
.
Utf8
.
stringify
(
decrypt
).
toString
()
}
...
...
public/zjtlj/src/views/dashboard/import-data.vue
View file @
b940553e
<
template
>
<div>
<div
class=
"drawer_body_box"
>
<el-form
ref=
"importForm"
:rules=
"rules"
label-position=
"left"
label-width=
"90px"
>
<el-form
ref=
"importForm"
:rules=
"rules"
:model=
"temp"
label-position=
"left"
label-width=
"90px"
>
<el-form-item
label=
"文件模板"
prop=
"name"
>
<el-button
size=
"small"
@
click=
"downloadTemplate"
>
下载模板
</el-button>
<span>
请按照模板格式填写数据
</span>
</el-form-item>
<el-form-item
label=
"导入文件"
prop=
"
name
"
>
<el-form-item
label=
"导入文件"
prop=
"
files
"
>
<!-- “文件大小不可超过8MB”、“请上传格式为以.xlsx或.xls结尾的excel文件” -->
<el-upload
action=
"#"
class=
"upload-demo"
ref=
"upload"
:limit=
"1"
:on-exceed=
"handleExceed"
:on-preview=
"handlePreview"
:on-change=
"handleChange"
:on-remove=
"handleRemove"
...
...
@@ -75,6 +79,7 @@ export default {
num_s
:
10
,
num_f
:
11
,
dialogResultVisible
:
false
,
temp
:
{},
fileList
:
[],
dialogFormVisible
:
false
,
rules
:
{}
...
...
@@ -82,6 +87,19 @@ export default {
},
created
()
{},
methods
:
{
validateFiles
()
{
let
nv
=
this
.
fileList
.
length
&&
Object
.
prototype
.
toString
.
call
(
this
.
fileList
[
0
])
===
'
[object Object]
'
?
this
.
fileList
[
0
].
raw
:
{
size
:
0
}
if
(
Number
(
nv
.
size
/
1024
/
1024
)
>
8
)
{
this
.
$message
.
warning
(
'
文件大小不可超过8MB
'
)
return
false
}
else
{
return
true
}
},
downloadFail
()
{
console
.
log
(
this
)
},
...
...
@@ -90,18 +108,19 @@ export default {
},
downloadTemplate
()
{},
addCallback
(
status
)
{},
handleRemove
(
file
,
fileList
)
{
console
.
log
(
file
,
fileList
)
},
handlePreview
(
file
)
{
console
.
log
(
file
)
},
handleChange
(
file
,
fileList
)
{
// 替换为最新的
console
.
log
(
arguments
)
this
.
fileList
=
fileList
},
handleExceed
(
files
,
fileList
)
{
this
.
$message
.
warning
(
`当前限制选择 1 个文件`
)
this
.
fileList
=
[
file
]
this
.
validateFiles
()
},
submitUpload
()
{
if
(
!
this
.
fileList
.
length
)
{
this
.
$message
.
warning
(
'
请先选择上文件
'
)
return
}
var
form
=
new
FormData
()
form
.
append
(
'
photo
'
,
this
.
fileList
[
0
].
raw
)
const
loading
=
this
.
$loading
({
...
...
@@ -116,39 +135,25 @@ export default {
console
.
log
(
res
)
loading
.
close
()
this
.
$emit
(
'
save
'
,
1
)
this
.
$message
({
message
:
res
.
status
||
'
Successfully
'
,
type
:
'
success
'
})
this
.
dialogResultVisible
=
true
})
.
catch
(
err
=>
{
loading
.
close
()
this
.
$message
.
warning
(
err
.
status
)
})
},
handleRemove
(
file
,
fileList
)
{
console
.
log
(
file
,
fileList
)
},
handlePreview
(
file
)
{
console
.
log
(
file
)
},
handleDownload
()
{},
saveData
(
status
)
{
console
.
log
(
this
.
fileList
)
this
.
dialogResultVisible
=
true
// console.log(this.fileList)
// 0 cancel/close 1 save dialogStatus/create/update
if
(
status
)
{
this
.
$refs
[
'
importForm
'
].
validate
(
valid
=>
{
if
(
valid
)
{
// if (!this.fileList.length) {
// this.$message({
// message: '请导入文件',
// type: 'warning'
// })
// return false
// }
// this.submitUpload()
if
(
!
this
.
fileList
.
length
)
{
this
.
$message
.
warning
(
'
请先导入文件
'
)
return
}
if
(
valid
&&
this
.
validateFiles
())
{
this
.
submitUpload
()
}
})
}
else
{
...
...
public/zjtlj/src/views/login/index.vue
View file @
b940553e
...
...
@@ -142,8 +142,12 @@ export default {
mounted
()
{
if
(
localStorage
.
getItem
(
'
aicremenberpwd
'
)
===
'
yes
'
)
{
this
.
loginForm
.
remenber
=
true
this
.
loginForm
.
email
=
localStorage
.
getItem
(
'
aicusername
'
)
this
.
loginForm
.
password
=
localStorage
.
getItem
(
'
aicuserpwd
'
)
this
.
loginForm
.
email
=
this
.
$publicTools
.
decrypt
(
localStorage
.
getItem
(
'
aicusername
'
)
)
this
.
loginForm
.
password
=
this
.
$publicTools
.
decrypt
(
localStorage
.
getItem
(
'
aicuserpwd
'
)
)
}
// eslint-disable-next-line no-undef
particlesJS
(
'
particlesId
'
,
{
...
...
@@ -298,8 +302,14 @@ export default {
}
if
(
this
.
loginForm
.
remenber
)
{
localStorage
.
setItem
(
'
aicremenberpwd
'
,
'
yes
'
)
localStorage
.
setItem
(
'
aicusername
'
,
this
.
loginForm
.
email
)
localStorage
.
setItem
(
'
aicuserpwd
'
,
this
.
loginForm
.
password
)
localStorage
.
setItem
(
'
aicusername
'
,
this
.
$publicTools
.
encrypt
(
this
.
loginForm
.
email
)
)
localStorage
.
setItem
(
'
aicuserpwd
'
,
this
.
$publicTools
.
encrypt
(
this
.
loginForm
.
password
)
)
}
else
{
localStorage
.
removeItem
(
'
aicremenberpwd
'
)
localStorage
.
removeItem
(
'
aicusername
'
)
...
...
@@ -309,6 +319,7 @@ export default {
let
{
email
,
password
}
=
this
.
loginForm
// console.log(this.$publicTools.encrypt('欢迎登陆')) // 加密
// console.log(this.$publicTools.decrypt('BSC3Xq5Kxw0ICjur0TDQTQ==')) // 解密
// 本地存储用了aes加解密 登陆暂未用
this
.
$store
.
dispatch
(
'
user/login
'
,
{
email
,
password
})
.
then
(()
=>
{
...
...
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