Commit a5424937 by 田爽

登录加密,退出接口,轮播图文件格式

parent 0b65a66c
......@@ -18,6 +18,7 @@
<script src="./static/plugins/ueditor-1.4.3.3/ueditor.all.min.js"></script>
<script src="./static/plugins/ueditor-1.4.3.3/lang/zh-cn/zh-cn.js"></script>
<% } %>
<script src="https://cdn.jsdelivr.net/npm/jsencrypt@3.0.0-beta.1/bin/jsencrypt.min.js"></script>
</head>
<body>
<div id="app"></div>
......
......@@ -69,14 +69,19 @@
}
},
submit () {
const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANOf6KgVV4tc+QGyoFWMPGNpYSitenD8sqiei5KliOExO0Cq+bE1LaaFpvNPgg4H/600YsCa0Yn7P/DwbugTwe0CAwEAAQ=='
const encrypt = new JSEncrypt()
encrypt.setPublicKey(publicKey);
const userName = encrypt.encrypt(this.dataForm.userName);
const password = encrypt.encrypt(this.dataForm.password);
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl('/office/sys/login'),
method: 'post',
data: this.$http.adornData({
'username': this.dataForm.userName,
'password': this.dataForm.password
'username': userName,
'password': password
})
}).then(({data}) => {
if (data && data.code === 0) {
......
......@@ -97,24 +97,24 @@
},
// 退出
logoutHandle () {
clearLoginInfo()
this.$router.push({ name: 'login' })
// this.$confirm(`确定进行[退出]操作?`, '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
// this.$http({
// url: this.$http.adornUrl('/sys/logout'),
// method: 'post',
// data: this.$http.adornData()
// }).then(({data}) => {
// if (data && data.code === 0) {
// clearLoginInfo()
// this.$router.push({ name: 'login' })
// }
// })
// }).catch(() => {})
this.$confirm(`确定进行[退出]操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/office/sys/logout'),
method: 'post',
data: this.$http.adornData()
}).then(({data}) => {
if (data && data.code === 0) {
clearLoginInfo()
this.$router.push({ name: 'login' })
}
})
}).catch(() => {})
}
}
}
......
......@@ -333,13 +333,16 @@ export default {
this.imgUrl = new FormData()
const isJPG = file.type === 'image/jpeg'
const isPNG = file.type === 'image/png'
const isGIF = file.type === 'image/gif'
const isLt2M = file.size / 1024 / 1024 < 2
if (!isJPG) {
if (!isPNG) {
this.$message.error('上传图片只能是 JPG, PNG 格式!')
if (!isGIF) {
this.$message.error('上传图片只能是 JPG, PNG, GIF 格式!')
return
}
}
}
if (!isLt2M) {
this.$message.error('上传头像图片大小不能超过 2MB!')
return
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment